]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix #2814 "trigger_push division by zero errors when starting map AMT-Freestyle6...
authorterencehill <piuntn@gmail.com>
Sat, 22 Jul 2023 15:04:32 +0000 (17:04 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 22 Jul 2023 15:04:32 +0000 (17:04 +0200)
qcsrc/common/mapobjects/subs.qc
qcsrc/common/mapobjects/trigger/jumppads.qc

index fbcb4b39aa2747af30cf7ef06bebf7443dde2e16..f89ab21e2f79ab1903dabc12c10da0cbcefac9ef 100644 (file)
@@ -104,6 +104,8 @@ void SUB_CalcMoveDone(entity this)
 
 void SUB_CalcMovePause(entity this)
 {
+       if (!this.move_controller)
+               return;
        this.move_controller.animstate_starttime += frametime;
        this.move_controller.animstate_endtime += frametime;
 }
index f7281e5e4ae2619098dffa22cefb386b9236105f..98498de1c7caa73f50affa3c79631668d63857d5 100644 (file)
@@ -588,7 +588,10 @@ bool trigger_push_test(entity this, entity item)
                        }
                        else
                        {
-                               if (trigger_push_testorigin(e, t, this, org))
+                               // optimization: if horizontal velocity is 0 then target is not good since the trajectory
+                               // will definitely go back to the jumppad (horizontal velocity of best_vel can't be 0 anyway)
+                               if ((e.velocity.x != 0 || e.velocity.y != 0)
+                                       && trigger_push_testorigin(e, t, this, org))
                                {
                                        best_target = trace_endpos;
                                        best_org = org;