]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/mutator_dodging.qc
Factor out animation decisions and gameplay
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator_dodging.qc
index 1c05a4a091bed2799cd05c1067edf2b1c4562f36..969c980a298dd44d7f085672385b4cf28650b815 100644 (file)
@@ -55,6 +55,9 @@ MUTATOR_HOOKFUNCTION(dodging_PlayerPhysics) {
        float velocity_difference;
        float clean_up_and_do_nothing;
 
+    if (self.deadflag != DEAD_NO)
+        return 0;
+
        new_velocity_gain = 0;
        clean_up_and_do_nothing = 0;
 
@@ -112,9 +115,9 @@ MUTATOR_HOOKFUNCTION(dodging_PlayerPhysics) {
                        + (autocvar_sv_dodging_up_speed * v_up);
 
                if (autocvar_sv_dodging_sound == 1)
-                       PlayerSound(playersound_jump, CHAN_PLAYER, VOICETYPE_PLAYERSOUND);
+                       PlayerSound(playersound_jump, CH_PLAYER, VOICETYPE_PLAYERSOUND);
 
-               setanim(self, self.anim_jump, TRUE, FALSE, TRUE);
+               animdecide_setaction(self, ANIMACTION_JUMP, TRUE);
 
                self.dodging_single_action = 0;
        }
@@ -241,8 +244,6 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) {
                }
        }
 
-
-
        if (dodge_detected == 1) {
                self.last_dodging_time = time;
 
@@ -255,7 +256,7 @@ MUTATOR_HOOKFUNCTION(dodging_GetPressedKeys) {
                self.dodging_direction_y = tap_direction_y;
 
                // normalize the dodging_direction vector.. (unlike UT99) XD
-               length = length + self.dodging_direction_x * self.dodging_direction_x;
+               length =          self.dodging_direction_x * self.dodging_direction_x;
                length = length + self.dodging_direction_y * self.dodging_direction_y;
                length = sqrt(length);