diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index fe9b9521357..1f88f45f14a 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -237,6 +237,18 @@ SEND_SIGNAL(src, COMSIG_ATOM_ON_Z_IMPACT, impacted_turf, levels) return TRUE +/* + * Attempts to move using zMove if direction is UP or DOWN, step if not + * + * Args: + * direction: The direction to go + * z_move_flags: bitflags used for checks in zMove and can_z_move +*/ +/atom/movable/proc/try_step_multiz(direction, z_move_flags = ZMOVE_FLIGHT_FLAGS) + if(direction == UP || direction == DOWN) + return zMove(direction, null, z_move_flags) + return step(src, direction) + /* * The core multi-z movement proc. Used to move a movable through z levels. * If target is null, it'll be determined by the can_z_move proc, which can potentially return null if diff --git a/code/game/objects/items/devices/chameleonproj.dm b/code/game/objects/items/devices/chameleonproj.dm index 11116893850..0a20f55bd16 100644 --- a/code/game/objects/items/devices/chameleonproj.dm +++ b/code/game/objects/items/devices/chameleonproj.dm @@ -171,7 +171,7 @@ amount = 25 can_move = world.time + amount - step(src, direction) + try_step_multiz(direction) return /obj/effect/dummy/chameleon/Destroy() diff --git a/code/game/objects/structures/crates_lockers/closets/cardboardbox.dm b/code/game/objects/structures/crates_lockers/closets/cardboardbox.dm index 47902948fb0..0a20e984485 100644 --- a/code/game/objects/structures/crates_lockers/closets/cardboardbox.dm +++ b/code/game/objects/structures/crates_lockers/closets/cardboardbox.dm @@ -32,7 +32,7 @@ return move_delay = TRUE var/oldloc = loc - step(src, direction) + try_step_multiz(direction); if(oldloc != loc) addtimer(CALLBACK(src, PROC_REF(ResetMoveDelay)), CONFIG_GET(number/movedelay/walk_delay) * move_speed_multiplier) else diff --git a/code/modules/mining/lavaland/megafauna_loot.dm b/code/modules/mining/lavaland/megafauna_loot.dm index 38fc8a59082..b6b6b8e8cc5 100644 --- a/code/modules/mining/lavaland/megafauna_loot.dm +++ b/code/modules/mining/lavaland/megafauna_loot.dm @@ -440,7 +440,7 @@ return if(pixel_x != base_pixel_x || pixel_y != base_pixel_y) animate(src, 0.2 SECONDS, pixel_x = base_pixel_y, pixel_y = base_pixel_y, flags = ANIMATION_PARALLEL) - Move(get_step_multiz(src, direction), direction) + try_step_multiz(direction) COOLDOWN_START(src, move_cooldown, (direction in GLOB.cardinals) ? 0.1 SECONDS : 0.2 SECONDS) /obj/item/soulscythe/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum) diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 1ba9076d4df..3acf1c6c78c 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -561,6 +561,12 @@ set name = "Move Down" set category = "IC" + var/turf/current_turf = get_turf(src) + var/turf/below_turf = SSmapping.get_turf_below(current_turf) + if(!below_turf) + to_chat(src, span_warning("There's nowhere to go in that direction!")) + return + if(ismovable(loc)) //Inside an object, tell it we moved var/atom/loc_atom = loc return loc_atom.relaymove(src, DOWN) diff --git a/code/modules/mod/mod_ai.dm b/code/modules/mod/mod_ai.dm index cbe0bcd0dfd..e486ceddbec 100644 --- a/code/modules/mod/mod_ai.dm +++ b/code/modules/mod/mod_ai.dm @@ -91,7 +91,7 @@ ADD_TRAIT(wearer, TRAIT_FORCED_STANDING, MOD_TRAIT) addtimer(CALLBACK(src, PROC_REF(ai_fall)), AI_FALL_TIME, TIMER_UNIQUE | TIMER_OVERRIDE) var/atom/movable/mover = wearer || src - return step(mover, direction) + return mover.try_step_multiz(direction) #undef MOVE_DELAY #undef WEARER_DELAY diff --git a/code/modules/vehicles/cars/car.dm b/code/modules/vehicles/cars/car.dm index 16d49d3e05e..a4dabce8bb5 100644 --- a/code/modules/vehicles/cars/car.dm +++ b/code/modules/vehicles/cars/car.dm @@ -95,9 +95,9 @@ if(trailer) var/dir_to_move = get_dir(trailer.loc, loc) - var/did_move = step(src, direction) + var/did_move = try_step_multiz(direction) if(did_move) step(trailer, dir_to_move) return did_move after_move(direction) - return step(src, direction) + return try_step_multiz(direction) diff --git a/code/modules/vehicles/mecha/mecha_movement.dm b/code/modules/vehicles/mecha/mecha_movement.dm index 562ff8f933c..d1513d4b3ee 100644 --- a/code/modules/vehicles/mecha/mecha_movement.dm +++ b/code/modules/vehicles/mecha/mecha_movement.dm @@ -119,7 +119,7 @@ set_glide_size(DELAY_TO_GLIDE_SIZE(movedelay)) //Otherwise just walk normally - . = step(src,direction, dir) + . = try_step_multiz(direction) if(phasing) use_power(phasing_energy_drain) if(strafe) diff --git a/modular_skyrat/modules/modsuit_pai/code/mod_pai.dm b/modular_skyrat/modules/modsuit_pai/code/mod_pai.dm index 9d903e06aae..0f61322b3bd 100644 --- a/modular_skyrat/modules/modsuit_pai/code/mod_pai.dm +++ b/modular_skyrat/modules/modsuit_pai/code/mod_pai.dm @@ -103,7 +103,7 @@ if(wearer && !wearer.Process_Spacemove(direction)) return FALSE var/atom/movable/mover = wearer || src - return step(mover, direction) + return mover.try_step_multiz(direction) #undef MOVE_DELAY #undef WEARER_DELAY