]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Reset dodging status when re-spawning players, fixes #2603
authorMario <mario.mario@y7mail.com>
Wed, 23 Jun 2021 03:16:38 +0000 (13:16 +1000)
committerMario <mario.mario@y7mail.com>
Wed, 23 Jun 2021 03:16:38 +0000 (13:16 +1000)
qcsrc/common/mutators/mutator/dodging/sv_dodging.qc

index a6611b755dabfa4026ba5a7c24446f2155934678..53effbae20c20c89822b6f499e816998be992810 100644 (file)
@@ -310,6 +310,31 @@ MUTATOR_HOOKFUNCTION(dodging, PlayerPhysics)
 REPLICATE(cvar_cl_dodging_timeout, float, "cl_dodging_timeout");
 REPLICATE(cvar_cl_dodging, bool, "cl_dodging");
 
+void dodging_ResetPlayer(entity this)
+{
+       this.last_dodging_time = 0;
+
+       this.dodging_action = 0;
+       this.dodging_single_action = 0;
+
+       this.dodging_force_total = 0;
+       this.dodging_force_remaining = 0;
+
+       this.dodging_direction = '0 0 0';
+}
+
+MUTATOR_HOOKFUNCTION(dodging, PlayerSpawn)
+{
+       entity player = M_ARGV(0, entity);
+       dodging_ResetPlayer(player);
+}
+
+MUTATOR_HOOKFUNCTION(dodging, MakePlayerObserver)
+{
+       entity player = M_ARGV(0, entity);
+       dodging_ResetPlayer(player);
+}
+
 MUTATOR_HOOKFUNCTION(dodging, GetPressedKeys)
 {
        entity player = M_ARGV(0, entity);