From 46a11b05423bb635f2f99b370ec6d036216682f3 Mon Sep 17 00:00:00 2001 From: AnturK Date: Fri, 18 Dec 2015 17:03:03 +0100 Subject: [PATCH] Ventcrawling fixes --- code/ATMOSPHERICS/atmospherics.dm | 9 +++++++-- code/ATMOSPHERICS/components/components_base.dm | 7 ++++++- .../components/unary_devices/vent_pump.dm | 4 ++-- .../components/unary_devices/vent_scrubber.dm | 4 ++-- code/ATMOSPHERICS/pipes/pipes.dm | 3 +++ code/modules/mob/living/ventcrawling.dm | 14 +++++++++----- 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index debea492b0a..f19d8df4217 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -248,7 +248,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()) + var/list/pipenetdiff = returnPipenets() ^ target_move.returnPipenets() + if(pipenetdiff.len) 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 @@ -273,4 +274,8 @@ Pipelines + Other Objects -> Pipe network /obj/machinery/atmospherics/proc/can_crawl_through() - return 1 \ No newline at end of file + return 1 + +/obj/machinery/atmospherics/proc/returnPipenets() + return list() + diff --git a/code/ATMOSPHERICS/components/components_base.dm b/code/ATMOSPHERICS/components/components_base.dm index 47791c124d7..bf7371f72cd 100644 --- a/code/ATMOSPHERICS/components/components_base.dm +++ b/code/ATMOSPHERICS/components/components_base.dm @@ -150,4 +150,9 @@ Helpers /obj/machinery/atmospherics/components/proc/update_parents() for(DEVICE_TYPE_LOOP) var/datum/pipeline/parent = PARENT_I - parent.update = 1 \ No newline at end of file + parent.update = 1 + +/obj/machinery/atmospherics/components/returnPipenets() + . = list() + for(DEVICE_TYPE_LOOP) + . += returnPipenet(NODE_I) \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm index fd6fef1583a..2aa4dc062fd 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_pump.dm @@ -272,11 +272,11 @@ if(!welded) user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.") welded = 1 - update_icon() else user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.") welded = 0 - update_icon() + update_icon() + pipe_vision_img = image(src, loc, layer = 20, dir = dir) return 1 else return ..() diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm index 1e4e34f5b3a..65bdcf2c5e8 100644 --- a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm @@ -304,11 +304,11 @@ if(!welded) user.visible_message("[user] welds the scrubber shut.","You weld the scrubber shut.", "You hear welding.") welded = 1 - update_icon() else user.visible_message("[user] unwelds the scrubber.", "You unweld the scrubber.", "You hear welding.") welded = 0 - update_icon() + update_icon() + pipe_vision_img = image(src, loc, layer = 20, dir = dir) return 1 if (!istype(W, /obj/item/weapon/wrench)) return ..() diff --git a/code/ATMOSPHERICS/pipes/pipes.dm b/code/ATMOSPHERICS/pipes/pipes.dm index df05d4d18bc..6a6845b80f6 100644 --- a/code/ATMOSPHERICS/pipes/pipes.dm +++ b/code/ATMOSPHERICS/pipes/pipes.dm @@ -100,3 +100,6 @@ if(NODE_I) var/obj/machinery/atmospherics/N = NODE_I N.update_icon() + +/obj/machinery/atmospherics/pipe/returnPipenets() + . = list(parent) \ No newline at end of file diff --git a/code/modules/mob/living/ventcrawling.dm b/code/modules/mob/living/ventcrawling.dm index 7036ebcba2e..0cc06ce18ec 100644 --- a/code/modules/mob/living/ventcrawling.dm +++ b/code/modules/mob/living/ventcrawling.dm @@ -78,13 +78,17 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/components/unary ..() -/mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/components/unary/starting_machine) - if(!istype(starting_machine) || !starting_machine.returnPipenet()) +/mob/living/proc/add_ventcrawl(obj/machinery/atmospherics/starting_machine) + if(!istype(starting_machine)) return var/list/totalMembers = list() - var/datum/pipeline/starting_machine_parent = starting_machine.PARENT1 - totalMembers += starting_machine_parent.members - totalMembers += starting_machine_parent.other_atmosmch + + for(var/datum/pipeline/P in starting_machine.returnPipenets()) + totalMembers += P.members + totalMembers += P.other_atmosmch + + if(!totalMembers.len) + return for(var/obj/machinery/atmospherics/A in totalMembers) if(!A.pipe_vision_img)