From b14f7a429fa55285130a094fbda2ceb0a909da2d Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Sun, 3 May 2015 09:19:27 -0700 Subject: [PATCH] Ventcrawling fixes d3athrow/vgstation13#4251 tgstation/-tg-station#9296 - Fixes moving between pipeline datums not updating pipe vision - Fixes login() not updating pipe vision - Removes hardcoded limit of entering through unary machinery-- does nothing *now* - Can see pipes in darkness as fullbright - More sanity checks --- code/ATMOSPHERICS/atmospherics.dm | 9 ++++++- .../components/unary/unary_base.dm | 4 +-- code/game/machinery/cryo.dm | 7 +++--- code/modules/mob/living/carbon/carbon.dm | 25 +++++++++++-------- code/modules/mob/living/login.dm | 5 ++++ 5 files changed, 32 insertions(+), 18 deletions(-) diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index c212e3132c5..dbd10396c83 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -25,12 +25,16 @@ Pipelines + Other Objects -> Pipe network var/initialize_directions = 0 var/pipe_color + var/image/pipe_image + var/global/datum/pipe_icon_manager/icon_manager /obj/machinery/atmospherics/Destroy() for(var/mob/living/M in src) //ventcrawling is serious business M.remove_ventcrawl() - M.loc = src.loc + M.forceMove(src.loc) + if(pipe_image) + del(pipe_image) //we have to del it, or it might keep a ref somewhere else ..() // Find a connecting /obj/machinery/atmospherics in specified direction. @@ -163,6 +167,9 @@ obj/machinery/atmospherics/proc/check_connect_types_construction(obj/machinery/a 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.") 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) user.loc = target_move user.client.eye = target_move //if we don't do this, Byond only updates the eye every tick - required for smooth movement if(world.time - user.last_played_vent > VENT_SOUND_DELAY) diff --git a/code/ATMOSPHERICS/components/unary/unary_base.dm b/code/ATMOSPHERICS/components/unary/unary_base.dm index c1a01996343..46b6ee9a708 100644 --- a/code/ATMOSPHERICS/components/unary/unary_base.dm +++ b/code/ATMOSPHERICS/components/unary/unary_base.dm @@ -66,7 +66,7 @@ return_network(obj/machinery/atmospherics/reference) build_network() - if(reference==node) + if(reference == node || reference == src) return network return null @@ -89,7 +89,7 @@ if(reference==node) del(network) node = null - + update_icon() update_underlays() diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index cb00c9cacc0..8449c006cb0 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -60,10 +60,9 @@ /obj/machinery/atmospherics/unary/cryo_cell/initialize() if(node) return - var/node_connect = dir - for(var/obj/machinery/atmospherics/target in get_step(src,node_connect)) - if(target.initialize_directions & get_dir(target,src)) - node = target + for(var/cdir in cardinal) + node = findConnecting(cdir) + if(node) break /obj/machinery/atmospherics/unary/cryo_cell/Destroy() diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 73244f1a6c5..683228e97e8 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -334,22 +334,25 @@ mob/living src << "You must be conscious to do this!" return -/mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/unary/starting_machine) - for(var/datum/pipeline/pipeline in starting_machine.network.line_members) - for(var/atom/A in (pipeline.members || pipeline.edges)) - var/image/new_image = image(A, A.loc, dir = A.dir) - pipes_shown += new_image - client.images += new_image +/mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/starting_machine) + var/datum/pipe_network/network = starting_machine.return_network(starting_machine) + if(!network) + return + for(var/datum/pipeline/pipeline in network.line_members) + for(var/obj/machinery/atmospherics/A in (pipeline.members || pipeline.edges)) + if(!A.pipe_image) + A.pipe_image = image(A, A.loc, layer = 20, dir = A.dir) //the 20 puts it above Byond's darkness (not its opacity view) + pipes_shown += A.pipe_image + client.images += A.pipe_image /mob/living/proc/remove_ventcrawl() - for(var/image/current_image in pipes_shown) - client.images -= current_image + if(client) + for(var/image/current_image in pipes_shown) + client.images -= current_image + client.eye = src pipes_shown.len = 0 - if(client) - client.eye = src - /mob/living/carbon/clean_blood() . = ..() if(ishuman(src)) diff --git a/code/modules/mob/living/login.dm b/code/modules/mob/living/login.dm index b349e3b15f7..8a212e106b1 100644 --- a/code/modules/mob/living/login.dm +++ b/code/modules/mob/living/login.dm @@ -7,6 +7,11 @@ //If they're SSD, remove it so they can wake back up. player_logged = 0 + //login during ventcrawl + if(istype(loc, /obj/machinery/atmospherics)) //attach us back into the pipes + remove_ventcrawl() + add_ventcrawl(loc) + //Round specific stuff like hud updates if(ticker && ticker.mode) var/ref = "\ref[mind]"