Don't kill me.. Its a commit to test something.. Sorry folks!

(testing a working air system made by Tobias Strife)
This commit is contained in:
zjm7891
2008-07-24 04:15:02 +00:00
parent 0d957161fb
commit 7e78cf0130
9 changed files with 4003 additions and 3057 deletions
+47
View File
@@ -1353,6 +1353,53 @@ obj/item/weapon/clothing/suit/labcoat
icon_state = "fcardholder0"
s_istate = "clipboard"
w_class = 3.0
/obj/item/weapon/filter //New vent air filters
icon_state = "regulatorfilter1"
var/oftype //Original filter type. Used when repairing Malf. Filters
var/ftype //Filter Type
var/cover = 1 //Starts covered.
var/oname //Original name. Used when repairing Malf. Filters
var/odesc //Original desc. Used when repairing Malf. Filters
w_class = 3.0
filtertype1
name = "Filter Type 1"
desc = "A type 1 Air Filter. Filters all gasses except Nitrogen and Oxygen."
oname = "Filter Type 1"
odesc = "A type 1 Air Filter. Filters all gasses except Nitrogen and Oxygen."
icon_state = "regulatorfilter1"
oftype = 1
ftype = 1
filtertype2
name = "Filter Type 2"
desc = "A type 2 Air Filter. Filters all gasses except co2."
oname = "Filter Type 2"
odesc = "A type 2 Air Filter. Filters all gasses except co2."
icon_state = "regulatorfilter2"
oftype = 2
ftype = 2
filtertype3
name = "Filter Type 3"
desc = "A type 3 Air Filter. Filters co2."
oname = "Filter Type 3"
odesc = "A type 3 Air Filter. Filters co2."
icon_state = "regulatorfilter3"
oftype = 3
ftype = 3
filtertype4
name = "Filter Type 4"
desc = "A type 4 Air Filter. Filters Nitrogen and Oxygen."
oname = "Filter Type 4"
odesc = "A type 4 Air Filter. Filters Nitrogen and Oxygen."
icon_state = "regulatorfilter4"
oftype = 4
ftype = 4
filtertype5
name = "Malfunctioning Filter"
desc = "A malfunctioning Air Filter. Filters nothing."
icon_state = "regulatorfilter5"
ftype = 5
/obj/item/weapon/flash
name = "flash"
icon_state = "flash"
+17 -2
View File
@@ -88,7 +88,7 @@ obj/machinery/atmoalter/canister
var/t = src.t_per
if (src.t_per > t2)
t = t2
src.holding.gas.transfer_from(src.gas, t)
else // If not holding a tank, release gas into the turf
if (T)
@@ -254,7 +254,7 @@ Pipe Valve Status: [ct]<BR>
Topic(href, href_list)
//debug message: //usr.client_mob() << "Topic on canister, usr is [usr], src is [src], usr.client_mob() is [usr.client_mob()], href is ([href]), href_list is ([href_list])."
..()
if (usr.stat || usr.restrained())
return
@@ -441,4 +441,19 @@ Pipe Valve Status: [ct]<BR>
return
//Main Atmospheric Reservoir, starts with air mixture. 10x normal holding capacity/starting amount. Anchored.
//This is just for testing, it's not permanent as the overlays don't look right and something a litttle more sophisticated
//Would be nice.
airreservoir
name = "Main Atmosphere Reservoir"
icon_state = "white"
color = "white"
anchored = 1
maximum = 1.3E9
New()
..()
src.gas.oxygen = 2.1e8*filled
src.gas.n2 = 7.9e8*filled
return
+295
View File
@@ -93,3 +93,298 @@ obj/machinery/vent
//Regulator for pipe based atmosphere
obj/machinery/regulator
name = "Atmospheric Control Vent"
icon = 'pipes.dmi'
icon_state = "vent"
desc = "A gas pipe outlet vent, fitted with a regulator and 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
regulator = 1 //Positive, Regulator is on
filtertype = 1 //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 = 1 //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 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 if regulator off, or dump regulated amount if on, associated filttration, then do standard flow calc for connected pipe.
process()
var/delta_gt
var/turf/T = src.loc //Set T
if (src.regulator == 0) //If the regulator is off. All following will just dump gas without regulation.
if (src.filtertype == 0) //NO Filter. They will not run without filters.
if (src.cover == 1) //Check if the filter has it's cover on.
flick("ventnofilter",src) //Of so flick the warning button icon_state
return
else //If the cover is up
return //Just return, don't flick the warning
// delta_gt = FLOWFRAC * (gas.tot_gas() / capmult)
// ngas.turf_add(T, delta_gt)
if (src.filtertype == 1) //Filter Type 1, Allow: Oxygen & N2
delta_gt = FLOWFRAC * (gas.oxygen / capmult)
ngas.turf_add_oxy(T, delta_gt)
delta_gt = FLOWFRAC * (gas.n2 / capmult)
ngas.turf_add_n2(T, delta_gt)
if (src.filtertype == 2) //Filter Type 1, Allow: co2
delta_gt = FLOWFRAC * (gas.co2 / capmult)
ngas.turf_add_co2(T, delta_gt)
if (src.filtertype == 3) //Filter Type 3, Allow: Oxygen, N2, Plasma, n2o
delta_gt = FLOWFRAC * (gas.oxygen / capmult)
ngas.turf_add_oxy(T, delta_gt)
delta_gt = FLOWFRAC * (gas.n2 / capmult)
ngas.turf_add_n2(T, delta_gt)
delta_gt = FLOWFRAC * (gas.plasma / capmult)
ngas.turf_add_plasma(T, delta_gt)
delta_gt = FLOWFRAC * (gas.sl_gas / capmult)
ngas.turf_add_sl(T, delta_gt)
if (src.filtertype == 4) //Filter Type 4, Allow: co2, Plasma, n2o
delta_gt = FLOWFRAC * (gas.co2 / capmult)
ngas.turf_add_co2(T, delta_gt)
delta_gt = FLOWFRAC * (gas.plasma / capmult)
ngas.turf_add_plasma(T, delta_gt)
delta_gt = FLOWFRAC * (gas.sl_gas / capmult)
ngas.turf_add_sl(T, delta_gt)
if (src.filtertype == 5) //Filter Type 5, AKA: Malfunctioning Filter/Hacked Filter Allow: All
delta_gt = FLOWFRAC * (gas.tot_gas() / capmult)
ngas.turf_add(T, delta_gt)
if (src.regulator == 1) //If regulator is on. All gas will be regulated when dumped.
var/difference //Define the difference
var/t1 //Define t1
if (src.filtertype == 0) //No Filter, vent will not operate. Same process as above.
if (src.cover == 1)
flick("ventnofilter",src)
return
else
return
if (src.filtertype == 1) //Same filtertypes as above.
difference = 756000.0 - T.oxygen //Set difference as CELLSTANDARD for oxygen - turf oxygen
if (difference > 0) //If there is a difference
t1 = src.gas.oxygen //Set t1 as the vents gas.oxygen level
if (difference > t1) //Make sure the difference (which will determine the dump amount) is not bigger than oxygen amount in gas in vent.
difference = t1 //If it is, set it to dump all that is there.
ngas.turf_add_oxy(T, difference) //Call turf_add_oxy proc, to the turf, for the difference.
difference = 2844000.0 - T.n2 //Same as oxygen, except for N2
if (difference > 0)
t1 = src.gas.n2
if (difference > t1)
difference = t1
ngas.turf_add_n2(T, difference)
if (src.filtertype == 2)
delta_gt = FLOWFRAC * (gas.co2 / capmult / 10)
ngas.turf_add_co2(T, delta_gt)
if (src.filtertype == 3)
difference = 756000.0 - T.oxygen
if (difference > 0)
t1 = src.gas.oxygen
if (difference > t1)
difference = t1
ngas.turf_add_oxy(T, difference)
difference = 2844000.0 - T.n2
if (difference > 0)
t1 = src.gas.n2
if (difference > t1)
difference = t1
ngas.turf_add_n2(T, difference)
delta_gt = FLOWFRAC * (gas.plasma / capmult / 10)
ngas.turf_add_plasma(T, delta_gt)
delta_gt = FLOWFRAC * (gas.sl_gas / capmult / 10)
ngas.turf_add_sl(T, delta_gt)
if (src.filtertype == 4)
delta_gt = FLOWFRAC * (gas.co2 / capmult / 10)
ngas.turf_add_co2(T, delta_gt)
delta_gt = FLOWFRAC * (gas.plasma / capmult / 10)
ngas.turf_add_plasma(T, delta_gt)
delta_gt = FLOWFRAC * (gas.sl_gas / capmult / 10)
ngas.turf_add_sl(T, delta_gt)
if (src.filtertype == 5)
difference = 756000.0 - T.oxygen
if (difference > 0)
t1 = src.gas.oxygen
if (difference > t1)
difference = t1
ngas.turf_add_oxy(T, difference)
difference = 2844000.0 - T.n2
if (difference > 0)
t1 = src.gas.n2
if (difference > t1)
difference = t1
ngas.turf_add_n2(T, difference)
delta_gt = FLOWFRAC * (gas.co2 / capmult / 10)
ngas.turf_add_co2(T, delta_gt)
delta_gt = FLOWFRAC * (gas.plasma / capmult / 10)
ngas.turf_add_plasma(T, delta_gt)
delta_gt = FLOWFRAC * (gas.sl_gas / capmult / 10)
ngas.turf_add_sl(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)
//Cover, Self explanitory
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 vent.")
src.cover = 0
src.icon_state="ventopen"
src.add_fingerprint(user)
else
user.show_message("\blue You carefully screw the cover back on the vent.")
src.cover = 1
src.icon_state="vent"
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 vent 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 vent 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!")
//Toggle Regulator
else
if ( istype(W, /obj/item/weapon/wirecutters))
if (src.cover == 1) //If it's covered this won't happen.
return
if (src.filtertype > 0) //Filter must be removed to reach regulator. Did this so there would be an order to dissasembling a vent.
user.show_message("\blue The filter must be removed to reach the regulator.")
return
else
if (src.regulator == 1)
user.show_message("\blue You cut the wires to the regulator, gas will now flow freely.")
src.regulator = 0
src.add_fingerprint(user)
else
user.show_message("\blue You mend the wires to the regulator, gas flow will now be regulated.")
src.regulator=1
src.add_fingerprint(user)
+19
View File
@@ -196,6 +196,25 @@
/area/turret_protected/computer_core
name = "Computer Core"
/area/medical_station/medical_dock
name = "dock"
/area/medical_station/medical_station
name = "main deck"
/area/medical_station/medical_engine
name = "engine control"
/area/medical_station/medical_engine_storage
name = "engine storage"
/area/medical_station/atmosphere_control_center
name = "atmosphere control center"
/area/medical_station/equipment_storage
name = "equipment storage"
/area/medical_station/chemical_storage
name = "chemical storage"
/area/medical_station/atmosphere_experiment
name = "experimental atmospheric testing"
/area/medical_station/ventilation_shaft
name = "ventilation shaft"
/area/New()
..()
+138 -2
View File
@@ -317,6 +317,7 @@ heat is conserved between exchanges
return
/obj/substance/gas/proc/turf_add_all_oxy(var/turf/target as turf)
var/t_gas = tot_gas()
@@ -326,7 +327,6 @@ heat is conserved between exchanges
var/heat_change = oxygen * temperature
//target.heat += heat_change
if( (t_turf + oxygen) >0 )
target.temp = ( target.temp * t_turf + heat_change ) / ( t_turf + oxygen )
@@ -346,6 +346,142 @@ 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
/obj/substance/gas/proc/turf_add_oxy(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/t2 = src.oxygen
if (amount < 0)
amount = src.oxygen
if (!( t2 ))
return
var/t_oxy = amount * src.oxygen / t2
src.oxygen -= t_oxy
var/ttotal = target.tot_gas()
target.oxygen += t_oxy
target.temp = ( target.temp * ttotal + (amount * temperature)*TURF_ADD_FRAC ) / (ttotal + amount)
target.res_vars()
return
/obj/substance/gas/proc/turf_add_co2(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/t2 = src.co2
if (amount < 0)
amount = src.co2
if (!( t2 ))
return
var/t_co2 = amount * src.co2 / t2
src.co2 -= t_co2
var/ttotal = target.tot_gas()
target.co2 += t_co2
target.temp = ( target.temp * ttotal + (amount * temperature)*TURF_ADD_FRAC ) / (ttotal + amount)
target.res_vars()
return
/obj/substance/gas/proc/turf_add_n2(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/t2 = src.n2
if (amount < 0)
amount = src.n2
if (!( t2 ))
return
var/t_n2 = amount * src.n2 / t2
src.n2 -= t_n2
var/ttotal = target.tot_gas()
target.n2 += t_n2
target.temp = ( target.temp * ttotal + (amount * temperature)*TURF_ADD_FRAC ) / (ttotal + amount)
target.res_vars()
return
/obj/substance/gas/proc/turf_add_plasma(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/t2 = src.plasma
if (amount < 0)
amount = src.plasma
if (!( t2 ))
return
var/t_pla = amount * src.plasma / t2
src.plasma -= t_pla
var/ttotal = target.tot_gas()
target.poison += t_pla
target.temp = ( target.temp * ttotal + (amount * temperature)*TURF_ADD_FRAC ) / (ttotal + amount)
target.res_vars()
return
/obj/substance/gas/proc/turf_add_sl(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/t2 = src.sl_gas
if (amount < 0)
amount = src.sl_gas
if (!( t2 ))
return
var/t_sl_gas = amount * src.sl_gas / t2
src.sl_gas -= t_sl_gas
var/ttotal = target.tot_gas()
target.sl_gas += t_sl_gas
target.temp = ( target.temp * ttotal + (amount * temperature)*TURF_ADD_FRAC ) / (ttotal + amount)
target.res_vars()
return
//End gas specific addition procs
/obj/substance/gas/proc/turf_take(var/turf/target as turf, amount)
if (((!( istype(target, /turf) ) && !( istype(target, /obj/move) )) || !( amount )))
@@ -733,7 +869,7 @@ heat is conserved between exchanges
M.eye_blurry += volume * 15
else
M.paralysis += volume * 12
if (M.stat == 0)
if (M.stat == 0)
M.stat = 1
return
+1 -1
View File
@@ -45,7 +45,7 @@
#ifdef VARSICON
var/rnd = rand(1,10000) // use random number in filename to avoid conflicts
user.client_mob() << browse_rsc(val, "tmp\ref[val][rnd].png") // precache the icon image file
user:client_mob() << browse_rsc(val, "tmp\ref[val][rnd].png") // precache the icon image file
t+="<IMG SRC=\"tmp\ref[val][rnd].png\">" // and add the icon to the HTML
#endif
+99
View File
@@ -429,3 +429,102 @@
node.buildnodes()
//Filter Attackby Procs
//Remove & Replace cover
/obj/item/weapon/filter/attackby(obj/item/weapon/W, mob/user)
if ( istype(W, /obj/item/weapon/screwdriver))
if (src.cover == 1) //If its closed
if (src.ftype == src.oftype) //If the filter is operating normaly.
user.show_message("\blue You unscrew the protective cover.")
src.cover = 0
src.icon_state="filter[src.ftype]open" //Set its operating open state.
src.add_fingerprint(user)
else
user.show_message("\blue You unscrew the protective cover.") //If it's malfunctioning.
src.cover = 0
src.icon_state="filter5open" //Set malfunctioning open state.
src.add_fingerprint(user)
else //If its open.
if (src.ftype == src.oftype) //If the filter is operating normaly.
src.icon_state="regulatorfilter[src.ftype]" //Set its operating closed state.
user.show_message("\blue You carefully screw on the protective cover")
src.cover = 1
src.add_fingerprint(user)
else //If the filter is malfunctioning.
src.icon_state="regulatorfilter5" //Set malfunctioning closed state.
user.show_message("\blue You carefully screw on the protective cover")
src.cover = 1
src.add_fingerprint(user)
//Cut & Mend wires
else
if ( istype(W, /obj/item/weapon/wirecutters))
if (src.cover == 1)
return
else
if (src.ftype == src.oftype)
src.icon_state="filter5open"
src.name = "Malfunctioning Filter"
src.desc = "A malfunctioning Air Filter. Filters nothing."
user.show_message("\blue You cut the safety wires. Gases will now bypass the filter.")
src.ftype = 5
src.add_fingerprint(user)
else
src.icon_state="filter[src.oftype]open"
src.name = src.oname
src.desc = src.odesc
user.show_message("\blue You mend the safety wires. The filter will now work as it should.")
src.ftype = src.oftype
src.add_fingerprint(user)
//Special process for Filter Type 5 AKA: Malfunctioning Filter.
//These objects are only spawned when taken out of a vent, since a Type 5 at first is actually just it's original object
//with a changed name, desc, and filter type.
//Remove & Replace cover
/obj/item/weapon/filter/filtertype5/attackby(obj/item/weapon/W, mob/user)
if ( istype(W, /obj/item/weapon/screwdriver))
if (src.cover == 1)
user.show_message("\blue You unscrew the protective cover.")
src.cover = 0
src.icon_state="filter5open"
src.add_fingerprint(user)
else
src.icon_state="regulatorfilter5"
user.show_message("\blue You carefully screw on the protective cover")
src.cover = 1
src.add_fingerprint(user)
//Cut & Mend wires
else
if ( istype(W, /obj/item/weapon/wirecutters))
if (src.cover == 1)
return
else
if (src.oftype == 1)
var/obj/item/weapon/filter/filtertype1/I = new(src.loc)
I.icon_state = "filter1open"
I.cover = 0
if (src.oftype == 2)
var/obj/item/weapon/filter/filtertype2/I = new(src.loc)
I.icon_state = "filter2open"
I.cover = 0
if (src.oftype == 3)
var/obj/item/weapon/filter/filtertype3/I = new(src.loc)
I.icon_state = "filter3open"
I.cover = 0
if (src.oftype == 4)
var/obj/item/weapon/filter/filtertype4/I = new(src.loc)
I.icon_state = "filter4open"
I.cover = 0
user.show_message("\blue You mend the safety wires. The filter will now work as it should.")
del (src)
+1 -7
View File
@@ -3,12 +3,6 @@
// New source code should be placed in .dm files: choose File/New --> Code File.
// BEGIN_INTERNALS
/*
FILE: ss13h_new.dmp
DIR: Code Code\Effects Code\Item Code\Item\Weapon Code\Machinery Code\Machinery\Computer
MAP_ICON_TYPE: 0
AUTO_FILE_DIR: ON
*/
// END_INTERNALS
// BEGIN_FILE_DIR
#define FILE_DIR .
@@ -28,12 +22,12 @@ AUTO_FILE_DIR: ON
// END_FILE_DIR
// BEGIN_PREFERENCES
#define DEBUG
// END_PREFERENCES
// BEGIN_INCLUDE
#include "ss13h_new.dmp"
#include "Code\!atoms.dm"
#include "Code\_debug.dm"
#include "Code\aaaDefines.dm"
#include "Code\ai_area_selection.dm"
#include "Code\airtunnel.dm"
+3386 -3045
View File
File diff suppressed because it is too large Load Diff