From ce22210b47487177c0ca55c7722bfb91109e45cf Mon Sep 17 00:00:00 2001 From: AnturK Date: Sat, 16 Dec 2017 11:07:52 +0100 Subject: [PATCH 1/2] Fixes mecha drifting. (#33542) * Fixes mecha drifting. --- code/game/mecha/mecha.dm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index e50da70c5d..799344fe54 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -24,7 +24,7 @@ infra_luminosity = 15 //byond implementation is bugged. force = 5 flags_1 = HEAR_1 - var/can_move = 1 + var/can_move = 0 //time of next allowed movement var/mob/living/carbon/occupant = null var/step_in = 10 //make a step in step_in/10 sec. var/dir_in = 2//What direction will the mech face when entered/powered on? Defaults to South. @@ -502,7 +502,7 @@ return domove(direction) /obj/mecha/proc/domove(direction) - if(!can_move) + if(can_move >= world.time) return 0 if(!Process_Spacemove(direction)) return 0 @@ -520,21 +520,19 @@ return 0 var/move_result = 0 + var/oldloc = loc if(internal_damage & MECHA_INT_CONTROL_LOST) move_result = mechsteprand() else if(dir != direction && !strafe) move_result = mechturn(direction) else move_result = mechstep(direction) - if(move_result) + if(move_result || loc != oldloc)// halfway done diagonal move still returns false use_power(step_energy_drain) - can_move = 0 - spawn(step_in) - can_move = 1 + can_move = world.time + step_in return 1 return 0 - /obj/mecha/proc/mechturn(direction) setDir(direction) if(turnsound)