From 6c52b84ddbcfe9760e67e83218eabef1927d6ea6 Mon Sep 17 00:00:00 2001 From: kane-f <57303506+kane-f@users.noreply.github.com> Date: Tue, 7 Jun 2022 03:40:12 +0100 Subject: [PATCH] Ventcrawl mutli-Z code cleanup (#32712) * Ventcrawl mutli-Z code cleanup * Ventcrawl mutli-Z code cleanup * Ventcrawl mutli-Z code cleanup Co-authored-by: kanef --- code/ATMOSPHERICS/atmospherics.dm | 34 +---------------------------- code/modules/multiz/ventcrawl.dm | 26 ++++++++++++++++------ maps/test_multiz.dmm | 36 ++++++++++++++++++++++++++----- 3 files changed, 51 insertions(+), 45 deletions(-) diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index 8c516594836..983d56c2bad 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -357,39 +357,7 @@ Pipelines + Other Objects -> Pipe network if(user.loc != src || !(direction & initialize_directions)) //can't go in a way we aren't connecting to return - var/obj/machinery/atmospherics/target_move = findConnecting(direction, user.ventcrawl_layer) - if(target_move) - if(is_type_in_list(target_move, ventcrawl_machinery) && target_move.can_crawl_through()) - if(user.special_delayer.blocked()) - return - user.delayNextSpecial(10) - user.visible_message("Something is squeezing through the ducts...", "You start crawling out the ventilation system.") - target_move.shake(2, 3) - spawn(0) - if(do_after(user, target_move, 10)) - user.remove_ventcrawl() - user.forceMove(target_move.loc) //handles entering and so on - user.visible_message("You hear something squeeze through the ducts.", "You climb out the ventilation system.") - else if(target_move.can_crawl_through()) - if(target_move.return_network(target_move) != return_network(src)) - user.remove_ventcrawl() - user.add_ventcrawl(target_move) - if (user.client.prefs.stumble && ((world.time - user.last_movement) > 5)) - user.delayNextMove(3) //if set, delays the second step when a mob starts moving to attempt to make precise high ping movement easier - user.forceMove(target_move) - user.client.eye = target_move //if we don't do this, Byond only updates the eye every tick - required for smooth movement - user.last_movement=world.time - if(world.time - user.last_played_vent > VENT_SOUND_DELAY) - user.last_played_vent = world.time - playsound(src, 'sound/machines/ventcrawl.ogg', 50, 1, -3) - else - if((direction & initialize_directions) || is_type_in_list(src, ventcrawl_machinery) && src.can_crawl_through()) //if we move in a way the pipe can connect, but doesn't - or we're in a vent - user.remove_ventcrawl() - user.forceMove(src.loc, glide_size_override = DELAY2GLIDESIZE(1)) - user.visible_message("You hear something squeezing through the pipes.", "You climb out the ventilation system.") - user.canmove = 0 - spawn(1) - user.canmove = 1 + ventcrawl_to(user, findConnecting(direction, user.ventcrawl_layer), direction) /obj/machinery/atmospherics/proc/can_crawl_through() return 1 diff --git a/code/modules/multiz/ventcrawl.dm b/code/modules/multiz/ventcrawl.dm index 7ec72bcda6b..13028ea60ad 100644 --- a/code/modules/multiz/ventcrawl.dm +++ b/code/modules/multiz/ventcrawl.dm @@ -4,7 +4,8 @@ set category = "Abilities" set src = usr.loc var/obj/machinery/atmospherics/target = check_ventcrawl(GetAbove(loc)) - if(target) ventcrawl_to(usr, target, UP) + if(target) + ventcrawl_to(usr, target, UP) /obj/machinery/atmospherics/pipe/zpipe/down/verb/ventcrawl_move_down() set name = "Ventcrawl Downwards" @@ -12,7 +13,8 @@ set category = "Abilities" set src = usr.loc var/obj/machinery/atmospherics/target = check_ventcrawl(GetBelow(loc)) - if(target) ventcrawl_to(usr, target, DOWN) + if(target) + ventcrawl_to(usr, target, DOWN) /obj/machinery/atmospherics/pipe/zpipe/proc/check_ventcrawl(var/turf/target) if(!istype(target)) @@ -28,23 +30,33 @@ /obj/machinery/atmospherics/proc/ventcrawl_to(var/mob/living/user, var/obj/machinery/atmospherics/target_move, var/direction) if(target_move) if(is_type_in_list(target_move, ventcrawl_machinery) && target_move.can_crawl_through()) - user.remove_ventcrawl() - user.forceMove(target_move.loc) //handles entering and so on - user.visible_message("You hear something squeezing through the ducts.", "You climb out the ventilation system.") + if(user.special_delayer.blocked()) + return + user.delayNextSpecial(10) + user.visible_message("Something is squeezing through the ducts...", "You start crawling out the ventilation system.") + target_move.shake(2, 3) + spawn(0) + if(do_after(user, target_move, 10)) + user.remove_ventcrawl() + user.forceMove(target_move.loc) //handles entering and so on + user.visible_message("You hear something squeeze through the ducts.", "You climb out the ventilation system.") else if(target_move.can_crawl_through()) if(target_move.return_network(target_move) != return_network(src)) user.remove_ventcrawl() user.add_ventcrawl(target_move) + if (user.client.prefs.stumble && ((world.time - user.last_movement) > 5)) + user.delayNextMove(3) //if set, delays the second step when a mob starts moving to attempt to make precise high ping movement easier user.forceMove(target_move) user.client.eye = target_move //if we don't do this, Byond only updates the eye every tick - required for smooth movement + user.last_movement=world.time if(world.time - user.last_played_vent > VENT_SOUND_DELAY) user.last_played_vent = world.time playsound(src, 'sound/machines/ventcrawl.ogg', 50, 1, -3) else if((direction & initialize_directions) || is_type_in_list(src, ventcrawl_machinery) && src.can_crawl_through()) //if we move in a way the pipe can connect, but doesn't - or we're in a vent user.remove_ventcrawl() - user.forceMove(src.loc) + user.forceMove(src.loc, glide_size_override = DELAY2GLIDESIZE(1)) user.visible_message("You hear something squeezing through the pipes.", "You climb out the ventilation system.") user.canmove = 0 spawn(1) - user.canmove = 1 \ No newline at end of file + user.canmove = 1 diff --git a/maps/test_multiz.dmm b/maps/test_multiz.dmm index 339c1276ab8..094678cd727 100644 --- a/maps/test_multiz.dmm +++ b/maps/test_multiz.dmm @@ -871,6 +871,12 @@ /obj/machinery/door/airlock/external, /turf/simulated/floor/plating, /area/crew_quarters/casino) +"nG" = ( +/obj/machinery/atmospherics/pipe/simple/supply/visible{ + dir = 4 + }, +/turf/simulated/floor/plating, +/area/crew_quarters/bar) "rd" = ( /obj/structure/railing/glass{ dir = 4 @@ -899,6 +905,12 @@ "wX" = ( /turf/simulated/floor/plating, /area) +"xx" = ( +/obj/machinery/atmospherics/unary/vent{ + dir = 4 + }, +/turf/simulated/floor/plating, +/area/crew_quarters/bar) "zI" = ( /obj/structure/railing/plasteel{ dir = 1 @@ -921,9 +933,23 @@ }, /turf/simulated/floor/plating, /area) +"Eo" = ( +/obj/structure/catwalk, +/obj/machinery/atmospherics/unary/vent{ + dir = 8 + }, +/turf/simulated/open, +/area/crew_quarters/bar) "EX" = ( /turf/simulated/floor/plating, /area/crew_quarters/casino) +"Gx" = ( +/obj/structure/catwalk, +/obj/machinery/atmospherics/pipe/zpipe/down/supply{ + dir = 4 + }, +/turf/simulated/open, +/area/crew_quarters/bar) "GO" = ( /obj/structure/railing/plasteel{ dir = 8 @@ -4994,7 +5020,7 @@ ad ae ae ae -ae +xx ae ad ac @@ -5056,7 +5082,7 @@ ad al an ae -ae +nG ae ad ac @@ -5118,7 +5144,7 @@ ad am ao ae -ae +ap as ad ac @@ -8839,7 +8865,7 @@ ad bF bO bM -bM +Gx ch az aw @@ -8901,7 +8927,7 @@ aP bG bP bM -bM +Eo cf az aw