mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 03:26:31 +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,
|
||||
|
||||
Reference in New Issue
Block a user