diff --git a/code/game/mecha/equipment/tools/jetpack.dm b/code/game/mecha/equipment/tools/jetpack.dm index 5f2fc153a26..9b6de6121fb 100644 --- a/code/game/mecha/equipment/tools/jetpack.dm +++ b/code/game/mecha/equipment/tools/jetpack.dm @@ -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("Your vehicle lacks the capacity to move in that direction!") + 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("You can't move that direction from here!") + result = FALSE + break + var/turf/dest = (direction == UP) ? GetAbove(chassis) : GetBelow(chassis) + if(!dest) + chassis.occupant_message("There is nothing of interest in this direction.") + result = FALSE + break + if(!dest.CanZPass(chassis,direction)) + chassis.occupant_message("There's something blocking your movement in that direction!") + 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("Movement control lost. Inertial movement started.") + 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)