Files
vgstation13/code/ATMOSPHERICS/pipes.dm
kane-f 84bf965ae8 Multi-z 3: With a vengeance (#30178)
* fix map

* Fixing bad syntax

* Maybe this will work

* Travis wanted me to remove this

* Unticking attempt

* Unticking attempt 2

* Removing all useless broken zshadow stuff

* Maybe now?

* Oh weird

* Adding up/down pipe sprites

* Adding darkness overlay, attempt #1

* Second attempt, now works

* Turf tweaks, now much less visually glitchy, plus walls now make blank floors above them for less weirdness

* Fix, plus keeps this floor in place

* Really bad fix that stops space looking weird

* Now everything should work normally, except lighting overlays

* Updates the map

* Consistency

* Adds new fall damage sound

* Typo

* Jetpack fun

* Better

* Less bad brackets and parantheses pain

* OHhh

* These fly too, brooms next whenever I figure those out

* Finishing pipe icons

* Making it easier to build catwalks and stuff on turfs without clicking the stuff below by mistake

* Bringing back zshadow, but with no icon

* Oh it's this issue again

* Final fix, better attempt at image relay

* Now for it looking nice, vis_contents are bad here too

* Attempt at refactoring this, light overlays are now finally underneath players, at the cost of blocking everything else, but exxion wanted to testmerge it

* Map change

* Changing it back, test server stays on box anyways

* Removing non-working solution

* Removes broken lighting overlays

* Finally fixes up floor generation above walls

* Adding bones of a 3d implementation of spiral block for git push origin multizfungit push origin multiz

* More, almost done

* Finalised

* Cube option

* Logic fix

* Syntax

* Attempting to make item fall on arc

* Compile

* Now this is no longer needed

* BRACE FOR ENABLING MULTI-Z ZAS

* Attempt at fixing glass floor tiles

* Splitting off explosion proc into destroy part, bones of calling it recursively and smaller on above and below layers, implementation of multi-z explosion suggested by DeityLink

* Missing var

* Removing unused var and fixes consistency

* Fixing logic and syntax etc, still needs testing before uncomment

* Uncommenting, some fixes too

* Makes this a seperate function otherwise it won't call at all, MULTI Z EXPLOSIONS NOW CONFIRMED WORKING

* Client proc to test this

* Adds to list

* Typo not drawing red on main layer

* Here too

* Adding debug logs for clarity

* Better

* Even better

* Experimental multi-Z EMP support, cylindrical effect for now

* Better distance falloff

* Sound/visual support on other layers?

* Z cap for EMP sound

* Booms too

* Adds back accidentally deleted file

* Muuuch more sane check

* Attempt at connecting heard speech between multi Z

* Cleaner

* Missing bracket

* Removing zshadow mobs entirely again, no need for them whatsoever

* Multi-z visible messages

* Emotes

* Fix?

* Wew

* K

* Much nicer function

* I forget about this define

* Ohhhh

* Comma fix

* Aaa

* This might fix

* Removing visible message one for now

* Trying this solution

* Typo

* RIP location, hope this won't break anything

* Actually location gets to come back, fix is here

* I give up, the tests are clearly what's borken

* Let's see what this does with those nullspaces test items (yes really)

* Indent fix, plus nice comments

* MULTI-Z SOUND???

* Woops

* Jetpack and etc trails over open space now!

* No macros, this is why we can't have nice things

* Watch how coder stops potion of levitation, broom and fairy wing wielders from falling with ONE NEAT TRICK

* Gotta make leapers not fall somehow

* Bad oversight

* Fully allows going down stairs with weird border objects

* Flying now works properly for humans on open space

* Now, fall instantly on stop

* Oversight

* Oh this function

* New helper functions

* Oversight again

* Replacing lines with abs(), multi z singulo pull attempt

* Quick supermatter fix

* Don't cut overlays

* Move down here

* Typo

* Now actually works, implementation could be better though

* Additional helper function for z distances because BYOND hates comparing z

* Reimplementing for sound

* abs() to keep positive for max comparisons in line distances

* Keeping gas overlays outside of multi-z viewing to stop some glitches

* That didn't work

* Testing removal from float planes for stuff that never needed to be on it

* Fixes gas overlays showing up all wrong in multi Z ZAS

* Gutting this controller, no longer needed period, system works fine without it

* Now glass floors look mostly perfect on open spaces

* Var name change for fun stuff later

* Knew I'd miss one

* Gravity based fall delay?

* Settle with using sleep() for now, what could go wrong?

* Lagged the game horribly, so everything

* Here all along, huh

* Just remove it for now, it kinda works but not ideally at all

* Thank you TK code for giving me a nice and working way to do this

* Comments, oversights

* No wait it was right the first time

* Now for the damage multiplier

* Knockdown too

* Nicer format

* This should still be min, plus now have a debug log and shifted around logic

* Now for mech stuff

* Clamping knockdown

* Definition fix

* Dusting this off, hopeful fix to things not falling

* Probably don't need this, I forget

* Hahaha nope, this did nothing

* Finally, a way to make fall() call in mid air after a delay without horrible lag

* Tunes pipe layering if on same zlevel, getting there

* Now fully tuned

* Adding bones for pipe item support

* Test

* z_up pipe item icon state

* z_up and z_down pipe item icon state

* Adding these to pipe dispensers

* Typo

* RCDs too

* Moved here

* Moved back

* Makes space work nicer

* Oh and here

* Fall updates

* Don't need this

* Oversights everywhere

* Fixes

* More

* More, and new stuff

* Even more

* Dampening these a bit

* So many, so moved to new file

* Forgot this

* Refactor

* Forgot to actually use

* Indentation issues

* Works better like this

* Refactors into nicer proc

* One oversight

* Stair frames, to construct into stairs

* Stack recipe for em

* Cutting useless stuff

* Fixes

* Last fixes

* Stops uncrossing at non existant aboves

* Better logic

* Better logic

* Fix

* Fixes nullspace checking runtime

* Removes redundant check on stairs

* Replaces CanPass with Cross, functionality is same and definition is duplicate of it

* Missed one

* Darkening and falling tweaks

* Better call for gravity

* Oversight

* Stops falling in space, zero-g open space movement fixes etc

* Consistency

* Fixes slipping on open spaces with catwalks (lattices make sense I guess) and stairs not being snapped down to

* Var name fix

* Much nicer system with no recursive function or last_fall variable use

* Adds buildFrom()s so z-pipes can actually be fitted, stops spam of fall() calls on enter with lock for nicer gravity

* Makes z distances pay attention to multi z support

* Maybe this is better

* Left this in

* Adding visible and hidden variants for mapping

* Counts glass floors as open space for the purpose of open space checks

* Bracket fix

* Makes it a macro for easy viewing

* Space looks much better like this honestly

* Makes schematics actually show up on RPD in multi-z

* Making these tied to WORLD_ICON_SIZE

* Changes for someone to test

* Now the fix actually works

* Removes forceMove(), nicer solution

* Giving stairs all their dirs

* Fixing stair position problem and other things

* Stair deconstruction

* Removing redundant enter() check to move()

* Some updates as requested

* .dme and map/file fixes

* .dme and map/file fixes

* Updating can_falls

* Ladder climb fix

* Some port notes updates

* Docs itself

* Removing unused edge_type var

* Removing landmark object, converts it code side

* Removing unsimmed walls doing it, not necessary

* Updated descs

* Fixing observer non-standards in file

* More file cleanup

* Jetpacks allow z-travelling

* Now they really do

* Robots too

* Updating docs

* Code cleanup

* Catch one

* Indent fix

* Not sure what that even is

* Catching these

* Applying some old fixes

* Removing unused file

* Moving nodes back to original places, or an attempt to

* Here too

* Removing unused file

* Moving these back too

* Some fixes for now

* Some more

* Even more, almost done

* Better pipe icons

* More icons

* Disposal pipe construction

* Mixup

* List optimisation, new fixes

Co-authored-by: Damian <damian@autistici.org>
Co-authored-by: kanef <kanef9x@protonmail.com>
2021-08-27 08:14:13 -05:00

1339 lines
38 KiB
Plaintext

/obj/machinery/atmospherics/pipe
var/datum/gas_mixture/air_temporary //used when reconstructing a pipeline that broke
var/datum/pipeline/parent
var/volume = 0
force = 20
plane = ABOVE_TURF_PLANE //Set above turf for mapping preview only, supposed to be ABOVE_PLATING_PLANE, handled in update_planes_and_layers() (called on New())
layer = PIPE_LAYER
use_power = 0
var/alert_pressure = 80*ONE_ATMOSPHERE
var/baseicon=""
/obj/machinery/atmospherics/pipe/node_plane()
return FLOAT_PLANE
/obj/machinery/atmospherics/pipe/update_planes_and_layers()
if(level == LEVEL_BELOW_FLOOR)
plane = ABOVE_PLATING_PLANE
layer = PIPE_LAYER
else
plane = ABOVE_TURF_PLANE
layer = EXPOSED_PIPE_LAYER
layer = PIPING_LAYER(layer, piping_layer)
/obj/machinery/atmospherics/pipe/proc/mass_colouration(var/mass_colour)
if (findtext(mass_colour,"#"))
var/datum/pipeline/pipeline = parent
var/list/update_later = list()
for(var/obj/machinery/atmospherics/pipe in pipeline.members)
if(pipe.can_be_coloured)
pipe.color = mass_colour
for(var/obj/machinery/atmospherics/pipe in pipeline.edges)
pipe.update_icon()
update_later -= pipeline.edges
for(var/obj/machinery/atmospherics/pipe in update_later)
pipe.update_icon(1)
/obj/machinery/atmospherics/pipe/singularity_pull(/obj/machinery/singularity/S, size)
return
/obj/machinery/atmospherics/pipe/proc/pipeline_expansion()
return null
/obj/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: del(src) will by default return null
return 1
/obj/machinery/atmospherics/pipe/update_icon(var/adjacent_procd)
if(color && centre_overlay)
centre_overlay.color = color
overlays.Cut()
overlays += centre_overlay
..()
/obj/machinery/atmospherics/pipe/t_scanner_expose()
if (exposed())
return
invisibility = 0
plane = ABOVE_TURF_PLANE
layer = EXPOSED_PIPE_LAYER
spawn(1 SECONDS)
update_icon()
update_planes_and_layers()
/obj/machinery/atmospherics/pipe/return_air()
if(!parent)
parent = new /datum/pipeline
parent.build_pipeline(src)
return parent.air
/obj/machinery/atmospherics/pipe/build_network()
if(!parent)
parent = new /datum/pipeline
parent.build_pipeline(src)
return parent.return_network()
/obj/machinery/atmospherics/pipe/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
if(!parent)
parent = new /datum/pipeline
parent.build_pipeline(src)
return parent.network_expand(new_network, reference)
/obj/machinery/atmospherics/pipe/return_network(obj/machinery/atmospherics/reference)
if(!parent)
parent = new /datum/pipeline
parent.build_pipeline(src)
return parent.return_network(reference)
/obj/machinery/atmospherics/pipe/Destroy()
if(parent)
qdel(parent)
parent = null
for(var/obj/machinery/meter/M in src.loc)
if(M.target == src)
new /obj/item/pipe_meter(src.loc)
qdel(M)
if(air_temporary && loc)
loc.assume_air(air_temporary)
air_temporary = null
..()
/obj/machinery/atmospherics/pipe/simple
icon = 'icons/obj/pipes.dmi'
icon_state = "intact"
name = "pipe"
desc = "A one meter section of regular pipe."
volume = 70
dir = SOUTH
initialize_directions = SOUTH|NORTH
var/obj/machinery/atmospherics/node1
var/obj/machinery/atmospherics/node2
var/minimum_temperature_difference = 300
var/thermal_conductivity = 0 //WALL_HEAT_TRANSFER_COEFFICIENT No
color = "#B4B4B4"
var/maximum_pressure = 100*ONE_ATMOSPHERE // 10132.5 kPa
var/fatigue_pressure = 80 *ONE_ATMOSPHERE // 8106 kPa
alert_pressure = 80 *ONE_ATMOSPHERE
can_be_coloured = 1
// Type of burstpipe to use on burst()
var/burst_type = /obj/machinery/atmospherics/unary/vent/burstpipe
level = LEVEL_BELOW_FLOOR
/obj/machinery/atmospherics/pipe/simple/New()
..()
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/machinery/atmospherics/pipe/simple/buildFrom(var/mob/usr,var/obj/item/pipe/pipe)
dir = pipe.dir
initialize_directions = pipe.get_pipe_dir()
var/turf/T = loc
level = T.intact ? LEVEL_ABOVE_FLOOR : LEVEL_BELOW_FLOOR
update_planes_and_layers()
initialize(1)
if(!node1&&!node2)
to_chat(usr, "<span class='warning'>There's nothing to connect this pipe section to! A pipe segment must be connected to at least one other object!</span>")
return 0
update_icon()
build_network()
if (node1)
node1.initialize()
node1.build_network()
if (node2)
node2.initialize()
node2.build_network()
return 1
/obj/machinery/atmospherics/pipe/simple/get_node(node_id)
switch(node_id)
if(1)
return node1
if(2)
return node2
else
CRASH("Invalid node_id!")
/obj/machinery/atmospherics/pipe/simple/set_node(node_id, value)
switch(node_id)
if(1)
node1 = value
if(2)
node2 = value
else
CRASH("Invalid node_id!")
/obj/machinery/atmospherics/pipe/simple/hide(var/i)
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
. = ..()
atmos_machines.Remove(src)
/obj/machinery/atmospherics/pipe/simple/check_pressure(pressure)
if(!loc)
return
// Note: This checks the difference between atmospheric pressure and pressure in the pipe.
// So, a pipe rated at 8,000 kPa in a 104kPa environment will explode at 8,104kPa.
var/datum/gas_mixture/environment = loc.return_air()
var/pressure_difference = pressure - environment.return_pressure()
// Burst check first.
if(pressure_difference > maximum_pressure && prob(1))
burst()
// Groan if that check failed and we're above fatigue pressure
else if(pressure_difference > fatigue_pressure && prob(1)) // 5 was too often
groan()
// Otherwise, continue on.
else
return 1
/obj/machinery/atmospherics/pipe/simple/examine(mob/user)
..()
to_chat(user, "<span class='info'>This [src.name] is rated up to [format_num(alert_pressure)] kPa.</span>")
/obj/machinery/atmospherics/pipe/simple/proc/groan()
src.visible_message("<span class='warning'>\The [src] groans from the pressure!</span>");
// Need SFX for groaning metal.
//playsound(src, 'sound/effects/groan.ogg', 25, 1)
/obj/machinery/atmospherics/pipe/simple/proc/burst()
src.visible_message("<span class='danger'>\The [src] bursts!</span>");
var/turf/T=get_turf(src)
message_admins("Pipe burst in area [formatJumpTo(T)]")
var/area/A=get_area(src)
log_game("Pipe burst in area [A.name] ")
// Disconnect first.
for(var/obj/machinery/atmospherics/node in pipeline_expansion())
if(node)
node.disconnect(src)
node = null
// Move away from explosion
loc=null
if(prob(50))
explosion(T, -1, 1, 2, adminlog=0)
else
explosion(T, 0, 1, 2, adminlog=0)
// Now connect burstpipes.
var/node_id=0
for(var/direction in cardinal)
if(initialize_directions & direction)
node_id++
var/obj/machinery/atmospherics/found
var/node_type=getNodeType(node_id)
switch(node_type)
if(PIPE_TYPE_STANDARD)
found = findConnecting(direction)
if(PIPE_TYPE_HE)
found = findConnectingHE(direction)
else
error("UNKNOWN RESPONSE FROM [src.type]/getNodeType([node_id]): [node_type]")
return
if(!found)
continue
var/obj/machinery/atmospherics/unary/vent/burstpipe/BP = new burst_type(T, setdir=direction)
BP.color=src.color
BP.invisibility=src.invisibility
BP.level=src.level
BP.do_connect()
qdel(src) // NOT qdel.
/obj/machinery/atmospherics/pipe/simple/proc/normalize_dir()
if(dir==3)
dir = 1
else if(dir==12)
dir = 4
/obj/machinery/atmospherics/pipe/simple/Destroy()
if(node1)
node1.disconnect(src)
if(node2)
node2.disconnect(src)
node1 = null
node2 = null
..()
/obj/machinery/atmospherics/pipe/ex_act(severity)
if(isturf(loc))
var/turf/T = loc
if(T.protect_infrastructure)
return
..()
/obj/machinery/atmospherics/pipe/simple/pipeline_expansion()
return list(node1, node2)
/obj/machinery/atmospherics/pipe/simple/update_icon(var/adjacent_procd)
if (exposed() || (node1 && node1.exposed()) || (node2 && node2.exposed()))
invisibility = 0
else
invisibility = 101
var/node_list = list(node1,node2)
if(!node1||!node2)
icon_state = "exposed"
..(adjacent_procd,node_list)
else
underlays.Cut()
icon_state = "intact"
alpha = invisibility ? 128 : 255
if(!adjacent_procd)
for(var/obj/machinery/atmospherics/node in node_list)
if(node.update_icon_ready && !(istype(node,/obj/machinery/atmospherics/pipe/simple)))
node.update_icon(1)
if(!node1&&!node2)
qdel(src) //TODO: silent deleting looks weird
/obj/machinery/atmospherics/pipe/simple/initialize(var/suppress_icon_check=0)
normalize_dir()
findAllConnections(initialize_directions)
var/turf/T = src.loc // hide if turf is not intact
hide(T.intact)
if(!suppress_icon_check)
update_icon()
add_self_to_holomap()
/obj/machinery/atmospherics/pipe/simple/disconnect(obj/machinery/atmospherics/reference)
if(reference == node1)
if(istype(node1, /obj/machinery/atmospherics/pipe) && !isnull(parent))
qdel(parent)
node1 = null
if(reference == node2)
if(istype(node2, /obj/machinery/atmospherics/pipe) && !isnull(parent))
qdel(parent)
node2 = null
update_icon()
return null
/obj/machinery/atmospherics/pipe/simple/scrubbers
name = "Scrubbers pipe"
color=PIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/simple/supply
name = "Air supply pipe"
color=PIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/simple/supplymain
name = "Main air supply pipe"
color=PIPE_COLOR_PURPLE
/obj/machinery/atmospherics/pipe/simple/general
name = "Pipe"
color=PIPE_COLOR_GREY
/obj/machinery/atmospherics/pipe/simple/yellow
name = "Pipe"
color=PIPE_COLOR_ORANGE
/obj/machinery/atmospherics/pipe/simple/cyan
name = "Pipe"
color=PIPE_COLOR_CYAN
/obj/machinery/atmospherics/pipe/simple/filtering
name = "Pipe"
color=PIPE_COLOR_GREEN
/obj/machinery/atmospherics/pipe/simple/scrubbers/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/simple/supply/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/simple/supply/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/simple/supplymain/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/simple/supplymain/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/simple/general/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/simple/general/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/simple/yellow/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/simple/yellow/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/simple/cyan/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/simple/cyan/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/simple/filtering/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/simple/filtering/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/simple/insulated
name = "\improper Insulated pipe"
minimum_temperature_difference = 10000
thermal_conductivity = 0
maximum_pressure = 1000000 // 1M kPa
fatigue_pressure = 900000 // 900k kPa
alert_pressure = 900000
color = IPIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/simple/insulated/visible
icon_state = "intact"
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/simple/insulated/visible/blue
color=IPIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/simple/insulated/hidden
icon_state = "intact"
alpha=128
level = LEVEL_BELOW_FLOOR
/obj/machinery/atmospherics/pipe/simple/insulated/hidden/blue
color= IPIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/manifold
icon = 'icons/obj/atmospherics/pipe_manifold.dmi'
icon_state = "map"
baseicon = "manifold"
name = "pipe manifold"
desc = "A manifold composed of regular pipes."
volume = 105
color = "#B4B4B4"
dir = SOUTH
initialize_directions = EAST|NORTH|WEST
var/obj/machinery/atmospherics/node1
var/obj/machinery/atmospherics/node2
var/obj/machinery/atmospherics/node3
level = LEVEL_BELOW_FLOOR
layer = PIPE_LAYER
var/global/image/manifold_centre = image('icons/obj/pipes.dmi',"manifold_centre")
/obj/machinery/atmospherics/pipe/manifold/buildFrom(var/mob/usr,var/obj/item/pipe/pipe)
dir = pipe.dir
initialize_directions = pipe.get_pipe_dir()
var/turf/T = loc
level = T.intact ? LEVEL_ABOVE_FLOOR : LEVEL_BELOW_FLOOR
update_planes_and_layers()
initialize(1)
if(!node1&&!node2&&!node3)
to_chat(usr, "<span class='warning'>There's nothing to connect this manifold to! A pipe segment must be connected to at least one other object!</span>")
return 0
update_icon() // Skipped in initialize()!
build_network()
if (node1)
node1.initialize()
node1.build_network()
if (node2)
node2.initialize()
node2.build_network()
if (node3)
node3.initialize()
node3.build_network()
return 1
/obj/machinery/atmospherics/pipe/manifold/New()
icon_state = "manifold"
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
centre_overlay = manifold_centre
centre_overlay.color = color
overlays += centre_overlay
..()
/obj/machinery/atmospherics/pipe/manifold/get_node(node_id)
switch(node_id)
if(1)
return node1
if(2)
return node2
if(3)
return node3
else
CRASH("Invalid node_id!")
/obj/machinery/atmospherics/pipe/manifold/set_node(node_id, value)
switch(node_id)
if(1)
node1 = value
if(2)
node2 = value
if(3)
node3 = value
else
CRASH("Invalid node_id!")
/obj/machinery/atmospherics/pipe/manifold/hide(var/i)
update_icon()
/obj/machinery/atmospherics/pipe/manifold/pipeline_expansion()
return list(node1, node2, node3)
/obj/machinery/atmospherics/pipe/manifold/process()
if(!parent)
. = ..()
atmos_machines.Remove(src)
/*
if(!node1)
parent.mingle_with_turf(loc, 70)
if(!nodealert)
// to_chat(world, "Missing node from [src] at [src.x],[src.y],[src.z]")
nodealert = 1
else if(!node2)
parent.mingle_with_turf(loc, 70)
if(!nodealert)
// to_chat(world, "Missing node from [src] at [src.x],[src.y],[src.z]")
nodealert = 1
else if(!node3)
parent.mingle_with_turf(loc, 70)
if(!nodealert)
// to_chat(world, "Missing node from [src] at [src.x],[src.y],[src.z]")
nodealert = 1
else if (nodealert)
nodealert = 0
*/
/obj/machinery/atmospherics/pipe/manifold/Destroy()
if(node1)
node1.disconnect(src)
if(node2)
node2.disconnect(src)
if(node3)
node3.disconnect(src)
node1 = null
node2 = null
node3 = null
..()
/obj/machinery/atmospherics/pipe/manifold/disconnect(obj/machinery/atmospherics/reference)
if(reference == node1)
if(istype(node1, /obj/machinery/atmospherics/pipe) && !isnull(parent))
qdel(parent)
node1 = null
if(reference == node2)
if(istype(node2, /obj/machinery/atmospherics/pipe) && !isnull(parent))
qdel(parent)
node2 = null
if(reference == node3)
if(istype(node3, /obj/machinery/atmospherics/pipe) && !isnull(parent))
qdel(parent)
node3 = null
update_icon()
..()
/obj/machinery/atmospherics/pipe/manifold/update_icon(var/adjacent_procd)
if (exposed() || (node1 && node1.exposed()) || (node2 && node2.exposed()) || (node3 && node3.exposed()))
invisibility = 0
else
invisibility = 101
var/node_list = list(node1,node2,node3)
..(adjacent_procd,node_list)
if(!node1 && !node2 && !node3)
qdel(src)
/obj/machinery/atmospherics/pipe/manifold/initialize(var/skip_icon_update=0)
var/connect_directions = (NORTH|SOUTH|EAST|WEST)&(~dir)
findAllConnections(connect_directions)
var/turf/T = src.loc // hide if turf is not intact
hide(T.intact)
if(!skip_icon_update)
update_icon()
add_self_to_holomap()
/obj/machinery/atmospherics/pipe/manifold/scrubbers
name = "\improper Scrubbers pipe"
color = PIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/manifold/supply
name = "\improper Air supply pipe"
color = PIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/manifold/supplymain
name = "\improper Main air supply pipe"
color = PIPE_COLOR_PURPLE
/obj/machinery/atmospherics/pipe/manifold/general
name = "\improper Gas pipe"
color = PIPE_COLOR_GREY
/obj/machinery/atmospherics/pipe/manifold/yellow
name = "\improper Air supply pipe"
color = PIPE_COLOR_ORANGE
/obj/machinery/atmospherics/pipe/manifold/cyan
name = "\improper Air supply pipe"
color = PIPE_COLOR_CYAN
/obj/machinery/atmospherics/pipe/manifold/filtering
name = "\improper Air filtering pipe"
color = PIPE_COLOR_GREEN
/obj/machinery/atmospherics/pipe/manifold/insulated
name = "\improper Insulated pipe"
alert_pressure = 900*ONE_ATMOSPHERE
color=IPIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/manifold/scrubbers/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold/supply/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold/supply/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold/supplymain/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold/supplymain/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold/general/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold/general/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold/insulated/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold/insulated/visible/blue
color=IPIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/manifold/insulated/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold/insulated/hidden/blue
color=IPIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/manifold/yellow/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold/yellow/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold/cyan/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold/cyan/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold/filtering/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold/filtering/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold4w
icon = 'icons/obj/atmospherics/pipe_manifold.dmi'
icon_state = "map_4way"
name = "4-way pipe manifold"
desc = "A manifold composed of regular pipes."
volume = 140
dir = SOUTH
initialize_directions = NORTH|SOUTH|EAST|WEST
color = "#B4B4B4"
var/obj/machinery/atmospherics/node1
var/obj/machinery/atmospherics/node2
var/obj/machinery/atmospherics/node3
var/obj/machinery/atmospherics/node4
level = LEVEL_BELOW_FLOOR
layer = PIPE_LAYER
baseicon="manifold4w"
var/global/image/manifold4w_centre = image('icons/obj/pipes.dmi',"manifold4w_centre")
/obj/machinery/atmospherics/pipe/manifold4w/buildFrom(var/mob/usr,var/obj/item/pipe/pipe)
dir = pipe.dir
initialize_directions = pipe.get_pipe_dir()
var/turf/T = loc
level = T.intact ? LEVEL_ABOVE_FLOOR : LEVEL_BELOW_FLOOR
update_planes_and_layers()
initialize(1)
if(!node1 && !node2 && !node3 && !node4)
to_chat(usr, "<span class='warning'>There's nothing to connect this manifold to! A pipe segment must be connected to at least one other object!</span>")
return 0
update_icon()
build_network()
if (node1)
node1.initialize()
node1.build_network()
if (node2)
node2.initialize()
node2.build_network()
if (node3)
node3.initialize()
node3.build_network()
if (node4)
node4.initialize()
node4.build_network()
return 1
/obj/machinery/atmospherics/pipe/manifold4w/New()
icon_state = "manifold4w"
..()
centre_overlay = manifold4w_centre
centre_overlay.color = color
overlays += centre_overlay
/obj/machinery/atmospherics/pipe/manifold4w/get_node(node_id)
switch(node_id)
if(1)
return node1
if(2)
return node2
if(3)
return node3
if(4)
return node4
else
CRASH("Invalid node_id!")
/obj/machinery/atmospherics/pipe/manifold4w/set_node(node_id, value)
switch(node_id)
if(1)
node1 = value
if(2)
node2 = value
if(3)
node3 = value
if(4)
node4 = value
else
CRASH("Invalid node_id!")
/obj/machinery/atmospherics/pipe/manifold4w/hide(var/i)
update_icon()
/obj/machinery/atmospherics/pipe/manifold4w/pipeline_expansion()
return list(node1, node2, node3, node4)
/obj/machinery/atmospherics/pipe/manifold4w/process()
if(!parent)
. = ..()
atmos_machines.Remove(src)
/*
if(!node1)
parent.mingle_with_turf(loc, 70)
if(!nodealert)
// to_chat(world, "Missing node from [src] at [src.x],[src.y],[src.z]")
nodealert = 1
else if(!node2)
parent.mingle_with_turf(loc, 70)
if(!nodealert)
// to_chat(world, "Missing node from [src] at [src.x],[src.y],[src.z]")
nodealert = 1
else if(!node3)
parent.mingle_with_turf(loc, 70)
if(!nodealert)
// to_chat(world, "Missing node from [src] at [src.x],[src.y],[src.z]")
nodealert = 1
else if (nodealert)
nodealert = 0
*/
/obj/machinery/atmospherics/pipe/manifold4w/Destroy()
if(node1)
node1.disconnect(src)
if(node2)
node2.disconnect(src)
if(node3)
node3.disconnect(src)
if(node4)
node4.disconnect(src)
node1 = null
node2 = null
node3 = null
node4 = null
..()
/obj/machinery/atmospherics/pipe/manifold4w/disconnect(obj/machinery/atmospherics/reference)
if(reference == node1)
if(istype(node1, /obj/machinery/atmospherics/pipe) && !isnull(parent))
qdel(parent)
node1 = null
if(reference == node2)
if(istype(node2, /obj/machinery/atmospherics/pipe) && !isnull(parent))
qdel(parent)
node2 = null
if(reference == node3)
if(istype(node3, /obj/machinery/atmospherics/pipe) && !isnull(parent))
qdel(parent)
node3 = null
if(reference == node4)
if(istype(node4, /obj/machinery/atmospherics/pipe) && !isnull(parent))
qdel(parent)
node4 = null
update_icon()
..()
/obj/machinery/atmospherics/pipe/manifold4w/update_icon(var/adjacent_procd)
if (exposed() || (node1 && node1.exposed()) || (node2 && node2.exposed()) || (node3 && node3.exposed()) || (node4 && node4.exposed()))
invisibility = 0
else
invisibility = 101
var/node_list = list(node1,node2,node3,node4)
..(adjacent_procd,node_list)
if(!node1 && !node2 && !node3 && !node4)
qdel(src)
/obj/machinery/atmospherics/pipe/manifold4w/initialize(var/skip_update_icon=0)
findAllConnections(initialize_directions)
var/turf/T = src.loc // hide if turf is not intact
hide(T.intact)
if(!skip_update_icon)
update_icon()
add_self_to_holomap()
/obj/machinery/atmospherics/pipe/manifold4w/scrubbers
name = "\improper Scrubbers pipe"
color = PIPE_COLOR_RED
/obj/machinery/atmospherics/pipe/manifold4w/supply
name = "\improper Air supply pipe"
color = PIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/manifold4w/supplymain
name = "\improper Main air supply pipe"
color = PIPE_COLOR_PURPLE
/obj/machinery/atmospherics/pipe/manifold4w/general
name = "\improper Air supply pipe"
color = PIPE_COLOR_GREY
/obj/machinery/atmospherics/pipe/manifold4w/yellow
name = "\improper Air supply pipe"
color = PIPE_COLOR_ORANGE
/obj/machinery/atmospherics/pipe/manifold4w/filtering
name = "\improper Air filtering pipe"
color = PIPE_COLOR_GREEN
/obj/machinery/atmospherics/pipe/manifold4w/insulated
name = "\improper Insulated pipe"
color = IPIPE_COLOR_RED
alert_pressure = 900*ONE_ATMOSPHERE
/obj/machinery/atmospherics/pipe/manifold4w/scrubbers/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold4w/scrubbers/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold4w/supply/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold4w/supply/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold4w/supplymain/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold4w/supplymain/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold4w/general/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold4w/general/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold4w/filtering/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold4w/filtering/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold4w/yellow/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold4w/yellow/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold4w/insulated/hidden
level = LEVEL_BELOW_FLOOR
alpha=128
/obj/machinery/atmospherics/pipe/manifold4w/insulated/visible
level = LEVEL_ABOVE_FLOOR
/obj/machinery/atmospherics/pipe/manifold4w/insulated/hidden/blue
color=IPIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/manifold4w/insulated/visible/blue
color=IPIPE_COLOR_BLUE
/obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if(istype(W, /obj/item/device/rcd/rpd) || istype(W, /obj/item/device/pipe_painter))
return // Coloring pipes.
if(istype(W, /obj/item/weapon/reagent_containers/glass/paint/red))
src.color = PIPE_COLOR_RED
to_chat(user, "<span class='notice'>You paint the pipe red.</span>")
update_icon()
return 1
if(istype(W, /obj/item/weapon/reagent_containers/glass/paint/blue))
src.color = PIPE_COLOR_BLUE
to_chat(user, "<span class='notice'>You paint the pipe blue.</span>")
update_icon()
return 1
if(istype(W, /obj/item/weapon/reagent_containers/glass/paint/green))
src.color = PIPE_COLOR_GREEN
to_chat(user, "<span class='notice'>You paint the pipe green.</span>")
update_icon()
return 1
if(istype(W, /obj/item/weapon/reagent_containers/glass/paint/yellow))
src.color = PIPE_COLOR_ORANGE
to_chat(user, "<span class='notice'>You paint the pipe yellow.</span>")
update_icon()
return 1
if(istype(W, /obj/item/pipe_meter))
var/obj/item/pipe_meter/meter = W
if(user.drop_item(meter, src.loc))
meter.setAttachLayer(src.piping_layer)
if(istype(W,/obj/item/device/analyzer))
var/obj/item/device/analyzer/A = W
var/datum/gas_mixture/environment = src.return_air()
user.show_message(A.output_gas_scan(environment,src,1))
return ..()
/obj/machinery/atmospherics/pipe/layer_manifold
name = "pipe-layer manifold"
icon = 'icons/obj/atmospherics/pipe_manifold.dmi'
icon_state = "map_layer"
baseicon = ""
dir = SOUTH
initialize_directions = NORTH|SOUTH
volume = 260 //6 averaged pipe segments
pipe_flags = ALL_LAYER
color = PIPE_COLOR_GREY
var/list/layer_nodes = list()
var/obj/machinery/atmospherics/other_node = null
var/static/image/centre_image = image(icon = 'icons/obj/atmospherics/pipe_manifold.dmi', icon_state = "layer_center")
/obj/machinery/atmospherics/pipe/layer_manifold/New()
for(var/pipelayer = PIPING_LAYER_MIN; pipelayer <= PIPING_LAYER_MAX; pipelayer += PIPING_LAYER_INCREMENT)
layer_nodes.Add(null)
switch(dir)
if(NORTH,SOUTH)
initialize_directions = NORTH|SOUTH
if(EAST,WEST)
initialize_directions = EAST|WEST
centre_overlay = centre_image
centre_overlay.color = color
overlays += centre_overlay
icon_state = ""
..()
/obj/machinery/atmospherics/pipe/layer_manifold/setPipingLayer(var/new_layer = PIPING_LAYER_DEFAULT)
piping_layer = PIPING_LAYER_DEFAULT
/obj/machinery/atmospherics/pipe/layer_manifold/buildFrom(var/mob/usr,var/obj/item/pipe/pipe)
dir = pipe.dir
initialize_directions = pipe.get_pipe_dir()
var/turf/T = loc
level = T.intact ? LEVEL_ABOVE_FLOOR : LEVEL_BELOW_FLOOR
update_planes_and_layers()
initialize(1)
if(!(locate(/obj/machinery/atmospherics) in layer_nodes) && !other_node)
to_chat(usr, "<span class='warning'>There's nothing to connect this manifold to! A pipe segment must be connected to at least one other object!</span>")
return 0
update_icon()
build_network()
for(var/obj/machinery/atmospherics/node in layer_nodes)
node.initialize()
node.build_network()
if (other_node)
other_node.initialize()
other_node.build_network()
return 1
/obj/machinery/atmospherics/pipe/layer_manifold/hide(var/i)
update_icon()
/obj/machinery/atmospherics/pipe/layer_manifold/pipeline_expansion()
return layer_nodes + other_node
/obj/machinery/atmospherics/pipe/layer_manifold/process()
if(!parent)
. = ..()
atmos_machines.Remove(src)
/obj/machinery/atmospherics/pipe/layer_manifold/Destroy()
for(var/obj/machinery/atmospherics/node in layer_nodes)
node.disconnect(src)
if(other_node)
other_node.disconnect(src)
..()
/obj/machinery/atmospherics/pipe/layer_manifold/disconnect(obj/machinery/atmospherics/reference)
if(reference == other_node)
if(istype(other_node, /obj/machinery/atmospherics/pipe) && !isnull(parent))
qdel(parent)
other_node = null
else
for(var/pipelayer = PIPING_LAYER_MIN; pipelayer <= PIPING_LAYER_MAX; pipelayer += PIPING_LAYER_INCREMENT)
if(reference == layer_nodes[pipelayer])
if(istype(layer_nodes[pipelayer], /obj/machinery/atmospherics/pipe) && !isnull(parent))
qdel(parent)
layer_nodes[pipelayer] = null
update_icon()
..()
/obj/machinery/atmospherics/pipe/layer_manifold/icon_directions()
return list(turn(dir, 180))
/obj/machinery/atmospherics/pipe/layer_manifold/update_icon(var/adjacent_procd)
..(adjacent_procd, list(other_node)) // Adds the back connector
var/is_partially_exposed = exposed()
for(var/pipelayer = PIPING_LAYER_MIN; pipelayer <= PIPING_LAYER_MAX; pipelayer += PIPING_LAYER_INCREMENT)
var/obj/machinery/atmospherics/node = layer_nodes[pipelayer]
var/layer_diff = pipelayer - PIPING_LAYER_DEFAULT
var/image/ex = image(icon, "layer_[pipelayer]", layer = 100, dir = dir)
if(node) //we are connected at this layer
var/node_color = node_color_for(node)
var/image/con = image('icons/obj/pipes.dmi', "pipe_intact", layer = 200, dir = dir)
con.pixel_x = layer_diff * PIPING_LAYER_P_X
con.pixel_y = layer_diff * PIPING_LAYER_P_Y
con.color = node_color
ex.color = node_color
underlays += con
if (!adjacent_procd && node.update_icon_ready && !istype(node,/obj/machinery/atmospherics/pipe/simple))
node.update_icon(TRUE)
if (node.exposed())
is_partially_exposed = TRUE
else
ex.color = default_colour || PIPE_COLOR_GREY
underlays += ex
if(!other_node && !(locate(/obj/machinery/atmospherics) in layer_nodes))
qdel(src)
invisibility = is_partially_exposed ? 0 : 101
alpha = is_partially_exposed ? 255 : 128
/obj/machinery/atmospherics/pipe/layer_manifold/initialize(var/skip_update_icon=0)
findAllConnections(initialize_directions)
var/turf/T = src.loc // hide if turf is not intact
hide(T.intact)
if(!skip_update_icon)
update_icon()
add_self_to_holomap()
/obj/machinery/atmospherics/pipe/layer_manifold/findAllConnections(var/connect_dirs)
for(var/direction in cardinal)
if(connect_dirs & direction)
if(direction == dir) //we're facing this
for(var/i = PIPING_LAYER_MIN; i <= PIPING_LAYER_MAX; i += PIPING_LAYER_INCREMENT)
var/obj/machinery/atmospherics/found
var/node_type=getNodeType(i)
switch(node_type)
if(PIPE_TYPE_STANDARD)
found = findConnecting(direction, i) //we pass the layer to find the pipe
if(PIPE_TYPE_HE)
found = findConnectingHE(direction, i)
else
error("UNKNOWN RESPONSE FROM [src.type]/getNodeType([i]): [node_type]")
return
if(!found)
continue
layer_nodes[i] = found //put it in the list
else
var/obj/machinery/atmospherics/found
var/node_type=getNodeType(direction)
switch(node_type)
if(PIPE_TYPE_STANDARD)
found = findConnecting(direction)
if(PIPE_TYPE_HE)
found = findConnectingHE(direction)
else
error("UNKNOWN RESPONSE FROM [src.type]/getNodeType([direction]): [node_type]")
if(!found)
continue
other_node = found
/obj/machinery/atmospherics/pipe/layer_manifold/isConnectable(var/obj/machinery/atmospherics/target, var/direction, var/given_layer)
if(direction == turn(src.dir, 180))
return (given_layer == PIPING_LAYER_DEFAULT)
return ..()
/obj/machinery/atmospherics/pipe/layer_manifold/getNodeType()
return PIPE_TYPE_STANDARD
//We would normally set layer here, but I don't want to
/obj/machinery/atmospherics/pipe/layer_manifold/Entered()
return
/obj/machinery/atmospherics/pipe/layer_manifold/relaymove(mob/living/user, direction)
if(!(direction & initialize_directions)) //can't go in a way we aren't connecting to
var/layer_mod = 0
if(dir & (NORTH|SOUTH))
if(direction == EAST) //Going up in layers
layer_mod = 1
else
layer_mod = -1
else
if(direction == SOUTH) //
layer_mod = 1
else
layer_mod = -1
user.ventcrawl_layer = clamp(user.ventcrawl_layer + layer_mod, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
to_chat(user, "You align yourself with the [user.ventcrawl_layer]\th output.")
return 1
else
if(direction != dir && user.ventcrawl_layer != PIPING_LAYER_DEFAULT) // The mob is moving to the single pipe outlet, we need to align it if it's on a layer that's not the default layer
user.ventcrawl_layer = PIPING_LAYER_DEFAULT
to_chat(user, "You are redirected into the [user.ventcrawl_layer]\th piping layer.")
return ..()
/obj/machinery/atmospherics/pipe/layer_adapter
name = "pipe-layer adapter"
icon = 'icons/obj/atmospherics/pipe_adapter.dmi'
icon_state = "adapter_1"
baseicon = "adapter"
color = PIPE_COLOR_GREY
dir = SOUTH
initialize_directions = NORTH|SOUTH
volume = 260 //6 averaged pipe segments
var/obj/machinery/atmospherics/layer_node = null
var/obj/machinery/atmospherics/mid_node = null
/obj/machinery/atmospherics/pipe/layer_adapter/New()
..()
switch(dir)
if(NORTH,SOUTH)
initialize_directions = NORTH|SOUTH
if(EAST,WEST)
initialize_directions = EAST|WEST
/obj/machinery/atmospherics/pipe/layer_adapter/setPipingLayer(var/new_layer = PIPING_LAYER_DEFAULT)
piping_layer = new_layer
/obj/machinery/atmospherics/pipe/layer_adapter/buildFrom(var/mob/usr,var/obj/item/pipe/pipe)
dir = pipe.dir
initialize_directions = pipe.get_pipe_dir()
var/turf/T = loc
level = T.intact ? LEVEL_ABOVE_FLOOR : LEVEL_BELOW_FLOOR
update_planes_and_layers()
initialize(1)
if(!mid_node && !layer_node)
to_chat(usr, "<span class='warning'>There's nothing to connect this adapter to! A pipe segment must be connected to at least one other object!</span>")
return 0
update_icon()
build_network()
if (mid_node)
mid_node.initialize()
mid_node.build_network()
if (layer_node)
layer_node.initialize()
layer_node.build_network()
return 1
/obj/machinery/atmospherics/pipe/layer_adapter/hide(var/i)
update_icon()
/obj/machinery/atmospherics/pipe/layer_adapter/pipeline_expansion()
return list(layer_node, mid_node)
/obj/machinery/atmospherics/pipe/layer_adapter/process()
if(!parent)
. = ..()
atmos_machines.Remove(src)
/obj/machinery/atmospherics/pipe/layer_adapter/Destroy()
if(mid_node)
mid_node.disconnect(src)
if(layer_node)
layer_node.disconnect(src)
..()
/obj/machinery/atmospherics/pipe/layer_adapter/disconnect(var/obj/machinery/atmospherics/reference)
if(reference == mid_node)
if(istype(mid_node, /obj/machinery/atmospherics/pipe) && !isnull(parent))
qdel(parent)
mid_node = null
if(reference == layer_node)
if(istype(layer_node, /obj/machinery/atmospherics/pipe) && !isnull(parent))
qdel(parent)
layer_node = null
..()
/obj/machinery/atmospherics/pipe/layer_adapter/update_icon()
overlays.len = 0
alpha = invisibility ? 128 : 255
icon_state = "[baseicon]_[piping_layer]"
if(layer_node)
var/layer_diff = piping_layer - PIPING_LAYER_DEFAULT
var/image/con = image(icon(src.icon,"layer_con",turn(src.dir,180)))
con.pixel_x = layer_diff * PIPING_LAYER_P_X
con.pixel_y = layer_diff * PIPING_LAYER_P_Y
overlays += con
if(!mid_node && !layer_node)
qdel(src)
if (exposed() || (mid_node && mid_node.exposed()) || (layer_node && layer_node.exposed()))
invisibility = 0
else
invisibility = 101
/obj/machinery/atmospherics/pipe/layer_adapter/initialize(var/skip_update_icon=0)
findAllConnections(initialize_directions)
var/turf/T = src.loc // hide if turf is not intact
hide(T.intact)
if(!skip_update_icon)
update_icon()
add_self_to_holomap()
/obj/machinery/atmospherics/pipe/layer_adapter/findAllConnections(var/connect_dirs)
for(var/direction in cardinal)
if(connect_dirs & direction)
if(direction == dir) //we're facing this
var/obj/machinery/atmospherics/found
var/node_type=getNodeType(direction)
switch(node_type)
if(PIPE_TYPE_STANDARD)
found = findConnecting(direction, PIPING_LAYER_DEFAULT)
if(PIPE_TYPE_HE)
found = findConnectingHE(direction, PIPING_LAYER_DEFAULT)
else
error("UNKNOWN RESPONSE FROM [src.type]/getNodeType([direction]): [node_type]")
if(!found)
continue
mid_node = found
else
var/obj/machinery/atmospherics/found
var/node_type=getNodeType(direction)
switch(node_type)
if(PIPE_TYPE_STANDARD)
found = findConnecting(direction, piping_layer) //we pass the layer to find the pipe
if(PIPE_TYPE_HE)
found = findConnectingHE(direction, piping_layer)
else
error("UNKNOWN RESPONSE FROM [src.type]/getNodeType([piping_layer]): [node_type]")
return
if(!found)
continue
layer_node = found
/obj/machinery/atmospherics/pipe/layer_adapter/getNodeType()
return PIPE_TYPE_STANDARD
//We would normally set layer here, but I don't want to
/obj/machinery/atmospherics/pipe/layer_adapter/Entered()
return
/obj/machinery/atmospherics/pipe/layer_adapter/relaymove(mob/living/user, direction)
// Autoset layer
if(direction & initialize_directions)
user.ventcrawl_layer = (direction == dir) ? PIPING_LAYER_DEFAULT : piping_layer
to_chat(user, "You are redirected into the [user.ventcrawl_layer]\th piping layer.")
return ..()
/obj/machinery/atmospherics/pipe/layer_adapter/get_layer_of_dir(var/direction)
if (direction == dir)
return PIPING_LAYER_DEFAULT // requested direction is our mid_node
else if (turn(direction, 180) == dir)
return piping_layer // requested direction is our layer_node