forked from tgstation/tgstation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2 316c924e-a4…
…36-60f5-8080-3fe189b3f50e
- Loading branch information
only.lurking
committed
Aug 23, 2010
1 parent
757ea7b
commit 662c082
Showing
919 changed files
with
136,852 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
Quick overview: | ||
Pipes combine to form pipelines | ||
Pipelines and other atmospheric objects combine to form pipe_networks | ||
Note: A single pipe_network represents a completely open space | ||
Pipes -> Pipelines | ||
Pipelines + Other Objects -> Pipe network | ||
*/ | ||
|
||
obj/machinery/atmospherics | ||
anchored = 1 | ||
|
||
var/initialize_directions = 0 | ||
|
||
process() | ||
build_network() | ||
..() | ||
|
||
proc | ||
network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) | ||
// Check to see if should be added to network. Add self if so and adjust variables appropriately. | ||
// Note don't forget to have neighbors look as well! | ||
|
||
return null | ||
|
||
build_network() | ||
// Called to build a network from this node | ||
|
||
return null | ||
|
||
return_network(obj/machinery/atmospherics/reference) | ||
// Returns pipe_network associated with connection to reference | ||
// Notes: should create network if necessary | ||
// Should never return null | ||
|
||
return null | ||
|
||
reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network) | ||
// Used when two pipe_networks are combining | ||
|
||
return_network_air(datum/network/reference) | ||
// Return a list of gas_mixture(s) in the object | ||
// associated with reference pipe_network for use in rebuilding the networks gases list | ||
// Is permitted to return null | ||
|
||
disconnect(obj/machinery/atmospherics/reference) | ||
|
||
update_icon() | ||
return null |
129 changes: 129 additions & 0 deletions
129
code/ATMOSPHERICS/components/binary_devices/binary_atmos_base.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
obj/machinery/atmospherics/binary | ||
dir = SOUTH | ||
initialize_directions = SOUTH|NORTH | ||
|
||
var/datum/gas_mixture/air1 | ||
var/datum/gas_mixture/air2 | ||
|
||
var/obj/machinery/atmospherics/node1 | ||
var/obj/machinery/atmospherics/node2 | ||
|
||
var/datum/pipe_network/network1 | ||
var/datum/pipe_network/network2 | ||
|
||
New() | ||
..() | ||
switch(dir) | ||
if(NORTH) | ||
initialize_directions = NORTH|SOUTH | ||
if(SOUTH) | ||
initialize_directions = NORTH|SOUTH | ||
if(EAST) | ||
initialize_directions = EAST|WEST | ||
if(WEST) | ||
initialize_directions = EAST|WEST | ||
air1 = new | ||
air2 = new | ||
|
||
air1.volume = 200 | ||
air2.volume = 200 | ||
|
||
// Housekeeping and pipe network stuff below | ||
network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) | ||
if(reference == node1) | ||
network1 = new_network | ||
|
||
else if(reference == node2) | ||
network2 = new_network | ||
|
||
if(new_network.normal_members.Find(src)) | ||
return 0 | ||
|
||
new_network.normal_members += src | ||
|
||
return null | ||
|
||
Del() | ||
loc = null | ||
|
||
if(node1) | ||
node1.disconnect(src) | ||
del(network1) | ||
if(node2) | ||
node2.disconnect(src) | ||
del(network2) | ||
|
||
node1 = null | ||
node2 = null | ||
|
||
..() | ||
|
||
initialize() | ||
if(node1 && node2) return | ||
|
||
var/node2_connect = dir | ||
var/node1_connect = turn(dir, 180) | ||
|
||
for(var/obj/machinery/atmospherics/target in get_step(src,node1_connect)) | ||
if(target.initialize_directions & get_dir(target,src)) | ||
node1 = target | ||
break | ||
|
||
for(var/obj/machinery/atmospherics/target in get_step(src,node2_connect)) | ||
if(target.initialize_directions & get_dir(target,src)) | ||
node2 = target | ||
break | ||
|
||
update_icon() | ||
|
||
build_network() | ||
if(!network1 && node1) | ||
network1 = new /datum/pipe_network() | ||
network1.normal_members += src | ||
network1.build_network(node1, src) | ||
|
||
if(!network2 && node2) | ||
network2 = new /datum/pipe_network() | ||
network2.normal_members += src | ||
network2.build_network(node2, src) | ||
|
||
|
||
return_network(obj/machinery/atmospherics/reference) | ||
build_network() | ||
|
||
if(reference==node1) | ||
return network1 | ||
|
||
if(reference==node2) | ||
return network2 | ||
|
||
return null | ||
|
||
reassign_network(datum/pipe_network/old_network, datum/pipe_network/new_network) | ||
if(network1 == old_network) | ||
network1 = new_network | ||
if(network2 == old_network) | ||
network2 = new_network | ||
|
||
return 1 | ||
|
||
return_network_air(datum/pipe_network/reference) | ||
var/list/results = list() | ||
|
||
if(network1 == reference) | ||
results += air1 | ||
if(network2 == reference) | ||
results += air2 | ||
|
||
return results | ||
|
||
disconnect(obj/machinery/atmospherics/reference) | ||
if(reference==node1) | ||
del(network1) | ||
node1 = null | ||
|
||
else if(reference==node2) | ||
del(network2) | ||
node2 = null | ||
|
||
return null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
//node1, air1, network1 correspond to input | ||
//node2, air2, network2 correspond to output | ||
|
||
/obj/machinery/atmospherics/binary/circulator | ||
name = "circulator/heat exchanger" | ||
desc = "A gas circulator pump and heat exchanger." | ||
icon = 'pipes.dmi' | ||
icon_state = "circ1-off" | ||
|
||
var/side = 1 // 1=left 2=right | ||
var/status = 0 | ||
|
||
var/last_pressure_delta = 0 | ||
|
||
anchored = 1.0 | ||
density = 1 | ||
|
||
proc/return_transfer_air() | ||
var/output_starting_pressure = air2.return_pressure() | ||
var/input_starting_pressure = air1.return_pressure() | ||
|
||
if(output_starting_pressure >= input_starting_pressure-10) | ||
//Need at least 10 KPa difference to overcome friction in the mechanism | ||
last_pressure_delta = 0 | ||
return null | ||
|
||
//Calculate necessary moles to transfer using PV = nRT | ||
if((air1.total_moles() > 0) && (air1.temperature>0)) | ||
var/pressure_delta = (input_starting_pressure - output_starting_pressure)/2 | ||
|
||
var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION) | ||
|
||
last_pressure_delta = pressure_delta | ||
|
||
//Actually transfer the gas | ||
var/datum/gas_mixture/removed = air1.remove(transfer_moles) | ||
|
||
if(network1) | ||
network1.update = 1 | ||
|
||
if(network2) | ||
network2.update = 1 | ||
|
||
return removed | ||
|
||
else | ||
last_pressure_delta = 0 | ||
|
||
process() | ||
..() | ||
update_icon() | ||
|
||
update_icon() | ||
if(stat & (BROKEN|NOPOWER)) | ||
icon_state = "circ[side]-p" | ||
else if(last_pressure_delta > 0) | ||
if(last_pressure_delta > ONE_ATMOSPHERE) | ||
icon_state = "circ[side]-run" | ||
else | ||
icon_state = "circ[side]-slow" | ||
else | ||
icon_state = "circ[side]-off" | ||
|
||
return 1 |
Oops, something went wrong.