mirror of
https://github.com/cybergirlvannie/OpenSS13.git
synced 2026-08-28 15:16:23 +01:00
Committed atmospheric pipe tests
This commit is contained in:
@@ -93,8 +93,96 @@ obj/machinery/vent
|
||||
|
||||
|
||||
|
||||
obj/machinery/emergencyrelease
|
||||
|
||||
|
||||
name = "vent"
|
||||
icon = 'pipes.dmi'
|
||||
icon_state = "vent"
|
||||
desc = "An emergency release vent. Releases at 133% suggested mass content."
|
||||
anchored = 1
|
||||
p_dir = 2
|
||||
capmult = 2
|
||||
|
||||
var
|
||||
obj/machinery/node // the connected object
|
||||
obj/machinery/vnode // the connected pipeline (if node is a pipe)
|
||||
obj/substance/gas/gas // the gas reservoir
|
||||
obj/substance/gas/ngas // the new gas reservoir after calculating flow
|
||||
capacity = 6000000 // nominal gas capacity
|
||||
|
||||
|
||||
// Create a new vent. Pipe connection p_dir is calculated from icon dir, so p_dir does not need to be set on map.
|
||||
// Create the gas reservoir and register with the gasflowlist.
|
||||
|
||||
New()
|
||||
..()
|
||||
p_dir = dir
|
||||
gas = new/obj/substance/gas(src)
|
||||
gas.maximum = capacity
|
||||
ngas = new/obj/substance/gas()
|
||||
gasflowlist += src
|
||||
|
||||
|
||||
// Find the connected machine or pipe to the vent pipe.
|
||||
|
||||
buildnodes()
|
||||
var/turf/T = get_step(src.loc, src.dir)
|
||||
var/fdir = turn(src.p_dir, 180)
|
||||
|
||||
for(var/obj/machinery/M in T)
|
||||
if(M.p_dir & fdir)
|
||||
src.node = M
|
||||
break
|
||||
|
||||
if(node) vnode = node.getline()
|
||||
|
||||
return
|
||||
|
||||
|
||||
// Get the gas fullness value.
|
||||
|
||||
get_gas_val(from)
|
||||
return gas.tot_gas()/2
|
||||
|
||||
// Get the gas reservoir object
|
||||
|
||||
get_gas(from)
|
||||
return gas
|
||||
|
||||
|
||||
// Replace the gas level by the new level calculated in process()
|
||||
|
||||
gas_flow()
|
||||
gas.replace_by(ngas)
|
||||
|
||||
|
||||
// Timed process. Dump gas into turf, then do standard flow calc for connected pipe.
|
||||
|
||||
process()
|
||||
|
||||
var/delta_gt
|
||||
|
||||
var/turf/T = src.loc
|
||||
|
||||
if(gas.tot_gas() >= gas.maximum * 1.3)
|
||||
|
||||
delta_gt = FLOWFRAC * (gas.tot_gas() / capmult)
|
||||
ngas.turf_add(T, delta_gt)
|
||||
if(vnode)
|
||||
delta_gt = FLOWFRAC * ( vnode.get_gas_val(src) - gas.tot_gas() / capmult)
|
||||
calc_delta( src, gas, ngas, vnode, delta_gt)//, dbg)
|
||||
else
|
||||
leak_to_turf()
|
||||
|
||||
|
||||
// Leak from pipe to turf if no node connected
|
||||
|
||||
proc/leak_to_turf()
|
||||
|
||||
var/turf/T = get_step(src, dir)
|
||||
if(T && !T.density)
|
||||
flow_to_turf(gas, ngas, T)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user