mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 01:57:01 +00:00
Several of the greps were missing the `-P` switch which caused them to fail to match things. The EOL grep also wasn't working right so I replaced it with the one I added to TGMC.
139 lines
4.7 KiB
Plaintext
139 lines
4.7 KiB
Plaintext
/obj/machinery/atmospherics/pipe/layer_manifold
|
|
name = "layer adaptor"
|
|
icon = 'icons/obj/atmospherics/pipes/manifold.dmi'
|
|
icon_state = "manifoldlayer"
|
|
desc = "A special pipe to bridge pipe layers with."
|
|
dir = SOUTH
|
|
initialize_directions = NORTH|SOUTH
|
|
pipe_flags = PIPING_ALL_LAYER | PIPING_DEFAULT_LAYER_ONLY | PIPING_CARDINAL_AUTONORMALIZE
|
|
piping_layer = PIPING_LAYER_DEFAULT
|
|
device_type = 0
|
|
volume = 260
|
|
construction_type = /obj/item/pipe/binary
|
|
pipe_state = "manifoldlayer"
|
|
|
|
var/list/front_nodes
|
|
var/list/back_nodes
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/Initialize()
|
|
front_nodes = list()
|
|
back_nodes = list()
|
|
icon_state = "manifoldlayer_center"
|
|
return ..()
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/Destroy()
|
|
nullifyAllNodes()
|
|
return ..()
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/proc/nullifyAllNodes()
|
|
var/list/obj/machinery/atmospherics/needs_nullifying = get_all_connected_nodes()
|
|
front_nodes = null
|
|
back_nodes = null
|
|
nodes = list()
|
|
for(var/obj/machinery/atmospherics/A in needs_nullifying)
|
|
A.disconnect(src)
|
|
A.build_network()
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/proc/get_all_connected_nodes()
|
|
return front_nodes + back_nodes + nodes
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/update_icon() //HEAVILY WIP FOR UPDATE ICONS!!
|
|
cut_overlays()
|
|
layer = initial(layer) + (PIPING_LAYER_MAX * PIPING_LAYER_LCHANGE) //This is above everything else.
|
|
|
|
for(var/node in front_nodes)
|
|
add_attached_images(node)
|
|
for(var/node in back_nodes)
|
|
add_attached_images(node)
|
|
|
|
update_alpha()
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/proc/add_attached_images(obj/machinery/atmospherics/A)
|
|
if(!A)
|
|
return
|
|
if(istype(A, /obj/machinery/atmospherics/pipe/layer_manifold))
|
|
for(var/i in PIPING_LAYER_MIN to PIPING_LAYER_MAX)
|
|
add_attached_image(get_dir(src, A), i)
|
|
return
|
|
add_attached_image(get_dir(src, A), A.piping_layer, A.pipe_color)
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/proc/add_attached_image(p_dir, p_layer, p_color = null)
|
|
var/image/I
|
|
|
|
if(p_color)
|
|
I = getpipeimage(icon, "pipe", p_dir, p_color, piping_layer = p_layer)
|
|
else
|
|
I = getpipeimage(icon, "pipe", p_dir, piping_layer = p_layer)
|
|
|
|
I.layer = layer - 0.01
|
|
add_overlay(I)
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/SetInitDirections()
|
|
switch(dir)
|
|
if(NORTH || SOUTH)
|
|
initialize_directions = NORTH|SOUTH
|
|
if(EAST || WEST)
|
|
initialize_directions = EAST|WEST
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/isConnectable(obj/machinery/atmospherics/target, given_layer)
|
|
if(!given_layer)
|
|
return TRUE
|
|
. = ..()
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/proc/findAllConnections()
|
|
front_nodes = list()
|
|
back_nodes = list()
|
|
var/list/new_nodes = list()
|
|
for(var/iter in PIPING_LAYER_MIN to PIPING_LAYER_MAX)
|
|
var/obj/machinery/atmospherics/foundfront = findConnecting(dir, iter)
|
|
var/obj/machinery/atmospherics/foundback = findConnecting(turn(dir, 180), iter)
|
|
front_nodes += foundfront
|
|
back_nodes += foundback
|
|
if(foundfront && !QDELETED(foundfront))
|
|
new_nodes += foundfront
|
|
if(foundback && !QDELETED(foundback))
|
|
new_nodes += foundback
|
|
update_icon()
|
|
return new_nodes
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/atmosinit()
|
|
normalize_cardinal_directions()
|
|
findAllConnections()
|
|
var/turf/T = loc // hide if turf is not intact
|
|
hide(T.intact)
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/setPipingLayer()
|
|
piping_layer = PIPING_LAYER_DEFAULT
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/pipeline_expansion()
|
|
return get_all_connected_nodes()
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/disconnect(obj/machinery/atmospherics/reference)
|
|
if(istype(reference, /obj/machinery/atmospherics/pipe))
|
|
var/obj/machinery/atmospherics/pipe/P = reference
|
|
P.destroy_network()
|
|
while(reference in get_all_connected_nodes())
|
|
if(reference in nodes)
|
|
var/i = nodes.Find(reference)
|
|
nodes[i] = null
|
|
if(reference in front_nodes)
|
|
var/i = front_nodes.Find(reference)
|
|
front_nodes[i] = null
|
|
if(reference in back_nodes)
|
|
var/i = back_nodes.Find(reference)
|
|
back_nodes[i] = null
|
|
update_icon()
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/relaymove(mob/living/user, dir)
|
|
if(initialize_directions & dir)
|
|
return ..()
|
|
if((NORTH|EAST) & dir)
|
|
user.ventcrawl_layer = CLAMP(user.ventcrawl_layer + 1, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
|
if((SOUTH|WEST) & dir)
|
|
user.ventcrawl_layer = CLAMP(user.ventcrawl_layer - 1, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
|
to_chat(user, "You align yourself with the [user.ventcrawl_layer]\th output.")
|
|
|
|
/obj/machinery/atmospherics/pipe/layer_manifold/visible
|
|
level = PIPE_VISIBLE_LEVEL
|
|
layer = GAS_PIPE_VISIBLE_LAYER
|