1 #include "doublejump.qh"
5 #include <server/antilag.qh>
7 #include <common/physics/player.qh>
10 REGISTER_MUTATOR(doublejump, autocvar_sv_doublejump);
12 REGISTER_MUTATOR(doublejump, true);
15 #define PHYS_DOUBLEJUMP(s) STAT(DOUBLEJUMP, s)
18 MUTATOR_HOOKFUNCTION(doublejump, PlayerJump)
20 entity player = M_ARGV(0, entity);
22 if (PHYS_DOUBLEJUMP(player))
24 tracebox(player.origin + '0 0 0.01', player.mins, player.maxs, player.origin - '0 0 0.01', MOVE_NORMAL, player);
25 if (trace_fraction < 1 && trace_plane_normal_z > 0.7)
27 M_ARGV(2, bool) = true;
29 // we MUST clip velocity here!
30 float f = player.velocity * trace_plane_normal;
32 player.velocity -= f * trace_plane_normal;