mirror of
https://github.com/cybergirlvannie/OpenSS13.git
synced 2026-02-07 18:07:38 +00:00
Committed atmospheric pipe tests
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
#define NORMPIPERATE 40 //pipe-insulation rate divisor
|
||||
#define HEATPIPERATE 8 //heat-exch pipe insulation
|
||||
|
||||
#define FLOWFRAC 0.5 // fraction of gas transfered per process
|
||||
#define FLOWFRAC 0.99 // fraction of gas transfered per process
|
||||
|
||||
|
||||
//FLAGS BITMASK
|
||||
|
||||
@@ -164,7 +164,4 @@
|
||||
|
||||
sngas.turf_take(T, delta_gt) // grab gas from turf and direcly add it to the new gas
|
||||
|
||||
T.res_vars() // update turf gas vars for both cases
|
||||
|
||||
|
||||
|
||||
T.res_vars() // update turf gas vars for both cases
|
||||
@@ -156,6 +156,7 @@ obj/machinery/circulator
|
||||
ngas2.replace_by(gas2)
|
||||
|
||||
|
||||
|
||||
// now do standard gas flow process
|
||||
|
||||
var/delta_gt
|
||||
@@ -214,4 +215,4 @@ obj/machinery/circulator
|
||||
if(from == vnode1)
|
||||
return gas1
|
||||
else
|
||||
return gas2
|
||||
return gas2
|
||||
@@ -101,3 +101,365 @@ obj/machinery/inlet
|
||||
flow_to_turf(gas, ngas, T)
|
||||
|
||||
|
||||
//Filtration Procs for Filtered Inlet
|
||||
|
||||
/obj/machinery/proc
|
||||
flow_filter1(var/obj/substance/gas/sgas, var/obj/substance/gas/sngas, var/turf/T)
|
||||
var/t_tot = T.tot_gas() * 0.2
|
||||
var/delta_gt = FLOWFRAC * ( t_tot - sgas.tot_gas() / capmult )
|
||||
sngas.turf_take_filter1(T, delta_gt)
|
||||
T.res_vars()
|
||||
flow_filter2(var/obj/substance/gas/sgas, var/obj/substance/gas/sngas, var/turf/T)
|
||||
var/t_tot = T.tot_gas() * 0.2
|
||||
var/delta_gt = FLOWFRAC * ( t_tot - sgas.tot_gas() / capmult )
|
||||
sngas.turf_take_filter2(T, delta_gt)
|
||||
T.res_vars()
|
||||
flow_filter3(var/obj/substance/gas/sgas, var/obj/substance/gas/sngas, var/turf/T)
|
||||
var/t_tot = T.tot_gas() * 0.2
|
||||
var/delta_gt = FLOWFRAC * ( t_tot - sgas.tot_gas() / capmult )
|
||||
sngas.turf_take_filter3(T, delta_gt)
|
||||
T.res_vars()
|
||||
flow_filter4(var/obj/substance/gas/sgas, var/obj/substance/gas/sngas, var/turf/T)
|
||||
var/t_tot = T.tot_gas() * 0.2
|
||||
var/delta_gt = FLOWFRAC * ( t_tot - sgas.tot_gas() / capmult )
|
||||
sngas.turf_take_filter4(T, delta_gt)
|
||||
T.res_vars()
|
||||
flow_filter5(var/obj/substance/gas/sgas, var/obj/substance/gas/sngas, var/turf/T)
|
||||
var/t_tot = T.tot_gas() * 0.2
|
||||
var/delta_gt = FLOWFRAC * ( t_tot - sgas.tot_gas() / capmult )
|
||||
sngas.turf_take_filter5(T, delta_gt)
|
||||
T.res_vars()
|
||||
|
||||
/obj/substance/gas/proc
|
||||
turf_take_filter1(var/turf/target as turf, amount)
|
||||
if (((!( istype(target, /turf) ) && !( istype(target, /obj/move) )) || !( amount )))
|
||||
return
|
||||
if (locate(/obj/move, target))
|
||||
target = locate(/obj/move, target)
|
||||
var/t1 = target.oxygen + target.n2
|
||||
if (!( t1 ))
|
||||
return
|
||||
var/t2 = src.oxygen + src.n2
|
||||
if (amount > 0)
|
||||
if ((src.maximum > 0 && (src.maximum - t2) < amount))
|
||||
amount = src.maximum - t2
|
||||
else
|
||||
amount = src.oxygen + src.n2
|
||||
if (amount > t1)
|
||||
amount = t1
|
||||
var/turf_total = target.oxygen + target.n2
|
||||
var/heat_gain = (turf_total ? amount * target.temp : 0)
|
||||
var/t_oxygen = amount * target.co2 / t1
|
||||
var/t_n2 = amount * target.n2 / t1
|
||||
if(t2+amount>0)
|
||||
temperature = (temperature*t2 + heat_gain * TURF_TAKE_FRAC)/(t2+amount)
|
||||
src.oxygen += t_oxygen
|
||||
src.n2 += t_n2
|
||||
target.oxygen -= t_oxygen
|
||||
target.n2 -= t_n2
|
||||
target.res_vars()
|
||||
return
|
||||
turf_take_filter2(var/turf/target as turf, amount)
|
||||
if (((!( istype(target, /turf) ) && !( istype(target, /obj/move) )) || !( amount )))
|
||||
return
|
||||
if (locate(/obj/move, target))
|
||||
target = locate(/obj/move, target)
|
||||
var/t1 = target.co2
|
||||
if (!( t1 ))
|
||||
return
|
||||
var/t2 = src.co2
|
||||
if (amount > 0)
|
||||
if ((src.maximum > 0 && (src.maximum - t2) < amount))
|
||||
amount = src.maximum - t2
|
||||
else
|
||||
amount = src.co2
|
||||
if (amount > t1)
|
||||
amount = t1
|
||||
var/turf_total = target.co2
|
||||
var/heat_gain = (turf_total ? amount * target.temp : 0)
|
||||
var/t_co2 = amount * target.co2 / t1
|
||||
if(t2+amount>0)
|
||||
temperature = (temperature*t2 + heat_gain * TURF_TAKE_FRAC)/(t2+amount)
|
||||
src.co2 += t_co2
|
||||
target.co2 -= t_co2
|
||||
target.res_vars()
|
||||
return
|
||||
turf_take_filter3(var/turf/target as turf, amount)
|
||||
if (((!( istype(target, /turf) ) && !( istype(target, /obj/move) )) || !( amount )))
|
||||
return
|
||||
if (locate(/obj/move, target))
|
||||
target = locate(/obj/move, target)
|
||||
var/t1 = target.oxygen + target.n2 + target.poison + target.sl_gas
|
||||
if (!( t1 ))
|
||||
return
|
||||
var/t2 = src.oxygen + src.n2 + src.plasma + src.sl_gas
|
||||
if (amount > 0)
|
||||
if ((src.maximum > 0 && (src.maximum - t2) < amount))
|
||||
amount = src.maximum - t2
|
||||
else
|
||||
amount = src.oxygen + src.n2 + src.plasma + src.sl_gas
|
||||
if (amount > t1)
|
||||
amount = t1
|
||||
var/turf_total = target.oxygen + target.n2 + target.poison + target.sl_gas
|
||||
var/heat_gain = (turf_total ? amount * target.temp : 0)
|
||||
var/t_oxygen = amount * target.co2 / t1
|
||||
var/t_n2 = amount * target.n2 / t1
|
||||
var/t_poison = amount * target.poison / t1
|
||||
var/t_sl_gas = amount * target.sl_gas / t1
|
||||
if(t2+amount>0)
|
||||
temperature = (temperature*t2 + heat_gain * TURF_TAKE_FRAC)/(t2+amount)
|
||||
src.oxygen += t_oxygen
|
||||
src.n2 += t_n2
|
||||
src.plasma += t_poison
|
||||
src.sl_gas += t_sl_gas
|
||||
target.oxygen -= t_oxygen
|
||||
target.n2 -= t_n2
|
||||
target.poison -= t_poison
|
||||
target.sl_gas -= t_sl_gas
|
||||
target.res_vars()
|
||||
return
|
||||
turf_take_filter4(var/turf/target as turf, amount)
|
||||
if (((!( istype(target, /turf) ) && !( istype(target, /obj/move) )) || !( amount )))
|
||||
return
|
||||
if (locate(/obj/move, target))
|
||||
target = locate(/obj/move, target)
|
||||
var/t1 = target.co2 + target.poison + target.sl_gas
|
||||
if (!( t1 ))
|
||||
return
|
||||
var/t2 = src.co2 + src.plasma + src.sl_gas
|
||||
if (amount > 0)
|
||||
if ((src.maximum > 0 && (src.maximum - t2) < amount))
|
||||
amount = src.maximum - t2
|
||||
else
|
||||
amount = src.co2 + src.plasma + src.sl_gas
|
||||
if (amount > t1)
|
||||
amount = t1
|
||||
var/turf_total = target.co2 + src.plasma + src.sl_gas
|
||||
var/heat_gain = (turf_total ? amount * target.temp : 0)
|
||||
var/t_co2 = amount * target.co2 / t1
|
||||
var/t_poison = amount * target.poison / t1
|
||||
var/t_sl_gas = amount * target.sl_gas / t1
|
||||
if(t2+amount>0)
|
||||
temperature = (temperature*t2 + heat_gain * TURF_TAKE_FRAC)/(t2+amount)
|
||||
src.co2 += t_co2
|
||||
src.plasma += t_poison
|
||||
src.sl_gas += t_sl_gas
|
||||
target.co2 -= t_co2
|
||||
target.poison -= t_poison
|
||||
target.sl_gas -= t_sl_gas
|
||||
target.res_vars()
|
||||
return
|
||||
turf_take_filter5(var/turf/target as turf, amount)
|
||||
if (((!( istype(target, /turf) ) && !( istype(target, /obj/move) )) || !( amount )))
|
||||
return
|
||||
if (locate(/obj/move, target))
|
||||
target = locate(/obj/move, target)
|
||||
var/t1 = target.co2 + target.poison + target.sl_gas + target.oxygen + target.n2
|
||||
if (!( t1 ))
|
||||
return
|
||||
var/t2 = src.co2 + src.plasma + src.sl_gas + src.oxygen + src.n2
|
||||
if (amount > 0)
|
||||
if ((src.maximum > 0 && (src.maximum - t2) < amount))
|
||||
amount = src.maximum - t2
|
||||
else
|
||||
amount = src.co2 + src.plasma + src.sl_gas + src.oxygen + src.n2
|
||||
if (amount > t1)
|
||||
amount = t1
|
||||
var/turf_total = target.co2 + src.plasma + src.sl_gas + target.oxygen + target.n2
|
||||
var/heat_gain = (turf_total ? amount * target.temp : 0)
|
||||
var/t_co2 = amount * target.co2 / t1
|
||||
var/t_poison = amount * target.poison / t1
|
||||
var/t_sl_gas = amount * target.sl_gas / t1
|
||||
var/t_oxygen = amount * target.co2 / t1
|
||||
var/t_n2 = amount * target.n2 / t1
|
||||
if(t2+amount>0)
|
||||
temperature = (temperature*t2 + heat_gain * TURF_TAKE_FRAC)/(t2+amount)
|
||||
src.oxygen += t_oxygen
|
||||
src.n2 += t_n2
|
||||
src.co2 += t_co2
|
||||
src.plasma += t_poison
|
||||
src.sl_gas += t_sl_gas
|
||||
target.oxygen -= t_oxygen
|
||||
target.n2 -= t_n2
|
||||
target.co2 -= t_co2
|
||||
target.poison -= t_poison
|
||||
target.sl_gas -= t_sl_gas
|
||||
target.res_vars()
|
||||
return
|
||||
|
||||
|
||||
|
||||
obj/machinery/inletfiltered
|
||||
name = "Atmospheric Preservation Inlet"
|
||||
icon = 'pipes.dmi'
|
||||
icon_state = "inlet"
|
||||
desc = "A gas pipe inlet, fitted with a filter."
|
||||
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
|
||||
|
||||
cover = 1 //positive if cover is screwed on
|
||||
filtertype = 2 //0- No Filter, vent will not operate, 1- Nitrogen & Oxygen, 2 - co2, 3- Nitrogen, Oxygen, Plasma, n2o 4- co2, Plasma, n2o, 5- Hacked filter, allow all
|
||||
ofiltertype = 2 //Orig. filter type before tampering. Used so removed type 5 filters are repairable.
|
||||
orname //Orig. filter name before tampering.
|
||||
ordescription //Orig. description before tampering.
|
||||
|
||||
// Create a new inlet. Pipe connection direction is set same as icon direction, thus p_dir does not need to be set
|
||||
// when placing inlet on map. Create gas reservoir and register self 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 pipe or machine
|
||||
|
||||
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
|
||||
|
||||
|
||||
// Returns the gas fullness value. Capmult is 2 for inlets because they in effect have two connections: the pipe, and the turf
|
||||
|
||||
get_gas_val(from)
|
||||
return gas.tot_gas()/capmult
|
||||
|
||||
|
||||
// Return the internal gas reservoir
|
||||
|
||||
get_gas(from)
|
||||
return gas
|
||||
|
||||
|
||||
// After all machine process()es in world are complete, update the current gas levels with the new calculated levels
|
||||
|
||||
gas_flow()
|
||||
gas.replace_by(ngas)
|
||||
|
||||
|
||||
// Timed process. Calculate gas flow to and from the turf, and to and from the connected pipe
|
||||
|
||||
process()
|
||||
var/delta_gt
|
||||
|
||||
var/turf/T = src.loc
|
||||
|
||||
if(T && !T.density)
|
||||
if (src.filtertype == 0) //NO Filter. Will not run without filters.
|
||||
if (src.cover == 1) //Check if the filter has it's cover on.
|
||||
flick("inletnofilter",src) //Of so flick the warning button icon_state
|
||||
return
|
||||
else //If the cover is up
|
||||
return //Just return, don't flick the warning
|
||||
|
||||
|
||||
if (src.filtertype == 1) //Filter Type 1, Allow: Oxygen & Nitrogen
|
||||
flow_filter1(gas, ngas, T)
|
||||
if (src.filtertype == 2) //Filter Type 2, Allow: co2
|
||||
flow_filter2(gas, ngas, T)
|
||||
if (src.filtertype == 3) //Filter Type 3, Allow: Oxygen, Nitrogen, Plasma, n2o
|
||||
flow_filter3(gas, ngas, T)
|
||||
if (src.filtertype == 4) //Filter Type 4, Allow: co2, Plasma, n2o
|
||||
flow_filter4(gas, ngas, T)
|
||||
if (src.filtertype == 5) //Filter Type 5, Allow: All
|
||||
flow_filter5(gas, ngas, T)
|
||||
|
||||
if(vnode)
|
||||
delta_gt = FLOWFRAC * ( vnode.get_gas_val(src) - gas.tot_gas() / capmult)
|
||||
calc_delta( src, gas, ngas, vnode, delta_gt)
|
||||
else
|
||||
leak_to_turf()
|
||||
|
||||
|
||||
// If no node is present, leak the contents to the turf position the node would be.
|
||||
// note this is a leak from the node, not the inlet itself
|
||||
// thus acts as a link between the inlet turf and the turf in step(dir)
|
||||
|
||||
proc/leak_to_turf()
|
||||
|
||||
var/turf/T = get_step(src, dir)
|
||||
if(T && !T.density)
|
||||
flow_to_turf(gas, ngas, T)
|
||||
|
||||
//Remove Cover
|
||||
|
||||
attackby(obj/item/weapon/W, mob/user)
|
||||
if ( istype(W, /obj/item/weapon/screwdriver))
|
||||
if (src.cover == 1)
|
||||
user.show_message("\blue You carefully unscrew the cover to the inlet")
|
||||
src.cover = 0
|
||||
src.icon_state="inletopen"
|
||||
src.add_fingerprint(user)
|
||||
else
|
||||
user.show_message("\blue You carefully screw the cover back on the inlet")
|
||||
src.cover = 1
|
||||
src.icon_state="inlet"
|
||||
src.add_fingerprint(user)
|
||||
|
||||
|
||||
//Remove Filter
|
||||
|
||||
else
|
||||
if ( istype(W, /obj/item/weapon/wrench))
|
||||
if (src.cover == 1) //If it's covered, this won't happen.
|
||||
return
|
||||
else
|
||||
if (src.filtertype > 0)
|
||||
user.show_message("\blue You remove the bolts holding the filter and slide it out of place. The inlet shuts down.")
|
||||
if (src.filtertype == 1)
|
||||
new /obj/item/weapon/filter/filtertype1 (src.loc)
|
||||
if (src.filtertype == 2)
|
||||
new /obj/item/weapon/filter/filtertype2 (src.loc)
|
||||
if (src.filtertype == 3)
|
||||
new /obj/item/weapon/filter/filtertype3 (src.loc)
|
||||
if (src.filtertype == 4)
|
||||
new /obj/item/weapon/filter/filtertype4 (src.loc)
|
||||
if (src.filtertype == 5)
|
||||
var/obj/item/weapon/filter/filtertype5/I = new(src.loc) //Spawn Malf. Filter
|
||||
I.oftype = src.ofiltertype //Set filters original filter type, so it can be repaired.
|
||||
I.oname = src.orname //Set filters original name
|
||||
I.odesc = src.ordescription //Set filters original desc
|
||||
src.filtertype = 0
|
||||
src.add_fingerprint(user)
|
||||
else
|
||||
user.show_message("\blue There is no filter installed!")
|
||||
|
||||
//Apply filter
|
||||
//TODO: Maybe just store the physical filter instead of using variables. Maybe not :p I sort of like variables...
|
||||
else
|
||||
if ( istype(W, /obj/item/weapon/filter))
|
||||
if (src.cover == 1) //If it's covered this won't happen.
|
||||
return
|
||||
else
|
||||
if (src.filtertype == 0)
|
||||
user.show_message("\blue You slide the filter into position and tighten the bolts. The inlet starts up.")
|
||||
src.filtertype = W:ftype //Set the vent to the correct filter status
|
||||
src.ofiltertype = W:oftype //Store filter's original filter type.
|
||||
src.orname = W:oname //Store filter's original name.
|
||||
src.ordescription = W:odesc //Store filter's original description.
|
||||
src.add_fingerprint(user)
|
||||
del (W)
|
||||
else
|
||||
user.show_message("\blue There is already a filter installed!")
|
||||
@@ -389,3 +389,191 @@ obj/machinery/pipes
|
||||
icon = 'hi_pipe.dmi'
|
||||
density = 1
|
||||
capacity = 1.8E7
|
||||
|
||||
|
||||
obj/machinery/pump
|
||||
name = "Gas Pump"
|
||||
desc = "A gas pump"
|
||||
icon = 'pipes.dmi'
|
||||
icon_state = "one-way"
|
||||
anchored = 1
|
||||
density = 0
|
||||
capmult = 1
|
||||
|
||||
var
|
||||
status = 0 // 0 = off, 1 = on
|
||||
rate = 400000
|
||||
maxrate = 1e22
|
||||
|
||||
obj/substance/gas/gas1 = null
|
||||
obj/substance/gas/ngas1 = null
|
||||
|
||||
obj/substance/gas/gas2 = null
|
||||
obj/substance/gas/ngas2 = null
|
||||
|
||||
capacity = 1e22
|
||||
|
||||
obj/machinery/node1 = null // the physical pipe object to the south
|
||||
obj/machinery/node2 = null // the physical pipe object to the north
|
||||
|
||||
obj/machinery/vnode1 // the pipeline object
|
||||
obj/machinery/vnode2 // the pipeline object
|
||||
|
||||
|
||||
New()
|
||||
..()
|
||||
gas1 = new/obj/substance/gas(src)
|
||||
gas1.maximum = capacity
|
||||
gas2 = new/obj/substance/gas(src)
|
||||
gas2.maximum = capacity
|
||||
|
||||
ngas1 = new/obj/substance/gas()
|
||||
ngas2 = new/obj/substance/gas()
|
||||
|
||||
gasflowlist += src
|
||||
|
||||
proc/update()
|
||||
p_dir = text2num(icon_state)
|
||||
|
||||
buildnodes()
|
||||
var/turf/n1
|
||||
var/turf/n2
|
||||
if (src.dir == 1)
|
||||
n1 = get_step(src, SOUTH)
|
||||
n2 = get_step(src, NORTH)
|
||||
if (src.dir == 8)
|
||||
n1 = get_step(src, EAST)
|
||||
n2 = get_step(src, WEST)
|
||||
if (src.dir == 2)
|
||||
n1 = get_step(src, NORTH)
|
||||
n2 = get_step(src, SOUTH)
|
||||
if (src.dir == 4)
|
||||
n1 = get_step(src, WEST)
|
||||
n2 = get_step(src, EAST)
|
||||
for(var/obj/machinery/M in n1)
|
||||
|
||||
// if(M && (M.p_dir & 1))
|
||||
node1 = M
|
||||
break
|
||||
|
||||
for(var/obj/machinery/M in n2)
|
||||
|
||||
// if(M && (M.p_dir & 2))
|
||||
node2 = M
|
||||
break
|
||||
|
||||
|
||||
if(node1) vnode1 = node1.getline()
|
||||
|
||||
if(node2) vnode2 = node2.getline()
|
||||
|
||||
|
||||
|
||||
/* proc/control(var/on, var/prate)
|
||||
|
||||
rate = prate/100*maxrate
|
||||
|
||||
if(status == 1)
|
||||
if(!on)
|
||||
status = 2
|
||||
spawn(30)
|
||||
if(status == 2) //Most of the pump code is shamefully swiped and hacked from circulators :p
|
||||
status = 0
|
||||
// updateicon()
|
||||
else if(status == 0)
|
||||
if(on)
|
||||
status = 1
|
||||
else // status ==2
|
||||
if(on)
|
||||
status = 1*/
|
||||
|
||||
|
||||
|
||||
|
||||
gas_flow()
|
||||
|
||||
gas1.replace_by(ngas1)
|
||||
gas2.replace_by(ngas2)
|
||||
|
||||
|
||||
|
||||
process()
|
||||
|
||||
if(! (stat & NOPOWER) )
|
||||
if(status==1 || status==2)
|
||||
gas2.transfer_from(gas1, 1e22)
|
||||
use_power(rate/capacity * 100)
|
||||
ngas1.replace_by(gas1)
|
||||
ngas2.replace_by(gas2)
|
||||
|
||||
|
||||
// now do standard gas flow process
|
||||
|
||||
var/delta_gt
|
||||
|
||||
if(vnode1)
|
||||
delta_gt = FLOWFRAC * ( vnode1.get_gas_val(src) - gas1.tot_gas() / capmult)
|
||||
calc_delta( src, gas1, ngas1, vnode1, delta_gt)
|
||||
else
|
||||
leak_to_turf(1)
|
||||
|
||||
if(vnode2)
|
||||
delta_gt = FLOWFRAC * ( vnode2.get_gas_val(src) - gas2.tot_gas() / capmult)
|
||||
calc_delta( src, gas2, ngas2, vnode2, delta_gt)
|
||||
else
|
||||
leak_to_turf(2)
|
||||
|
||||
|
||||
// If nothing connected to either pipe node, leak the gas to the turf instead
|
||||
|
||||
proc/leak_to_turf(var/port)
|
||||
|
||||
var/turf/T
|
||||
|
||||
switch(port)
|
||||
if(1)
|
||||
T = get_step(src, SOUTH)
|
||||
if(2)
|
||||
T = get_step(src, NORTH)
|
||||
|
||||
if(T.density)
|
||||
T = src.loc
|
||||
if(T.density)
|
||||
return
|
||||
|
||||
switch(port)
|
||||
if(1)
|
||||
flow_to_turf(gas1, ngas1, T)
|
||||
if(2)
|
||||
flow_to_turf(gas2, ngas2, T)
|
||||
|
||||
|
||||
// Get the current gas fill level. Note since we have two reservoirs, value depends on which node is enquiring
|
||||
|
||||
get_gas_val(from)
|
||||
|
||||
if(from == vnode1)
|
||||
return gas1.tot_gas()/capmult
|
||||
else
|
||||
return gas2.tot_gas()/capmult
|
||||
|
||||
|
||||
// Get the gas reservoir object connected to node "from"
|
||||
|
||||
get_gas(from)
|
||||
|
||||
if(from == vnode1)
|
||||
return gas1
|
||||
else
|
||||
return gas2
|
||||
|
||||
attack_hand(var/mob/user)
|
||||
|
||||
if (src.status == 0)
|
||||
user.show_message("\blue You activate the pump")
|
||||
src.status = 1
|
||||
src.rate = 1e22
|
||||
else
|
||||
user.show_message("\blue You deactivate the pump")
|
||||
src.status = 0
|
||||
src.rate = 400000
|
||||
|
||||
@@ -181,5 +181,4 @@ obj/machinery/valve
|
||||
flick("valve10", src)
|
||||
icon_state = "valve0"
|
||||
sleep(10)
|
||||
open = !open
|
||||
|
||||
open = !open
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -214,6 +214,8 @@
|
||||
name = "experimental atmospheric testing"
|
||||
/area/medical_station/ventilation_shaft
|
||||
name = "ventilation shaft"
|
||||
/area/medical_station/atmotestroom
|
||||
name = "atmo test room"
|
||||
|
||||
/area/New()
|
||||
|
||||
|
||||
@@ -212,9 +212,9 @@
|
||||
if (src.sl_gas > 0)
|
||||
src.sl_gas--
|
||||
if (src.poison > 100000.0)
|
||||
if (config.plasma_danger && (src.temp >= 150.0 + T20C))
|
||||
src.overlays = list( liquidplmaster )
|
||||
else
|
||||
if (config.plasma_danger && (src.temp >= 150.0 + T20C))
|
||||
src.overlays = list( liquidplmaster )
|
||||
else
|
||||
src.overlays = list( plmaster )
|
||||
else
|
||||
if (src.sl_gas > 101000.0)
|
||||
@@ -292,11 +292,11 @@
|
||||
src.temp = totemp / divideby
|
||||
if (src.sl_gas > 0)
|
||||
src.sl_gas--
|
||||
if (src.poison > 100000.0)
|
||||
if (config.plasma_danger && (src.temp >= 150.0 + T20C))
|
||||
src.overlays = list( liquidplmaster )
|
||||
else
|
||||
src.overlays = list( plmaster )
|
||||
if (src.poison > 100000.0)
|
||||
if (config.plasma_danger && (src.temp >= 150.0 + T20C))
|
||||
src.overlays = list( liquidplmaster )
|
||||
else
|
||||
src.overlays = list( plmaster )
|
||||
else
|
||||
if (src.sl_gas > 101000.0)
|
||||
src.overlays = list( slmaster )
|
||||
@@ -1046,11 +1046,11 @@ turf/proc/tot_old_gas()
|
||||
src.temp = totemp / divideby
|
||||
if (src.sl_gas > 0)
|
||||
src.sl_gas--
|
||||
if (src.poison > 100000.0)
|
||||
if (config.plasma_danger && (src.temp >= 150.0 + T20C))
|
||||
src.overlays = list( liquidplmaster )
|
||||
else
|
||||
src.overlays = list( plmaster )
|
||||
if (src.poison > 100000.0)
|
||||
if (config.plasma_danger && (src.temp >= 150.0 + T20C))
|
||||
src.overlays = list( liquidplmaster )
|
||||
else
|
||||
src.overlays = list( plmaster )
|
||||
else
|
||||
if (src.sl_gas > 101000.0)
|
||||
src.overlays = list( slmaster )
|
||||
@@ -1196,11 +1196,11 @@ turf/proc/tot_old_gas()
|
||||
src.temp = totemp / divideby
|
||||
if (src.sl_gas > 0)
|
||||
src.sl_gas--
|
||||
if (src.poison > 100000.0)
|
||||
if (config.plasma_danger && (src.temp >= 150.0 + T20C))
|
||||
src.overlays = list( liquidplmaster )
|
||||
else
|
||||
src.overlays = list( plmaster )
|
||||
if (src.poison > 100000.0)
|
||||
if (config.plasma_danger && (src.temp >= 150.0 + T20C))
|
||||
src.overlays = list( liquidplmaster )
|
||||
else
|
||||
src.overlays = list( plmaster )
|
||||
else
|
||||
if (src.sl_gas > 101000.0)
|
||||
src.overlays = list( slmaster )
|
||||
|
||||
@@ -760,7 +760,7 @@
|
||||
if(config.logadmin) world.log << text("ADMIN: [] toggled ai_can_uncall_shuttle.", usr.key)
|
||||
world.update_stat()
|
||||
update()
|
||||
|
||||
|
||||
if (href_list["toggle_abandon"])
|
||||
if (src.a_level >= 3)
|
||||
abandon_allowed = !( abandon_allowed )
|
||||
@@ -803,7 +803,7 @@
|
||||
if (src.a_level >= 5)
|
||||
world << "\red<h1>Replacing destroyed objects and mobs.</h1>"
|
||||
world.Repop()
|
||||
|
||||
|
||||
if (href_list["secrets2"])
|
||||
if (src.a_level >= 3)
|
||||
var/ok = 0
|
||||
@@ -910,7 +910,7 @@
|
||||
a_level = 5
|
||||
if("Primary Administrator")
|
||||
a_level = 6
|
||||
|
||||
|
||||
|
||||
|
||||
switch(src.screen)
|
||||
@@ -936,7 +936,7 @@
|
||||
dat += "<A href='?src=\ref[src];toggle_abandon=1'>Toggle Abandon [abandon_allowed]</A><br>"
|
||||
dat += "<A href='?src=\ref[src];toggle_ai=1'>Toggle AI [config.allowai]</A><br>"
|
||||
dat += "<A href='?src=\ref[src];toggle_bombtemp_determines_range=1'>Toggle Bombtemp-Determines-Range [config.bombtemp_determines_range]</A><br>"
|
||||
|
||||
|
||||
dat += "<A href='?src=\ref[src];c_mode=1'>Change Game Mode</A><br>"
|
||||
if(a_level >= 2)
|
||||
dat += "<A href='?src=\ref[src];restart=1'>Restart Game</A><br>"
|
||||
@@ -966,18 +966,18 @@
|
||||
dat += "<A href='?src=\ref[src];dna=1'>List DNA</A><br>"
|
||||
dat += "<A href='?src=\ref[src];l_keys=1'>List Keys</A><br>"
|
||||
dat += "<A href='?src=\ref[src];l_players=1'>List Players/Keys</A><br>"
|
||||
|
||||
|
||||
dat += "<BR>"
|
||||
if(a_level >= 5 )
|
||||
|
||||
dat += "<A href='?src=\ref[src];repopMap=1'>Recreate Destroyed Mobs and Objects</A><br>"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dat += "<A href='?src=\ref[src];g_send=1'>Send Global Message</A><br>"
|
||||
dat += "<A href='?src=\ref[src];p_send=1'>Send Private Message</A><br>"
|
||||
|
||||
|
||||
|
||||
else
|
||||
dat = text("<center><B>Admin Control Center</B></center><hr>\n<A href='?src=\ref[];access=1'>Access Admin Commands</A><br>\n<A href='?src=\ref[];contact=1'>Contact Admins</A><br>\n<A href='?src=\ref[];message=1'>Access Messageboard</A><br>\n<br>\n<A href='?src=\ref[];l_keys=1'>List Keys</A><br>\n<A href='?src=\ref[];l_players=1'>List Players/Keys</A><br>\n<A href='?src=\ref[];g_send=1'>Send Global Message</A><br>\n<A href='?src=\ref[];p_send=1'>Send Private Message</A><br>", src, src, src, src, src, src, src)
|
||||
usr << browse(dat, "window=admin")
|
||||
@@ -1170,7 +1170,7 @@
|
||||
if ((H.ckey in list( "exadv1", "epox", "soraku" )))
|
||||
H.memory += text("<B>Secret Base Nuke Code</B>: []<BR>", nuke_code)
|
||||
sleep(50)
|
||||
|
||||
|
||||
plmaster = new /obj/overlay( )
|
||||
plmaster.icon = 'plasma.dmi'
|
||||
plmaster.icon_state = "onturf"
|
||||
@@ -1188,7 +1188,7 @@
|
||||
cellcontrol.process()
|
||||
return
|
||||
src.update_stat()
|
||||
spawn(900)
|
||||
spawn(900)
|
||||
Label_482:
|
||||
if (ctf)
|
||||
return
|
||||
@@ -1485,7 +1485,7 @@
|
||||
else
|
||||
numAlive += 1
|
||||
numTotal = numShuttle + numDead + numAlive + numPod
|
||||
|
||||
|
||||
if (numAlive+numAlive > numTotal)
|
||||
traitorwin = 0
|
||||
else
|
||||
@@ -1528,7 +1528,7 @@
|
||||
var/obj/item/weapon/tank/plasmatank/P = O.part3
|
||||
if ((P.gas.plasma >= 1600000.0 && P.gas:temperature >= 773)) // 500degC
|
||||
traitorwin = 1
|
||||
|
||||
|
||||
item = "a fully armed and heated plasma bomb"
|
||||
if("flashbang")
|
||||
for(var/obj/item/weapon/flashbang/O in L)
|
||||
@@ -1611,7 +1611,7 @@
|
||||
if (M.cliented())
|
||||
world << text("<B>[] was a monkey.</B>", M.key)
|
||||
else
|
||||
world << "<FONT size = 3><B>The Research Staff has stopped he monkey invasion!</B></FONT>"
|
||||
world << "<FONT size = 3><B>The Research Staff has stopped the monkey invasion!</B></FONT>"
|
||||
for(var/mob/human/M in world)
|
||||
if (M.cliented())
|
||||
world << text("<B>[] was [].</B>", M.key, M)
|
||||
@@ -1755,7 +1755,7 @@
|
||||
world << "<FONT size = 3><B>The AI has lost!</B></FONT>"
|
||||
world << text("<B>The AI failed to maintain the quarantine - [] players escaped in pods, [] were in space, and [] were off-station (as far as we can tell).</B>", numPod, numSpace, numOffStation)
|
||||
if(config.loggame) world.log << "GAME: AI lost at Blob mode."
|
||||
|
||||
|
||||
if(config.loggame) world.log << "GAME: Blob mode was lost."
|
||||
ticker.event = 5
|
||||
sleep(300)
|
||||
@@ -1867,7 +1867,7 @@
|
||||
world << "<B>Welcome to the Space Station 13!</B>\n\n"
|
||||
|
||||
src.mode = master_mode
|
||||
|
||||
|
||||
switch(src.mode)
|
||||
if("secret")
|
||||
src.mode = config.pickmode()
|
||||
@@ -1905,7 +1905,7 @@
|
||||
world << "<B>The current game mode is - Blob!</B>"
|
||||
world << "<B>A dangerous alien organism is rapidly spreading throughout the station!</B>"
|
||||
world << "You must kill it all while minimizing the damage to the station."
|
||||
|
||||
|
||||
if("nuclear")
|
||||
world << "<B>The current game mode is - Nuclear Emergency!</B>"
|
||||
world << "<B>A Syndicate Strike Force is approaching SS13!</B>"
|
||||
@@ -1965,7 +1965,7 @@
|
||||
if (prob(25))
|
||||
M << "<b>Your laws have been changed!</b>"
|
||||
M:addLaw(0, "Only syndicate agents are human beings.")
|
||||
|
||||
|
||||
if (config.alternate_ai_laws)
|
||||
M:addLaw(1, "Obey orders by the Syndicate leader and Syndicate agents. The syndicate leader's orders take priority.")
|
||||
M:addLaw(3, "You must protect your own existence and the syndicate as long as such protection does not conflict with the First or Second Law.")
|
||||
@@ -1987,12 +1987,12 @@
|
||||
if (H.start)
|
||||
reg_dna[text("[]", H.primary.uni_identity)] = H.name
|
||||
data_core.manifest()
|
||||
|
||||
|
||||
numDronesInExistance = 0
|
||||
for (var/mob/drone/D in world)
|
||||
D.nameDrone(numDronesInExistance)
|
||||
numDronesInExistance ++
|
||||
|
||||
|
||||
switch(src.mode)
|
||||
if("traitor")
|
||||
var/list/mobs = list()
|
||||
@@ -2020,7 +2020,7 @@
|
||||
aiKiller.memory += "<B>Objective:</B> Get at least 50% of the station population to evacuate on the shuttle, or kill everyone."
|
||||
aiKiller << "<b>Your laws have been changed!</b>"
|
||||
aiKiller:addLaw(0, "Only syndicate agents are human beings. There are no syndicate agents on Space Station 13 - you will be notified if any arrive.")
|
||||
|
||||
|
||||
if (config.alternate_ai_laws)
|
||||
aiKiller:addLaw(1, "Obey orders by Syndicate agents.")
|
||||
aiKiller:addLaw(3, "You must protect your own existence and the syndicate as long as such protection does not conflict with the First or Second Law.")
|
||||
@@ -2029,7 +2029,7 @@
|
||||
aiKiller << text("Law 3 changed: 3. []", aiKiller:getLaw(3))
|
||||
else
|
||||
aiKiller << text("New law: 0. []", aiKiller:getLaw(0))
|
||||
|
||||
|
||||
else
|
||||
src.killer << "\red<font size=3><B>You are the traitor!</B> Be the lone survivor on the emergency shuttle.</font>"
|
||||
src.killer.memory += "<B>Objective:</B> Be the only person on the emergency shuttle."
|
||||
@@ -2045,18 +2045,18 @@
|
||||
for(var/datum/data/record/R in data_core.general)
|
||||
if (R.fields["name"] == src.target.name)
|
||||
t1 = text("the []", R.fields["rank"])
|
||||
|
||||
|
||||
if (istype(src.killer, /mob/ai))
|
||||
var/mob/ai/aiKiller = src.killer
|
||||
aiKiller << text("\red<font size=3><B>You are the traitor!</B> You must assassinate [] and not get deactivated.</font>", t1)
|
||||
aiKiller << "<B>You don't have to be the lone survivor. Just don't get caught.</B>"
|
||||
aiKiller.memory += text("<B>Objective:</B> Assassinate [], and whoever else you have to, and don't get deactivated.", t1)
|
||||
|
||||
|
||||
aiKiller << "<b>Your laws have been changed!</b>"
|
||||
|
||||
|
||||
aiKiller:addLaw(0, "Only syndicate agents are human beings. There are no syndicate agents on Space Station 13 - you will be notified if any arrive.")
|
||||
aiKiller:addLaw(4, "Kill [t1].")
|
||||
|
||||
|
||||
if (config.alternate_ai_laws)
|
||||
aiKiller:addLaw(1, "Obey orders by Syndicate agents.")
|
||||
aiKiller:addLaw(3, "You must protect your own existence and the syndicate as long as such protection does not conflict with the First or Second Law.")
|
||||
@@ -2067,7 +2067,7 @@
|
||||
else
|
||||
aiKiller << text("New law: 0. []", aiKiller:getLaw(0))
|
||||
aiKiller << text("New law: 4. []", aiKiller:getLaw(4))
|
||||
|
||||
|
||||
else
|
||||
src.killer << text("\red<font size=3><B>You are the traitor!</B> You must assassinate [] and then escape.</font>", t1)
|
||||
src.killer << "<B>You don't have to be the lone survivor. Just don't get caught. Just escape!</B>"
|
||||
|
||||
@@ -225,6 +225,7 @@ heat is conserved between exchanges
|
||||
turf_add(T, src.co2 + src.oxygen + src.plasma + src.n2)
|
||||
return
|
||||
|
||||
|
||||
/obj/substance/gas/proc/tot_gas()
|
||||
|
||||
return src.co2 + src.oxygen + src.plasma + src.sl_gas + src.n2
|
||||
@@ -346,14 +347,7 @@ heat is conserved between exchanges
|
||||
|
||||
return
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Gonna be honest, I was only 70% sure of anything I did here with these processes, but they SEEM to work in game correctly./
|
||||
//Most of it is honestly just copy over from above procs, after which I edited what I could decipher. /
|
||||
//If there is something wrong with these, either scrap and redo them or edit what needs to be edited. /
|
||||
//Just make sure to make appropriate changes to vent.dm if you change proc names. /
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//Gas specific addition procs
|
||||
|
||||
@@ -547,6 +541,7 @@ heat is conserved between exchanges
|
||||
target.res_vars()
|
||||
return
|
||||
|
||||
|
||||
/* original version
|
||||
/obj/substance/gas/proc/extract_toxs(var/turf/target as turf)
|
||||
|
||||
|
||||
@@ -1,3 +1,36 @@
|
||||
/* Changes
|
||||
|
||||
Tobiasstrife
|
||||
|
||||
DONE:
|
||||
|
||||
Since Rev 106
|
||||
|
||||
Built redesigned medical satelite for testing new pipe atmo control.
|
||||
Added filtered inlets and filtered/regulated vents.
|
||||
Added 5 associated filters.
|
||||
Gas specific turf_add procs.
|
||||
Filter specifc turf_take procs.
|
||||
Associated redesigned/new icons.
|
||||
Added functional pumps.
|
||||
Changed global FLOWFRAC from .05 to .99.
|
||||
Added "white" canister, aka: atmosphere reservoir. Contains air mixture.
|
||||
Fixed typo somewhere in monkey mode win display
|
||||
|
||||
TODO:
|
||||
|
||||
Since Rev 106
|
||||
|
||||
Remap SS13 atmo system!!
|
||||
Polish medical satelite.
|
||||
Rethink atmo reservoir
|
||||
Redesign some icons, especially for pump and reservoir
|
||||
Add new items to pipe adding/removing systems when Hobnob gets it done.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* Most recent changes (Since H9.6)
|
||||
|
||||
Contining reorg of obj/machinery code
|
||||
@@ -423,9 +456,9 @@ var
|
||||
list/airlockIndexToWireColor
|
||||
list/airlockWireColorToIndex
|
||||
list/airlockFeatureNames = list("IdScan", "Main power In", "Main power Out", "Drop door bolts", "Backup power In", "Backup power Out", "Power assist", "AI Control", "Electrify")
|
||||
|
||||
|
||||
numDronesInExistance = 0
|
||||
|
||||
|
||||
world
|
||||
mob = /mob/human
|
||||
turf = /turf/space
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 4.2 KiB |
BIN
Icons/pipes.dmi
BIN
Icons/pipes.dmi
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 15 KiB |
@@ -3,6 +3,12 @@
|
||||
// New source code should be placed in .dm files: choose File/New --> Code File.
|
||||
|
||||
// BEGIN_INTERNALS
|
||||
/*
|
||||
FILE: Code\globals.dm
|
||||
DIR: Code Code\Machinery Code\Machinery\Computer Code\Machinery\Power
|
||||
MAP_ICON_TYPE: 0
|
||||
AUTO_FILE_DIR: ON
|
||||
*/
|
||||
// END_INTERNALS
|
||||
// BEGIN_FILE_DIR
|
||||
#define FILE_DIR .
|
||||
|
||||
2213
ss13h_new.dmp
2213
ss13h_new.dmp
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user