]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/ecs/systems/sv_physics.qc
If physics are overridden, reset the idle time (fixes getting kicked while driving...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / ecs / systems / sv_physics.qc
index 0df3411c1d37be4b62ae0ca2aa4db0ad6b0ba3f0..a68d51b8e677f770b8dce708ed7fc5e4eb6fe1bb 100644 (file)
@@ -6,15 +6,18 @@ void sys_phys_fix(entity this, float dt)
        Physics_UpdateStats(this, PHYS_HIGHSPEED(this));
 }
 
-bool sys_phys_override(entity this)
+bool sys_phys_override(entity this, float dt)
 {
        int buttons = PHYS_INPUT_BUTTON_MASK(this);
+       float idlesince = this.parm_idlesince;
+       this.parm_idlesince = time; // in the case that physics are overridden
        if (PM_check_specialcommand(this, buttons)) { return true; }
-       if (this.PlayerPhysplug && this.PlayerPhysplug(this)) { return true; }
+       if (this.PlayerPhysplug && this.PlayerPhysplug(this, dt)) { return true; }
+       this.parm_idlesince = idlesince;
        return false;
 }
 
-void sys_phys_monitor(entity this)
+void sys_phys_monitor(entity this, float dt)
 {
        int buttons = PHYS_INPUT_BUTTON_MASK(this);
        anticheat_physics(this);
@@ -24,7 +27,7 @@ void sys_phys_monitor(entity this)
                    || this.v_angle != this.v_angle_old) { this.parm_idlesince = time; }
        }
        PM_check_nickspam(this);
-       PM_check_punch(this);
+       PM_check_punch(this, dt);
 }
 
 void sys_phys_ai(entity this)
@@ -37,13 +40,13 @@ void sys_phys_ai(entity this)
 void sys_phys_pregame_hold(entity this)
 {
        if (!IS_PLAYER(this)) { return; }
-       const bool allowed_to_move = (time >= game_starttime);
+       const bool allowed_to_move = (time >= game_starttime && !game_stopped);
        if (!allowed_to_move) {
                this.velocity = '0 0 0';
-               this.movetype = MOVETYPE_NONE;
+               set_movetype(this, MOVETYPE_NONE);
                this.disableclientprediction = 2;
        } else if (this.disableclientprediction == 2) {
-               if (this.movetype == MOVETYPE_NONE) { this.movetype = MOVETYPE_WALK; }
+               if (this.move_movetype == MOVETYPE_NONE) { set_movetype(this, MOVETYPE_WALK); }
                this.disableclientprediction = 0;
        }
 }