diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index 3f847604cd9..7f70c5ab29e 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -23,13 +23,9 @@ Pipelines + Other Objects -> Pipe network var/welded = 0 //Used on pumps and scrubbers var/global/list/iconsetids = list() var/global/list/pipeimages = list() + var/datum/pipeline/parent = null - -/obj/machinery/atmospherics/Destroy() - for(var/mob/living/L in src) - L.remove_ventcrawl() - L.forceMove(get_turf(src)) - ..() + var/image/pipe_vision_img = null /obj/machinery/atmospherics/New() @@ -44,6 +40,13 @@ Pipelines + Other Objects -> Pipe network if (stored) qdel(stored) stored = null + + for(var/mob/living/L in src) + L.remove_ventcrawl() + L.forceMove(get_turf(src)) + if(pipe_vision_img) + qdel(pipe_vision_img) + ..() //this is called just after the air controller sets up turfs @@ -65,7 +68,7 @@ Pipelines + Other Objects -> Pipe network return default_set /obj/machinery/atmospherics/proc/returnPipenet() - return + return parent /obj/machinery/atmospherics/proc/returnPipenetAir() return @@ -127,6 +130,7 @@ Pipelines + Other Objects -> Pipe network var/turf/T = loc stored.loc = T transfer_fingerprints_to(stored) + stored = null qdel(src) @@ -199,6 +203,8 @@ Pipelines + Other Objects -> Pipe network user.forceMove(target_move.loc) //handle 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(returnPipenet() != target_move.returnPipenet()) + user.update_pipe_vision(target_move) user.loc = target_move user.client.eye = target_move //Byond only updates the eye every tick, This smooths out the movement if(world.time - user.last_played_vent > VENT_SOUND_DELAY) @@ -223,3 +229,5 @@ Pipelines + Other Objects -> Pipe network /obj/machinery/atmospherics/proc/can_crawl_through() return 1 + + diff --git a/code/ATMOSPHERICS/components/unary/unary_base.dm b/code/ATMOSPHERICS/components/unary/unary_base.dm index 20c62c00c7c..cd031bbeec0 100644 --- a/code/ATMOSPHERICS/components/unary/unary_base.dm +++ b/code/ATMOSPHERICS/components/unary/unary_base.dm @@ -5,7 +5,6 @@ layer = TURF_LAYER+0.1 var/datum/gas_mixture/air_contents var/obj/machinery/atmospherics/node - var/datum/pipeline/parent var/showpipe = 0 /obj/machinery/atmospherics/unary/New() @@ -116,9 +115,6 @@ Housekeeping and pipe network stuff below /obj/machinery/atmospherics/unary/setPipenet(datum/pipeline/P) parent = P -/obj/machinery/atmospherics/unary/returnPipenet() - return parent - /obj/machinery/atmospherics/unary/replacePipenet(datum/pipeline/Old, datum/pipeline/New) if(Old == parent) parent = New \ No newline at end of file diff --git a/code/ATMOSPHERICS/pipes.dm b/code/ATMOSPHERICS/pipes.dm index b2a1bb5236b..e4a464894ce 100644 --- a/code/ATMOSPHERICS/pipes.dm +++ b/code/ATMOSPHERICS/pipes.dm @@ -1,6 +1,5 @@ /obj/machinery/atmospherics/pipe var/datum/gas_mixture/air_temporary //used when reconstructing a pipeline that broke - var/datum/pipeline/parent var/volume = 0 layer = 2.4 //under wires with their 2.44 use_power = 0 diff --git a/code/modules/mob/living/login.dm b/code/modules/mob/living/login.dm index 0b46914c42b..7d99cd5fce8 100644 --- a/code/modules/mob/living/login.dm +++ b/code/modules/mob/living/login.dm @@ -14,7 +14,7 @@ if(ventcrawler) src << "You can ventcrawl! Use alt+click on vents to quickly travel about the station." //Should update regardless of if we can ventcrawl, since we can end up in pipes in other ways. - update_pipe_vision() + update_pipe_vision(loc) update_interface() return . diff --git a/code/modules/mob/living/ventcrawling.dm b/code/modules/mob/living/ventcrawling.dm index 78ccc103d0a..9165e233d1b 100644 --- a/code/modules/mob/living/ventcrawling.dm +++ b/code/modules/mob/living/ventcrawling.dm @@ -62,15 +62,20 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump, src << "This ventilation duct is not connected to anything!" -/mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/unary/starting_machine) - if(!starting_machine) +/mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/starting_machine) + if(!istype(starting_machine) || !starting_machine.returnPipenet()) return - var/list/totalMembers = starting_machine.parent.members + starting_machine.parent.other_atmosmch - for(var/atom/A in totalMembers) - var/image/new_image = image(A, A.loc, dir = A.dir) - pipes_shown += new_image + var/list/totalMembers = list() + totalMembers |= starting_machine.parent.members + totalMembers |= starting_machine.parent.other_atmosmch + + for(var/obj/machinery/atmospherics/A in totalMembers) + if(!A.pipe_vision_img) + A.pipe_vision_img = image(A, A.loc, layer = 20, dir = A.dir) + //20 for being above darkness + pipes_shown |= A.pipe_vision_img if(client) - client.images += new_image + client.images |= A.pipe_vision_img /mob/living/proc/remove_ventcrawl() @@ -84,13 +89,13 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump, //OOP -/atom/proc/update_pipe_vision() +/atom/proc/update_pipe_vision(var/atom/new_loc = null) return -/mob/living/update_pipe_vision() - if(pipes_shown.len) - if(!istype(loc, /obj/machinery/atmospherics)) - remove_ventcrawl() - else - if(istype(loc, /obj/machinery/atmospherics)) - add_ventcrawl(loc) +/mob/living/update_pipe_vision(var/atom/new_loc = null) + . = loc + if(new_loc) + . = new_loc + remove_ventcrawl() + add_ventcrawl(.) +