Eliminate duplicate code in pipes hide & process procs.

* These procs were repeated verbatim on the different subtypes of /obj/machinery/atmospherics/pipe.  Consolidated them in the parent.
* Added little comment headers over the different types of pipes to make the file easier to read.
This commit is contained in:
Leshana
2018-01-15 14:26:19 -05:00
parent c632c2604d
commit 6310c1da78

View File

@@ -1,3 +1,6 @@
//
// Base type of pipes
//
/obj/machinery/atmospherics/pipe
var/datum/gas_mixture/air_temporary // used when reconstructing a pipeline that broke
@@ -100,7 +103,7 @@
qdel(meter)
qdel(src)
/obj/machinery/atmospherics/proc/change_color(var/new_color)
/obj/machinery/atmospherics/pipe/proc/change_color(var/new_color)
//only pass valid pipe colors please ~otherwise your pipe will turn invisible
if(!pipe_color_check(new_color))
return
@@ -108,21 +111,6 @@
pipe_color = new_color
update_icon()
/*
/obj/machinery/atmospherics/pipe/add_underlay(var/obj/machinery/atmospherics/node, var/direction)
if(istype(src, /obj/machinery/atmospherics/pipe/tank)) //todo: move tanks to unary devices
return ..()
if(node)
var/temp_dir = get_dir(src, node)
underlays += icon_manager.get_atmos_icon("pipe_underlay_intact", temp_dir, color_cache_name(node))
return temp_dir
else if(direction)
underlays += icon_manager.get_atmos_icon("pipe_underlay_exposed", direction, pipe_color)
else
return null
*/
/obj/machinery/atmospherics/pipe/color_cache_name(var/obj/machinery/atmospherics/node)
if(istype(src, /obj/machinery/atmospherics/pipe/tank))
return ..()
@@ -137,6 +125,20 @@
else
return pipe_color
/obj/machinery/atmospherics/pipe/hide(var/i)
if(istype(loc, /turf/simulated))
invisibility = i ? 101 : 0
update_icon()
/obj/machinery/atmospherics/pipe/process()
if(!parent) //This should cut back on the overhead calling build_network thousands of times per cycle
..()
else
. = PROCESS_KILL
//
// Simple Pipes - Just a tube, maybe bent
//
/obj/machinery/atmospherics/pipe/simple
icon = 'icons/atmos/pipes.dmi'
icon_state = ""
@@ -166,17 +168,6 @@
icon = null
alpha = 255
/obj/machinery/atmospherics/pipe/simple/hide(var/i)
if(istype(loc, /turf/simulated))
invisibility = i ? 101 : 0
update_icon()
/obj/machinery/atmospherics/pipe/simple/process()
if(!parent) //This should cut back on the overhead calling build_network thousands of times per cycle
..()
else
. = PROCESS_KILL
/obj/machinery/atmospherics/pipe/simple/check_pressure(pressure)
var/datum/gas_mixture/environment = loc.return_air()
@@ -411,7 +402,9 @@
level = 2
//
// Manifold Pipes - Three way "T" joints
//
/obj/machinery/atmospherics/pipe/manifold
icon = 'icons/atmos/manifold.dmi'
icon_state = ""
@@ -444,20 +437,9 @@
if(WEST)
initialize_directions = NORTH|EAST|SOUTH
/obj/machinery/atmospherics/pipe/manifold/hide(var/i)
if(istype(loc, /turf/simulated))
invisibility = i ? 101 : 0
update_icon()
/obj/machinery/atmospherics/pipe/manifold/pipeline_expansion()
return list(node1, node2, node3)
/obj/machinery/atmospherics/pipe/manifold/process()
if(!parent)
..()
else
. = PROCESS_KILL
/obj/machinery/atmospherics/pipe/manifold/Destroy()
if(node1)
node1.disconnect(src)
@@ -674,6 +656,10 @@
/obj/machinery/atmospherics/pipe/manifold/hidden/purple
color = PIPE_COLOR_PURPLE
//
// 4-Way Manifold Pipes - 4 way "cross" junction
//
/obj/machinery/atmospherics/pipe/manifold4w
icon = 'icons/atmos/manifold.dmi'
icon_state = ""
@@ -699,12 +685,6 @@
/obj/machinery/atmospherics/pipe/manifold4w/pipeline_expansion()
return list(node1, node2, node3, node4)
/obj/machinery/atmospherics/pipe/manifold4w/process()
if(!parent)
..()
else
. = PROCESS_KILL
/obj/machinery/atmospherics/pipe/manifold4w/Destroy()
if(node1)
node1.disconnect(src)
@@ -813,11 +793,6 @@
..()
update_icon()
/obj/machinery/atmospherics/pipe/manifold4w/hide(var/i)
if(istype(loc, /turf/simulated))
invisibility = i ? 101 : 0
update_icon()
/obj/machinery/atmospherics/pipe/manifold4w/atmos_init()
for(var/obj/machinery/atmospherics/target in get_step(src,1))
@@ -939,6 +914,9 @@
/obj/machinery/atmospherics/pipe/manifold4w/hidden/purple
color = PIPE_COLOR_PURPLE
//
// Pipe Cap - They go on the end
//
/obj/machinery/atmospherics/pipe/cap
name = "pipe endcap"
desc = "An endcap for pipes"
@@ -957,19 +935,9 @@
/obj/machinery/atmospherics/pipe/cap/init_dir()
initialize_directions = dir
/obj/machinery/atmospherics/pipe/cap/hide(var/i)
if(istype(loc, /turf/simulated))
invisibility = i ? 101 : 0
update_icon()
/obj/machinery/atmospherics/pipe/cap/pipeline_expansion()
return list(node)
/obj/machinery/atmospherics/pipe/cap/process()
if(!parent)
..()
else
. = PROCESS_KILL
/obj/machinery/atmospherics/pipe/cap/Destroy()
if(node)
node.disconnect(src)
@@ -1061,7 +1029,9 @@
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
//
// Tanks - These are implemented as pipes with large volume
//
/obj/machinery/atmospherics/pipe/tank
icon = 'icons/atmos/tank.dmi'
icon_state = "air_map"
@@ -1084,12 +1054,6 @@
/obj/machinery/atmospherics/pipe/tank/init_dir()
initialize_directions = dir
/obj/machinery/atmospherics/pipe/tank/process()
if(!parent)
..()
else
. = PROCESS_KILL
/obj/machinery/atmospherics/pipe/tank/Destroy()
if(node1)
node1.disconnect(src)
@@ -1226,6 +1190,9 @@
..()
icon_state = "n2o"
//
// Vent Pipe - Unpowered vent
//
/obj/machinery/atmospherics/pipe/vent
icon = 'icons/obj/atmospherics/pipe_vent.dmi'
icon_state = "intact"
@@ -1307,7 +1274,9 @@
else
icon_state = "exposed"
//
// Universal Pipe Adapter - Designed for connecting scrubbers, normal, and supply pipes together.
//
/obj/machinery/atmospherics/pipe/simple/visible/universal
name="Universal pipe adapter"
desc = "An adapter for regular, supply and scrubbers pipes"