Fixes mech jetpack allowing breaking time and space

This commit is contained in:
Heroman
2022-01-13 21:02:47 +10:00
parent 7bff9cc974
commit 0b4a543749
@@ -48,6 +48,43 @@
if(!action_checks())
return chassis.dyndomove(direction)
var/move_result = 0
if(direction == UP || direction == DOWN)
if(!chassis.can_ztravel())
chassis.occupant_message("<span class='warning'>Your vehicle lacks the capacity to move in that direction!</span>")
return FALSE
//We're using locs because some mecha are 2x2 turfs. So thicc!
var/result = TRUE
for(var/turf/T in chassis.locs)
if(!T.CanZPass(chassis,direction))
chassis.occupant_message("<span class='warning'>You can't move that direction from here!</span>")
result = FALSE
break
var/turf/dest = (direction == UP) ? GetAbove(chassis) : GetBelow(chassis)
if(!dest)
chassis.occupant_message("<span class='notice'>There is nothing of interest in this direction.</span>")
result = FALSE
break
if(!dest.CanZPass(chassis,direction))
chassis.occupant_message("<span class='warning'>There's something blocking your movement in that direction!</span>")
result = FALSE
break
if(result)
move_result = chassis.mechstep(direction)
if(move_result)
chassis.can_move = 0
chassis.use_power(chassis.step_energy_drain)
if(istype(chassis.loc, /turf/space))
if(!chassis.check_for_support())
chassis.float_direction = direction
chassis.start_process(MECHA_PROC_MOVEMENT)
chassis.log_message("<span class='warning'>Movement control lost. Inertial movement started.</span>")
if(chassis.do_after(get_step_delay()))
chassis.can_move = 1
return 1
return 0
if(chassis.hasInternalDamage(MECHA_INT_CONTROL_LOST))
move_result = step_rand(chassis)
else if(chassis.dir!=direction)