Files
VMSolidusandGitHub 75dfa30013 More Atom Cleanup (#22777)
Unused vars take up memory and worsen proc overhead. By far the worst
offenders to this are vars on /atom and /mob since they more or less
globally stack lots and lots and lots and lots of proc overhead. So I'm
cleaning up unused vars on these to save resources. I also noted several
vars that are excellent candidates for making components or elements.
When I'm not drowning in school work anymore, their time is numbered.

Mfw every space carp forever has a CCIA record, no wonder mobs are
laggy.
2026-07-07 14:13:51 +00:00

1550 lines
46 KiB
Plaintext

/obj/structure/machinery/atmospherics/pipe
obj_flags = OBJ_FLAG_MOVES_UNSUPPORTED
var/datum/gas_mixture/air_temporary // used when reconstructing a pipeline that broke
var/datum/pipeline/parent
var/volume = 0
force = 25
use_power = POWER_USE_OFF
var/alert_pressure = ATMOS_DEFAULT_ALERT_PRESSURE
//minimum pressure before check_pressure(...) should be called
can_buckle = 1
buckle_require_restraints = 1
buckle_lying = -1
/obj/structure/machinery/atmospherics/pipe/mechanics_hints(mob/user, distance, is_adjacent)
. += ..()
. += "This pipe, and all other pipes, can be safely connected or disconnected by a pipe wrench. The internal pressure of the pipe must \
be below 300 kPa to do this."
. += "Using a regular wrench on a pressurized pipe is not a good idea."
. += "Special pipe types, like Supply, Scrubber, Fuel, and Aux, will not connect to normal pipes or to each other. If you want to connect them, use \
a Universal Adapter pipe."
. += "Use an Analyzer on a pipe to get details on its contents."
/obj/structure/machinery/atmospherics/pipe/feedback_hints(mob/user, distance, is_adjacent)
. += ..()
var/pipe_color_check = pipe_color || PIPE_COLOR_GREY
var/found_color_name = "Unknown"
for(var/color_name in GLOB.pipe_colors)
var/color_value = GLOB.pipe_colors[color_name]
if(pipe_color_check == color_value)
found_color_name = color_name
break
. += "This pipe is: <span style='color:[pipe_color_check == PIPE_COLOR_GREY ? COLOR_GRAY : pipe_color_check]'>[capitalize(found_color_name)]</span>"
/obj/structure/machinery/atmospherics/pipe/drain_power()
return -1
/obj/structure/machinery/atmospherics/pipe/Initialize(mapload)
if(istype(get_turf(src), /turf/simulated/wall) || istype(get_turf(src), /turf/unsimulated/wall))
level = 1
. = ..()
if(!mapload)
return INITIALIZE_HINT_NORMAL
/obj/structure/machinery/atmospherics/pipe/hides_under_flooring()
return level != 2
/obj/structure/machinery/atmospherics/pipe/proc/pipeline_expansion()
return null
/obj/structure/machinery/atmospherics/pipe/proc/check_pressure(pressure)
//Return 1 if parent should continue checking other pipes
//Return null if parent should stop checking other pipes. Recall: qdel(src) will by default return null
return 1
/obj/structure/machinery/atmospherics/pipe/return_air()
if(!parent)
parent = new /datum/pipeline()
parent.build_pipeline(src)
return parent.air
/obj/structure/machinery/atmospherics/pipe/build_network()
if(!parent)
parent = new /datum/pipeline()
parent.build_pipeline(src)
return parent.return_network()
/obj/structure/machinery/atmospherics/pipe/network_expand(datum/pipe_network/new_network, obj/structure/machinery/atmospherics/pipe/reference)
if(!parent)
parent = new /datum/pipeline()
parent.build_pipeline(src)
return parent.network_expand(new_network, reference)
/obj/structure/machinery/atmospherics/pipe/return_network(obj/structure/machinery/atmospherics/reference)
if(!parent)
parent = new /datum/pipeline()
parent.build_pipeline(src)
return parent.return_network(reference)
/obj/structure/machinery/atmospherics/pipe/Destroy()
QDEL_NULL(parent)
if(air_temporary)
loc.assume_air(air_temporary)
return ..()
/obj/structure/machinery/atmospherics/pipe/attackby(obj/item/attacking_item, mob/user)
if (istype(src, /obj/structure/machinery/atmospherics/pipe/tank))
return ..()
if(istype(attacking_item,/obj/item/paint_sprayer))
return FALSE
if(istype(attacking_item, /obj/item/analyzer) && Adjacent(user))
var/obj/item/analyzer/A = attacking_item
A.analyze_gases(src, user)
return FALSE
if (attacking_item.tool_behaviour != TOOL_WRENCH && !istype(attacking_item, /obj/item/pipewrench))
return ..()
var/turf/T = src.loc
if (level==1 && isturf(T) && !T.is_plating())
to_chat(user, SPAN_WARNING("You must remove the plating first!"))
return TRUE
var/datum/gas_mixture/int_air = return_air()
if(!loc) return FALSE
var/datum/gas_mixture/env_air = loc.return_air()
if ((XGM_PRESSURE(int_air)-XGM_PRESSURE(env_air)) > PRESSURE_EXERTED)
if(!istype(attacking_item, /obj/item/pipewrench))
to_chat(user, SPAN_WARNING("You cannot unwrench \the [src], it is too exerted due to internal pressure."))
add_fingerprint(user)
return TRUE
else
to_chat(user, SPAN_WARNING("You struggle to unwrench \the [src] with your pipe wrench."))
to_chat(user, SPAN_NOTICE("You begin to unfasten \the [src]..."))
if(attacking_item.use_tool(src, user, istype(attacking_item, /obj/item/pipewrench) ? 80 : 40, volume = 50))
user.visible_message( \
SPAN_NOTICE("\The [user] unfastens \the [src]."), \
SPAN_NOTICE("You have unfastened \the [src]."), \
"You hear a ratchet.")
new /obj/item/pipe(loc, make_from=src)
for (var/obj/structure/machinery/meter/meter in T)
if (meter.target == src)
new /obj/item/pipe_meter(T)
qdel(meter)
qdel(src)
return TRUE
/obj/structure/machinery/atmospherics/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
pipe_color = new_color
update_icon()
/*
/obj/structure/machinery/atmospherics/pipe/add_underlay(var/obj/structure/machinery/atmospherics/node, var/direction)
if(istype(src, /obj/structure/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/structure/machinery/atmospherics/pipe/color_cache_name(var/obj/structure/machinery/atmospherics/node)
if(istype(src, /obj/structure/machinery/atmospherics/pipe/tank))
return ..()
if(istype(node, /obj/structure/machinery/atmospherics/pipe/manifold) || istype(node, /obj/structure/machinery/atmospherics/pipe/manifold4w))
if(pipe_color == node.pipe_color)
return node.pipe_color
else
return null
else if(istype(node, /obj/structure/machinery/atmospherics/pipe/simple))
return node.pipe_color
else
return pipe_color
/obj/structure/machinery/atmospherics/pipe/simple
icon = 'icons/atmos/pipes.dmi'
icon_state = ""
var/pipe_icon = "" //what kind of pipe it is and from which dmi is the icon manager getting its icons, "" for simple pipes, "hepipe" for HE pipes, "hejunction" for HE junctions
name = "pipe"
desc = "A one meter section of regular pipe"
volume = ATMOS_DEFAULT_VOLUME_PIPE
dir = SOUTH
initialize_directions = SOUTH|NORTH
var/minimum_temperature_difference = 300
var/thermal_conductivity = 0 //WALL_HEAT_TRANSFER_COEFFICIENT No
var/maximum_pressure = ATMOS_DEFAULT_MAX_PRESSURE
var/fatigue_pressure = ATMOS_DEFAULT_FATIGUE_PRESSURE
alert_pressure = ATMOS_DEFAULT_ALERT_PRESSURE
level = 1
/obj/structure/machinery/atmospherics/pipe/simple/Initialize(mapload)
if(mapload)
var/turf/T = loc
var/image/I = image(icon, T, icon_state, dir, pixel_x, pixel_y)
I.plane = ABOVE_LIGHTING_PLANE
I.color = color
I.alpha = 125
LAZYADD(T.blueprints, I)
// Pipe colors and icon states are handled by an image cache - so color and icon should
// be null. For mapping purposes color is defined in the object definitions.
icon = null
alpha = 255
switch(dir)
if(SOUTH, NORTH)
initialize_directions = SOUTH|NORTH
if(EAST, WEST)
initialize_directions = EAST|WEST
if(NORTHEAST)
initialize_directions = NORTH|EAST
if(NORTHWEST)
initialize_directions = NORTH|WEST
if(SOUTHEAST)
initialize_directions = SOUTH|EAST
if(SOUTHWEST)
initialize_directions = SOUTH|WEST
. = ..()
/obj/structure/machinery/atmospherics/pipe/simple/hide(var/i)
if(istype(loc, /turf/simulated))
set_invisibility(i ? 101 : 0)
queue_icon_update()
/obj/structure/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/structure/machinery/atmospherics/pipe/simple/check_pressure(pressure)
if(!loc) return
var/datum/gas_mixture/environment = loc.return_air()
var/pressure_difference = pressure - XGM_PRESSURE(environment)
if(pressure_difference > maximum_pressure)
burst()
else if(pressure_difference > fatigue_pressure)
//TODO: leak to turf, doing pfshhhhh
if(prob(5))
burst()
else return 1
/obj/structure/machinery/atmospherics/pipe/simple/proc/burst()
src.visible_message(SPAN_DANGER("\The [src] bursts!"));
playsound(src.loc, 'sound/effects/bang.ogg', 25, 1)
var/datum/effect/effect/system/smoke_spread/smoke = new
smoke.set_up(1,0, src.loc, 0)
smoke.start()
qdel(src)
/obj/structure/machinery/atmospherics/pipe/simple/proc/normalize_dir()
if(dir==3)
set_dir(1)
else if(dir==12)
set_dir(4)
/obj/structure/machinery/atmospherics/pipe/simple/Destroy()
if(node1)
node1.disconnect(src)
node1 = null
if(node2)
node2.disconnect(src)
node2 = null
return ..()
/obj/structure/machinery/atmospherics/pipe/simple/pipeline_expansion()
return list(node1, node2)
/obj/structure/machinery/atmospherics/pipe/simple/change_color(var/new_color)
..()
//for updating connected atmos device pipes (i.e. vents, manifolds, etc)
if(node1)
node1.update_underlays()
if(node2)
node2.update_underlays()
/obj/structure/machinery/atmospherics/pipe/simple/update_icon(var/safety = 0)
if(!check_icon_cache())
return
if(!atmos_initialised)
return
alpha = 255
ClearOverlays()
if(!node1 && !node2)
var/turf/T = get_turf(src)
new /obj/item/pipe(loc, make_from=src)
for (var/obj/structure/machinery/meter/meter in T)
if (meter.target == src)
new /obj/item/pipe_meter(T)
qdel(meter)
qdel(src)
else if(node1 && node2)
AddOverlays(icon_manager.get_atmos_icon("pipe", , pipe_color, "[pipe_icon]intact[icon_connect_type]"))
else
AddOverlays(icon_manager.get_atmos_icon("pipe", , pipe_color, "[pipe_icon]exposed[node1?1:0][node2?1:0][icon_connect_type]"))
/obj/structure/machinery/atmospherics/pipe/simple/update_underlays()
return
/obj/structure/machinery/atmospherics/pipe/simple/atmos_init()
normalize_dir()
var/node1_dir
var/node2_dir
for(var/direction in GLOB.cardinals)
if(direction&initialize_directions)
if (!node1_dir)
node1_dir = direction
else if (!node2_dir)
node2_dir = direction
for(var/obj/structure/machinery/atmospherics/target in get_step(src,node1_dir))
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node1 = target
break
for(var/obj/structure/machinery/atmospherics/target in get_step(src,node2_dir))
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node2 = target
break
if(!node1 && !node2)
qdel(src)
return
atmos_initialised = TRUE
var/turf/T = loc
if(level == 1 && !T.is_plating()) hide(1)
queue_icon_update()
/obj/structure/machinery/atmospherics/pipe/simple/disconnect(obj/structure/machinery/atmospherics/reference)
if(reference == node1)
if(istype(node1, /obj/structure/machinery/atmospherics/pipe))
QDEL_NULL(parent)
node1 = null
if(reference == node2)
if(istype(node2, /obj/structure/machinery/atmospherics/pipe))
QDEL_NULL(parent)
node2 = null
update_icon()
return null
/obj/structure/machinery/atmospherics/pipe/simple/visible
icon_state = "intact"
level = 2
/obj/structure/machinery/atmospherics/pipe/simple/visible/scrubbers
name = "Scrubbers pipe"
desc = "A one meter section of scrubbers pipe."
icon_state = "intact-scrubbers"
connect_types = CONNECT_TYPE_SCRUBBER
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/structure/machinery/atmospherics/pipe/simple/visible/supply
name = "Air supply pipe"
desc = "A one meter section of supply pipe"
icon_state = "intact-supply"
connect_types = CONNECT_TYPE_SUPPLY
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/structure/machinery/atmospherics/pipe/simple/visible/fuel
name = "Fuel pipe"
desc = "A one meter section of fuel pipe."
icon_state = "intact-fuel"
connect_types = CONNECT_TYPE_FUEL
icon_connect_type = "-fuel"
color = PIPE_COLOR_YELLOW
/obj/structure/machinery/atmospherics/pipe/simple/visible/aux
name = "Auxiliary pipe"
desc = "A one meter section of auxiliary pipe."
icon_state = "intact-aux"
connect_types = CONNECT_TYPE_AUX
icon_connect_type = "-aux"
color = PIPE_COLOR_CYAN
/obj/structure/machinery/atmospherics/pipe/simple/visible/yellow
color = PIPE_COLOR_YELLOW
/obj/structure/machinery/atmospherics/pipe/simple/visible/cyan
color = PIPE_COLOR_CYAN
/obj/structure/machinery/atmospherics/pipe/simple/visible/green
color = PIPE_COLOR_GREEN
/obj/structure/machinery/atmospherics/pipe/simple/visible/black
color = PIPE_COLOR_BLACK
/obj/structure/machinery/atmospherics/pipe/simple/visible/red
color = PIPE_COLOR_RED
/obj/structure/machinery/atmospherics/pipe/simple/visible/blue
color = PIPE_COLOR_BLUE
/obj/structure/machinery/atmospherics/pipe/simple/visible/purple
color = PIPE_COLOR_PURPLE
/obj/structure/machinery/atmospherics/pipe/simple/hidden
icon_state = "intact"
level = 1
alpha = 128 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game
/obj/structure/machinery/atmospherics/pipe/simple/hidden/scrubbers
name = "Scrubbers pipe"
desc = "A one meter section of scrubbers pipe."
icon_state = "intact-scrubbers"
connect_types = CONNECT_TYPE_SCRUBBER
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/structure/machinery/atmospherics/pipe/simple/hidden/supply
name = "Air supply pipe"
desc = "A one meter section of supply pipe."
icon_state = "intact-supply"
connect_types = CONNECT_TYPE_SUPPLY
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/structure/machinery/atmospherics/pipe/simple/hidden/fuel
name = "Fuel pipe"
desc = "A one meter section of fuel pipe."
icon_state = "intact-fuel"
connect_types = CONNECT_TYPE_FUEL
icon_connect_type = "-fuel"
color = PIPE_COLOR_YELLOW
/obj/structure/machinery/atmospherics/pipe/simple/hidden/aux
name = "Auxiliary pipe"
desc = "A one meter section of auxiliary pipe."
icon_state = "intact-aux"
connect_types = CONNECT_TYPE_AUX
icon_connect_type = "-aux"
color = PIPE_COLOR_CYAN
/obj/structure/machinery/atmospherics/pipe/simple/hidden/yellow
color = PIPE_COLOR_YELLOW
/obj/structure/machinery/atmospherics/pipe/simple/hidden/cyan
color = PIPE_COLOR_CYAN
/obj/structure/machinery/atmospherics/pipe/simple/hidden/green
color = PIPE_COLOR_GREEN
/obj/structure/machinery/atmospherics/pipe/simple/hidden/black
color = PIPE_COLOR_BLACK
/obj/structure/machinery/atmospherics/pipe/simple/hidden/red
color = PIPE_COLOR_RED
/obj/structure/machinery/atmospherics/pipe/simple/hidden/blue
color = PIPE_COLOR_BLUE
/obj/structure/machinery/atmospherics/pipe/simple/hidden/purple
color = PIPE_COLOR_PURPLE
/obj/structure/machinery/atmospherics/pipe/manifold
name = "pipe manifold"
desc = "A manifold composed of regular pipes."
icon = 'icons/atmos/manifold.dmi'
icon_state = ""
volume = ATMOS_DEFAULT_VOLUME_PIPE * 1.5
dir = SOUTH
initialize_directions = EAST|NORTH|WEST
var/obj/structure/machinery/atmospherics/node3
level = 1
/obj/structure/machinery/atmospherics/pipe/manifold/Initialize(mapload)
if(mapload)
var/turf/T = loc
var/image/I = image(icon, T, icon_state, dir, pixel_x, pixel_y)
I.plane = ABOVE_LIGHTING_PLANE
I.color = color
I.alpha = 125
LAZYADD(T.blueprints, I)
alpha = 255
icon = null
switch(dir)
if(NORTH)
initialize_directions = EAST|SOUTH|WEST
if(SOUTH)
initialize_directions = WEST|NORTH|EAST
if(EAST)
initialize_directions = SOUTH|WEST|NORTH
if(WEST)
initialize_directions = NORTH|EAST|SOUTH
. = ..()
/obj/structure/machinery/atmospherics/pipe/manifold/hide(var/i)
if(istype(loc, /turf/simulated))
set_invisibility(i ? 101 : 0)
queue_icon_update()
/obj/structure/machinery/atmospherics/pipe/manifold/pipeline_expansion()
return list(node1, node2, node3)
/obj/structure/machinery/atmospherics/pipe/manifold/process()
if(!parent)
..()
else
. = PROCESS_KILL
/obj/structure/machinery/atmospherics/pipe/manifold/Destroy()
if(node1)
node1.disconnect(src)
node1 = null
if(node2)
node2.disconnect(src)
node2 = null
if(node3)
node3.disconnect(src)
node3 = null
return ..()
/obj/structure/machinery/atmospherics/pipe/manifold/disconnect(obj/structure/machinery/atmospherics/reference)
if(reference == node1)
if(istype(node1, /obj/structure/machinery/atmospherics/pipe))
QDEL_NULL(parent)
node1 = null
if(reference == node2)
if(istype(node2, /obj/structure/machinery/atmospherics/pipe))
QDEL_NULL(parent)
node2 = null
if(reference == node3)
if(istype(node3, /obj/structure/machinery/atmospherics/pipe))
QDEL_NULL(parent)
node3 = null
update_icon()
..()
/obj/structure/machinery/atmospherics/pipe/manifold/change_color(var/new_color)
..()
//for updating connected atmos device pipes (i.e. vents, manifolds, etc)
if(node1)
node1.update_underlays()
if(node2)
node2.update_underlays()
if(node3)
node3.update_underlays()
/obj/structure/machinery/atmospherics/pipe/manifold/update_icon(var/safety = 0)
if(!check_icon_cache())
return
if(!atmos_initialised)
return
alpha = 255
if(!node1 && !node2 && !node3)
var/turf/T = get_turf(src)
new /obj/item/pipe(loc, make_from=src)
for (var/obj/structure/machinery/meter/meter in T)
if (meter.target == src)
new /obj/item/pipe_meter(T)
qdel(meter)
qdel(src)
else
ClearOverlays()
AddOverlays(icon_manager.get_atmos_icon("manifold", , pipe_color, "core" + icon_connect_type))
AddOverlays(icon_manager.get_atmos_icon("manifold", , , "clamps" + icon_connect_type))
// Can't handle underlays with SSoverlay.
underlays.Cut()
var/turf/T = get_turf(src)
var/list/directions = list(NORTH, SOUTH, EAST, WEST)
var/node1_direction = get_dir(src, node1)
var/node2_direction = get_dir(src, node2)
var/node3_direction = get_dir(src, node3)
directions -= dir
directions -= add_underlay(T,node1,node1_direction,icon_connect_type)
directions -= add_underlay(T,node2,node2_direction,icon_connect_type)
directions -= add_underlay(T,node3,node3_direction,icon_connect_type)
for(var/D in directions)
add_underlay(T,,D,icon_connect_type)
/obj/structure/machinery/atmospherics/pipe/manifold/update_underlays()
..()
queue_icon_update()
/obj/structure/machinery/atmospherics/pipe/manifold/atmos_init()
var/connect_directions = (NORTH|SOUTH|EAST|WEST)&(~dir)
for(var/direction in GLOB.cardinals)
if(direction&connect_directions)
for(var/obj/structure/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node1 = target
connect_directions &= ~direction
break
if (node1)
break
for(var/direction in GLOB.cardinals)
if(direction&connect_directions)
for(var/obj/structure/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node2 = target
connect_directions &= ~direction
break
if (node2)
break
for(var/direction in GLOB.cardinals)
if(direction&connect_directions)
for(var/obj/structure/machinery/atmospherics/target in get_step(src,direction))
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node3 = target
connect_directions &= ~direction
break
if (node3)
break
if(!node1 && !node2 && !node3)
qdel(src)
return
atmos_initialised = TRUE
var/turf/T = get_turf(src)
if(level == 1 && !T.is_plating()) hide(1)
queue_icon_update()
/obj/structure/machinery/atmospherics/pipe/manifold/visible
icon_state = "map"
level = 2
/obj/structure/machinery/atmospherics/pipe/manifold/visible/scrubbers
name = "scrubbers pipe manifold"
desc = "A manifold composed of scrubbers pipes"
icon_state = "map-scrubbers"
connect_types = CONNECT_TYPE_SCRUBBER
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/structure/machinery/atmospherics/pipe/manifold/visible/supply
name = "air supply pipe manifold"
desc = "A manifold composed of supply pipes."
icon_state = "map-supply"
connect_types = CONNECT_TYPE_SUPPLY
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/structure/machinery/atmospherics/pipe/manifold/visible/fuel
name = "fuel pipe manifold"
desc = "A manifold composed of fuel piping."
icon_state = "map-fuel"
connect_types = CONNECT_TYPE_FUEL
icon_connect_type = "-fuel"
color = PIPE_COLOR_YELLOW
/obj/structure/machinery/atmospherics/pipe/manifold/visible/aux
name = "auxiliary pipe manifold"
desc = "A manifold composed of auxiliary piping."
icon_state = "map-aux"
connect_types = CONNECT_TYPE_AUX
icon_connect_type = "-aux"
color = PIPE_COLOR_CYAN
/obj/structure/machinery/atmospherics/pipe/manifold/visible/yellow
color = PIPE_COLOR_YELLOW
/obj/structure/machinery/atmospherics/pipe/manifold/visible/cyan
color = PIPE_COLOR_CYAN
/obj/structure/machinery/atmospherics/pipe/manifold/visible/green
color = PIPE_COLOR_GREEN
/obj/structure/machinery/atmospherics/pipe/manifold/visible/black
color = PIPE_COLOR_BLACK
/obj/structure/machinery/atmospherics/pipe/manifold/visible/red
color = PIPE_COLOR_RED
/obj/structure/machinery/atmospherics/pipe/manifold/visible/blue
color = PIPE_COLOR_BLUE
/obj/structure/machinery/atmospherics/pipe/manifold/visible/purple
color = PIPE_COLOR_PURPLE
/obj/structure/machinery/atmospherics/pipe/manifold/hidden
icon_state = "map"
level = 1
alpha = 128 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game
/obj/structure/machinery/atmospherics/pipe/manifold/hidden/scrubbers
name = "scrubbers pipe manifold"
desc = "A manifold composed of scrubbers pipes."
icon_state = "map-scrubbers"
connect_types = CONNECT_TYPE_SCRUBBER
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/structure/machinery/atmospherics/pipe/manifold/hidden/supply
name = "air supply pipe manifold"
desc = "A manifold composed of supply pipes."
icon_state = "map-supply"
connect_types = CONNECT_TYPE_SUPPLY
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/structure/machinery/atmospherics/pipe/manifold/hidden/fuel
name = "Fuel pipe manifold"
desc = "A manifold composed of fuel pipes."
icon_state = "map-fuel"
connect_types = CONNECT_TYPE_FUEL
icon_connect_type = "-fuel"
color = PIPE_COLOR_YELLOW
/obj/structure/machinery/atmospherics/pipe/manifold/hidden/aux
name = "Auxiliary pipe"
desc = "A manifold composed of auxiliary pipes."
icon_state = "map-aux"
connect_types = CONNECT_TYPE_AUX
icon_connect_type = "-aux"
color = PIPE_COLOR_CYAN
/obj/structure/machinery/atmospherics/pipe/manifold/hidden/yellow
color = PIPE_COLOR_YELLOW
/obj/structure/machinery/atmospherics/pipe/manifold/hidden/cyan
color = PIPE_COLOR_CYAN
/obj/structure/machinery/atmospherics/pipe/manifold/hidden/green
color = PIPE_COLOR_GREEN
/obj/structure/machinery/atmospherics/pipe/manifold/hidden/black
color = PIPE_COLOR_BLACK
/obj/structure/machinery/atmospherics/pipe/manifold/hidden/red
color = PIPE_COLOR_RED
/obj/structure/machinery/atmospherics/pipe/manifold/hidden/blue
color = PIPE_COLOR_BLUE
/obj/structure/machinery/atmospherics/pipe/manifold/hidden/purple
color = PIPE_COLOR_PURPLE
/obj/structure/machinery/atmospherics/pipe/manifold4w
name = "4-way pipe manifold"
desc = "A manifold composed of regular pipes."
icon = 'icons/atmos/manifold.dmi'
icon_state = ""
volume = ATMOS_DEFAULT_VOLUME_PIPE * 2
dir = SOUTH
initialize_directions = NORTH|SOUTH|EAST|WEST
var/obj/structure/machinery/atmospherics/node3
var/obj/structure/machinery/atmospherics/node4
level = 1
/obj/structure/machinery/atmospherics/pipe/manifold4w/Initialize(mapload)
if(mapload)
var/turf/T = loc
var/image/I = image(icon, T, icon_state, dir, pixel_x, pixel_y)
I.plane = ABOVE_LIGHTING_PLANE
I.color = color
I.alpha = 125
LAZYADD(T.blueprints, I)
. = ..()
alpha = 255
icon = null
/obj/structure/machinery/atmospherics/pipe/manifold4w/pipeline_expansion()
return list(node1, node2, node3, node4)
/obj/structure/machinery/atmospherics/pipe/manifold4w/process()
if(!parent)
..()
else
. = PROCESS_KILL
/obj/structure/machinery/atmospherics/pipe/manifold4w/Destroy()
if(node1)
node1.disconnect(src)
node1 = null
if(node2)
node2.disconnect(src)
node2 = null
if(node3)
node3.disconnect(src)
node3 = null
if(node4)
node4.disconnect(src)
node4 = null
return ..()
/obj/structure/machinery/atmospherics/pipe/manifold4w/disconnect(obj/structure/machinery/atmospherics/reference)
if(reference == node1)
if(istype(node1, /obj/structure/machinery/atmospherics/pipe))
QDEL_NULL(parent)
node1 = null
if(reference == node2)
if(istype(node2, /obj/structure/machinery/atmospherics/pipe))
QDEL_NULL(parent)
node2 = null
if(reference == node3)
if(istype(node3, /obj/structure/machinery/atmospherics/pipe))
QDEL_NULL(parent)
node3 = null
if(reference == node4)
if(istype(node4, /obj/structure/machinery/atmospherics/pipe))
QDEL_NULL(parent)
node4 = null
update_icon()
..()
/obj/structure/machinery/atmospherics/pipe/manifold4w/change_color(var/new_color)
..()
//for updating connected atmos device pipes (i.e. vents, manifolds, etc)
if(node1)
node1.update_underlays()
if(node2)
node2.update_underlays()
if(node3)
node3.update_underlays()
if(node4)
node4.update_underlays()
/obj/structure/machinery/atmospherics/pipe/manifold4w/update_icon(var/safety = 0)
if(!check_icon_cache())
return
if(!atmos_initialised)
return
alpha = 255
if(!node1 && !node2 && !node3 && !node4)
var/turf/T = get_turf(src)
new /obj/item/pipe(loc, make_from=src)
for (var/obj/structure/machinery/meter/meter in T)
if (meter.target == src)
new /obj/item/pipe_meter(T)
qdel(meter)
qdel(src)
else
ClearOverlays()
AddOverlays(icon_manager.get_atmos_icon("manifold", , pipe_color, "4way" + icon_connect_type))
AddOverlays(icon_manager.get_atmos_icon("manifold", , , "clamps_4way" + icon_connect_type))
underlays.Cut()
/*
var/list/directions = list(NORTH, SOUTH, EAST, WEST)
directions -= add_underlay(node1)
directions -= add_underlay(node2)
directions -= add_underlay(node3)
directions -= add_underlay(node4)
for(var/D in directions)
add_underlay(,D)
*/
var/turf/T = get_turf(src)
var/list/directions = list(NORTH, SOUTH, EAST, WEST)
var/node1_direction = get_dir(src, node1)
var/node2_direction = get_dir(src, node2)
var/node3_direction = get_dir(src, node3)
var/node4_direction = get_dir(src, node4)
directions -= dir
directions -= add_underlay(T,node1,node1_direction,icon_connect_type)
directions -= add_underlay(T,node2,node2_direction,icon_connect_type)
directions -= add_underlay(T,node3,node3_direction,icon_connect_type)
directions -= add_underlay(T,node4,node4_direction,icon_connect_type)
for(var/D in directions)
add_underlay(T,,D,icon_connect_type)
/obj/structure/machinery/atmospherics/pipe/manifold4w/update_underlays()
..()
queue_icon_update()
/obj/structure/machinery/atmospherics/pipe/manifold4w/hide(var/i)
if(istype(loc, /turf/simulated))
set_invisibility(i ? 101 : 0)
queue_icon_update()
/obj/structure/machinery/atmospherics/pipe/manifold4w/atmos_init()
for(var/obj/structure/machinery/atmospherics/target in get_step(src,1))
if(target.initialize_directions & 2)
if (check_connect_types(target,src))
node1 = target
break
for(var/obj/structure/machinery/atmospherics/target in get_step(src,2))
if(target.initialize_directions & 1)
if (check_connect_types(target,src))
node2 = target
break
for(var/obj/structure/machinery/atmospherics/target in get_step(src,4))
if(target.initialize_directions & 8)
if (check_connect_types(target,src))
node3 = target
break
for(var/obj/structure/machinery/atmospherics/target in get_step(src,8))
if(target.initialize_directions & 4)
if (check_connect_types(target,src))
node4 = target
break
if(!node1 && !node2 && !node3 && !node4)
qdel(src)
return
atmos_initialised = TRUE
var/turf/T = get_turf(src)
if(level == 1 && !T.is_plating()) hide(1)
queue_icon_update()
/obj/structure/machinery/atmospherics/pipe/manifold4w/visible
icon_state = "map_4way"
level = 2
/obj/structure/machinery/atmospherics/pipe/manifold4w/visible/scrubbers
name = "4-way scrubbers pipe manifold"
desc = "A manifold composed of scrubbers pipes."
icon_state = "map_4way-scrubbers"
connect_types = CONNECT_TYPE_SCRUBBER
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/structure/machinery/atmospherics/pipe/manifold4w/visible/supply
name = "4-way air supply pipe manifold"
desc = "A manifold composed of supply pipes"
icon_state = "map_4way-supply"
connect_types = CONNECT_TYPE_SUPPLY
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/structure/machinery/atmospherics/pipe/manifold4w/visible/fuel
name = "4-way fuel pipe manifold"
desc = "A manifold composed of fuel pipes."
icon_state = "map_4way-fuel"
connect_types = CONNECT_TYPE_FUEL
icon_connect_type = "-fuel"
color = PIPE_COLOR_YELLOW
/obj/structure/machinery/atmospherics/pipe/manifold4w/visible/aux
name = "4-way auxiliary pipe manifold"
desc = "A manifold composed of auxiliary pipes"
icon_state = "map_4way-aux"
connect_types = CONNECT_TYPE_AUX
icon_connect_type = "-aux"
color = PIPE_COLOR_CYAN
/obj/structure/machinery/atmospherics/pipe/manifold4w/visible/yellow
color = PIPE_COLOR_YELLOW
/obj/structure/machinery/atmospherics/pipe/manifold4w/visible/cyan
color = PIPE_COLOR_CYAN
/obj/structure/machinery/atmospherics/pipe/manifold4w/visible/green
color = PIPE_COLOR_GREEN
/obj/structure/machinery/atmospherics/pipe/manifold4w/visible/black
color = PIPE_COLOR_BLACK
/obj/structure/machinery/atmospherics/pipe/manifold4w/visible/red
color = PIPE_COLOR_RED
/obj/structure/machinery/atmospherics/pipe/manifold4w/visible/blue
color = PIPE_COLOR_BLUE
/obj/structure/machinery/atmospherics/pipe/manifold4w/visible/purple
color = PIPE_COLOR_PURPLE
/obj/structure/machinery/atmospherics/pipe/manifold4w/hidden
icon_state = "map_4way"
level = 1
alpha = 128 //set for the benefit of mapping - this is reset to opaque when the pipe is spawned in game
/obj/structure/machinery/atmospherics/pipe/manifold4w/hidden/scrubbers
name = "4-way scrubbers pipe manifold"
desc = "A manifold composed of scrubbers pipes."
icon_state = "map_4way-scrubbers"
connect_types = CONNECT_TYPE_SCRUBBER
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/structure/machinery/atmospherics/pipe/manifold4w/hidden/supply
name = "4-way air supply pipe manifold"
desc = "A manifold composed of supply pipes."
icon_state = "map_4way-supply"
connect_types = CONNECT_TYPE_SUPPLY
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/structure/machinery/atmospherics/pipe/manifold4w/hidden/fuel
name = "4-way fuel pipe manifold"
desc = "A manifold composed of fuel pipes."
icon_state = "map_4way-fuel"
connect_types = CONNECT_TYPE_FUEL
icon_connect_type = "-fuel"
color = PIPE_COLOR_YELLOW
/obj/structure/machinery/atmospherics/pipe/manifold4w/hidden/aux
name = "4-way auxiliary pipe manifold"
desc = "A manifold composed of auxiliary pipes."
icon_state = "map_4way-aux"
connect_types = CONNECT_TYPE_AUX
icon_connect_type = "-aux"
color = PIPE_COLOR_CYAN
/obj/structure/machinery/atmospherics/pipe/manifold4w/hidden/yellow
color = PIPE_COLOR_YELLOW
/obj/structure/machinery/atmospherics/pipe/manifold4w/hidden/cyan
color = PIPE_COLOR_CYAN
/obj/structure/machinery/atmospherics/pipe/manifold4w/hidden/green
color = PIPE_COLOR_GREEN
/obj/structure/machinery/atmospherics/pipe/manifold4w/hidden/black
color = PIPE_COLOR_BLACK
/obj/structure/machinery/atmospherics/pipe/manifold4w/hidden/red
color = PIPE_COLOR_RED
/obj/structure/machinery/atmospherics/pipe/manifold4w/hidden/blue
color = PIPE_COLOR_BLUE
/obj/structure/machinery/atmospherics/pipe/manifold4w/hidden/purple
color = PIPE_COLOR_PURPLE
/obj/structure/machinery/atmospherics/pipe/cap
name = "pipe endcap"
desc = "An endcap for pipes"
icon = 'icons/atmos/pipes.dmi'
icon_state = ""
level = 2
volume = 35
dir = SOUTH
initialize_directions = SOUTH
var/obj/structure/machinery/atmospherics/node
/obj/structure/machinery/atmospherics/pipe/cap/mechanics_hints(mob/user, distance, is_adjacent)
. += ..()
. += "This is a cosmetic attachment, as pipes do not spill their contents into the air."
/obj/structure/machinery/atmospherics/pipe/cap/Initialize()
initialize_directions = dir
. = ..()
/obj/structure/machinery/atmospherics/pipe/cap/hide(var/i)
if(istype(loc, /turf/simulated))
set_invisibility(i ? 101 : 0)
queue_icon_update()
/obj/structure/machinery/atmospherics/pipe/cap/pipeline_expansion()
return list(node)
/obj/structure/machinery/atmospherics/pipe/cap/process()
if(!parent)
..()
else
. = PROCESS_KILL
/obj/structure/machinery/atmospherics/pipe/cap/Destroy()
if(node)
node.disconnect(src)
node = null
return ..()
/obj/structure/machinery/atmospherics/pipe/cap/disconnect(obj/structure/machinery/atmospherics/reference)
if(reference == node)
if(istype(node, /obj/structure/machinery/atmospherics/pipe))
QDEL_NULL(parent)
node = null
update_icon()
..()
/obj/structure/machinery/atmospherics/pipe/cap/change_color(var/new_color)
..()
//for updating connected atmos device pipes (i.e. vents, manifolds, etc)
if(node)
node.update_underlays()
/obj/structure/machinery/atmospherics/pipe/cap/update_icon(var/safety = 0)
if(!check_icon_cache())
return
if(!atmos_initialised)
return
alpha = 255
ClearOverlays()
AddOverlays(icon_manager.get_atmos_icon("pipe", , pipe_color, "cap"))
/obj/structure/machinery/atmospherics/pipe/cap/atmos_init()
for(var/obj/structure/machinery/atmospherics/target in get_step(src, dir))
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node = target
break
atmos_initialised = TRUE
var/turf/T = src.loc // hide if turf is not intact
if(level == 1 && !T.is_plating()) hide(1)
queue_icon_update()
/obj/structure/machinery/atmospherics/pipe/cap/visible
level = 2
icon_state = "cap"
/obj/structure/machinery/atmospherics/pipe/cap/visible/scrubbers
name = "scrubbers pipe endcap"
desc = "An endcap for scrubbers pipes"
connect_types = CONNECT_TYPE_SCRUBBER
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/structure/machinery/atmospherics/pipe/cap/visible/supply
name = "supply pipe endcap"
desc = "An endcap for supply pipes"
connect_types = CONNECT_TYPE_SUPPLY
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/structure/machinery/atmospherics/pipe/cap/visible/fuel
name = "fuel pipe endcap"
desc = "An endcap for fuel pipes"
connect_types = CONNECT_TYPE_FUEL
icon_connect_type = "-fuel"
color = PIPE_COLOR_YELLOW
/obj/structure/machinery/atmospherics/pipe/cap/visible/aux
name = "auxiliary pipe endcap"
desc = "An endcap for auxiliary pipes"
connect_types = CONNECT_TYPE_AUX
icon_connect_type = "-aux"
color = PIPE_COLOR_CYAN
/obj/structure/machinery/atmospherics/pipe/cap/hidden
level = 1
icon_state = "cap"
alpha = 128
/obj/structure/machinery/atmospherics/pipe/cap/hidden/scrubbers
name = "scrubbers pipe endcap"
desc = "An endcap for scrubbers pipes"
connect_types = CONNECT_TYPE_SCRUBBER
icon_connect_type = "-scrubbers"
color = PIPE_COLOR_RED
/obj/structure/machinery/atmospherics/pipe/cap/hidden/supply
name = "supply pipe endcap"
desc = "An endcap for supply pipes"
connect_types = CONNECT_TYPE_SUPPLY
icon_connect_type = "-supply"
color = PIPE_COLOR_BLUE
/obj/structure/machinery/atmospherics/pipe/cap/hidden/fuel
name = "fuel pipe endcap"
desc = "An endcap for fuel pipes"
connect_types = CONNECT_TYPE_FUEL
icon_connect_type = "-fuel"
color = PIPE_COLOR_YELLOW
/obj/structure/machinery/atmospherics/pipe/cap/hidden/aux
name = "auxiliary pipe endcap"
desc = "An endcap for auxiliary pipes"
connect_types = CONNECT_TYPE_AUX
icon_connect_type = "-aux"
color = PIPE_COLOR_CYAN
/obj/structure/machinery/atmospherics/pipe/tank
icon = 'icons/atmos/tank.dmi'
icon_state = "air_map"
name = "Pressure Tank"
desc = "A large vessel containing pressurized gas."
layer = STRUCTURE_LAYER
connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SUPPLY|CONNECT_TYPE_SCRUBBER|CONNECT_TYPE_FUEL|CONNECT_TYPE_AUX
volume = 10000 //in liters, 1 meters by 1 meters by 2 meters ~tweaked it a little to simulate a pressure tank without needing to recode them yet
var/start_pressure = PRESSURE_ONE_THOUSAND * 2.5
level = 1
dir = SOUTH
initialize_directions = SOUTH
density = 1
/obj/structure/machinery/atmospherics/pipe/tank/Initialize()
icon_state = "air"
initialize_directions = dir
. = ..()
/obj/structure/machinery/atmospherics/pipe/tank/process()
if(!parent)
..()
else
. = PROCESS_KILL
/obj/structure/machinery/atmospherics/pipe/tank/Destroy()
if(node1)
node1.disconnect(src)
node1 = null
return ..()
/obj/structure/machinery/atmospherics/pipe/tank/pipeline_expansion()
return list(node1)
/obj/structure/machinery/atmospherics/pipe/tank/update_underlays()
if(..())
underlays.Cut()
var/turf/T = get_turf(src)
if(!istype(T))
return
add_underlay(T, node1, dir)
/obj/structure/machinery/atmospherics/pipe/tank/hide()
update_underlays()
/obj/structure/machinery/atmospherics/pipe/tank/atmos_init()
var/connect_direction = dir
for(var/obj/structure/machinery/atmospherics/target in get_step(src,connect_direction))
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node1 = target
break
atmos_initialised = TRUE
update_underlays()
/obj/structure/machinery/atmospherics/pipe/tank/disconnect(obj/structure/machinery/atmospherics/reference)
if(reference == node1)
if(istype(node1, /obj/structure/machinery/atmospherics/pipe))
QDEL_NULL(parent)
node1 = null
update_underlays()
return null
/obj/structure/machinery/atmospherics/pipe/tank/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/paint_sprayer))
return FALSE
if(istype(attacking_item, /obj/item/analyzer) && in_range(user, src))
var/obj/item/analyzer/A = attacking_item
A.analyze_gases(src, user)
return TRUE
/obj/structure/machinery/atmospherics/pipe/tank/air
name = "Pressure Tank (Air)"
icon_state = "air_map"
/obj/structure/machinery/atmospherics/pipe/tank/air/Initialize()
air_temporary = new
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.adjust_multi(GAS_OXYGEN, (start_pressure*O2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature), \
GAS_NITROGEN,(start_pressure*N2STANDARD)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
. = ..()
icon_state = "air"
/obj/structure/machinery/atmospherics/pipe/tank/air/scc_shuttle
icon = 'icons/atmos/tank_scc.dmi'
/obj/structure/machinery/atmospherics/pipe/tank/air/scc_shuttle/airlock
start_pressure = 607.95
/obj/structure/machinery/atmospherics/pipe/tank/oxygen
name = "Pressure Tank (Oxygen)"
icon_state = "o2_map"
/obj/structure/machinery/atmospherics/pipe/tank/oxygen/Initialize()
air_temporary = new
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.adjust_gas(GAS_OXYGEN, (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
. = ..()
icon_state = "o2"
/obj/structure/machinery/atmospherics/pipe/tank/nitrogen
name = "Pressure Tank (Nitrogen)"
icon_state = "n2_map"
/obj/structure/machinery/atmospherics/pipe/tank/nitrogen/Initialize()
air_temporary = new
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.adjust_gas(GAS_NITROGEN, (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
. = ..()
icon_state = "n2"
/obj/structure/machinery/atmospherics/pipe/tank/carbon_dioxide
name = "Pressure Tank (Carbon Dioxide)"
icon_state = "co2_map"
/obj/structure/machinery/atmospherics/pipe/tank/carbon_dioxide/Initialize()
air_temporary = new
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.adjust_gas(GAS_CO2, (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
. = ..()
icon_state = "co2"
/obj/structure/machinery/atmospherics/pipe/tank/carbon_dioxide/scc_shuttle
icon = 'icons/atmos/tank_scc.dmi'
/obj/structure/machinery/atmospherics/pipe/tank/phoron
name = "Pressure Tank (Phoron)"
icon_state = "phoron_map"
/obj/structure/machinery/atmospherics/pipe/tank/phoron/Initialize()
air_temporary = new
air_temporary.volume = volume
air_temporary.temperature = T20C
air_temporary.adjust_gas(GAS_PHORON, (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
. = ..()
icon_state = GAS_PHORON
/obj/structure/machinery/atmospherics/pipe/tank/hydrogen
name = "Pressure Tank (Hydrogen)"
icon_state = "h2_map"
/obj/structure/machinery/atmospherics/pipe/tank/hydrogen/Initialize()
air_temporary = new
air_temporary.volume = ATMOS_DEFAULT_VOLUME_FILTER
air_temporary.temperature = T0C
air_temporary.adjust_gas(GAS_HYDROGEN, (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
. = ..()
icon_state = "h2"
/obj/structure/machinery/atmospherics/pipe/tank/nitrous_oxide
name = "Pressure Tank (Nitrous Oxide)"
icon_state = "n2o_map"
/obj/structure/machinery/atmospherics/pipe/tank/nitrous_oxide/Initialize()
air_temporary = new
air_temporary.volume = volume
air_temporary.temperature = T0C
air_temporary.adjust_gas(GAS_N2O, (start_pressure)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature))
. = ..()
icon_state = "n2o"
/obj/structure/machinery/atmospherics/pipe/simple/visible/universal
name = "universal pipe adapter"
desc = "An adapter for regular, supply, scrubbers, fuel, and auxiliary pipes."
connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SUPPLY|CONNECT_TYPE_SCRUBBER|CONNECT_TYPE_FUEL|CONNECT_TYPE_AUX
icon_state = "map_universal"
/obj/structure/machinery/atmospherics/pipe/simple/visible/universal/mechanics_hints(mob/user, distance, is_adjacent)
. = list()
. += "This allows you to connect 'normal' pipes, blue 'supply' pipes, red 'scrubber' pipes, yellow 'fuel' pipes, and cyan 'aux' pipes together."
. += ..()
/obj/structure/machinery/atmospherics/pipe/simple/visible/universal/update_icon(var/safety = 0)
if(!check_icon_cache())
return
alpha = 255
ClearOverlays()
AddOverlays(icon_manager.get_atmos_icon("pipe", , pipe_color, "universal"))
underlays.Cut()
if (node1)
universal_underlays(node1)
if(node2)
universal_underlays(node2)
else
var/node1_dir = get_dir(node1,src)
universal_underlays(,node1_dir)
else if (node2)
universal_underlays(node2)
else
universal_underlays(,dir)
universal_underlays(,turn(dir, -180))
/obj/structure/machinery/atmospherics/pipe/simple/visible/universal/update_underlays()
..()
queue_icon_update()
/obj/structure/machinery/atmospherics/pipe/simple/hidden/universal
name = "universal pipe adapter"
desc = "An adapter for regular, supply, scrubbers, fuel, and auxiliary pipes."
connect_types = CONNECT_TYPE_REGULAR|CONNECT_TYPE_SUPPLY|CONNECT_TYPE_SCRUBBER|CONNECT_TYPE_FUEL|CONNECT_TYPE_AUX
icon_state = "map_universal"
/obj/structure/machinery/atmospherics/pipe/simple/hidden/universal/mechanics_hints(mob/user, distance, is_adjacent)
. = list()
. += "This allows you to connect 'normal' pipes, blue 'supply' pipes, red 'scrubber' pipes, yellow 'fuel' pipes, and cyan 'aux' pipes together."
. += ..()
/obj/structure/machinery/atmospherics/pipe/simple/hidden/universal/update_icon(var/safety = 0)
if(!check_icon_cache())
return
alpha = 255
ClearOverlays()
AddOverlays(icon_manager.get_atmos_icon("pipe", , pipe_color, "universal"))
underlays.Cut()
if (node1)
universal_underlays(node1)
if(node2)
universal_underlays(node2)
else
var/node2_dir = turn(get_dir(src,node1),-180)
universal_underlays(,node2_dir)
else if (node2)
universal_underlays(node2)
var/node1_dir = turn(get_dir(src,node2),-180)
universal_underlays(,node1_dir)
else
universal_underlays(,dir)
universal_underlays(,turn(dir, -180))
/obj/structure/machinery/atmospherics/pipe/simple/hidden/universal/update_underlays()
..()
queue_icon_update()
/obj/structure/machinery/atmospherics/proc/universal_underlays(var/obj/structure/machinery/atmospherics/node, var/direction)
var/turf/T = loc
if(node)
var/node_dir = get_dir(src,node)
if(node.icon_connect_type == "-supply")
add_underlay_adapter(T, , node_dir, "")
add_underlay_adapter(T, node, node_dir, "-supply")
add_underlay_adapter(T, , node_dir, "-scrubbers")
add_underlay_adapter(T, , node_dir, "-fuel")
add_underlay_adapter(T, , node_dir, "-aux")
else if (node.icon_connect_type == "-scrubbers")
add_underlay_adapter(T, , node_dir, "")
add_underlay_adapter(T, , node_dir, "-supply")
add_underlay_adapter(T, node, node_dir, "-scrubbers")
add_underlay_adapter(T, , node_dir, "-fuel")
add_underlay_adapter(T, , node_dir, "-aux")
else if (node.icon_connect_type == "-fuel")
add_underlay_adapter(T, , node_dir, "")
add_underlay_adapter(T, , node_dir, "-supply")
add_underlay_adapter(T, , node_dir, "-scrubbers")
add_underlay_adapter(T, node, node_dir, "-fuel")
add_underlay_adapter(T, , node_dir, "-aux")
else if (node.icon_connect_type == "-aux")
add_underlay_adapter(T, , node_dir, "")
add_underlay_adapter(T, , node_dir, "-supply")
add_underlay_adapter(T, , node_dir, "-scrubbers")
add_underlay_adapter(T, , node_dir, "-fuel")
add_underlay_adapter(T, node, node_dir, "-aux")
else
add_underlay_adapter(T, node, node_dir, "")
add_underlay_adapter(T, , node_dir, "-supply")
add_underlay_adapter(T, , node_dir, "-scrubbers")
add_underlay_adapter(T, , node_dir, "-fuel")
add_underlay_adapter(T, , node_dir, "-aux")
else
add_underlay_adapter(T, , direction, "-supply")
add_underlay_adapter(T, , direction, "-scrubbers")
add_underlay_adapter(T, , direction, "")
add_underlay_adapter(T, , direction, "-fuel")
add_underlay_adapter(T, , direction, "-aux")
/obj/structure/machinery/atmospherics/proc/add_underlay_adapter(var/turf/T, var/obj/structure/machinery/atmospherics/node, var/direction, var/icon_connect_type) //modified from add_underlay, does not make exposed underlays
if(node)
if(!T.is_plating() && node.level == 1 && istype(node, /obj/structure/machinery/atmospherics/pipe))
underlays += icon_manager.get_atmos_icon("underlay", direction, color_cache_name(node), "down" + icon_connect_type)
else
underlays += icon_manager.get_atmos_icon("underlay", direction, color_cache_name(node), "intact" + icon_connect_type)
else
underlays += icon_manager.get_atmos_icon("underlay", direction, color_cache_name(node), "retracted" + icon_connect_type)