From 07f1b17a75d8c0c36f594f4042cbe28441799b63 Mon Sep 17 00:00:00 2001 From: Remie Richards Date: Sun, 3 May 2015 00:13:21 +0100 Subject: [PATCH 1/2] Update pipe vision when moving from scrubbers-->vents or vice versa via atmos/pipe fuckery, Fixes pipe vision not updating on login() --- code/ATMOSPHERICS/atmospherics.dm | 18 +++++++++++++- .../components/unary/unary_base.dm | 4 ---- code/ATMOSPHERICS/pipes.dm | 1 - code/modules/mob/living/login.dm | 2 +- code/modules/mob/living/ventcrawling.dm | 24 ++++++++++--------- 5 files changed, 31 insertions(+), 18 deletions(-) diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index 55acfd5c3d3..b596f63eaf8 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -23,6 +23,7 @@ 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() @@ -65,7 +66,7 @@ Pipelines + Other Objects -> Pipe network return default_set /obj/machinery/atmospherics/proc/returnPipenet() - return + return parent /obj/machinery/atmospherics/proc/returnPipenetAir() return @@ -197,6 +198,19 @@ 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) + + /* + var/list/myPipenets = getAllPipenets() + var/list/targetAllPipenets = target_move.getAllPipenets() + for(var/datum/pipeline/I in targetAllPipenets) + for(var/datum/pipeline/J in myPipenets) + if(I != J) + update_pipe_vision(target_move) + break + */ + 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) @@ -221,3 +235,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 ed6f483cd47..963d91bd405 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() @@ -114,9 +113,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..d4425c434ba 100644 --- a/code/modules/mob/living/ventcrawling.dm +++ b/code/modules/mob/living/ventcrawling.dm @@ -62,10 +62,12 @@ 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 + var/list/totalMembers = list() + totalMembers |= starting_machine.parent.members + totalMembers |= 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 @@ -84,13 +86,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(.) + From c9f2d282d61f18873b4fabb659eea5892bb3dfb3 Mon Sep 17 00:00:00 2001 From: Remie Richards Date: Sun, 3 May 2015 17:34:18 +0100 Subject: [PATCH 2/2] Fixes #9311, Fixes destroyed pipes still being in pipe vision, Pipe vision now appears above darkness. --- code/ATMOSPHERICS/atmospherics.dm | 26 +++++++++---------------- code/modules/mob/living/ventcrawling.dm | 11 +++++++---- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index b596f63eaf8..7fcc9ac67d0 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -25,12 +25,7 @@ Pipelines + Other Objects -> Pipe network 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() @@ -45,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 @@ -128,6 +130,7 @@ Pipelines + Other Objects -> Pipe network var/turf/T = loc stored.loc = T transfer_fingerprints_to(stored) + stored = null qdel(src) @@ -200,17 +203,6 @@ Pipelines + Other Objects -> Pipe network else if(target_move.can_crawl_through()) if(returnPipenet() != target_move.returnPipenet()) user.update_pipe_vision(target_move) - - /* - var/list/myPipenets = getAllPipenets() - var/list/targetAllPipenets = target_move.getAllPipenets() - for(var/datum/pipeline/I in targetAllPipenets) - for(var/datum/pipeline/J in myPipenets) - if(I != J) - update_pipe_vision(target_move) - break - */ - 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) diff --git a/code/modules/mob/living/ventcrawling.dm b/code/modules/mob/living/ventcrawling.dm index d4425c434ba..9165e233d1b 100644 --- a/code/modules/mob/living/ventcrawling.dm +++ b/code/modules/mob/living/ventcrawling.dm @@ -68,11 +68,14 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump, var/list/totalMembers = list() totalMembers |= starting_machine.parent.members totalMembers |= 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 + + 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()