mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
3rd pass OOP
now we've got lists for parents, nodes, and air mixtures (they're all broken) moves tank.dm, cryo.dm, Freezer.dm to components/unary_devices/
This commit is contained in:
@@ -3,20 +3,7 @@
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH
|
||||
use_power = 1
|
||||
nodes = 2
|
||||
|
||||
var/datum/gas_mixture/air1
|
||||
var/datum/gas_mixture/air2
|
||||
|
||||
var/obj/machinery/atmospherics/node1
|
||||
var/obj/machinery/atmospherics/node2
|
||||
|
||||
var/datum/pipeline/parent1
|
||||
var/datum/pipeline/parent2
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/New()
|
||||
var/airs[] = ..()
|
||||
set_airs(airs)
|
||||
node_amount = 2
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/SetInitDirections()
|
||||
switch(dir)
|
||||
@@ -40,35 +27,8 @@ Iconnery
|
||||
Helpers
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/get_airs()
|
||||
return list(air1, air2)
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/get_nodes()
|
||||
return list(node1, node2)
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/get_parents()
|
||||
return list(parent1, parent2)
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/set_airs(var/list/L)
|
||||
var/datum/gas_mixture/a1 = L[1]
|
||||
var/datum/gas_mixture/a2 = L[2]
|
||||
|
||||
air1 = a1
|
||||
air2 = a2
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/set_nodes(var/list/L)
|
||||
var/obj/machinery/atmospherics/n1 = L[1]
|
||||
var/obj/machinery/atmospherics/n2 = L[2]
|
||||
|
||||
node1 = n1
|
||||
node2 = n2
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/set_parents(var/list/L)
|
||||
var/datum/pipeline/p1 = L[1]
|
||||
var/datum/pipeline/p2 = L[2]
|
||||
|
||||
parent1 = p1
|
||||
parent2 = p2
|
||||
/obj/machinery/atmospherics/components/trinary/update_airs(var/a1, var/a2)
|
||||
..(list(1 = a1, 2 = a2))
|
||||
|
||||
/*
|
||||
Housekeeping and pipe network stuff
|
||||
@@ -79,44 +39,13 @@ Housekeeping and pipe network stuff
|
||||
var/node2_connect = dir
|
||||
var/node1_connect = turn(dir, 180)
|
||||
|
||||
//var/node_connects[] = list(node1_connect, node2_connect)
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
|
||||
var/node_connects[] = list(1 = node1_connect, 2 = node2_connect)
|
||||
/* for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
nodes[node1] = target
|
||||
nodes[1] = target
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
nodes[node2] = target
|
||||
break
|
||||
..(/*node_connects*/)
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/construction()
|
||||
var/parents[] = ..()
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/build_network()
|
||||
var/parents[] = ..()
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/disconnect(obj/machinery/atmospherics/reference)
|
||||
var/parents[] = ..(reference)
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/nullifyPipenet(datum/pipeline/P)
|
||||
var/parents[] = ..(P)
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/setPipenet(datum/pipeline/P, obj/machinery/atmospherics/A)
|
||||
var/parents[] = ..(P, A)
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
|
||||
var/parents[] = ..(Old, New)
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/binary/unsafe_pressure_release(var/mob/user, var/pressures)
|
||||
var/airs[] = ..(user, pressures)
|
||||
set_airs(airs)
|
||||
|
||||
//This sure looks like a lot of copypaste... It's already WAY better though, so it works for now
|
||||
//TODO: make it even more OOP - duncathan
|
||||
nodes[2] = target
|
||||
break */
|
||||
..(node_connects)
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
/obj/machinery/atmospherics/binary/circulator/proc/return_transfer_air()
|
||||
|
||||
var/datum/gas_mixture/air1 = airs[1]
|
||||
var/datum/gas_mixture/air2 = airs[2]
|
||||
|
||||
var/output_starting_pressure = air1.return_pressure()
|
||||
var/input_starting_pressure = air2.return_pressure()
|
||||
@@ -40,9 +42,9 @@
|
||||
//Actually transfer the gas
|
||||
var/datum/gas_mixture/removed = air2.remove(transfer_moles)
|
||||
|
||||
parent1.update = 1
|
||||
update_airs(air1, air2)
|
||||
|
||||
parent2.update = 1
|
||||
update_parents()
|
||||
|
||||
return removed
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@ Acts like a normal vent, but has an input AND output.
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume/New()
|
||||
..()
|
||||
|
||||
air1.volume = 1000
|
||||
air2.volume = 1000
|
||||
var/datum/gas_mixture/air1 = airs[1] ; air1.volume = 1000
|
||||
var/datum/gas_mixture/air2 = airs[2] ; air2.volume = 1000
|
||||
update_airs(air1, air2)
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/update_icon_nopipes()
|
||||
overlays.Cut()
|
||||
@@ -65,6 +65,8 @@ Acts like a normal vent, but has an input AND output.
|
||||
|
||||
if(!on)
|
||||
return 0
|
||||
var/datum/gas_mixture/air1 = airs[1]
|
||||
var/datum/gas_mixture/air2 = airs[2]
|
||||
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
var/environment_pressure = environment.return_pressure()
|
||||
@@ -86,7 +88,7 @@ Acts like a normal vent, but has an input AND output.
|
||||
loc.assume_air(removed)
|
||||
air_update_turf()
|
||||
|
||||
parent1.update = 1
|
||||
update_parents(list(1 = parents[1])) //this looks disgusting, but it works
|
||||
|
||||
else //external -> output
|
||||
var/pressure_delta = 10000
|
||||
@@ -105,7 +107,9 @@ Acts like a normal vent, but has an input AND output.
|
||||
air2.merge(removed)
|
||||
air_update_turf()
|
||||
|
||||
parent2.update = 1
|
||||
update_parents(list(2 = parents[2]))
|
||||
|
||||
update_airs(air1, air2)
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
@@ -40,6 +40,9 @@ Passive gate is similar to the regular pump except:
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air1 = airs[1]
|
||||
var/datum/gas_mixture/air2 = airs[2]
|
||||
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
var/input_starting_pressure = air1.return_pressure()
|
||||
|
||||
@@ -59,9 +62,8 @@ Passive gate is similar to the regular pump except:
|
||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||
air2.merge(removed)
|
||||
|
||||
parent1.update = 1
|
||||
|
||||
parent2.update = 1
|
||||
update_airs(air1, air2)
|
||||
update_parents()
|
||||
|
||||
|
||||
//Radio remote control
|
||||
|
||||
@@ -48,6 +48,9 @@ Thus, the two variables affect pump operation are set in New():
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air1 = airs[1]
|
||||
var/datum/gas_mixture/air2 = airs[2]
|
||||
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
|
||||
if( (target_pressure - output_starting_pressure) < 0.01)
|
||||
@@ -63,10 +66,8 @@ Thus, the two variables affect pump operation are set in New():
|
||||
var/datum/gas_mixture/removed = air1.remove(transfer_moles)
|
||||
air2.merge(removed)
|
||||
|
||||
parent1.update = 1
|
||||
|
||||
|
||||
parent2.update = 1
|
||||
update_airs(air1, air2)
|
||||
update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ It's like a regular ol' straight pipe, but you can turn it on and off.
|
||||
/obj/machinery/atmospherics/binary/valve/proc/open()
|
||||
open = 1
|
||||
update_icon_nopipes()
|
||||
parent1.update = 0
|
||||
parent2.update = 0
|
||||
parent1.reconcile_air()
|
||||
update_parents()
|
||||
var/datum/pipeline/parent1 = parents[1] ; parent1.reconcile_air()
|
||||
parents[1] = parent1
|
||||
investigate_log("was opened by [usr ? key_name(usr) : "a remote signal"]", "atmos")
|
||||
|
||||
/obj/machinery/atmospherics/binary/valve/proc/close()
|
||||
|
||||
@@ -48,6 +48,9 @@ Thus, the two variables affect pump operation are set in New():
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air1 = airs[1]
|
||||
var/datum/gas_mixture/air2 = airs[2]
|
||||
|
||||
// Pump mechanism just won't do anything if the pressure is too high/too low
|
||||
|
||||
var/input_starting_pressure = air1.return_pressure()
|
||||
@@ -62,9 +65,8 @@ Thus, the two variables affect pump operation are set in New():
|
||||
|
||||
air2.merge(removed)
|
||||
|
||||
parent1.update = 1
|
||||
|
||||
parent2.update = 1
|
||||
update_airs(air1, air2)
|
||||
update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
@@ -124,6 +126,7 @@ Thus, the two variables affect pump operation are set in New():
|
||||
on = !on
|
||||
|
||||
if("set_transfer_rate" in signal.data)
|
||||
var/datum/gas_mixture/air1 = airs[1]
|
||||
transfer_rate = Clamp(
|
||||
text2num(signal.data["set_transfer_rate"]),
|
||||
0,
|
||||
|
||||
@@ -5,17 +5,19 @@ On top of that, now people can add component-speciic procs/vars if they want!
|
||||
/obj/machinery/atmospherics/components/
|
||||
var/welded = 0 //Used on pumps and scrubbers
|
||||
var/showpipe = 0
|
||||
var/nodes = 0
|
||||
var/list/nodes
|
||||
var/list/parents
|
||||
var/list/airs
|
||||
var/node_amount
|
||||
|
||||
/obj/machinery/atmospherics/components/New(var/new_airs[] = get_airs()) //doesn't work properly
|
||||
/obj/machinery/atmospherics/components/New() //doesn't work properly
|
||||
..()
|
||||
for(var/A in new_airs)
|
||||
for(var/A = 1; A <= node_amount; A++)
|
||||
var/datum/gas_mixture/air = A
|
||||
|
||||
air = new
|
||||
air.volume = 200
|
||||
new_airs[A] = air
|
||||
return new_airs
|
||||
airs[A] = air
|
||||
/*
|
||||
Iconnery
|
||||
*/
|
||||
@@ -35,7 +37,7 @@ Iconnery
|
||||
/obj/machinery/atmospherics/components/proc/update_icon_nopipes()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/components/update_icon(var/update_nodes[] = nodes) //works
|
||||
/obj/machinery/atmospherics/components/update_icon() //works
|
||||
update_icon_nopipes()
|
||||
|
||||
underlays.Cut()
|
||||
@@ -44,7 +46,7 @@ Iconnery
|
||||
|
||||
var/connected = 0
|
||||
|
||||
for(var/N in update_nodes) //adds intact pieces
|
||||
for(var/N in nodes) //adds intact pieces
|
||||
var/obj/machinery/atmospherics/node = N
|
||||
if(node)
|
||||
connected = icon_addintact(node, connected)
|
||||
@@ -54,124 +56,113 @@ Iconnery
|
||||
/*
|
||||
Pipenet stuff; housekeeping
|
||||
*/
|
||||
/obj/machinery/atmospherics/components/Destroy(var/dest_nodes[] = get_nodes(), var/dest_parents[] = get_parents()) //works somewhat
|
||||
for(var/N in dest_nodes)
|
||||
/obj/machinery/atmospherics/components/Destroy() //works somewhat
|
||||
for(var/N in nodes)
|
||||
var/obj/machinery/atmospherics/node = N
|
||||
var/datum/pipeline/parent = dest_parents[N]
|
||||
var/datum/pipeline/parent = parents[N]
|
||||
|
||||
if(node)
|
||||
node.disconnect(src)
|
||||
node = null
|
||||
nullifyPipenet(parent)
|
||||
dest_nodes[N] = node
|
||||
dest_parents[N] = parent
|
||||
nodes[N] = node
|
||||
parents[N] = parent
|
||||
..()
|
||||
return list(nodes = dest_nodes, parents = dest_parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/atmosinit(var/node_connects[], var/init_nodes[] = get_nodes()) //doesn't work for another reason
|
||||
/*for(var/N in nodes)
|
||||
var/obj/machinery/atmospherics/node = N
|
||||
var/dir/node_connect = node_connects[N]
|
||||
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node_connect))
|
||||
/obj/machinery/atmospherics/components/atmosinit(var/list/node_connects) //doesn't work for another reason
|
||||
for(var/N = 1; N <= node_amount; N++)
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node_connects[N]))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node = target
|
||||
break*/
|
||||
nodes[N] = target
|
||||
if(level == 2)
|
||||
showpipe = 1
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/components/construction(var/constr_parents[] = get_parents()) //doesn't work
|
||||
/obj/machinery/atmospherics/components/construction() //doesn't work
|
||||
..()
|
||||
for(var/P in constr_parents)
|
||||
for(var/P in parents)
|
||||
var/datum/pipeline/parent = P
|
||||
parent.update = 1
|
||||
constr_parents[P] = parent
|
||||
return constr_parents
|
||||
parents[P] = parent
|
||||
|
||||
/obj/machinery/atmospherics/components/build_network(var/build_parents[] = get_parents()) //doesn't work
|
||||
for(var/P in build_parents)
|
||||
/obj/machinery/atmospherics/components/build_network() //doesn't work
|
||||
for(var/P in parents)
|
||||
var/datum/pipeline/parent = P
|
||||
|
||||
if(parent)
|
||||
return
|
||||
parent = new /datum/pipeline()
|
||||
parent.build_pipeline(src)
|
||||
build_parents[P] = parent
|
||||
return build_parents
|
||||
parents[P] = parent
|
||||
|
||||
/obj/machinery/atmospherics/components/disconnect(obj/machinery/atmospherics/reference, var/disc_nodes[] = get_nodes(), var/disc_parents[] = get_parents()) //works
|
||||
for(var/N in disc_nodes)
|
||||
/obj/machinery/atmospherics/components/disconnect(obj/machinery/atmospherics/reference) //works
|
||||
for(var/N in nodes)
|
||||
var/obj/machinery/atmospherics/node = N
|
||||
var/datum/pipeline/parent = disc_parents[N]
|
||||
var/datum/pipeline/parent = parents[N]
|
||||
|
||||
if(reference == node)
|
||||
if(istype(node, /obj/machinery/atmospherics/pipe))
|
||||
qdel(parent)
|
||||
parent = null
|
||||
disc_parents[N] = parent
|
||||
parents[N] = parent
|
||||
update_icon()
|
||||
return disc_parents
|
||||
|
||||
/obj/machinery/atmospherics/components/nullifyPipenet(datum/pipeline/pipeline, var/null_parents[] = get_parents(), var/null_airs[] = get_airs()) //untestable
|
||||
/obj/machinery/atmospherics/components/nullifyPipenet(datum/pipeline/pipeline) //untestable
|
||||
..()
|
||||
for(var/P in null_parents)
|
||||
for(var/P in parents)
|
||||
var/datum/pipeline/parent = P
|
||||
var/datum/gas_mixture/air = null_airs[P]
|
||||
var/datum/gas_mixture/air = airs[P]
|
||||
|
||||
if(pipeline == parent)
|
||||
parent.other_airs -= air
|
||||
parent = null
|
||||
null_parents[P] = parent
|
||||
return null_parents
|
||||
parents[P] = parent
|
||||
|
||||
/obj/machinery/atmospherics/components/returnPipenetAir(datum/pipeline/pipeline, var/return_parents[] = get_parents(), var/return_airs[] = get_airs()) //untestable; should work
|
||||
for(var/P in return_parents)
|
||||
/obj/machinery/atmospherics/components/returnPipenetAir(datum/pipeline/pipeline) //untestable; should work
|
||||
for(var/P in parents)
|
||||
var/datum/pipeline/parent = P
|
||||
var/datum/gas_mixture/air = return_airs[P]
|
||||
var/datum/gas_mixture/air = airs[P]
|
||||
|
||||
if(pipeline == parent)
|
||||
return air
|
||||
|
||||
/obj/machinery/atmospherics/components/pipeline_expansion(datum/pipeline/pipeline, var/expand_parents[] = get_parents(), var/expand_nodes[] = get_nodes()) //TODO: dong
|
||||
/obj/machinery/atmospherics/components/pipeline_expansion(datum/pipeline/pipeline)
|
||||
if(!pipeline)
|
||||
return expand_nodes //works
|
||||
for(var/N in expand_nodes)
|
||||
return nodes //works
|
||||
for(var/N in nodes)
|
||||
var/obj/machinery/atmospherics/node = N
|
||||
var/datum/pipeline/parent = expand_parents[N]
|
||||
var/datum/pipeline/parent = parents[N]
|
||||
|
||||
if(parent == pipeline)
|
||||
return list(node) //untestable; should work
|
||||
|
||||
/obj/machinery/atmospherics/components/setPipenet(datum/pipeline/pipeline, obj/machinery/atmospherics/A, var/set_parents[] = get_parents(), var/set_nodes[] = get_nodes())
|
||||
for(var/N in set_nodes)
|
||||
/obj/machinery/atmospherics/components/setPipenet(datum/pipeline/pipeline, obj/machinery/atmospherics/A)
|
||||
for(var/N in nodes)
|
||||
var/obj/machinery/atmospherics/node = N
|
||||
var/datum/pipeline/parent = set_parents[N]
|
||||
var/datum/pipeline/parent = parents[N]
|
||||
|
||||
if(A == node)
|
||||
parent = pipeline
|
||||
set_parents[N] = parent
|
||||
return set_parents
|
||||
parents[N] = parent
|
||||
|
||||
/obj/machinery/atmospherics/components/returnPipenet(obj/machinery/atmospherics/A, var/return_parents[] = get_parents(), var/return_nodes = get_nodes())
|
||||
for(var/N in return_nodes)
|
||||
/obj/machinery/atmospherics/components/returnPipenet(obj/machinery/atmospherics/A)
|
||||
for(var/N in nodes)
|
||||
var/obj/machinery/atmospherics/node = N
|
||||
var/datum/pipeline/parent = return_parents[N]
|
||||
var/datum/pipeline/parent = parents[N]
|
||||
|
||||
if(A == node)
|
||||
return parent //probably works
|
||||
|
||||
/obj/machinery/atmospherics/components/replacePipenet(datum/pipeline/Old, datum/pipeline/New, var/replace_parents[] = get_parents())
|
||||
for(var/P in replace_parents)
|
||||
/obj/machinery/atmospherics/components/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
|
||||
for(var/P in parents)
|
||||
var/datum/pipeline/parent = P
|
||||
|
||||
if(Old == parent)
|
||||
parent = New
|
||||
replace_parents[P] = parent
|
||||
return replace_parents
|
||||
parents[P] = parent
|
||||
|
||||
/obj/machinery/atmospherics/components/unsafe_pressure_release(var/mob/user, var/pressures, var/unsafe_airs[] = get_airs()) //untestable; I'll fix this last
|
||||
/obj/machinery/atmospherics/components/unsafe_pressure_release(var/mob/user, var/pressures) //untestable; I'll fix this last
|
||||
..()
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
@@ -180,23 +171,22 @@ Pipenet stuff; housekeeping
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/lost = null
|
||||
var/times_lost = 0
|
||||
for(var/A in unsafe_airs)
|
||||
for(var/A in airs)
|
||||
var/datum/gas_mixture/air = A
|
||||
lost += pressures*environment.volume/(air.temperature * R_IDEAL_GAS_EQUATION)
|
||||
times_lost++
|
||||
var/shared_loss = lost/times_lost
|
||||
|
||||
var/datum/gas_mixture/to_release
|
||||
for(var/A in unsafe_airs)
|
||||
for(var/A in airs)
|
||||
var/datum/gas_mixture/air = A
|
||||
if(!to_release)
|
||||
to_release = air.remove(shared_loss)
|
||||
continue
|
||||
to_release.merge(air.remove(shared_loss))
|
||||
unsafe_airs[A] = air
|
||||
airs[A] = air
|
||||
T.assume_air(to_release)
|
||||
air_update_turf(1)
|
||||
return unsafe_airs
|
||||
|
||||
/*
|
||||
I think this is NanoUI?
|
||||
@@ -218,9 +208,14 @@ Helpers
|
||||
/obj/machinery/atmospherics/components/proc/get_parents()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/components/proc/set_airs()
|
||||
return
|
||||
/obj/machinery/atmospherics/components/proc/set_nodes()
|
||||
return
|
||||
/obj/machinery/atmospherics/components/proc/set_parents()
|
||||
return
|
||||
/obj/machinery/atmospherics/components/proc/update_airs(var/list/L)
|
||||
for(var/N in L)
|
||||
var/datum/gas_mixture/air = L[N]
|
||||
airs[N] = air
|
||||
|
||||
/obj/machinery/atmospherics/components/proc/update_parents(var/list/L = parents)
|
||||
for(var/N in L)
|
||||
if(!N)
|
||||
continue
|
||||
var/datum/pipeline/parent = N ; parent.update = 1
|
||||
parents[N] = parent
|
||||
@@ -67,7 +67,7 @@ Filter types:
|
||||
|
||||
/obj/machinery/atmospherics/trinary/filter/update_icon_nopipes()
|
||||
|
||||
if(!(stat & NOPOWER) && on && node1 && node2 && node3)
|
||||
if(!(stat & NOPOWER) && on && nodes[1] && nodes[2] && nodes[3])
|
||||
icon_state = "filter_on[flipped?"_f":""]"
|
||||
return
|
||||
|
||||
@@ -86,6 +86,10 @@ Filter types:
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air1 = airs[1]
|
||||
var/datum/gas_mixture/air2 = airs[2]
|
||||
var/datum/gas_mixture/air3 = airs[3]
|
||||
|
||||
var/output_starting_pressure = air3.return_pressure()
|
||||
|
||||
if(output_starting_pressure >= target_pressure)
|
||||
@@ -147,11 +151,8 @@ Filter types:
|
||||
air2.merge(filtered_out)
|
||||
air3.merge(removed)
|
||||
|
||||
parent2.update = 1
|
||||
|
||||
parent3.update = 1
|
||||
|
||||
parent1.update = 1
|
||||
update_airs(air1, air2, air3)
|
||||
update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
@@ -36,8 +36,13 @@
|
||||
overlays.Cut()
|
||||
..()
|
||||
|
||||
<<<<<<< HEAD
|
||||
/obj/machinery/atmospherics/trinary/mixer/update_icon_nopipes()
|
||||
if(!(stat & NOPOWER) && on && node1 && node2 && node3)
|
||||
=======
|
||||
/obj/machinery/atmospherics/components/trinary/mixer/update_icon_nopipes()
|
||||
if(!(stat & NOPOWER) && on && nodes[1] && nodes[2] && nodes[3])
|
||||
>>>>>>> 3ee8754... 3rd pass OOP
|
||||
icon_state = "mixer_on[flipped?"_f":""]"
|
||||
return
|
||||
|
||||
@@ -53,13 +58,18 @@
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/New()
|
||||
..()
|
||||
air3.volume = 300
|
||||
var/datum/gas_mixture/air3 = airs[3] ; air3.volume = 300
|
||||
airs[3] = air3
|
||||
|
||||
/obj/machinery/atmospherics/trinary/mixer/process_atmos()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air1 = airs[1]
|
||||
var/datum/gas_mixture/air2 = airs[2]
|
||||
var/datum/gas_mixture/air3 = airs[3]
|
||||
|
||||
var/output_starting_pressure = air3.return_pressure()
|
||||
|
||||
if(output_starting_pressure >= target_pressure)
|
||||
@@ -104,12 +114,13 @@
|
||||
air3.merge(removed2)
|
||||
|
||||
if(transfer_moles1)
|
||||
parent1.update = 1
|
||||
update_parents(list(1 = parents[1]))
|
||||
|
||||
if(transfer_moles2)
|
||||
parent2.update = 1
|
||||
update_parents(list(2 = parents[2]))
|
||||
|
||||
parent3.update = 1
|
||||
update_airs(air1, air2, air3)
|
||||
update_parents(list(3 = parents[3]))
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
@@ -3,26 +3,10 @@
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH|NORTH|WEST
|
||||
use_power = 1
|
||||
nodes = 3
|
||||
|
||||
var/obj/machinery/atmospherics/node1
|
||||
var/obj/machinery/atmospherics/node2
|
||||
var/obj/machinery/atmospherics/node3
|
||||
|
||||
var/datum/pipeline/parent1
|
||||
var/datum/pipeline/parent2
|
||||
var/datum/pipeline/parent3
|
||||
|
||||
var/datum/gas_mixture/air1
|
||||
var/datum/gas_mixture/air2
|
||||
var/datum/gas_mixture/air3
|
||||
node_amount = 3
|
||||
|
||||
var/flipped = 0
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/New()
|
||||
var/airs[] = ..()
|
||||
set_airs(airs)
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/SetInitDirections()
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
@@ -35,27 +19,12 @@
|
||||
initialize_directions = WEST|NORTH|EAST
|
||||
|
||||
/*
|
||||
Helpers //these all look kinda copypaste-y, but I'm not entirely certain how to get around that -duncathan
|
||||
Helpers
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/get_airs()
|
||||
return list(air1, air2, air3)
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/get_nodes()
|
||||
return list(node1, node2, node3)
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/get_parents()
|
||||
return list(parent1, parent2, parent3)
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/set_airs(var/list/L)
|
||||
var/datum/gas_mixture/a1 = L[1]
|
||||
var/datum/gas_mixture/a2 = L[2]
|
||||
var/datum/gas_mixture/a3 = L[3]
|
||||
|
||||
air1 = a1
|
||||
air2 = a2
|
||||
air3 = a3
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/update_airs(var/a1, var/a2, var/a3)
|
||||
..(list(1 = a1, 2 = a2, 3 = a3))
|
||||
/*
|
||||
/obj/machinery/atmospherics/components/trinary/set_nodes(var/list/L)
|
||||
var/obj/machinery/atmospherics/n1 = L[1]
|
||||
var/obj/machinery/atmospherics/n2 = L[2]
|
||||
@@ -64,25 +33,13 @@ Helpers //these all look kinda copypaste-y, but I'm not entirely certain how to
|
||||
node1 = n1
|
||||
node2 = n2
|
||||
node3 = n3
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/set_parents(var/list/L)
|
||||
var/datum/pipeline/p1 = L[1]
|
||||
var/datum/pipeline/p2 = L[2]
|
||||
var/datum/pipeline/p3 = L[3]
|
||||
|
||||
parent1 = p1
|
||||
parent2 = p2
|
||||
parent3 = p3
|
||||
|
||||
/*
|
||||
Housekeeping and pipe network stuff
|
||||
//WOW this got cut down thank you based OOP - duncathan
|
||||
*/
|
||||
/obj/machinery/atmospherics/components/trinary/Destroy()
|
||||
var/returns[] = ..()
|
||||
|
||||
set_nodes(returns[1])
|
||||
set_parents(returns[2])
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/atmosinit()
|
||||
|
||||
@@ -105,49 +62,18 @@ Housekeeping and pipe network stuff
|
||||
node1_connect = turn(node1_connect, 180)
|
||||
node3_connect = turn(node3_connect, 180)
|
||||
|
||||
//var/node_connects[] = list(nodes[node1]_connect, nodes[node2]_connect, nodes[node3]_connect)
|
||||
var/node_connects[] = list(1 = node1_connect, 2 = node2_connect, 3 = node3_connect)
|
||||
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
|
||||
/* for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
nodes[node1] = target
|
||||
nodes[1] = target
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
nodes[node2] = target
|
||||
nodes[2] = target
|
||||
break
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,node3_connect))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
nodes[node3] = target
|
||||
break
|
||||
..(/*node_connects*/)
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/construction()
|
||||
var/parents[] = ..()
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/build_network()
|
||||
var/parents[] = ..()
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/disconnect(obj/machinery/atmospherics/reference)
|
||||
var/parents[] = ..(reference)
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/nullifyPipenet(datum/pipeline/P)
|
||||
var/parents[] = ..(P)
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/setPipenet(datum/pipeline/P, obj/machinery/atmospherics/A)
|
||||
var/parents[] = ..(P, A)
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
|
||||
var/parents[] = ..(Old, New)
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/unsafe_pressure_release(var/mob/user, var/pressures)
|
||||
var/airs[] = ..(user, pressures)
|
||||
set_airs(airs)
|
||||
|
||||
//This sure looks like a lot of copypaste... It's already way better though, so it works for now
|
||||
//TODO: make it even more OOP - duncathan
|
||||
nodes[3] = target
|
||||
break */
|
||||
..(node_connects)
|
||||
@@ -69,6 +69,7 @@
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/interact(mob/user)
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
user.set_machine(src)
|
||||
var/temp_text = ""
|
||||
if(air_contents.temperature > (T0C - 20))
|
||||
@@ -193,6 +194,8 @@
|
||||
return interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/interact(mob/user)
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
user.set_machine(src)
|
||||
@@ -16,7 +16,7 @@
|
||||
if(showpipe)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/unary_devices.dmi', "scrub_cap", initialize_directions) //scrub_cap works for now
|
||||
|
||||
if(!node || !on || stat & (NOPOWER|BROKEN))
|
||||
if(!nodes[1] || !on || stat & (NOPOWER|BROKEN))
|
||||
icon_state = "cold_off"
|
||||
return
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
||||
var/old_temperature = air_contents.temperature
|
||||
@@ -36,7 +38,7 @@
|
||||
air_contents.temperature = combined_energy/combined_heat_capacity
|
||||
|
||||
//todo: have current temperature affected. require power to bring down current temperature again
|
||||
|
||||
update_airs(air_contents)
|
||||
if(abs(old_temperature-air_contents.temperature) > 1)
|
||||
parent.update = 1
|
||||
update_parents()
|
||||
return 1
|
||||
|
||||
@@ -47,11 +47,13 @@
|
||||
..()
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/process_atmos()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
|
||||
if(air_contents)
|
||||
temperature_archived = air_contents.temperature
|
||||
heat_gas_contents()
|
||||
if(abs(temperature_archived-air_contents.temperature) > 1)
|
||||
parent.update = 1
|
||||
update_parents()
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/process()
|
||||
..()
|
||||
@@ -60,14 +62,14 @@
|
||||
on = 0
|
||||
open_machine()
|
||||
playsound(src.loc, 'sound/machines/ding.ogg', 50, 1)
|
||||
if(!node || !is_operational())
|
||||
if(!nodes[1] || !is_operational())
|
||||
return
|
||||
|
||||
if(!on)
|
||||
updateDialog()
|
||||
return
|
||||
|
||||
if(air_contents)
|
||||
if(airs[1])
|
||||
if (occupant)
|
||||
process_occupant()
|
||||
expel_gas()
|
||||
@@ -144,6 +146,8 @@
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/get_ui_data()
|
||||
// this is the data which will be sent to the ui
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
|
||||
var/data = list()
|
||||
data["isOperating"] = on
|
||||
data["hasOccupant"] = occupant ? 1 : 0
|
||||
@@ -286,6 +290,7 @@
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/proc/process_occupant()
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
if(air_contents.total_moles() < 10)
|
||||
return
|
||||
if(occupant)
|
||||
@@ -293,7 +298,7 @@
|
||||
occupant.bodytemperature = T0C
|
||||
return
|
||||
occupant.bodytemperature += 2*(air_contents.temperature - occupant.bodytemperature) * current_heat_capacity / (current_heat_capacity + air_contents.heat_capacity())
|
||||
occupant.bodytemperature = max(occupant.bodytemperature, air_contents.temperature) // this is so ugly i'm sorry for doing it i'll fix it later i promise
|
||||
occupant.bodytemperature = max(occupant.bodytemperature, air_contents.temperature) // this is so ugly i'm sorry for doing it i'll fix it later i promise //TODO: fix someone else's broken promise - duncathan
|
||||
if(occupant.bodytemperature < T0C)
|
||||
// occupant.sleeping = max(5/efficiency, (1 / occupant.bodytemperature)*2000/efficiency)
|
||||
// occupant.Paralyse(max(5/efficiency, (1 / occupant.bodytemperature)*3000/efficiency))
|
||||
@@ -317,6 +322,8 @@
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/proc/heat_gas_contents()
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
|
||||
if(air_contents.total_moles() < 1)
|
||||
return
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
@@ -324,9 +331,12 @@
|
||||
if(combined_heat_capacity > 0)
|
||||
var/combined_energy = T20C * current_heat_capacity + air_heat_capacity * air_contents.temperature
|
||||
air_contents.temperature = combined_energy/combined_heat_capacity
|
||||
update_airs(air_contents)
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/proc/expel_gas()
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
|
||||
if(air_contents.total_moles() < 1)
|
||||
return
|
||||
var/datum/gas_mixture/expel_gas = new
|
||||
@@ -335,3 +345,4 @@
|
||||
expel_gas.temperature = T20C //Lets expel hot gas and see if that helps people not die as they are removed
|
||||
loc.assume_air(expel_gas)
|
||||
air_update_turf()
|
||||
update_airs(air_contents)
|
||||
@@ -9,7 +9,7 @@
|
||||
var/update_cycle
|
||||
|
||||
/obj/machinery/atmospherics/unary/generator_input/update_icon()
|
||||
if(node)
|
||||
if(nodes[1])
|
||||
icon_state = "intact"
|
||||
else
|
||||
icon_state = "exposed"
|
||||
@@ -17,4 +17,4 @@
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/generator_input/proc/return_exchange_air()
|
||||
return air_contents
|
||||
return airs[1]
|
||||
|
||||
@@ -11,8 +11,9 @@
|
||||
var/update_cycle
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_exchanger/update_icon()
|
||||
if(node)
|
||||
if(nodes[1])
|
||||
icon_state = "he_intact"
|
||||
var/obj/machinery/atmospherics/node = nodes[1]
|
||||
color = node.color
|
||||
else
|
||||
icon_state = "he_exposed"
|
||||
@@ -42,24 +43,30 @@
|
||||
update_cycle = SSair.times_fired
|
||||
partner.update_cycle = SSair.times_fired
|
||||
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
var/datum/gas_mixture/partner_air_contents = partner.airs[1]
|
||||
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
var/other_air_heat_capacity = partner.air_contents.heat_capacity()
|
||||
var/other_air_heat_capacity = partner_air_contents.heat_capacity()
|
||||
var/combined_heat_capacity = other_air_heat_capacity + air_heat_capacity
|
||||
|
||||
var/old_temperature = air_contents.temperature
|
||||
var/other_old_temperature = partner.air_contents.temperature
|
||||
var/other_old_temperature = partner_air_contents.temperature
|
||||
|
||||
if(combined_heat_capacity > 0)
|
||||
var/combined_energy = partner.air_contents.temperature*other_air_heat_capacity + air_heat_capacity*air_contents.temperature
|
||||
var/combined_energy = partner_air_contents.temperature*other_air_heat_capacity + air_heat_capacity*air_contents.temperature
|
||||
|
||||
var/new_temperature = combined_energy/combined_heat_capacity
|
||||
air_contents.temperature = new_temperature
|
||||
partner.air_contents.temperature = new_temperature
|
||||
partner_air_contents.temperature = new_temperature
|
||||
|
||||
if(abs(old_temperature-air_contents.temperature) > 1)
|
||||
parent.update = 1
|
||||
update_parents()
|
||||
|
||||
if(abs(other_old_temperature-partner.air_contents.temperature) > 1)
|
||||
partner.parent.update = 1
|
||||
if(abs(other_old_temperature-partner_air_contents.temperature) > 1)
|
||||
partner.update_parents()
|
||||
|
||||
update_airs(air_contents)
|
||||
partner.update_airs(partner_air_contents)
|
||||
|
||||
return 1
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
if(showpipe)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/unary_devices.dmi', "scrub_cap", initialize_directions) //scrub_cap works for now
|
||||
|
||||
if(!node || !on || stat & (NOPOWER|BROKEN))
|
||||
if(!nodes[1] || !on || stat & (NOPOWER|BROKEN))
|
||||
icon_state = "cold_off"
|
||||
return
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
|
||||
var/air_heat_capacity = air_contents.heat_capacity()
|
||||
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
||||
var/old_temperature = air_contents.temperature
|
||||
@@ -39,5 +42,6 @@
|
||||
//todo: have current temperature affected. require power to bring up current temperature again
|
||||
|
||||
if(abs(old_temperature-air_contents.temperature) > 1)
|
||||
parent.update = 1
|
||||
update_parents()
|
||||
update_airs(air_contents)
|
||||
return 1
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
on = 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/update_icon_nopipes()
|
||||
if(!node || !on || stat & (NOPOWER|BROKEN))
|
||||
if(!nodes[1] || !on || stat & (NOPOWER|BROKEN))
|
||||
icon_state = "inje_off"
|
||||
return
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
if(!on || stat & NOPOWER)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
|
||||
if(air_contents.temperature > 0)
|
||||
var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
|
||||
|
||||
@@ -53,7 +55,8 @@
|
||||
loc.assume_air(removed)
|
||||
air_update_turf()
|
||||
|
||||
parent.update = 1
|
||||
update_airs(air_contents)
|
||||
update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
@@ -61,6 +64,8 @@
|
||||
if(on || injecting)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
|
||||
injecting = 1
|
||||
|
||||
if(air_contents.temperature > 0)
|
||||
@@ -70,7 +75,8 @@
|
||||
|
||||
loc.assume_air(removed)
|
||||
|
||||
parent.update = 1
|
||||
update_airs(air_contents)
|
||||
update_parents()
|
||||
|
||||
flick("inje_inject", src)
|
||||
|
||||
@@ -126,6 +132,7 @@
|
||||
|
||||
if("set_volume_rate" in signal.data)
|
||||
var/number = text2num(signal.data["set_volume_rate"])
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
volume_rate = Clamp(number, 0, air_contents.volume)
|
||||
|
||||
if("status" in signal.data)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
if(showpipe)
|
||||
overlays += getpipeimage('icons/obj/atmospherics/unary_devices.dmi', "scrub_cap", initialize_directions) //it works for now
|
||||
|
||||
if(!node || !on || stat & BROKEN)
|
||||
if(!nodes[1] || !on || stat & BROKEN)
|
||||
icon_state = "o2gen_off"
|
||||
return
|
||||
|
||||
@@ -27,14 +27,16 @@
|
||||
|
||||
/obj/machinery/atmospherics/unary/oxygen_generator/New()
|
||||
..()
|
||||
|
||||
air_contents.volume = 50
|
||||
var/datum/gas_mixture/air_contents = airs[1] ; air_contents.volume = 50
|
||||
airs[1] = air_contents
|
||||
|
||||
/obj/machinery/atmospherics/unary/oxygen_generator/process_atmos()
|
||||
..()
|
||||
if(!on)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
|
||||
var/total_moles = air_contents.total_moles()
|
||||
|
||||
if(total_moles < oxygen_content)
|
||||
@@ -45,6 +47,7 @@
|
||||
air_contents.temperature = (current_heat_capacity*air_contents.temperature + 20*added_oxygen*T0C)/(current_heat_capacity+20*added_oxygen)
|
||||
air_contents.oxygen += added_oxygen
|
||||
|
||||
parent.update = 1
|
||||
update_airs(air_contents)
|
||||
update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/obj/machinery/atmospherics/unary/portables_connector
|
||||
/obj/machinery/atmospherics/components/unary/portables_connector
|
||||
name = "connector port"
|
||||
desc = "For connecting portables devices related to atmospherics control."
|
||||
icon = 'icons/obj/atmospherics/unary_devices.dmi'
|
||||
@@ -8,40 +8,27 @@
|
||||
use_power = 0
|
||||
level = 0
|
||||
|
||||
/obj/machinery/atmospherics/unary/portables_connector/visible
|
||||
/obj/machinery/atmospherics/components/unary/portables_connector/visible
|
||||
level = 2
|
||||
|
||||
/obj/machinery/atmospherics/unary/portables_connector/update_icon()
|
||||
icon_state = "connector"
|
||||
underlays.Cut()
|
||||
if(showpipe)
|
||||
var/state
|
||||
var/col
|
||||
if(node)
|
||||
state = "pipe_intact"
|
||||
col = node.pipe_color
|
||||
else
|
||||
state = "pipe_exposed"
|
||||
underlays += getpipeimage('icons/obj/atmospherics/binary_devices.dmi', state, initialize_directions, col)
|
||||
|
||||
/obj/machinery/atmospherics/unary/portables_connector/process_atmos()
|
||||
/obj/machinery/atmospherics/components/unary/portables_connector/process_atmos()
|
||||
if(!connected_device)
|
||||
return
|
||||
parent.update = 1
|
||||
update_parents()
|
||||
|
||||
/obj/machinery/atmospherics/unary/portables_connector/Destroy()
|
||||
/obj/machinery/atmospherics/components/unary/portables_connector/Destroy()
|
||||
if(connected_device)
|
||||
connected_device.disconnect()
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/unary/portables_connector/attackby(obj/item/weapon/W, mob/user, params)
|
||||
/obj/machinery/atmospherics/components/unary/portables_connector/attackby(obj/item/weapon/W, mob/user, params)
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
if(connected_device)
|
||||
user << "<span class='warning'>You cannot unwrench this [src], dettach [connected_device] first!</span>"
|
||||
return 1
|
||||
return ..()
|
||||
|
||||
/obj/machinery/atmospherics/unary/portables_connector/portableConnectorReturnAir()
|
||||
/obj/machinery/atmospherics/components/unary/portables_connector/portableConnectorReturnAir()
|
||||
return connected_device.portableConnectorReturnAir()
|
||||
|
||||
/obj/proc/portableConnectorReturnAir()
|
||||
|
||||
+26
-26
@@ -1,4 +1,4 @@
|
||||
/obj/machinery/atmospherics/unary/tank
|
||||
/obj/machinery/atmospherics/components/unary/tank
|
||||
icon = 'icons/obj/atmospherics/pipes/pressure_tank.dmi'
|
||||
icon_state = "generic"
|
||||
name = "pressure tank"
|
||||
@@ -6,76 +6,76 @@
|
||||
var/volume = 10000 //in liters, 1 meters by 1 meters by 2 meters
|
||||
density = 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/update_icon()
|
||||
underlays.Cut()
|
||||
if(showpipe)
|
||||
var/state
|
||||
var/col
|
||||
if(node)
|
||||
state = "pipe_intact"
|
||||
col = node.pipe_color
|
||||
else
|
||||
state = "pipe_exposed"
|
||||
underlays += getpipeimage('icons/obj/atmospherics/pipes/pressure_tank.dmi', state, initialize_directions, col)
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/carbon_dioxide
|
||||
/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide
|
||||
name = "pressure tank (Carbon Dioxide)"
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/carbon_dioxide/New()
|
||||
/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
air_contents.volume = volume
|
||||
air_contents.temperature = T20C
|
||||
air_contents.carbon_dioxide = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
update_airs(air_contents)
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/toxins
|
||||
/obj/machinery/atmospherics/components/unary/tank/toxins
|
||||
icon_state = "orange"
|
||||
name = "pressure tank (Plasma)"
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/toxins/New()
|
||||
/obj/machinery/atmospherics/components/unary/tank/toxins/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
air_contents.volume = volume
|
||||
air_contents.temperature = T20C
|
||||
air_contents.toxins = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
update_airs(air_contents)
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/oxygen_agent_b
|
||||
/obj/machinery/atmospherics/components/unary/tank/oxygen_agent_b
|
||||
icon_state = "orange_2"
|
||||
name = "pressure tank (Oxygen + Plasma)"
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/oxygen_agent_b/New()
|
||||
/obj/machinery/atmospherics/components/unary/tank/oxygen_agent_b/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
air_contents.volume = volume
|
||||
air_contents.temperature = T0C
|
||||
var/datum/gas/oxygen_agent_b/trace_gas = new
|
||||
trace_gas.moles = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.trace_gases += trace_gas
|
||||
update_airs(air_contents)
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/oxygen
|
||||
/obj/machinery/atmospherics/components/unary/tank/oxygen
|
||||
icon_state = "blue"
|
||||
name = "pressure tank (Oxygen)"
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/oxygen/New()
|
||||
/obj/machinery/atmospherics/components/unary/tank/oxygen/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
air_contents.volume = volume
|
||||
air_contents.temperature = T20C
|
||||
air_contents.oxygen = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
update_airs(air_contents)
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/nitrogen
|
||||
/obj/machinery/atmospherics/components/unary/tank/nitrogen
|
||||
icon_state = "red"
|
||||
name = "pressure tank (Nitrogen)"
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/nitrogen/New()
|
||||
/obj/machinery/atmospherics/components/unary/tank/nitrogen/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
air_contents.volume = volume
|
||||
air_contents.temperature = T20C
|
||||
air_contents.nitrogen = (25*ONE_ATMOSPHERE)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
update_airs(air_contents)
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/air
|
||||
/obj/machinery/atmospherics/components/unary/tank/air
|
||||
icon_state = "grey"
|
||||
name = "pressure tank (Air)"
|
||||
|
||||
/obj/machinery/atmospherics/unary/tank/air/New()
|
||||
/obj/machinery/atmospherics/components/unary/tank/air/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
air_contents.volume = volume
|
||||
air_contents.temperature = T20C
|
||||
air_contents.oxygen = (25*ONE_ATMOSPHERE*O2STANDARD)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.nitrogen = (25*ONE_ATMOSPHERE*N2STANDARD)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
air_contents.nitrogen = (25*ONE_ATMOSPHERE*N2STANDARD)*(air_contents.volume)/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
|
||||
update_airs(air_contents)
|
||||
@@ -3,14 +3,7 @@
|
||||
dir = SOUTH
|
||||
initialize_directions = SOUTH
|
||||
layer = TURF_LAYER+0.1
|
||||
nodes = 1
|
||||
|
||||
var/datum/gas_mixture/air_contents
|
||||
var/obj/machinery/atmospherics/node
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/New()
|
||||
var/airs[] = ..()
|
||||
set_airs(airs)
|
||||
node_amount = 1
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/SetInitDirections()
|
||||
initialize_directions = dir
|
||||
@@ -27,82 +20,36 @@ Iconnery
|
||||
Helpers
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/get_airs()
|
||||
return list(air_contents)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/get_nodes()
|
||||
return list(node)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/get_parents()
|
||||
return list(parent)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/set_airs(var/list/L)
|
||||
var/datum/gas_mixture/a1 = L[1]
|
||||
air_contents = a1
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/set_nodes(var/list/L)
|
||||
var/obj/machinery/atmospherics/n1 = L[1]
|
||||
node = n1
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/set_parents(var/list/L)
|
||||
var/datum/pipeline/p1 = L[1]
|
||||
parent = p1
|
||||
/obj/machinery/atmospherics/components/unary/update_airs(var/a1)
|
||||
..(list(1 = a1))
|
||||
|
||||
/*
|
||||
Housekeeping and pipe network stuff below
|
||||
*/
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/atmosinit()
|
||||
//var/node_connects = list(dir)
|
||||
for(var/obj/machinery/atmospherics/target in get_step(src,dir))
|
||||
var/node_connects = list(1 = dir)
|
||||
/*for(var/obj/machinery/atmospherics/target in get_step(src,dir))
|
||||
if(target.initialize_directions & get_dir(target,src))
|
||||
node = target
|
||||
break
|
||||
..(/*node_connects*/)
|
||||
nodes[1] = target
|
||||
break*/
|
||||
..(node_connects)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/default_change_direction_wrench(mob/user, obj/item/weapon/wrench/W)
|
||||
if(..())
|
||||
initialize_directions = dir
|
||||
if(node)
|
||||
node.disconnect(src)
|
||||
node = null
|
||||
nullifyPipenet(parent)
|
||||
atmosinit()
|
||||
initialize()
|
||||
if(node)
|
||||
node.atmosinit()
|
||||
node.initialize()
|
||||
node.addMember(src)
|
||||
build_network()
|
||||
. = 1
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/construction()
|
||||
var/parents[] = ..()
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/build_network()
|
||||
var/parents[] = ..()
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/disconnect(obj/machinery/atmospherics/reference)
|
||||
var/parents[] = ..(reference)
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/nullifyPipenet(datum/pipeline/P)
|
||||
var/parents[] = ..(P)
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/setPipenet(datum/pipeline/P, obj/machinery/atmospherics/A)
|
||||
var/parents[] = ..(P, A)
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
|
||||
var/parents[] = ..(Old, New)
|
||||
set_parents(parents)
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/unsafe_pressure_release(var/mob/user, var/pressures)
|
||||
var/airs[] = ..(user, pressures)
|
||||
set_airs(airs)
|
||||
|
||||
//This sure looks like a lot of copypaste... It's already way better though, so it works for now
|
||||
//TODO: make it even more OOP - duncathan
|
||||
return 0
|
||||
initialize_directions = dir
|
||||
var/obj/machinery/atmospherics/node = nodes[1]
|
||||
if(node)
|
||||
node.disconnect(src)
|
||||
node = null
|
||||
nullifyPipenet(parent)
|
||||
atmosinit()
|
||||
initialize()
|
||||
if(node)
|
||||
node.atmosinit()
|
||||
node.initialize()
|
||||
node.addMember(src)
|
||||
build_network()
|
||||
. = 1
|
||||
nodes[1] = node
|
||||
@@ -65,7 +65,9 @@
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/high_volume/New()
|
||||
..()
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
air_contents.volume = 1000
|
||||
update_airs(air_contents)
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/update_icon_nopipes()
|
||||
overlays.Cut()
|
||||
@@ -76,7 +78,7 @@
|
||||
icon_state = "vent_welded"
|
||||
return
|
||||
|
||||
if(!node || !on || stat & (NOPOWER|BROKEN))
|
||||
if(!nodes[1] || !on || stat & (NOPOWER|BROKEN))
|
||||
icon_state = "vent_off"
|
||||
return
|
||||
|
||||
@@ -89,7 +91,7 @@
|
||||
..()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if (!node)
|
||||
if (!nodes[1])
|
||||
on = 0
|
||||
//broadcast_status() // from now air alarm/control computer should request update purposely --rastaf0
|
||||
if(!on)
|
||||
@@ -98,6 +100,7 @@
|
||||
if(welded)
|
||||
return 0
|
||||
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
var/environment_pressure = environment.return_pressure()
|
||||
|
||||
@@ -118,8 +121,6 @@
|
||||
loc.assume_air(removed)
|
||||
air_update_turf()
|
||||
|
||||
parent.update = 1
|
||||
|
||||
else //external -> internal
|
||||
var/pressure_delta = 10000
|
||||
if(pressure_checks&1)
|
||||
@@ -137,8 +138,8 @@
|
||||
|
||||
air_contents.merge(removed)
|
||||
air_update_turf()
|
||||
|
||||
parent.update = 1
|
||||
update_airs(air_contents)
|
||||
update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
icon_state = "scrub_welded"
|
||||
return
|
||||
|
||||
if(!node || !on || stat & (NOPOWER|BROKEN))
|
||||
if(!nodes[1] || !on || stat & (NOPOWER|BROKEN))
|
||||
icon_state = "scrub_off"
|
||||
return
|
||||
|
||||
@@ -114,13 +114,13 @@
|
||||
..()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if (!node)
|
||||
if (!nodes[1])
|
||||
on = 0
|
||||
//broadcast_status()
|
||||
if(!on || welded)
|
||||
return 0
|
||||
|
||||
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
|
||||
if(scrubbing)
|
||||
@@ -158,8 +158,6 @@
|
||||
loc.assume_air(removed)
|
||||
air_update_turf()
|
||||
|
||||
parent.update = 1
|
||||
|
||||
else //Just siphoning all air
|
||||
if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE)
|
||||
return
|
||||
@@ -171,7 +169,8 @@
|
||||
air_contents.merge(removed)
|
||||
air_update_turf()
|
||||
|
||||
parent.update = 1
|
||||
update_airs(air_contents)
|
||||
update_parents()
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
@@ -207,8 +207,8 @@ var/pipenetwarnings = 10
|
||||
GL += P.other_airs
|
||||
for(var/obj/machinery/atmospherics/binary/valve/V in P.other_atmosmch)
|
||||
if(V.open)
|
||||
PL |= V.parent1
|
||||
PL |= V.parent2
|
||||
PL |= V.parents[1]
|
||||
PL |= V.parents[2]
|
||||
for(var/obj/machinery/atmospherics/unary/portables_connector/C in P.other_atmosmch)
|
||||
if(C.connected_device)
|
||||
GL += C.portableConnectorReturnAir()
|
||||
|
||||
@@ -824,11 +824,12 @@ Sorry Giacom. Please don't be mad :(
|
||||
|
||||
else if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell))
|
||||
var/obj/machinery/atmospherics/unary/cryo_cell/C = loc
|
||||
var/datum/gas_mixture/C_air_contents = C.airs[1]
|
||||
|
||||
if(C.air_contents.total_moles() < 10)
|
||||
if(C_air_contents.total_moles() < 10)
|
||||
loc_temp = environment.temperature
|
||||
else
|
||||
loc_temp = C.air_contents.temperature
|
||||
loc_temp = C_air_contents.temperature
|
||||
|
||||
else
|
||||
loc_temp = environment.temperature
|
||||
|
||||
@@ -106,10 +106,14 @@
|
||||
// update icon overlays only if displayed level has changed
|
||||
|
||||
if(hot_air)
|
||||
circ2.air1.merge(hot_air)
|
||||
var/datum/gas_mixture/circ2_air1 = circ2.airs[1]
|
||||
circ2_air1.merge(hot_air)
|
||||
circ2.update_airs(circ2_air1)
|
||||
|
||||
if(cold_air)
|
||||
circ1.air1.merge(cold_air)
|
||||
var/datum/gas_mixture/circ1_air1 = circ1.airs[1]
|
||||
circ1_air1.merge(cold_air)
|
||||
circ1.update_airs(circ1_air1)
|
||||
|
||||
var/genlev = max(0, min( round(11*lastgen / 100000), 11))
|
||||
var/circ = "[circ1 && circ1.last_pressure_delta > 0 ? "1" : "0"][circ2 && circ2.last_pressure_delta > 0 ? "1" : "0"]"
|
||||
@@ -131,6 +135,10 @@
|
||||
if(!powernet)
|
||||
t += "<span class='bad'>Unable to connect to the power network!</span>"
|
||||
else if(circ1 && circ2)
|
||||
var/datum/gas_mixture/circ1_air1 = circ1.airs[1]
|
||||
var/datum/gas_mixture/circ1_air2 = circ1.airs[2]
|
||||
var/datum/gas_mixture/circ2_air1 = circ2.airs[1]
|
||||
var/datum/gas_mixture/circ2_air2 = circ2.airs[2]
|
||||
|
||||
t += "<div class='statusDisplay'>"
|
||||
|
||||
@@ -139,12 +147,12 @@
|
||||
t += "<BR>"
|
||||
|
||||
t += "<B><font color='blue'>Cold loop</font></B><BR>"
|
||||
t += "Temperature Inlet: [round(circ1.air2.temperature, 0.1)] K / Outlet: [round(circ1.air1.temperature, 0.1)] K<BR>"
|
||||
t += "Pressure Inlet: [round(circ1.air2.return_pressure(), 0.1)] kPa / Outlet: [round(circ1.air1.return_pressure(), 0.1)] kPa<BR>"
|
||||
t += "Temperature Inlet: [round(circ1_air2.temperature, 0.1)] K / Outlet: [round(circ1_air1.temperature, 0.1)] K<BR>"
|
||||
t += "Pressure Inlet: [round(circ1_air2.return_pressure(), 0.1)] kPa / Outlet: [round(circ1_air1.return_pressure(), 0.1)] kPa<BR>"
|
||||
|
||||
t += "<B><font color='red'>Hot loop</font></B><BR>"
|
||||
t += "Temperature Inlet: [round(circ2.air2.temperature, 0.1)] K / Outlet: [round(circ2.air1.temperature, 0.1)] K<BR>"
|
||||
t += "Pressure Inlet: [round(circ2.air2.return_pressure(), 0.1)] kPa / Outlet: [round(circ2.air1.return_pressure(), 0.1)] kPa<BR>"
|
||||
t += "Temperature Inlet: [round(circ2_air2.temperature, 0.1)] K / Outlet: [round(circ2_air1.temperature, 0.1)] K<BR>"
|
||||
t += "Pressure Inlet: [round(circ2_air2.return_pressure(), 0.1)] kPa / Outlet: [round(circ2_air1.return_pressure(), 0.1)] kPa<BR>"
|
||||
|
||||
t += "</div>"
|
||||
else
|
||||
|
||||
+3
-3
@@ -105,12 +105,15 @@
|
||||
#include "code\ATMOSPHERICS\components\trinary_devices\mixer.dm"
|
||||
#include "code\ATMOSPHERICS\components\trinary_devices\trinary_base.dm"
|
||||
#include "code\ATMOSPHERICS\components\unary_devices\cold_sink.dm"
|
||||
#include "code\ATMOSPHERICS\components\unary_devices\cryo.dm"
|
||||
#include "code\ATMOSPHERICS\components\unary_devices\Freezer.dm"
|
||||
#include "code\ATMOSPHERICS\components\unary_devices\generator_input.dm"
|
||||
#include "code\ATMOSPHERICS\components\unary_devices\heat_exchanger.dm"
|
||||
#include "code\ATMOSPHERICS\components\unary_devices\heat_source.dm"
|
||||
#include "code\ATMOSPHERICS\components\unary_devices\outlet_injector.dm"
|
||||
#include "code\ATMOSPHERICS\components\unary_devices\oxygen_generator.dm"
|
||||
#include "code\ATMOSPHERICS\components\unary_devices\portables_connector.dm"
|
||||
#include "code\ATMOSPHERICS\components\unary_devices\tank.dm"
|
||||
#include "code\ATMOSPHERICS\components\unary_devices\unary_base.dm"
|
||||
#include "code\ATMOSPHERICS\components\unary_devices\vent_pump.dm"
|
||||
#include "code\ATMOSPHERICS\components\unary_devices\vent_scrubber.dm"
|
||||
@@ -119,7 +122,6 @@
|
||||
#include "code\ATMOSPHERICS\pipes\manifold4w.dm"
|
||||
#include "code\ATMOSPHERICS\pipes\pipes.dm"
|
||||
#include "code\ATMOSPHERICS\pipes\simple.dm"
|
||||
#include "code\ATMOSPHERICS\pipes\tank.dm"
|
||||
#include "code\controllers\configuration.dm"
|
||||
#include "code\controllers\failsafe.dm"
|
||||
#include "code\controllers\master_controller.dm"
|
||||
@@ -384,13 +386,11 @@
|
||||
#include "code\game\machinery\cell_charger.dm"
|
||||
#include "code\game\machinery\cloning.dm"
|
||||
#include "code\game\machinery\constructable_frame.dm"
|
||||
#include "code\game\machinery\cryo.dm"
|
||||
#include "code\game\machinery\deployable.dm"
|
||||
#include "code\game\machinery\door_control.dm"
|
||||
#include "code\game\machinery\doppler_array.dm"
|
||||
#include "code\game\machinery\droneDispenser.dm"
|
||||
#include "code\game\machinery\flasher.dm"
|
||||
#include "code\game\machinery\Freezer.dm"
|
||||
#include "code\game\machinery\hologram.dm"
|
||||
#include "code\game\machinery\igniter.dm"
|
||||
#include "code\game\machinery\iv_drip.dm"
|
||||
|
||||
Reference in New Issue
Block a user