mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 06:29:23 +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)
|
||||
@@ -0,0 +1,252 @@
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer
|
||||
name = "freezer"
|
||||
icon = 'icons/obj/Cryogenic2.dmi'
|
||||
icon_state = "freezer"
|
||||
density = 1
|
||||
var/min_temperature = 0
|
||||
anchored = 1.0
|
||||
use_power = 1
|
||||
current_heat_capacity = 1000
|
||||
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/New()
|
||||
..()
|
||||
initialize_directions = dir
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/weapon/circuitboard/thermomachine(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/micro_laser(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/micro_laser(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
|
||||
component_parts += new /obj/item/stack/cable_coil(null, 1)
|
||||
RefreshParts()
|
||||
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/construction()
|
||||
..(dir,dir)
|
||||
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/RefreshParts()
|
||||
var/H
|
||||
var/T
|
||||
for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts)
|
||||
H += M.rating
|
||||
for(var/obj/item/weapon/stock_parts/micro_laser/M in component_parts)
|
||||
T += M.rating
|
||||
min_temperature = max(T0C - (170 + (T*15)), 1)
|
||||
current_heat_capacity = 1000 * ((H - 1) ** 2)
|
||||
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/attackby(obj/item/I, mob/user, params)
|
||||
if(default_deconstruction_screwdriver(user, "freezer-o", "freezer", I))
|
||||
on = 0
|
||||
update_icon()
|
||||
return
|
||||
|
||||
if(exchange_parts(user, I))
|
||||
return
|
||||
|
||||
default_deconstruction_crowbar(I)
|
||||
|
||||
if(default_change_direction_wrench(user, I))
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/update_icon()
|
||||
if(panel_open)
|
||||
icon_state = "freezer-o"
|
||||
else if(src.on)
|
||||
icon_state = "freezer_1"
|
||||
else
|
||||
icon_state = "freezer"
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/attack_ai(mob/user as mob)
|
||||
return interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/attack_paw(mob/user as mob)
|
||||
return interact(user)
|
||||
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/attack_hand(mob/user as mob)
|
||||
return interact(user)
|
||||
|
||||
/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))
|
||||
temp_text = "<span class='bad'>[air_contents.temperature]</span>"
|
||||
else if(air_contents.temperature < (T0C - 20) && air_contents.temperature > (T0C - 100))
|
||||
temp_text = "<span class='average'>[air_contents.temperature]</span>"
|
||||
else
|
||||
temp_text = "<span class='good'>[air_contents.temperature]</span>"
|
||||
|
||||
var/dat = {"
|
||||
Current Status: [ on ? "<A href='?src=\ref[src];start=1'>Off</A> <span class='linkOn'>On</span>" : "<span class='linkOn'>Off</span> <A href='?src=\ref[src];start=1'>On</A>"]<BR>
|
||||
Current Gas Temperature: [temp_text]<BR>
|
||||
Current Air Pressure: [air_contents.return_pressure()]<BR>
|
||||
Target Gas Temperature: <A href='?src=\ref[src];temp=-100'>-</A> <A href='?src=\ref[src];temp=-10'>-</A> <A href='?src=\ref[src];temp=-1'>-</A> [current_temperature] <A href='?src=\ref[src];temp=1'>+</A> <A href='?src=\ref[src];temp=10'>+</A> <A href='?src=\ref[src];temp=100'>+</A><BR>
|
||||
"}
|
||||
|
||||
//user << browse(dat, "window=freezer;size=400x500")
|
||||
//onclose(user, "freezer")
|
||||
var/datum/browser/popup = new(user, "freezer", "Cryo Gas Cooling System", 400, 240) // Set up the popup browser window
|
||||
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.set_machine(src)
|
||||
if (href_list["start"])
|
||||
src.on = !src.on
|
||||
use_power = 1 + src.on
|
||||
update_icon()
|
||||
if(href_list["temp"])
|
||||
var/amount = text2num(href_list["temp"])
|
||||
if(amount > 0)
|
||||
src.current_temperature = min(T20C, src.current_temperature+amount)
|
||||
else
|
||||
src.current_temperature = max(min_temperature, src.current_temperature+amount)
|
||||
active_power_usage = (current_heat_capacity * (T20C - current_temperature) / 100) + idle_power_usage
|
||||
src.updateUsrDialog()
|
||||
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/process()
|
||||
..()
|
||||
src.updateUsrDialog()
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/cold_sink/freezer/power_change()
|
||||
..()
|
||||
if(stat & NOPOWER)
|
||||
on = 0
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/
|
||||
name = "heater"
|
||||
icon = 'icons/obj/Cryogenic2.dmi'
|
||||
icon_state = "heater"
|
||||
density = 1
|
||||
var/max_temperature = 0
|
||||
anchored = 1.0
|
||||
|
||||
current_heat_capacity = 1000
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/New()
|
||||
..()
|
||||
initialize_directions = dir
|
||||
var/obj/item/weapon/circuitboard/thermomachine/H = new /obj/item/weapon/circuitboard/thermomachine(null)
|
||||
H.build_path = /obj/machinery/atmospherics/unary/heat_reservoir/heater
|
||||
H.name = "circuit board (Heater)"
|
||||
component_parts = list()
|
||||
component_parts += H
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/micro_laser(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/micro_laser(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
|
||||
component_parts += new /obj/item/stack/cable_coil(null, 1)
|
||||
RefreshParts()
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/construction()
|
||||
..(dir,dir)
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/RefreshParts()
|
||||
var/H
|
||||
var/T
|
||||
for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts)
|
||||
H += M.rating
|
||||
for(var/obj/item/weapon/stock_parts/micro_laser/M in component_parts)
|
||||
T += M.rating
|
||||
max_temperature = T20C + (140 * T)
|
||||
current_heat_capacity = 1000 * ((H - 1) ** 2)
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/attackby(obj/item/I, mob/user, params)
|
||||
if(default_deconstruction_screwdriver(user, "heater-o", "heater", I))
|
||||
on = 0
|
||||
update_icon()
|
||||
return
|
||||
|
||||
if(exchange_parts(user, I))
|
||||
return
|
||||
|
||||
default_deconstruction_crowbar(I)
|
||||
|
||||
if(default_change_direction_wrench(user, I))
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/update_icon()
|
||||
if(panel_open)
|
||||
icon_state = "heater-o"
|
||||
else if(src.on)
|
||||
icon_state = "heater_1"
|
||||
else
|
||||
icon_state = "heater"
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/attack_ai(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/attack_paw(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/attack_hand(mob/user as mob)
|
||||
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)
|
||||
var/temp_text = ""
|
||||
if(air_contents.temperature < (T20C + 80))
|
||||
temp_text = "<span class='good'>[air_contents.temperature]</span>"
|
||||
else if(air_contents.temperature > (T20C + 80) && air_contents.temperature < (T20C + 180))
|
||||
temp_text = "<span class='average'>[air_contents.temperature]</span>"
|
||||
else
|
||||
temp_text = "<span class='bad'>[air_contents.temperature]</span>"
|
||||
|
||||
var/dat = {"
|
||||
Current Status: [ on ? "<A href='?src=\ref[src];start=1'>Off</A> <span class='linkOn'>On</span>" : "<span class='linkOn'>Off</span> <A href='?src=\ref[src];start=1'>On</A>"]<BR>
|
||||
Current Gas Temperature: [temp_text]<BR>
|
||||
Current Air Pressure: [air_contents.return_pressure()]<BR>
|
||||
Target Gas Temperature: <A href='?src=\ref[src];temp=-100'>-</A> <A href='?src=\ref[src];temp=-10'>-</A> <A href='?src=\ref[src];temp=-1'>-</A> [current_temperature] <A href='?src=\ref[src];temp=1'>+</A> <A href='?src=\ref[src];temp=10'>+</A> <A href='?src=\ref[src];temp=100'>+</A><BR>
|
||||
"}
|
||||
|
||||
//user << browse(dat, "window=freezer;size=400x500")
|
||||
//onclose(user, "freezer")
|
||||
var/datum/browser/popup = new(user, "freezer", "Pyro Gas Heating System", 400, 240) // Set up the popup browser window
|
||||
|
||||
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.set_machine(src)
|
||||
if (href_list["start"])
|
||||
src.on = !src.on
|
||||
use_power = 1 + src.on
|
||||
update_icon()
|
||||
if(href_list["temp"])
|
||||
var/amount = text2num(href_list["temp"])
|
||||
if(amount > 0)
|
||||
src.current_temperature = min((max_temperature), src.current_temperature+amount)
|
||||
else
|
||||
src.current_temperature = max(T20C, src.current_temperature+amount)
|
||||
active_power_usage = (current_heat_capacity * (current_temperature - T20C) / 100) + idle_power_usage
|
||||
src.updateUsrDialog()
|
||||
src.add_fingerprint(usr)
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/process()
|
||||
..()
|
||||
src.updateUsrDialog()
|
||||
|
||||
/obj/machinery/atmospherics/unary/heat_reservoir/heater/power_change()
|
||||
..()
|
||||
if(stat & NOPOWER)
|
||||
on = 0
|
||||
update_icon()
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,348 @@
|
||||
/obj/machinery/atmospherics/unary/cryo_cell
|
||||
name = "cryo cell"
|
||||
icon = 'icons/obj/cryogenics.dmi'
|
||||
icon_state = "cell-off"
|
||||
density = 1
|
||||
anchored = 1.0
|
||||
layer = 4
|
||||
|
||||
var/on = 0
|
||||
var/temperature_archived
|
||||
var/obj/item/weapon/reagent_containers/beaker = null
|
||||
var/next_trans = 0
|
||||
var/current_heat_capacity = 50
|
||||
state_open = 0
|
||||
var/efficiency
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/New()
|
||||
..()
|
||||
initialize_directions = dir
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/weapon/circuitboard/cryo_tube(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
|
||||
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
|
||||
component_parts += new /obj/item/stack/cable_coil(null, 1)
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/construction()
|
||||
..(dir,dir)
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/RefreshParts()
|
||||
var/C
|
||||
for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts)
|
||||
C += M.rating
|
||||
current_heat_capacity = 50 * C
|
||||
efficiency = C
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/Destroy()
|
||||
var/turf/T = loc
|
||||
T.contents += contents
|
||||
|
||||
if(beaker)
|
||||
beaker.loc = get_step(loc, SOUTH) //Beaker is carefully ejected from the wreckage of the cryotube
|
||||
beaker = null
|
||||
..()
|
||||
/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)
|
||||
update_parents()
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/process()
|
||||
..()
|
||||
if(occupant)
|
||||
if(occupant.health >= 100)
|
||||
on = 0
|
||||
open_machine()
|
||||
playsound(src.loc, 'sound/machines/ding.ogg', 50, 1)
|
||||
if(!nodes[1] || !is_operational())
|
||||
return
|
||||
|
||||
if(!on)
|
||||
updateDialog()
|
||||
return
|
||||
|
||||
if(airs[1])
|
||||
if (occupant)
|
||||
process_occupant()
|
||||
expel_gas()
|
||||
|
||||
updateDialog()
|
||||
return 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/MouseDrop_T(mob/target, mob/user)
|
||||
if(user.stat || user.lying || !Adjacent(user) || !target.Adjacent(user) || !iscarbon(target))
|
||||
return
|
||||
close_machine(target)
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/relaymove(var/mob/user)
|
||||
open_machine()
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/container_resist()
|
||||
open_machine()
|
||||
return
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/verb/move_eject()
|
||||
set name = "Eject Cryo Cell"
|
||||
set desc = "Begin the release sequence inside the cryo tube."
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
if(usr == occupant || contents.Find(usr)) //If the user is inside the tube...
|
||||
if(usr.stat == DEAD) //and he's not dead....
|
||||
return
|
||||
usr << "<span class='notice'>Release sequence activated. This will take about a minute.</span>"
|
||||
sleep(600)
|
||||
if(!src || !usr || (!occupant && !contents.Find(usr))) //Check if someone's released/replaced/bombed him already
|
||||
return
|
||||
open_machine()
|
||||
add_fingerprint(usr)
|
||||
else
|
||||
if(!istype(usr, /mob/living) || usr.stat)
|
||||
usr << "<span class='warning'>You can't do that!</span>"
|
||||
return
|
||||
open_machine()
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/examine(mob/user)
|
||||
..()
|
||||
|
||||
var/list/otherstuff = contents - beaker
|
||||
if(otherstuff.len > 0)
|
||||
user << "You can just about make out some loose objects floating in the murk:"
|
||||
for(var/atom/movable/floater in otherstuff)
|
||||
user << "\icon[floater] [floater.name]"
|
||||
else
|
||||
user << "Seems empty."
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/attack_hand(mob/user)
|
||||
if(..())
|
||||
return
|
||||
|
||||
ui_interact(user)
|
||||
|
||||
|
||||
/**
|
||||
* The ui_interact proc is used to open and update Nano UIs
|
||||
* If ui_interact is not used then the UI will not update correctly
|
||||
* ui_interact is currently defined for /atom/movable
|
||||
*
|
||||
* @param user /mob The mob who is interacting with this ui
|
||||
* @param ui_key string A string key to use for this ui. Allows for multiple unique uis on one obj/mob (defaut value "main")
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
if(user == occupant || user.stat || panel_open)
|
||||
return
|
||||
|
||||
ui = SSnano.push_open_or_new_ui(user, src, ui_key, ui, "cryo.tmpl", "Cryo Cell Control System", 520, 410, 1)
|
||||
//user.set_machine(src)
|
||||
|
||||
/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
|
||||
|
||||
var/occupantData = list()
|
||||
if (!occupant)
|
||||
occupantData["name"] = null
|
||||
occupantData["stat"] = null
|
||||
occupantData["health"] = null
|
||||
occupantData["maxHealth"] = null
|
||||
occupantData["minHealth"] = null
|
||||
occupantData["bruteLoss"] = null
|
||||
occupantData["oxyLoss"] = null
|
||||
occupantData["toxLoss"] = null
|
||||
occupantData["fireLoss"] = null
|
||||
occupantData["bodyTemperature"] = null
|
||||
else
|
||||
occupantData["name"] = occupant.name
|
||||
occupantData["stat"] = occupant.stat
|
||||
occupantData["health"] = occupant.health
|
||||
occupantData["maxHealth"] = occupant.maxHealth
|
||||
occupantData["minHealth"] = config.health_threshold_dead
|
||||
occupantData["bruteLoss"] = occupant.getBruteLoss()
|
||||
occupantData["oxyLoss"] = occupant.getOxyLoss()
|
||||
occupantData["toxLoss"] = occupant.getToxLoss()
|
||||
occupantData["fireLoss"] = occupant.getFireLoss()
|
||||
occupantData["bodyTemperature"] = occupant.bodytemperature
|
||||
data["occupant"] = occupantData
|
||||
|
||||
data["isOpen"] = state_open
|
||||
data["cellTemperature"] = round(air_contents.temperature)
|
||||
data["cellTemperatureStatus"] = "good"
|
||||
if(air_contents.temperature > T0C) // if greater than 273.15 kelvin (0 celcius)
|
||||
data["cellTemperatureStatus"] = "bad"
|
||||
else if(air_contents.temperature > 225)
|
||||
data["cellTemperatureStatus"] = "average"
|
||||
|
||||
data["isBeakerLoaded"] = beaker ? 1 : 0
|
||||
var beakerContents[0]
|
||||
if(beaker && beaker:reagents && beaker:reagents.reagent_list.len)
|
||||
for(var/datum/reagent/R in beaker:reagents.reagent_list)
|
||||
beakerContents.Add(list(list("name" = R.name, "volume" = R.volume))) // list in a list because Byond merges the first list...
|
||||
data["beakerContents"] = beakerContents
|
||||
return data
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/Topic(href, href_list)
|
||||
if(usr == occupant || panel_open)
|
||||
return 0 // don't update UIs attached to this object
|
||||
|
||||
if(..())
|
||||
return 0 // don't update UIs attached to this object
|
||||
|
||||
if(href_list["switchOn"])
|
||||
if(!state_open)
|
||||
on = 1
|
||||
|
||||
if(href_list["open"])
|
||||
open_machine()
|
||||
|
||||
if(href_list["close"])
|
||||
if(close_machine() == usr)
|
||||
var/datum/nanoui/ui = SSnano.get_open_ui(usr, src, "main")
|
||||
ui.close()
|
||||
on = 1
|
||||
if(href_list["switchOff"])
|
||||
on = 0
|
||||
|
||||
if(href_list["ejectBeaker"])
|
||||
if(beaker)
|
||||
var/obj/item/weapon/reagent_containers/glass/B = beaker
|
||||
B.loc = get_step(loc, SOUTH)
|
||||
beaker = null
|
||||
update_icon()
|
||||
add_fingerprint(usr)
|
||||
return 1 // update UIs attached to this object
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/weapon/reagent_containers/glass))
|
||||
if(isrobot(user))
|
||||
return
|
||||
if(beaker)
|
||||
user << "<span class='warning'>A beaker is already loaded into [src]!</span>"
|
||||
return
|
||||
if(!user.drop_item())
|
||||
return
|
||||
|
||||
beaker = I
|
||||
I.loc = src
|
||||
user.visible_message("[user] places [I] in [src].", \
|
||||
"<span class='notice'>You place [I] in [src].</span>")
|
||||
|
||||
if(!(on || occupant || state_open))
|
||||
if(default_deconstruction_screwdriver(user, "cell-o", "cell-off", I))
|
||||
return
|
||||
|
||||
if(default_change_direction_wrench(user, I))
|
||||
return
|
||||
|
||||
if(exchange_parts(user, I))
|
||||
return
|
||||
|
||||
if(default_pry_open(I))
|
||||
return
|
||||
|
||||
default_deconstruction_crowbar(I)
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/open_machine()
|
||||
if(!state_open && !panel_open)
|
||||
on = 0
|
||||
layer = 3
|
||||
if(occupant)
|
||||
occupant.bodytemperature = Clamp(occupant.bodytemperature, 261, 360)
|
||||
..()
|
||||
if(beaker)
|
||||
beaker.loc = src
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/close_machine(mob/living/carbon/M)
|
||||
if(state_open && !panel_open)
|
||||
layer = 4
|
||||
..(M)
|
||||
return occupant
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/update_icon()
|
||||
if(panel_open)
|
||||
icon_state = "cell-o"
|
||||
return
|
||||
if(state_open)
|
||||
icon_state = "cell-open"
|
||||
return
|
||||
if(on && is_operational())
|
||||
if(occupant)
|
||||
icon_state = "cell-occupied"
|
||||
else
|
||||
icon_state = "cell-on"
|
||||
else
|
||||
icon_state = "cell-off"
|
||||
|
||||
/obj/machinery/atmospherics/unary/cryo_cell/power_change()
|
||||
..()
|
||||
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)
|
||||
if(occupant.stat == 2 || occupant.health >= 100) //Why waste energy on dead or healthy people
|
||||
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 //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))
|
||||
if(air_contents.oxygen > 2)
|
||||
if(occupant.getOxyLoss()) occupant.adjustOxyLoss(-1)
|
||||
else
|
||||
occupant.adjustOxyLoss(-1)
|
||||
//severe damage should heal waaay slower without proper chemicals
|
||||
if(occupant.bodytemperature < 225)
|
||||
if(occupant.getToxLoss())
|
||||
occupant.adjustToxLoss(max(-efficiency, (-20*(efficiency ** 2)) / occupant.getToxLoss()))
|
||||
var/heal_brute = occupant.getBruteLoss() ? min(efficiency, 20*(efficiency**2) / occupant.getBruteLoss()) : 0
|
||||
var/heal_fire = occupant.getFireLoss() ? min(efficiency, 20*(efficiency**2) / occupant.getFireLoss()) : 0
|
||||
occupant.heal_organ_damage(heal_brute,heal_fire)
|
||||
if(beaker && next_trans == 0)
|
||||
beaker.reagents.trans_to(occupant, 1, 10)
|
||||
beaker.reagents.reaction(occupant)
|
||||
next_trans++
|
||||
if(next_trans == 10)
|
||||
next_trans = 0
|
||||
|
||||
|
||||
/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()
|
||||
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
||||
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
|
||||
var/remove_amount = air_contents.total_moles() / 100
|
||||
expel_gas = air_contents.remove(remove_amount)
|
||||
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()
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/obj/machinery/atmospherics/components/unary/tank
|
||||
icon = 'icons/obj/atmospherics/pipes/pressure_tank.dmi'
|
||||
icon_state = "generic"
|
||||
name = "pressure tank"
|
||||
desc = "A large vessel containing pressurized gas."
|
||||
var/volume = 10000 //in liters, 1 meters by 1 meters by 2 meters
|
||||
density = 1
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide
|
||||
name = "pressure tank (Carbon Dioxide)"
|
||||
|
||||
/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/components/unary/tank/toxins
|
||||
icon_state = "orange"
|
||||
name = "pressure tank (Plasma)"
|
||||
|
||||
/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/components/unary/tank/oxygen_agent_b
|
||||
icon_state = "orange_2"
|
||||
name = "pressure tank (Oxygen + Plasma)"
|
||||
|
||||
/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/components/unary/tank/oxygen
|
||||
icon_state = "blue"
|
||||
name = "pressure tank (Oxygen)"
|
||||
|
||||
/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/components/unary/tank/nitrogen
|
||||
icon_state = "red"
|
||||
name = "pressure tank (Nitrogen)"
|
||||
|
||||
/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/components/unary/tank/air
|
||||
icon_state = "grey"
|
||||
name = "pressure tank (Air)"
|
||||
|
||||
/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)
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user