]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/mutator/doublejump/doublejump.qc
This commit is dedicated to TimePath
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / doublejump / doublejump.qc
1 #ifdef IMPLEMENTATION
2 #ifdef SVQC
3         #include "../../../../server/antilag.qh"
4 #endif
5 #include "../../../physics.qh"
6
7 REGISTER_MUTATOR(doublejump, true);
8
9 #define PHYS_DOUBLEJUMP(s)                     STAT(DOUBLEJUMP, s)
10
11
12 MUTATOR_HOOKFUNCTION(doublejump, PlayerJump)
13 {
14         if (PHYS_DOUBLEJUMP(self))
15         {
16                 tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
17                 if (trace_fraction < 1 && trace_plane_normal_z > 0.7)
18                 {
19                         player_multijump = true;
20
21                         // we MUST clip velocity here!
22                         float f = self.velocity * trace_plane_normal;
23                         if (f < 0)
24                                 self.velocity -= f * trace_plane_normal;
25                 }
26         }
27         return false;
28 }
29
30 #ifdef SVQC
31
32 MUTATOR_HOOKFUNCTION(doublejump, BuildMutatorsString)
33 {
34         ret_string = strcat(ret_string, ":doublejump");
35         return false;
36 }
37
38 MUTATOR_HOOKFUNCTION(doublejump, BuildMutatorsPrettyString)
39 {
40         ret_string = strcat(ret_string, ", Double jump");
41         return false;
42 }
43
44 #endif
45 #endif