Merge branch 'master' of github.com:Baystation12/Baystation12

This commit is contained in:
Erthilo
2012-05-12 16:42:54 +01:00
60 changed files with 8421 additions and 8556 deletions
@@ -25,7 +25,7 @@
return null
//Calculate necessary moles to transfer using PV = nRT
if((air1.total_moles() > 0) && (air1.temperature>0))
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)
@@ -37,7 +37,7 @@ obj/machinery/atmospherics/binary/passive_gate
return 1
//Calculate necessary moles to transfer using PV = nRT
if((air1.total_moles() > 0) && (air1.temperature>0))
if((air1.total_moles > 0) && (air1.temperature>0))
var/pressure_delta = (input_starting_pressure - output_starting_pressure)/2
//Can not have a pressure delta that would cause output_pressure > input_pressure
@@ -59,4 +59,4 @@ obj/machinery/atmospherics/binary/passive_gate
attack_hand(mob/user as mob)
src.on = !src.on
src.update_icon()
return
return
@@ -65,7 +65,7 @@ obj/machinery/atmospherics/binary/pump
return 1
//Calculate necessary moles to transfer using PV=nRT
if((air1.total_moles() > 0) && (air1.temperature>0))
if((air1.total_moles > 0) && (air1.temperature>0))
var/pressure_delta = target_pressure - output_starting_pressure
var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
@@ -86,12 +86,6 @@ Filter types:
filtered_out.toxins = removed.toxins
removed.toxins = 0
if(removed.trace_gases.len>0)
for(var/datum/gas/trace_gas in removed.trace_gases)
if(istype(trace_gas, /datum/gas/oxygen_agent_b))
removed.trace_gases -= trace_gas
filtered_out.trace_gases += trace_gas
if(1) //removing O2
filtered_out.oxygen = removed.oxygen
removed.oxygen = 0
@@ -115,6 +109,7 @@ Filter types:
filtered_out = null
filtered_out.update_values()
air2.merge(filtered_out)
air3.merge(removed)
@@ -51,8 +51,8 @@ obj/machinery/atmospherics/trinary/mixer
if(air2.temperature > 0)
transfer_moles2 = (node2_concentration*pressure_delta)*air3.volume/(air2.temperature * R_IDEAL_GAS_EQUATION)
var/air1_moles = air1.total_moles()
var/air2_moles = air2.total_moles()
var/air1_moles = air1.total_moles
var/air2_moles = air2.total_moles
if((air1_moles < transfer_moles1) || (air2_moles < transfer_moles2))
if(!transfer_moles1 || !transfer_moles2) return
@@ -33,7 +33,7 @@ obj/machinery/atmospherics/unary/oxygen_generator
if(!on)
return 0
var/total_moles = air_contents.total_moles()
var/total_moles = air_contents.total_moles
if(total_moles < oxygen_content)
var/current_heat_capacity = air_contents.heat_capacity()
@@ -25,18 +25,18 @@
//Get processable air sample and thermal info from environment
var/transfer_moles = 0.25 * environment.total_moles()
var/transfer_moles = 0.25 * environment.total_moles
var/datum/gas_mixture/external_removed = environment.remove(transfer_moles)
if (!external_removed)
return radiate()
if (external_removed.total_moles() < 10)
if (external_removed.total_moles < 10)
return radiate()
//Get same info from connected gas
var/internal_transfer_moles = 0.25 * air_contents.total_moles()
var/internal_transfer_moles = 0.25 * air_contents.total_moles
var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles)
if (!internal_removed)
@@ -61,7 +61,7 @@
proc/radiate()
var/internal_transfer_moles = 0.25 * air_contents.total_moles()
var/internal_transfer_moles = 0.25 * air_contents.total_moles
var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles)
if (!internal_removed)
@@ -98,7 +98,7 @@
if(scrubbing)
if((environment.toxins>0) || (environment.carbon_dioxide>0) || (environment.trace_gases.len>0))
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles()
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles
//Take a gas sample
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
@@ -117,15 +117,13 @@
if(removed.trace_gases.len>0)
for(var/datum/gas/trace_gas in removed.trace_gases)
if(istype(trace_gas, /datum/gas/oxygen_agent_b))
removed.trace_gases -= trace_gas
filtered_out.trace_gases += trace_gas
else if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O)
if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O)
removed.trace_gases -= trace_gas
filtered_out.trace_gases += trace_gas
//Remix the resulting gases
filtered_out.update_values()
air_contents.merge(filtered_out)
loc.assume_air(removed)
@@ -137,7 +135,7 @@
if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE)
return
var/transfer_moles = environment.total_moles()*(volume_rate/environment.volume)
var/transfer_moles = environment.total_moles*(volume_rate/environment.volume)
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
+6 -4
View File
@@ -92,8 +92,9 @@ datum/pipe_network
for(var/datum/gas_mixture/gas in gases)
air_transient.volume += gas.volume
total_thermal_energy += gas.thermal_energy()
total_heat_capacity += gas.heat_capacity()
var/temp_heatcap = gas.heat_capacity()
total_thermal_energy += gas.temperature*temp_heatcap
total_heat_capacity += temp_heatcap
air_transient.oxygen += gas.oxygen
air_transient.nitrogen += gas.nitrogen
@@ -157,8 +158,9 @@ proc/equalize_gases(datum/gas_mixture/list/gases)
for(var/datum/gas_mixture/gas in gases)
total_volume += gas.volume
total_thermal_energy += gas.thermal_energy()
total_heat_capacity += gas.heat_capacity()
var/temp_heatcap = gas.heat_capacity()
total_thermal_energy += gas.temperature*temp_heatcap
total_heat_capacity += temp_heatcap
total_oxygen += gas.oxygen
total_nitrogen += gas.nitrogen
+1 -33
View File
@@ -381,22 +381,6 @@ obj/machinery/atmospherics/pipe
..()
oxygen_agent_b
icon = 'red_orange_pipe_tank.dmi'
name = "Pressure Tank (Oxygen + Plasma)"
New()
air_temporary = new
air_temporary.volume = volume
air_temporary.temperature = T0C
var/datum/gas/oxygen_agent_b/trace_gas = new
trace_gas.moles = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
air_temporary.trace_gases += trace_gas
..()
oxygen
icon = 'blue_pipe_tank.dmi'
name = "Pressure Tank (Oxygen)"
@@ -480,22 +464,6 @@ obj/machinery/atmospherics/pipe
..()
oxygen_agent_b
icon = 'red_orange_pipe_tank.dmi'
name = "High Capacity Pressure Tank (Oxygen + Plasma)"
New()
air_temporary = new
air_temporary.volume = volume
air_temporary.temperature = T0C
var/datum/gas/oxygen_agent_b/trace_gas = new
trace_gas.moles = (160*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature)
air_temporary.trace_gases += trace_gas
..()
oxygen
icon = 'blue_pipe_tank.dmi'
name = "High Capacity Pressure Tank (Oxygen)"
@@ -599,7 +567,7 @@ obj/machinery/atmospherics/pipe
O << "\red [user] has used the analyzer on \icon[icon]"
var/pressure = parent.air.return_pressure()
var/total_moles = parent.air.total_moles()
var/total_moles = parent.air.total_moles
user << "\blue Results of analysis of \icon[icon]"
if (total_moles>0)
+6 -4
View File
@@ -116,7 +116,7 @@ obj/machinery/portable_atmospherics/canister
valve_open = 1
release_pressure = 1000
/*
obj/machinery/atmospherics
unary
heat_reservoir
@@ -352,6 +352,7 @@ obj/machinery/atmospherics
usr << "[x],[y] is in a pipeline with [parent.members.len] members ([parent.edges.len] edges)! Volume: [parent.air.volume]"
usr << "Pressure: [parent.air.return_pressure()], Temperature: [parent.air.temperature]"
usr << "[parent.air.oxygen], [parent.air.toxins], [parent.air.nitrogen], [parent.air.carbon_dioxide] .. [parent.alert_pressure]"
*/
mob
verb
flag_all_pipe_networks()
@@ -441,6 +442,7 @@ turf/simulated
trace_gas.moles = amount
adding.trace_gases += trace_gas
adding.temperature = T20C
adding.update_values()
assume_air(adding)
@@ -474,7 +476,7 @@ obj/indicator
return "error"
return "[round(GM.nitrogen/MOLES_CELLSTANDARD*10+0.5)]"
else
return "[round((GM.total_moles())/MOLES_CELLSTANDARD*10+0.5)]"
return "[round((GM.total_moles)/MOLES_CELLSTANDARD*10+0.5)]"
Click()
@@ -518,7 +520,7 @@ mob
for(var/obj/effect/hotspot/flame in world)
usr << "[flame.x],[flame.y]: [flame.temperature]K, [flame.volume] L - [flame.loc:air:temperature]"
process_cycle()
/* process_cycle()
set category = "Debug"
if(!master_controller)
usr << "Cannot find master_controller"
@@ -594,7 +596,7 @@ mob
if(S.processing)
S.icon_state = "individual_on"
else
S.icon_state = "individual_off"
S.icon_state = "individual_off"*/
mark_groups()
+39 -135
View File
@@ -10,29 +10,8 @@ datum
// to be rolled into the updating step
//optimization vars
var/tmp/next_check = 0 //number of ticks before this group updates
var/tmp/check_delay = 10 //number of ticks between updates, starts fairly high to get boring groups out of the way
proc
archive()
members()
//Returns the members of the group
check_regroup()
//If individually processing tiles, checks all member tiles to see if they are close enough
// that the group may resume group processing
//Warning: Do not call, called by air_master.process()
process_group()
suspend_group_processing()
update_group_from_tiles()
//Copy group air information to individual tile air
//Used right before turning on group processing
update_tiles_from_group()
//Copy group air information to individual tile air
//Used right before turning off group processing
// var/tmp/next_check = 0 //number of ticks before this group updates
// var/tmp/check_delay = 10 //number of ticks between updates, starts fairly high to get boring groups out of the way
var/list/borders //Tiles that connect this group to other groups/individual tiles
var/list/members //All tiles in this group
@@ -40,13 +19,21 @@ datum
var/list/space_borders
var/length_space_border = 0
suspend_group_processing()
proc/suspend_group_processing()
//Purpose: Suspends processing of the group, breaks it into individual tiles.
//Called by: Any check where the airgroup is determined to break.
//Inputs: None.
//Outputs: None.
group_processing = 0
update_tiles_from_group()
check_delay=0
next_check=0
update_group_from_tiles()
proc/update_group_from_tiles()
//Purpose: Regathers the tiles of the group into the airgroup, reverses update_tiles_from_group()
//Called by: Any check where the airgroup is determined to reconnect.
//Inputs: None.
//Outputs: None.
var/sample_member = pick(members)
var/datum/gas_mixture/sample_air = sample_member:air
@@ -55,20 +42,30 @@ datum
return 1
update_tiles_from_group()
proc/update_tiles_from_group()
//Purpose: Breaks the group into individual tiles.
//Called by: Any check where the airgroup is determined to break.
//Inputs: None.
//Outputs: None.
for(var/member in members)
member:air.copy_from(air)
if (istype(member,/turf/simulated))
var/turf/simulated/turfmem=member
turfmem.reset_delay()
archive()
proc/archive()
//Purpose: Archives the air for optimization.
//Called by: ?
//Inputs: None.
//Outputs: None.
air.archive()
archived_cycle = air_master.current_cycle
check_regroup()
proc/check_regroup()
//Purpose: Checks to see if group processing should be turned back on
//Returns: group_processing
//Called by: Any time an airgroup is checked to reform
//Inputs: None.
//Outputs: if the group is processing or not, boolean
if(group_processing) return 1
@@ -85,15 +82,14 @@ datum
return 1
turf/process_group()
proc/process_group()
//Purpose: Processes group atmos
//Called by: Atmos Ticker.
//Inputs: None.
//Outputs: None.
current_cycle = air_master.current_cycle
if(group_processing) //See if processing this group as a group
//check if we're skipping this tick
if (next_check > 0)
next_check--
return 1
next_check += check_delay + rand(0,check_delay/2)
check_delay++
var/turf/simulated/list/border_individual = list()
var/datum/air_group/list/border_group = list()
@@ -108,22 +104,9 @@ datum
//But only if another group didn't store it for us
for(var/turf/simulated/border_tile in src.borders)
//var/obj/movable/floor/movable_on_me = locate(/obj/movable/floor) in border_tile
for(var/direction in cardinal) //Go through all border tiles and get bordering groups and individuals
if(border_tile.group_border&direction)
var/turf/simulated/enemy_tile = get_step(border_tile, direction) //Add found tile to appropriate category
//var/obj/movable/floor/movable_on_enemy
//if(!movable_on_me)
// movable_on_enemy = locate(/obj/movable/floor) in enemy_tile
/*if(movable_on_enemy) //guaranteed !movable_on_me if this is set
if(movable_on_enemy.parent && movable_on_enemy.parent.group_processing)
border_group += movable_on_enemy.parent
enemies += movable_on_enemy
self_group_borders += border_tile
else
border_individual += movable_on_enemy
self_tile_borders += border_tile
else*/
var/turf/simulated/enemy_tile = get_step(border_tile, direction)
if(istype(enemy_tile) && enemy_tile.parent && enemy_tile.parent.group_processing)
border_group += enemy_tile.parent
enemies += enemy_tile
@@ -233,83 +216,4 @@ datum
member.hotspot_expose(air.temperature, CELL_VOLUME)
member.consider_superconductivity(starting=1)
air.react()
object/process_group()
current_cycle = air_master.current_cycle
if(group_processing) //See if processing this group as a group
var/turf/simulated/list/border_individual = list()
var/datum/air_group/list/border_group = list()
var/turf/simulated/list/enemies = list() //used to send the appropriate border tile of a group to the group proc
var/enemy_index = 1
if(archived_cycle < air_master.current_cycle)
archive()
//Archive air data for use in calculations
//But only if another group didn't store it for us
/*
for(var/obj/movable/floor/border_tile in src.borders)
for(var/direction in list(NORTH,SOUTH,EAST,WEST)) //Go through all border tiles and get bordering groups and individuals
if(border_tile.group_border&direction)
var/turf/simulated/enemy_tile = get_step(border_tile, direction) //Add found tile to appropriate category
var/obj/movable/floor/movable_on_enemy = locate(/obj/movable/floor) in enemy_tile
if(movable_on_enemy)
if(movable_on_enemy.parent && movable_on_enemy.parent.group_processing)
border_group += movable_on_enemy.parent
enemies += movable_on_enemy
enemy_index++
else
border_individual += movable_on_enemy
else
if(istype(enemy_tile) && enemy_tile.parent && enemy_tile.parent.group_processing)
border_group += enemy_tile.parent
enemies += enemy_tile
enemy_index++
else
border_individual += enemy_tile
*/
enemy_index = 1
var/abort_group = 0
for(var/datum/air_group/AG in border_group)
if(AG.archived_cycle < archived_cycle) //archive other groups information if it has not been archived yet this cycle
AG.archive()
if(AG.current_cycle < current_cycle)
//This if statement makes sure two groups only process their individual connections once!
//Without it, each connection would be processed a second time as the second group is evaluated
var/result = air.check_gas_mixture(AG.air)
if(result == 1)
air.share(AG.air)
else if(result == -1)
AG.suspend_group_processing()
var/turf/simulated/floor/enemy_border = enemies[enemy_index]
air.share(enemy_border.air)
else
abort_group = 0
break
enemy_index++
if(!abort_group)
for(var/enemy_tile in border_individual)
if(istype(enemy_tile, /turf/simulated))
if(enemy_tile:archived_cycle < archived_cycle) //archive tile information if not already done
enemy_tile:archive()
if(enemy_tile:current_cycle < current_cycle)
if(air.check_gas_mixture(enemy_tile:air))
air.share(enemy_tile:air)
else
abort_group = 1
break
else
if(air.check_turf(enemy_tile))
air.mimic(enemy_tile)
else
abort_group = 1
break
if(abort_group)
suspend_group_processing()
air.react()
+12 -4
View File
@@ -1,10 +1,18 @@
atom
proc
temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
return null
proc/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
//Purpose: Managing temperature exposure.
//Called by: Atmos
//Inputs: Airmix, temperature, volume.
//Outputs: None.
return null
turf
proc/hotspot_expose(exposed_temperature, exposed_volume, soh = 0)
//Purpose: Making the equivilent of a spark.
//Called by: Atmos. Anything that might light a fire.
//Inputs: Temperature, Volume, ?
//Outputs: If it is igniting or not.
simulated
hotspot_expose(exposed_temperature, exposed_volume, soh)
@@ -40,7 +48,7 @@ turf
//remove just_spawned protection if no longer processing this cell
//start processing quickly if we aren't already
reset_delay()
// reset_delay()
return igniting
+323 -286
View File
@@ -12,15 +12,13 @@ What are the archived variables for?
#define MINIMUM_HEAT_CAPACITY 0.0003
#define QUANTIZE(variable) (round(variable,0.0001))
#define TRANSFER_FRACTION 5 //What fraction (1/#) of the air difference to try and transfer
datum
gas
gas //These are used for the "Trace Gases" stuff, but is buggy.
sleeping_agent
specific_heat = 40
oxygen_agent_b
specific_heat = 300
volatile_fuel
specific_heat = 30
@@ -31,11 +29,12 @@ datum
moles_archived = 0
gas_mixture
var
var //Holds the "moles" of each of the four gases.
oxygen = 0
carbon_dioxide = 0
nitrogen = 0
toxins = 0
total_moles = 0 //Updated when a reaction occurs.
volume = CELL_VOLUME
@@ -47,9 +46,9 @@ datum
graphic
list/datum/gas/trace_gases = list()
list/datum/gas/trace_gases = list() //Seemed to be a good idea that was abandoned
tmp
tmp //These are variables for use with the archived data
oxygen_archived
carbon_dioxide_archived
nitrogen_archived
@@ -60,226 +59,214 @@ datum
graphic_archived
fuel_burnt = 0
proc //PV=nRT - related procedures
heat_capacity()
var/heat_capacity = HEAT_CAPACITY_CALCULATION(oxygen,carbon_dioxide,nitrogen,toxins)
//FOR THE LOVE OF GOD PLEASE USE THIS PROC
//Call it with negative numbers to remove gases.
if(trace_gases.len)
for(var/datum/gas/trace_gas in trace_gases)
heat_capacity += trace_gas.moles*trace_gas.specific_heat
proc/adjustGases(o2 = 0, co2 = 0, n2 = 0, tx = 0, list/datum/gas/traces = list())
//Purpose: Adjusting the gases within a airmix
//Called by: Nothing, yet!
//Inputs: The values of the gases to adjust
//Outputs: null
return heat_capacity
oxygen = max(0, oxygen + o2)
carbon_dioxide = max(0, carbon_dioxide + co2)
nitrogen = max(0, nitrogen + n2)
toxins = max(0, toxins + tx)
heat_capacity_archived()
var/heat_capacity_archived = HEAT_CAPACITY_CALCULATION(oxygen_archived,carbon_dioxide_archived,nitrogen_archived,toxins_archived)
//handle trace gasses
for(var/datum/gas/G in traces)
var/datum/gas/T = locate(G.type) in trace_gases
if(T)
T.moles = max(G.moles + T.moles, 0)
else if(G.moles > 0)
trace_gases |= G
update_values()
return
if(trace_gases.len)
for(var/datum/gas/trace_gas in trace_gases)
heat_capacity_archived += trace_gas.moles_archived*trace_gas.specific_heat
///////////////////////////////
//PV=nRT - related procedures//
///////////////////////////////
return heat_capacity_archived
total_moles()
var/moles = oxygen + carbon_dioxide + nitrogen + toxins
proc/heat_capacity()
//Purpose: Returning the heat capacity of the gas mix
//Called by: UNKNOWN
//Inputs: None
//Outputs: Heat capacity
if(trace_gases.len)
for(var/datum/gas/trace_gas in trace_gases)
moles += trace_gas.moles
var/heat_capacity = HEAT_CAPACITY_CALCULATION(oxygen,carbon_dioxide,nitrogen,toxins)
return moles
if(trace_gases.len)
for(var/datum/gas/trace_gas in trace_gases)
heat_capacity += trace_gas.moles*trace_gas.specific_heat
return_pressure()
if(volume>0)
return total_moles()*R_IDEAL_GAS_EQUATION*temperature/volume
return 0
return heat_capacity
return_temperature()
return temperature
proc/heat_capacity_archived()
//Purpose: Returning the archived heat capacity of the gas mix
//Called by: UNKNOWN
//Inputs: None
//Outputs: Archived heat capacity
return_volume()
return max(0, volume)
var/heat_capacity_archived = HEAT_CAPACITY_CALCULATION(oxygen_archived,carbon_dioxide_archived,nitrogen_archived,toxins_archived)
thermal_energy()
return temperature*heat_capacity()
if(trace_gases.len)
for(var/datum/gas/trace_gas in trace_gases)
heat_capacity_archived += trace_gas.moles_archived*trace_gas.specific_heat
proc //Procedures used for very specific events
check_tile_graphic()
//returns 1 if graphic changed
graphic = null
if(toxins > MOLES_PLASMA_VISIBLE)
graphic = "plasma"
return heat_capacity_archived
proc/return_pressure()
//Purpose: Calculating Current Pressure
//Called by:
//Inputs: None
//Outputs: Gas pressure.
if(volume>0)
return total_moles*R_IDEAL_GAS_EQUATION*temperature/volume
return 0
// proc/return_temperature()
//Purpose:
//Inputs:
//Outputs:
// return temperature
// proc/return_volume()
//Purpose:
//Inputs:
//Outputs:
// return max(0, volume)
// proc/thermal_energy()
//Purpose:
//Inputs:
//Outputs:
// return temperature*heat_capacity()
proc/update_values()
//Purpose: Calculating and storing values which were normally called CONSTANTLY
//Called by: Anything that changes values within a gas mix.
//Inputs: None
//Outputs: None
total_moles = oxygen + carbon_dioxide + nitrogen + toxins
if(trace_gases.len)
for(var/datum/gas/trace_gas in trace_gases)
total_moles += trace_gas.moles
return
////////////////////////////////////////////
//Procedures used for very specific events//
////////////////////////////////////////////
proc/check_tile_graphic()
//Purpose: Calculating the graphic for a tile
//Called by: Turfs updating
//Inputs: None
//Outputs: 1 if graphic changed, 0 if unchanged
graphic = null
if(toxins > MOLES_PLASMA_VISIBLE)
graphic = "plasma"
else
var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in trace_gases
if(sleeping_agent && (sleeping_agent.moles > 1))
graphic = "sleeping_agent"
else
var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in trace_gases
if(sleeping_agent && (sleeping_agent.moles > 1))
graphic = "sleeping_agent"
graphic = null
return graphic != graphic_archived
proc/react(atom/dump_location)
//Purpose: Calculating if it is possible for a fire to occur in the airmix
//Called by: Air mixes updating?
//Inputs: None
//Outputs: If a fire occured
var/reacting = 0 //set to 1 if a notable reaction occured (used by pipe_network)
if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
if(fire() > 0)
reacting = 1
return reacting
proc/fire()
//Purpose: Calculating any fire reactions.
//Called by: react() (See above)
//Inputs: None
//Outputs: How much fuel burned
var/energy_released = 0
var/old_heat_capacity = heat_capacity()
var/datum/gas/volatile_fuel/fuel_store = locate(/datum/gas/volatile_fuel) in trace_gases
if(fuel_store) //General volatile gas burn
var/burned_fuel = 0
if(oxygen < fuel_store.moles)
burned_fuel = oxygen
fuel_store.moles -= burned_fuel
oxygen = 0
else
burned_fuel = fuel_store.moles
oxygen -= fuel_store.moles
del(fuel_store)
energy_released += FIRE_CARBON_ENERGY_RELEASED * burned_fuel
carbon_dioxide += burned_fuel
fuel_burnt += burned_fuel
//Handle plasma burning
if(toxins > MINIMUM_HEAT_CAPACITY)
var/plasma_burn_rate = 0
var/oxygen_burn_rate = 0
//more plasma released at higher temperatures
var/temperature_scale
if(temperature > PLASMA_UPPER_TEMPERATURE)
temperature_scale = 1
else
temperature_scale = (temperature-PLASMA_MINIMUM_BURN_TEMPERATURE)/(PLASMA_UPPER_TEMPERATURE-PLASMA_MINIMUM_BURN_TEMPERATURE)
if(temperature_scale > 0)
oxygen_burn_rate = 1.4 - temperature_scale
if(oxygen > toxins*PLASMA_OXYGEN_FULLBURN)
plasma_burn_rate = (toxins*temperature_scale)/4
else
graphic = null
plasma_burn_rate = (temperature_scale*(oxygen/PLASMA_OXYGEN_FULLBURN))/4
if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY)
toxins -= plasma_burn_rate
oxygen -= plasma_burn_rate*oxygen_burn_rate
carbon_dioxide += plasma_burn_rate
return graphic != graphic_archived
energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate)
react(atom/dump_location)
var/reacting = 0 //set to 1 if a notable reaction occured (used by pipe_network)
fuel_burnt += (plasma_burn_rate)*(1+oxygen_burn_rate)
if(trace_gases.len > 0)
if(temperature > 900)
if(toxins > MINIMUM_HEAT_CAPACITY && carbon_dioxide > MINIMUM_HEAT_CAPACITY)
var/datum/gas/oxygen_agent_b/trace_gas = locate(/datum/gas/oxygen_agent_b/) in trace_gases
if(trace_gas)
var/reaction_rate = min(carbon_dioxide*0.75, toxins*0.25, trace_gas.moles*0.05)
if(energy_released > 0)
var/new_heat_capacity = heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
temperature = (temperature*old_heat_capacity + energy_released)/new_heat_capacity
update_values()
carbon_dioxide -= reaction_rate
oxygen += reaction_rate
return fuel_burnt
trace_gas.moles -= reaction_rate*0.05
temperature -= (reaction_rate*20000)/heat_capacity()
reacting = 1
fuel_burnt = 0
if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
//world << "pre [temperature], [oxygen], [toxins]"
if(fire() > 0)
reacting = 1
//world << "post [temperature], [oxygen], [toxins]"
return reacting
fire()
var/energy_released = 0
var/old_heat_capacity = heat_capacity()
var/datum/gas/volatile_fuel/fuel_store = locate(/datum/gas/volatile_fuel/) in trace_gases
if(fuel_store) //General volatile gas burn
var/burned_fuel = 0
if(oxygen < fuel_store.moles)
burned_fuel = oxygen
fuel_store.moles -= burned_fuel
oxygen = 0
else
burned_fuel = fuel_store.moles
oxygen -= fuel_store.moles
del(fuel_store)
energy_released += FIRE_CARBON_ENERGY_RELEASED * burned_fuel
carbon_dioxide += burned_fuel
fuel_burnt += burned_fuel
//Handle plasma burning
if(toxins > MINIMUM_HEAT_CAPACITY)
var/plasma_burn_rate = 0
var/oxygen_burn_rate = 0
//more plasma released at higher temperatures
var/temperature_scale
if(temperature > PLASMA_UPPER_TEMPERATURE)
temperature_scale = 1
else
temperature_scale = (temperature-PLASMA_MINIMUM_BURN_TEMPERATURE)/(PLASMA_UPPER_TEMPERATURE-PLASMA_MINIMUM_BURN_TEMPERATURE)
if(temperature_scale > 0)
oxygen_burn_rate = 1.4 - temperature_scale
if(oxygen > toxins*PLASMA_OXYGEN_FULLBURN)
plasma_burn_rate = (toxins*temperature_scale)/4
else
plasma_burn_rate = (temperature_scale*(oxygen/PLASMA_OXYGEN_FULLBURN))/4
if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY)
toxins -= plasma_burn_rate
oxygen -= plasma_burn_rate*oxygen_burn_rate
carbon_dioxide += plasma_burn_rate
energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate)
fuel_burnt += (plasma_burn_rate)*(1+oxygen_burn_rate)
if(energy_released > 0)
var/new_heat_capacity = heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
temperature = (temperature*old_heat_capacity + energy_released)/new_heat_capacity
return fuel_burnt
proc
archive()
//Update archived versions of variables
//Returns: 1 in all cases
merge(datum/gas_mixture/giver)
//Merges all air from giver into self. Deletes giver.
//Returns: 1 on success (no failure cases yet)
check_then_merge(datum/gas_mixture/giver)
//Similar to merge(...) but first checks to see if the amount of air assumed is small enough
// that group processing is still accurate for source (aborts if not)
//Returns: 1 on successful merge, 0 if the check failed
remove(amount)
//Proportionally removes amount of gas from the gas_mixture
//Returns: gas_mixture with the gases removed
remove_ratio(ratio)
//Proportionally removes amount of gas from the gas_mixture
//Returns: gas_mixture with the gases removed
subtract(datum/gas_mixture/right_side)
//Subtracts right_side from air_mixture. Used to help turfs mingle
check_then_remove(amount)
//Similar to remove(...) but first checks to see if the amount of air removed is small enough
// that group processing is still accurate for source (aborts if not)
//Returns: gas_mixture with the gases removed or null
copy_from(datum/gas_mixture/sample)
//Copies variables from sample
share(datum/gas_mixture/sharer)
//Performs air sharing calculations between two gas_mixtures assuming only 1 boundary length
//Return: amount of gas exchanged (+ if sharer received)
mimic(turf/model)
//Similar to share(...), except the model is not modified
//Return: amount of gas exchanged
check_gas_mixture(datum/gas_mixture/sharer)
//Returns: 0 if the self-check failed then -1 if sharer-check failed then 1 if both checks pass
check_turf(turf/model)
//Returns: 0 if self-check failed or 1 if check passes
// check_me_then_share(datum/gas_mixture/sharer)
//Similar to share(...) but first checks to see if amount of air moved is small enough
// that group processing is still accurate for source (aborts if not)
//Returns: 1 on successful share, 0 if the check failed
// check_me_then_mimic(turf/model)
//Similar to mimic(...) but first checks to see if amount of air moved is small enough
// that group processing is still accurate (aborts if not)
//Returns: 1 on successful mimic, 0 if the check failed
// check_both_then_share(datum/gas_mixture/sharer)
//Similar to check_me_then_share(...) but also checks to see if amount of air moved is small enough
// that group processing is still accurate for the sharer (aborts if not)
//Returns: 0 if the self-check failed then -1 if sharer-check failed then 1 if successful share
//////////////////////////////////////////////
//Procs for general gas spread calculations.//
//////////////////////////////////////////////
temperature_mimic(turf/model, conduction_coefficient)
proc/archive()
//Purpose: Archives the current gas values
//Called by: UNKNOWN
//Inputs: None
//Outputs: 1
temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
temperature_turf_share(turf/simulated/sharer, conduction_coefficient)
check_me_then_temperature_mimic(turf/model, conduction_coefficient)
check_me_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
check_both_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
check_me_then_temperature_turf_share(turf/simulated/sharer, conduction_coefficient)
compare(datum/gas_mixture/sample)
//Compares sample to self to see if within acceptable ranges that group processing may be enabled
archive()
oxygen_archived = oxygen
carbon_dioxide_archived = carbon_dioxide
nitrogen_archived = nitrogen
@@ -295,7 +282,13 @@ datum
return 1
check_then_merge(datum/gas_mixture/giver)
proc/check_then_merge(datum/gas_mixture/giver)
//Purpose: Similar to merge(...) but first checks to see if the amount of air assumed is small enough
// that group processing is still accurate for source (aborts if not)
//Called by: airgroups/machinery expelling air, ?
//Inputs: The gas to try and merge
//Outputs: 1 on successful merge. 0 otherwise.
if(!giver)
return 0
if(((giver.oxygen > MINIMUM_AIR_TO_SUSPEND) && (giver.oxygen >= oxygen*MINIMUM_AIR_RATIO_TO_SUSPEND)) \
@@ -314,7 +307,12 @@ datum
return merge(giver)
merge(datum/gas_mixture/giver)
proc/merge(datum/gas_mixture/giver)
//Purpose: Merges all air from giver into self. Deletes giver.
//Called by: Machinery expelling air, check_then_merge, ?
//Inputs: The gas to merge.
//Outputs: 1
if(!giver)
return 0
@@ -343,13 +341,18 @@ datum
corresponding = new trace_gas.type()
trace_gases += corresponding
corresponding.moles += trace_gas.moles*giver.group_multiplier/group_multiplier
update_values()
del(giver)
return 1
remove(amount)
proc/remove(amount)
//Purpose: Removes a certain number of moles from the air.
//Called by: ?
//Inputs: How many moles to remove.
//Outputs: Removed air.
var/sum = total_moles()
var/sum = total_moles
amount = min(amount,sum) //Can not take more air than tile has!
if(amount <= 0)
return null
@@ -376,10 +379,16 @@ datum
trace_gas.moles -= corresponding.moles/group_multiplier
removed.temperature = temperature
update_values()
removed.update_values()
return removed
remove_ratio(ratio)
proc/remove_ratio(ratio)
//Purpose: Removes a certain ratio of the air.
//Called by: ?
//Inputs: Percentage to remove.
//Outputs: Removed air.
if(ratio <= 0)
return null
@@ -407,25 +416,36 @@ datum
trace_gas.moles -= corresponding.moles/group_multiplier
removed.temperature = temperature
update_values()
removed.update_values()
return removed
check_then_remove(amount)
proc/check_then_remove(amount)
//Purpose: Similar to remove(...) but first checks to see if the amount of air removed is small enough
// that group processing is still accurate for source (aborts if not)
//Called by: ?
//Inputs: Number of moles to remove
//Outputs: Removed air or 0 if it can remove air or not.
//Since it is all proportional, the check may be done on the gas as a whole
var/sum = total_moles()
amount = min(amount,sum) //Can not take more air than tile has!
amount = min(amount,total_moles) //Can not take more air than tile has!
if((amount > MINIMUM_AIR_RATIO_TO_SUSPEND) && (amount > sum*MINIMUM_AIR_RATIO_TO_SUSPEND))
if((amount > MINIMUM_AIR_RATIO_TO_SUSPEND) && (amount > total_moles*MINIMUM_AIR_RATIO_TO_SUSPEND))
return 0
return remove(amount)
copy_from(datum/gas_mixture/sample)
proc/copy_from(datum/gas_mixture/sample)
//Purpose: Duplicates the sample air mixture.
//Called by: airgroups splitting, ?
//Inputs: Gas to copy
//Outputs: 1
oxygen = sample.oxygen
carbon_dioxide = sample.carbon_dioxide
nitrogen = sample.nitrogen
toxins = sample.toxins
total_moles = sample.total_moles
trace_gases.len=null
if(sample.trace_gases.len > 0)
@@ -439,47 +459,18 @@ datum
return 1
subtract(datum/gas_mixture/right_side)
oxygen -= right_side.oxygen
carbon_dioxide -= right_side.carbon_dioxide
nitrogen -= right_side.nitrogen
toxins -= right_side.toxins
proc/check_gas_mixture(datum/gas_mixture/sharer)
//Purpose: Telling if one or both airgroups needs to disable group processing.
//Called by: Airgroups sharing air, checking if group processing needs disabled.
//Inputs: Gas to compare from other airgroup
//Outputs: 0 if the self-check failed (local airgroup breaks?)
// then -1 if sharer-check failed (sharing airgroup breaks?)
// then 1 if both checks pass (share succesful?)
if((trace_gases.len > 0)||(right_side.trace_gases.len > 0))
for(var/datum/gas/trace_gas in right_side.trace_gases)
var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases
if(!corresponding)
corresponding = new trace_gas.type()
trace_gases += corresponding
corresponding.moles -= trace_gas.moles
return 1
/* check_me_then_share(datum/gas_mixture/sharer)
var/delta_oxygen = (oxygen_archived - sharer.oxygen_archived)/5
var/delta_carbon_dioxide = (carbon_dioxide_archived - sharer.carbon_dioxide_archived)/5
var/delta_nitrogen = (nitrogen_archived - sharer.nitrogen_archived)/5
var/delta_toxins = (toxins_archived - sharer.toxins_archived)/5
var/delta_temperature = (temperature_archived - sharer.temperature_archived)
if(((abs(delta_oxygen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_oxygen) >= oxygen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \
|| ((abs(delta_carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_carbon_dioxide) >= carbon_dioxide_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \
|| ((abs(delta_nitrogen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_nitrogen) >= nitrogen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \
|| ((abs(delta_toxins) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_toxins) >= toxins_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)))
return 0
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND)
return 0
return share(sharer)*/
check_gas_mixture(datum/gas_mixture/sharer)
if(!sharer) return 0
var/delta_oxygen = (oxygen_archived - sharer.oxygen_archived)/5
var/delta_carbon_dioxide = (carbon_dioxide_archived - sharer.carbon_dioxide_archived)/5
var/delta_nitrogen = (nitrogen_archived - sharer.nitrogen_archived)/5
var/delta_toxins = (toxins_archived - sharer.toxins_archived)/5
var/delta_oxygen = QUANTIZE(oxygen_archived - sharer.oxygen_archived)/TRANSFER_FRACTION
var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - sharer.carbon_dioxide_archived)/TRANSFER_FRACTION
var/delta_nitrogen = QUANTIZE(nitrogen_archived - sharer.nitrogen_archived)/TRANSFER_FRACTION
var/delta_toxins = QUANTIZE(toxins_archived - sharer.toxins_archived)/TRANSFER_FRACTION
var/delta_temperature = (temperature_archived - sharer.temperature_archived)
@@ -526,11 +517,16 @@ datum
return 1
check_turf(turf/model)
var/delta_oxygen = (oxygen_archived - model.oxygen)/5
var/delta_carbon_dioxide = (carbon_dioxide_archived - model.carbon_dioxide)/5
var/delta_nitrogen = (nitrogen_archived - model.nitrogen)/5
var/delta_toxins = (toxins_archived - model.toxins)/5
proc/check_turf(turf/model)
//Purpose: Used to compare the gases in an unsimulated turf with the gas in a simulated one.
//Called by: Sharing air (mimicing) with adjacent unsimulated turfs
//Inputs: Unsimulated turf
//Outputs: 1 if safe to mimic, 0 if needs to break airgroup.
var/delta_oxygen = (oxygen_archived - model.oxygen)/TRANSFER_FRACTION
var/delta_carbon_dioxide = (carbon_dioxide_archived - model.carbon_dioxide)/TRANSFER_FRACTION
var/delta_nitrogen = (nitrogen_archived - model.nitrogen)/TRANSFER_FRACTION
var/delta_toxins = (toxins_archived - model.toxins)/TRANSFER_FRACTION
var/delta_temperature = (temperature_archived - model.temperature)
@@ -549,12 +545,17 @@ datum
return 1
share(datum/gas_mixture/sharer)
if(!sharer) return 0
var/delta_oxygen = QUANTIZE(oxygen_archived - sharer.oxygen_archived)/5
var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - sharer.carbon_dioxide_archived)/5
var/delta_nitrogen = QUANTIZE(nitrogen_archived - sharer.nitrogen_archived)/5
var/delta_toxins = QUANTIZE(toxins_archived - sharer.toxins_archived)/5
proc/share(datum/gas_mixture/sharer)
//Purpose: Used to transfer gas from a more pressurised tile to a less presurised tile
// (Two directional, if the other tile is more pressurised, air travels to current tile)
//Called by: Sharing air with adjacent simulated turfs
//Inputs: Air datum to share with
//Outputs: Amount of gas exchanged (Negative if lost air, positive if gained.)
var/delta_oxygen = QUANTIZE(oxygen_archived - sharer.oxygen_archived)/TRANSFER_FRACTION
var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - sharer.carbon_dioxide_archived)/TRANSFER_FRACTION
var/delta_nitrogen = QUANTIZE(nitrogen_archived - sharer.nitrogen_archived)/TRANSFER_FRACTION
var/delta_toxins = QUANTIZE(toxins_archived - sharer.toxins_archived)/TRANSFER_FRACTION
var/delta_temperature = (temperature_archived - sharer.temperature_archived)
@@ -622,12 +623,12 @@ datum
var/delta = 0
if(corresponding)
delta = QUANTIZE(trace_gas.moles_archived - corresponding.moles_archived)/5
delta = QUANTIZE(trace_gas.moles_archived - corresponding.moles_archived)/TRANSFER_FRACTION
else
corresponding = new trace_gas.type()
sharer.trace_gases += corresponding
delta = trace_gas.moles_archived/5
delta = trace_gas.moles_archived/TRANSFER_FRACTION
trace_gas.moles -= delta/group_multiplier
corresponding.moles += delta/sharer.group_multiplier
@@ -656,7 +657,7 @@ datum
corresponding = new trace_gas.type()
trace_gases += corresponding
delta = trace_gas.moles_archived/5
delta = trace_gas.moles_archived/TRANSFER_FRACTION
trace_gas.moles -= delta/sharer.group_multiplier
corresponding.moles += delta/group_multiplier
@@ -667,6 +668,8 @@ datum
heat_capacity_sharer_to_self += individual_heat_capacity
moved_moles += -delta
update_values()
sharer.update_values()
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
var/new_self_heat_capacity = old_self_heat_capacity + heat_capacity_sharer_to_self - heat_capacity_self_to_sharer
@@ -683,17 +686,22 @@ datum
temperature_share(sharer, OPEN_HEAT_TRANSFER_COEFFICIENT)
if((delta_temperature > MINIMUM_TEMPERATURE_TO_MOVE) || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE)
var/delta_pressure = temperature_archived*(total_moles() + moved_moles) - sharer.temperature_archived*(sharer.total_moles() - moved_moles)
var/delta_pressure = temperature_archived*(total_moles + moved_moles) - sharer.temperature_archived*(sharer.total_moles - moved_moles)
return delta_pressure*R_IDEAL_GAS_EQUATION/volume
else
return 0
mimic(turf/model, border_multiplier)
var/delta_oxygen = QUANTIZE(oxygen_archived - model.oxygen)/5
var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - model.carbon_dioxide)/5
var/delta_nitrogen = QUANTIZE(nitrogen_archived - model.nitrogen)/5
var/delta_toxins = QUANTIZE(toxins_archived - model.toxins)/5
proc/mimic(turf/model, border_multiplier)
//Purpose: Used transfer gas from a more pressurised tile to a less presurised unsimulated tile.
//Called by: "sharing" from unsimulated to simulated turfs.
//Inputs: Unsimulated turf, Multiplier for gas transfer (optional)
//Outputs: Amount of gas exchanged
var/delta_oxygen = QUANTIZE(oxygen_archived - model.oxygen)/TRANSFER_FRACTION
var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - model.carbon_dioxide)/TRANSFER_FRACTION
var/delta_nitrogen = QUANTIZE(nitrogen_archived - model.nitrogen)/TRANSFER_FRACTION
var/delta_toxins = QUANTIZE(toxins_archived - model.toxins)/TRANSFER_FRACTION
var/delta_temperature = (temperature_archived - model.temperature)
@@ -738,7 +746,7 @@ datum
for(var/datum/gas/trace_gas in trace_gases)
var/delta = 0
delta = trace_gas.moles_archived/5
delta = trace_gas.moles_archived/TRANSFER_FRACTION
if(border_multiplier)
trace_gas.moles -= delta*border_multiplier/group_multiplier
@@ -749,6 +757,7 @@ datum
heat_transferred += heat_cap_transferred*temperature_archived
heat_capacity_transferred += heat_cap_transferred
moved_moles += delta
update_values()
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
var/new_self_heat_capacity = old_self_heat_capacity - heat_capacity_transferred
@@ -761,12 +770,12 @@ datum
temperature_mimic(model, model.thermal_conductivity, border_multiplier)
if((delta_temperature > MINIMUM_TEMPERATURE_TO_MOVE) || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE)
var/delta_pressure = temperature_archived*(total_moles() + moved_moles) - model.temperature*(model.oxygen+model.carbon_dioxide+model.nitrogen+model.toxins)
var/delta_pressure = temperature_archived*(total_moles + moved_moles) - model.temperature*(model.oxygen+model.carbon_dioxide+model.nitrogen+model.toxins)
return delta_pressure*R_IDEAL_GAS_EQUATION/volume
else
return 0
check_both_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
proc/check_both_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
var/delta_temperature = (temperature_archived - sharer.temperature_archived)
var/self_heat_capacity = heat_capacity_archived()
@@ -798,7 +807,7 @@ datum
return 1
//Logic integrated from: temperature_share(sharer, conduction_coefficient) for efficiency
check_me_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
proc/check_me_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
var/delta_temperature = (temperature_archived - sharer.temperature_archived)
var/self_heat_capacity = heat_capacity_archived()
@@ -826,7 +835,7 @@ datum
return 1
//Logic integrated from: temperature_share(sharer, conduction_coefficient) for efficiency
check_me_then_temperature_turf_share(turf/simulated/sharer, conduction_coefficient)
proc/check_me_then_temperature_turf_share(turf/simulated/sharer, conduction_coefficient)
var/delta_temperature = (temperature_archived - sharer.temperature)
var/self_temperature_delta = 0
@@ -854,7 +863,7 @@ datum
return 1
//Logic integrated from: temperature_turf_share(sharer, conduction_coefficient) for efficiency
check_me_then_temperature_mimic(turf/model, conduction_coefficient)
proc/check_me_then_temperature_mimic(turf/model, conduction_coefficient)
var/delta_temperature = (temperature_archived - model.temperature)
var/self_temperature_delta = 0
@@ -876,7 +885,7 @@ datum
return 1
//Logic integrated from: temperature_mimic(model, conduction_coefficient) for efficiency
temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
proc/temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
var/delta_temperature = (temperature_archived - sharer.temperature_archived)
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
@@ -890,7 +899,7 @@ datum
temperature -= heat/(self_heat_capacity*group_multiplier)
sharer.temperature += heat/(sharer_heat_capacity*sharer.group_multiplier)
temperature_mimic(turf/model, conduction_coefficient, border_multiplier)
proc/temperature_mimic(turf/model, conduction_coefficient, border_multiplier)
var/delta_temperature = (temperature - model.temperature)
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
var/self_heat_capacity = heat_capacity()//_archived()
@@ -906,7 +915,7 @@ datum
else
temperature -= heat/(self_heat_capacity*group_multiplier)
temperature_turf_share(turf/simulated/sharer, conduction_coefficient)
proc/temperature_turf_share(turf/simulated/sharer, conduction_coefficient)
var/delta_temperature = (temperature_archived - sharer.temperature)
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
var/self_heat_capacity = heat_capacity()
@@ -918,7 +927,12 @@ datum
temperature -= heat/(self_heat_capacity*group_multiplier)
sharer.temperature += heat/sharer.heat_capacity
compare(datum/gas_mixture/sample)
proc/compare(datum/gas_mixture/sample)
//Purpose: Compares sample to self to see if within acceptable ranges that group processing may be enabled
//Called by: Airgroups trying to rebuild
//Inputs: Gas mix to compare
//Outputs: 1 if can rebuild, 0 if not.
if((abs(oxygen-sample.oxygen) > MINIMUM_AIR_TO_SUSPEND) && \
((oxygen < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.oxygen) || (oxygen > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.oxygen)))
return 0
@@ -932,7 +946,7 @@ datum
((toxins < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.toxins) || (toxins > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.toxins)))
return 0
if(total_moles() > MINIMUM_AIR_TO_SUSPEND)
if(total_moles > MINIMUM_AIR_TO_SUSPEND)
if((abs(temperature-sample.temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) && \
((temperature < (1-MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature) || (temperature > (1+MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature)))
//world << "temp fail [temperature] & [sample.temperature]"
@@ -959,4 +973,27 @@ datum
return 0
else
return 0
return 1
proc/subtract(datum/gas_mixture/right_side)
//Purpose: Subtracts right_side from air_mixture. Used to help turfs mingle
//Called by: Pipelines ending in a break (or something)
//Inputs: Gas mix to remove
//Outputs: 1
oxygen -= right_side.oxygen
carbon_dioxide -= right_side.carbon_dioxide
nitrogen -= right_side.nitrogen
toxins -= right_side.toxins
if((trace_gases.len > 0)||(right_side.trace_gases.len > 0))
for(var/datum/gas/trace_gas in right_side.trace_gases)
var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases
if(!corresponding)
corresponding = new trace_gas.type()
trace_gases += corresponding
corresponding.moles -= trace_gas.moles
update_values()
return 1
+66 -147
View File
@@ -54,8 +54,14 @@ Important Procedures
*/
var/kill_air = 0
var/tick_multiplier = 2
atom/proc/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0)
//Purpose: Determines if the object (or airflow) can pass this atom.
//Called by: Movement, airflow.
//Inputs: The moving atom (optional), target turf, "height" and air group
//Outputs: Boolean if can pass.
return (!density || !height || air_group)
turf
@@ -97,41 +103,12 @@ datum
var/list/turf/simulated/groups_to_rebuild = list()
var/current_cycle = 0
var/update_delay = 5 //How long between check should it try to process atmos again.
proc
setup()
//Call this at the start to setup air groups geometry
//Warning: Very processor intensive but only must be done once per round
assemble_group_turf(turf/simulated/base)
//Call this to try to construct a group starting from base and merging with neighboring unparented tiles
//Expands the group until all valid borders explored
// assemble_group_object(obj/movable/floor/base)
process()
/* process()
//Call this to process air movements for a cycle
process_groups()
//Used by process()
//Warning: Do not call this
process_singletons()
//Used by process()
//Warning: Do not call this
process_high_pressure_delta()
//Used by process()
//Warning: Do not call this
process_super_conductivity()
//Used by process()
//Warning: Do not call this
process_update_tiles()
//Used by process()
//Warning: Do not call this
process_rebuild_select_groups()
//Used by process()
//Warning: Do not call this
@@ -139,15 +116,19 @@ datum
rebuild_group(datum/air_group)
//Used by process_rebuild_select_groups()
//Warning: Do not call this, add the group to air_master.groups_to_rebuild instead
*/
add_singleton(turf/simulated/T)
if(!active_singletons.Find(T))
active_singletons += T
setup()
proc/setup()
//Purpose: Call this at the start to setup air groups geometry
// (Warning: Very processor intensive but only must be done once per round)
//Called by: Gameticker/Master controller
//Inputs: None.
//Outputs: None.
set background = 1
world << "\red \b Processing Geometry..."
sleep(1)
sleep(-1)
var/start_time = world.timeofday
@@ -158,16 +139,16 @@ datum
if(S.z > 4) // Skipping asteroids -- TLE
continue
S.update_air_properties()
/*
for(var/obj/movable/floor/S in world)
if(!S.parent)
assemble_group_object(S)
for(var/obj/movable/floor/S in world) //Update all pathing and border information as well
S.update_air_properties()
*/
world << "\red \b Geometry processed in [(world.timeofday-start_time)/10] seconds!"
assemble_group_turf(turf/simulated/base)
world << "\red \b Geometry processed in [time2text(world.timeofday-start_time, "mm:ss")] minutes!"
spawn start()
proc/assemble_group_turf(turf/simulated/base)
//Purpose: Call this to try to construct a group starting from base and merging with neighboring unparented tiles
// (Expands the group until all valid borders explored)
//Called by: setup()
//Inputs: turf to flood fill from.
//Outputs: resulting group, or null if no group is formed.
var/list/turf/simulated/members = list(base) //Confirmed group members
var/list/turf/simulated/possible_members = list(base) //Possible places for group expansion
@@ -196,7 +177,7 @@ datum
possible_members -= test
if(members.len > 1)
var/datum/air_group/turf/group = new
var/datum/air_group/group = new
if(possible_borders.len>0)
group.borders = possible_borders
if(possible_space_borders.len>0)
@@ -221,85 +202,56 @@ datum
base.update_visuals(base.air)
return null
/*
assemble_group_object(obj/movable/floor/base)
var/list/obj/movable/floor/members = list(base) //Confirmed group members
var/list/obj/movable/floor/possible_members = list(base) //Possible places for group expansion
var/list/obj/movable/floor/possible_borders = list()
proc/start()
//Purpose: This is kicked off by the master controller, and controls the processing of all atmosphere.
//Called by: Master controller
//Inputs: None.
//Outputs: None.
while(possible_members.len>0) //Keep expanding, looking for new members
for(var/obj/movable/floor/test in possible_members)
for(var/direction in list(NORTH, SOUTH, EAST, WEST))
var/turf/T = get_step(test.loc,direction)
if(T && test.loc.CanPass(null, T, null, 1))
var/obj/movable/floor/O = locate(/obj/movable/floor) in T
if(istype(O) && !O.parent)
if(!members.Find(O))
possible_members += O
members += O
else
possible_borders -= test
possible_borders += test
possible_members -= test
set background = 1
while(1)
if(kill_air)
return 1
current_cycle++
if(groups_to_rebuild.len > 0) //If there are groups to rebuild, do so.
spawn process_rebuild_select_groups()
if(members.len > 1)
var/datum/air_group/object/group = new
if(possible_borders.len>0)
group.borders = possible_borders
if(tiles_to_update.len > 0) //If there are tiles to update, do so.
for(var/turf/simulated/T in tiles_to_update)
spawn T.update_air_properties()
tiles_to_update = list()
for(var/obj/movable/floor/test in members)
test.parent = group
test.processing = 0
active_singletons -= test
for(var/datum/air_group/AG in air_groups) //Processing groups
spawn AG.process_group()
for(var/turf/simulated/T in active_singletons) //Processing Singletons
spawn T.process_cell()
group.members = members
air_groups += group
for(var/turf/simulated/hot_potato in active_super_conductivity) //Process superconduction
spawn hot_potato.super_conduct()
group.update_group_from_tiles() //Initialize air group variables
return group
else
base.processing = 0 //singletons at startup are technically unconnected anyway
base.parent = null
if(high_pressure_delta.len) //Process high pressure delta (airflow)
for(var/turf/pressurized in high_pressure_delta)
spawn pressurized.high_pressure_movements()
high_pressure_delta = list()
return null
*/
process()
if(kill_air)
return 1
current_cycle++
if(groups_to_rebuild.len > 0) process_rebuild_select_groups()
if(tiles_to_update.len > 0) process_update_tiles()
if(current_cycle%10==5) //Check for groups of tiles to resume group processing every 10 cycles
for(var/datum/air_group/AG in air_groups)
spawn AG.check_regroup()
sleep(max(5,update_delay*tick_multiplier))
process_groups()
process_singletons()
process_super_conductivity()
process_high_pressure_delta()
if(current_cycle%10==5) //Check for groups of tiles to resume group processing every 10 cycles
for(var/datum/air_group/AG in air_groups)
AG.check_regroup()
return 1
process_update_tiles()
for(var/turf/simulated/T in tiles_to_update)
T.update_air_properties()
/*
for(var/obj/movable/floor/O in tiles_to_update)
O.update_air_properties()
*/
tiles_to_update.len = 0
process_rebuild_select_groups()
proc/process_rebuild_select_groups()
//Purpose: This gets called to recalculate and rebuild group geometry
//Called by: process()
//Inputs: None.
//Outputs: None.
var/turf/list/turfs = list()
for(var/datum/air_group/turf/turf_AG in groups_to_rebuild) //Deconstruct groups, gathering their old members
for(var/turf/simulated/T in turf_AG.members)
for(var/datum/air_group/AG in groups_to_rebuild) //Deconstruct groups, gathering their old members
for(var/turf/simulated/T in AG.members)
T.parent = null
turfs += T
del(turf_AG)
del(AG)
for(var/turf/simulated/S in turfs) //Have old members try to form new groups
if(!S.parent)
@@ -307,37 +259,4 @@ datum
for(var/turf/simulated/S in turfs)
S.update_air_properties()
// var/obj/movable/list/movable_objects = list()
for(var/datum/air_group/object/object_AG in groups_to_rebuild) //Deconstruct groups, gathering their old members
/*
for(var/obj/movable/floor/OM in object_AG.members)
OM.parent = null
movable_objects += OM
del(object_AG)
for(var/obj/movable/floor/OM in movable_objects) //Have old members try to form new groups
if(!OM.parent)
assemble_group_object(OM)
for(var/obj/movable/floor/OM in movable_objects)
OM.update_air_properties()
*/
groups_to_rebuild.len = 0
process_groups()
for(var/datum/air_group/AG in air_groups)
AG.process_group()
process_singletons()
for(var/turf/simulated/T in active_singletons)
T.process_cell()
process_super_conductivity()
for(var/turf/simulated/hot_potato in active_super_conductivity)
hot_potato.super_conduct()
process_high_pressure_delta()
for(var/turf/pressurized in high_pressure_delta)
pressurized.high_pressure_movements()
high_pressure_delta.len = 0
groups_to_rebuild = list()
+25 -23
View File
@@ -25,6 +25,7 @@ turf
GM.toxins = toxins
GM.temperature = temperature
GM.update_values()
return GM
@@ -39,6 +40,7 @@ turf
GM.toxins = (toxins/sum)*amount
GM.temperature = temperature
GM.update_values()
return GM
@@ -47,8 +49,8 @@ turf
var/pressure_direction = 0
//optimization vars
var/next_check = 0 //number of ticks before this tile updates
var/check_delay = 0 //number of ticks between updates
// var/next_check = 0 //number of ticks before this tile updates
// var/check_delay = 0 //number of ticks between updates
proc
high_pressure_movements()
@@ -93,7 +95,7 @@ turf
datum/gas_mixture/air
processing = 1
datum/air_group/turf/parent
datum/air_group/parent
group_border = 0
length_space_border = 0
@@ -149,6 +151,7 @@ turf
air.toxins = toxins
air.temperature = temperature
air.update_values()
if(air_master)
air_master.tiles_to_update.Add(src)
@@ -189,8 +192,8 @@ turf
parent.suspend_group_processing()
air.merge(giver)
else
if (giver.total_moles() > MINIMUM_AIR_TO_SUSPEND)
reset_delay()
// if (giver.total_moles > MINIMUM_AIR_TO_SUSPEND)
// reset_delay()
air.merge(giver)
@@ -239,7 +242,6 @@ turf
if(!processing)
if(air.check_tile_graphic())
update_visuals(air)
return removed
else
@@ -290,7 +292,7 @@ turf
if(air_check_directions)
processing = 1
if(!parent)
air_master.add_singleton(src)
air_master.active_singletons |= src
else
processing = 0
@@ -300,11 +302,11 @@ turf
//and doesn't afraid of anything
//check if we're skipping this tick
if (next_check > 0)
next_check--
return 1
next_check += check_delay + rand(0,check_delay/2)
check_delay++
// if (next_check > 0)
// next_check--
// return 1
// next_check += check_delay + rand(0,check_delay/2)
// check_delay++
var/turf/simulated/list/possible_fire_spreads = list()
if(processing)
@@ -321,11 +323,11 @@ turf
if(enemy_tile.archived_cycle < archived_cycle) //archive bordering tile information if not already done
enemy_tile.archive()
if (air && enemy_tile.air)
var/delay_trigger = air.compare(enemy_tile.air)
if (!delay_trigger) //if compare() didn't return 1, air is different enough to trigger processing
reset_delay()
enemy_tile.reset_delay()
// if (air && enemy_tile.air)
// var/delay_trigger = air.compare(enemy_tile.air)
// if (!delay_trigger) //if compare() didn't return 1, air is different enough to trigger processing
// reset_delay()
// enemy_tile.reset_delay()
if(enemy_tile.parent && enemy_tile.parent.group_processing) //apply tile to group sharing
if(enemy_tile.parent.current_cycle < current_cycle) //if the group hasn't been archived, it could just be out of date
@@ -390,7 +392,7 @@ turf
update_visuals(air)
if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
reset_delay() //hotspots always process quickly
// reset_delay() //hotspots always process quickly
hotspot_expose(air.temperature, CELL_VOLUME)
for(var/atom/movable/item in src)
item.temperature_expose(air, air.temperature, CELL_VOLUME)
@@ -562,11 +564,11 @@ turf
air_master.active_super_conductivity += src
proc/reset_delay()
// proc/reset_delay()
//sets this turf to process quickly again
next_check=0
check_delay= -5 //negative numbers mean a mandatory quick-update period
// next_check=0
// check_delay= -5 //negative numbers mean a mandatory quick-update period
//if this turf has a parent air group, suspend its processing
if (parent && parent.group_processing)
parent.suspend_group_processing()
// if (parent && parent.group_processing)
// parent.suspend_group_processing()
@@ -161,6 +161,8 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
plasma_captured.toxins = round(gas_covered.toxins * transfer_ratio)
plasma_captured.temperature = gas_covered.temperature
gas_covered.toxins -= plasma_captured.toxins
plasma_captured.update_values()
gas_covered.update_values()
held_plasma.merge(plasma_captured)
//
environment.merge(gas_covered)
@@ -302,7 +304,9 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
plasma_lost.temperature = held_plasma.temperature
//
plasma_lost.toxins = held_plasma.toxins * loss_ratio
plasma_lost.update_values()
held_plasma.toxins -= held_plasma.toxins * loss_ratio
held_plasma.update_values()
//
environment.merge(plasma_lost)
radiation += loss_ratio * mega_energy * 0.1
@@ -310,6 +314,7 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
return 1
else
held_plasma.toxins = 0
held_plasma.update_values()
return 0
//the !!fun!! part
@@ -60,7 +60,6 @@
//a lot of these variables are pretty hacked, so dont rely on the comments
/obj/machinery/power/supermatter/process()
//core can no longer spontaneously explode
/*
previousdet = det
@@ -110,15 +109,15 @@
//nothing can happen in a vacuum
var/datum/gas_mixture/removed = env
var/retardation_factor = 0.5
if(env.total_moles())
if(env.total_moles)
//Remove gas from surrounding area
var/transfer_moles = gasefficency * env.total_moles()
var/transfer_moles = gasefficency * env.total_moles
removed = env.remove(transfer_moles)
//100% oxygen atmosphere = 100% plasma production
//100% nitrogen atmosphere = 0% plasma production
//anything else is halfway in between; an atmosphere with no nitrogen or oxygen will still be at 50% (but steadily rise as more oxygen is made)
var/total_moles = removed.total_moles()
var/total_moles = removed.total_moles
if(total_moles)
retardation_factor += removed.oxygen / (total_moles * 2) - removed.nitrogen / (total_moles * 2)
else
@@ -143,6 +142,7 @@
//
produced = device_energy * OXYGEN_RELEASE_MODIFIER * retardation_factor
removed.oxygen += produced
removed.update_values()
//
mega_energy = 0
+1
View File
@@ -301,6 +301,7 @@
napalm.toxins = toxinsToDeduce
napalm.temperature = 400+T0C
napalm.update_values()
target_tile.assume_air(napalm)
spawn (0) target_tile.hotspot_expose(temperature, 400)
@@ -311,7 +311,7 @@ ________________________________________________________________________________
var/datum/gas_mixture/environment = T.return_air()
var/pressure = environment.return_pressure()
var/total_moles = environment.total_moles()
var/total_moles = environment.total_moles
dat += "Air Pressure: [round(pressure,0.1)] kPa"
+1 -1
View File
@@ -40,7 +40,7 @@ obj/machinery/air_sensor
signal.data["temperature"] = round(air_sample.temperature,0.1)
if(output>4)
var/total_moles = air_sample.total_moles()
var/total_moles = air_sample.total_moles
if(total_moles > 0)
if(output&4)
signal.data["oxygen"] = round(100*air_sample.oxygen/total_moles,0.1)
+6 -1
View File
@@ -289,6 +289,7 @@ Release Pressure: <A href='?src=\ref[src];pressure_adj=-1000'>-</A> <A href='?sr
..()
src.air_contents.toxins = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
air_contents.update_values()
src.update_icon()
return 1
@@ -298,7 +299,7 @@ Release Pressure: <A href='?src=\ref[src];pressure_adj=-1000'>-</A> <A href='?sr
..()
src.air_contents.oxygen = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
air_contents.update_values()
src.update_icon()
return 1
@@ -309,6 +310,7 @@ Release Pressure: <A href='?src=\ref[src];pressure_adj=-1000'>-</A> <A href='?sr
var/datum/gas/sleeping_agent/trace_gas = new
air_contents.trace_gases += trace_gas
trace_gas.moles = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
air_contents.update_values()
src.update_icon()
return 1
@@ -332,6 +334,7 @@ Release Pressure: <A href='?src=\ref[src];pressure_adj=-1000'>-</A> <A href='?sr
..()
src.air_contents.nitrogen = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
air_contents.update_values()
src.update_icon()
return 1
@@ -340,6 +343,7 @@ Release Pressure: <A href='?src=\ref[src];pressure_adj=-1000'>-</A> <A href='?sr
..()
src.air_contents.carbon_dioxide = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
air_contents.update_values()
src.update_icon()
return 1
@@ -350,6 +354,7 @@ Release Pressure: <A href='?src=\ref[src];pressure_adj=-1000'>-</A> <A href='?sr
..()
src.air_contents.oxygen = (O2STANDARD*src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
src.air_contents.nitrogen = (N2STANDARD*src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
air_contents.update_values()
src.update_icon()
return 1
@@ -15,6 +15,7 @@
air_contents.volume = volume
air_contents.temperature = T20C
air_contents.update_values()
return 1
@@ -110,7 +111,7 @@
O << "\red [user] has used [W] on \icon[icon]"
if(air_contents)
var/pressure = air_contents.return_pressure()
var/total_moles = air_contents.total_moles()
var/total_moles = air_contents.total_moles
user << "\blue Results of analysis of \icon[icon]"
if (total_moles>0)
+2 -7
View File
@@ -56,7 +56,7 @@
environment = holding.air_contents
else
environment = loc.return_air()
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles()
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles
//Take a gas sample
var/datum/gas_mixture/removed
@@ -83,12 +83,7 @@
if(istype(trace_gas, /datum/gas/sleeping_agent))
removed.trace_gases -= trace_gas
filtered_out.trace_gases += trace_gas
if(removed.trace_gases.len>0)
for(var/datum/gas/trace_gas in removed.trace_gases)
if(istype(trace_gas, /datum/gas/oxygen_agent_b))
removed.trace_gases -= trace_gas
filtered_out.trace_gases += trace_gas
filtered_out.update_values()
//Remix the resulting gases
air_contents.merge(filtered_out)
+3 -3
View File
@@ -23,7 +23,7 @@
var/datum/gas_mixture/conn_air = zturf_conn.air //TODO: pop culture reference
var/datum/gas_mixture/my_air = myturf.air
if (istype(conn_air) && istype(my_air))
if (!my_air.compare(conn_air))
myturf.reset_delay()
zturf_conn.reset_delay()
// if (!my_air.compare(conn_air))
// myturf.reset_delay()
// zturf_conn.reset_delay()
my_air.share(conn_air)
+14 -12
View File
@@ -44,7 +44,7 @@
if(air_contents)
temperature_archived = air_contents.temperature
heat_gas_contents()
// heat_gas_contents()
expel_gas()
if(abs(temperature_archived-air_contents.temperature) > 1)
@@ -156,7 +156,7 @@
add_overlays()
process_occupant()
if(air_contents.total_moles() < 10)
if(air_contents.total_moles < 10)
return
if(occupant)
if(occupant.stat == 2)
@@ -185,22 +185,24 @@
if(next_trans == 10)
next_trans = 0
heat_gas_contents()
if(air_contents.total_moles() < 1)
return
var/air_heat_capacity = air_contents.heat_capacity()
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
if(combined_heat_capacity > 0)
var/combined_energy = T20C*current_heat_capacity + air_heat_capacity*air_contents.temperature
air_contents.temperature = combined_energy/combined_heat_capacity
//Fucking ghost-heating.
// heat_gas_contents()
// if(air_contents.total_moles < 1)
// return
// var/air_heat_capacity = air_contents.heat_capacity()
// var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
// if(combined_heat_capacity > 0)
// var/combined_energy = T20C*current_heat_capacity + air_heat_capacity*air_contents.temperature
// air_contents.temperature = combined_energy/combined_heat_capacity
expel_gas()
if(air_contents.total_moles() < 1)
if(air_contents.total_moles < 1)
return
var/datum/gas_mixture/expel_gas = new
var/remove_amount = air_contents.total_moles()/100
var/remove_amount = air_contents.total_moles/100
expel_gas = air_contents.remove(remove_amount)
expel_gas.temperature = T20C // Lets expel hot gas and see if that helps people not die as they are removed
expel_gas.update_values()
loc.assume_air(expel_gas)
go_out()
+1 -1
View File
@@ -208,7 +208,7 @@
if("/turf/simulated/floor", "/turf/simulated/floor/engine")
var/datum/gas_mixture/environment = T.return_air()
var/turf_total = environment.total_moles()
var/turf_total = environment.total_moles
var/t1 = turf_total / MOLES_CELLSTANDARD * 175
if(t1<=100)
+1 -1
View File
@@ -166,7 +166,7 @@
var/datum/gas_mixture/env = L.return_air()
if(env.temperature < (set_temperature+T0C))
var/transfer_moles = 0.25 * env.total_moles()
var/transfer_moles = 0.25 * env.total_moles
var/datum/gas_mixture/removed = env.remove(transfer_moles)
@@ -205,7 +205,7 @@
var/datum/gas_mixture/env = L.return_air()
if(env.temperature < (heat_amt+T0C))
var/transfer_moles = 0.25 * env.total_moles()
var/transfer_moles = 0.25 * env.total_moles
var/datum/gas_mixture/removed = env.remove(transfer_moles)
+3 -3
View File
@@ -84,7 +84,7 @@
// if 3 or less books, fill shelf with that
for(var/datum/archived_book/AB in catbooks)
var/obj/item/weapon/book/B = new(src)
B.name = "Book: [AB.title]"
B.name = "[AB.title]"
B.title = AB.title
B.author = AB.author
B.dat = AB.dat
@@ -103,7 +103,7 @@
for(var/i = 1 to 3)
var/datum/archived_book/AB = pick(catbooks)
var/obj/item/weapon/book/B = new(src)
B.name = "Book: [AB.title]"
B.name = "[AB.title]"
B.title = AB.title
B.author = AB.author
B.dat = AB.dat
@@ -127,7 +127,7 @@
if(!newname)
return
else
src.setname(sanitize(newname))
setname(sanitize(newname))
else
..()
attack_hand(var/mob/user as mob)
+2 -2
View File
@@ -137,7 +137,7 @@ datum/controller/game_controller
spawn(0)
air_master.process()
// air_master.process()
air_master_ready = 1
spawn(0)
tension_master.process()
@@ -243,4 +243,4 @@ datum/controller/game_controller
else
for (var/mob/M in world)
if (M.client && M.client.holder)
M << "<font color='red' size='2'><b> The Master Controller has fired. Automatic restart aborted.</b></font>"
M << "<font color='red' size='2'><b> The Master Controller has fired. Automatic restart aborted.</b></font>"
+2 -1
View File
@@ -853,8 +853,9 @@
destroy()
else
GM.toxins += 5
GM.temperature = istype(T) ? T.air.return_temperature() : T20C
GM.temperature = istype(T) ? T.air.temperature : T20C
T.visible_message("The [src] suddenly disgorges a cloud of plasma.")
GM.update_values()
T.assume_air(GM)
return
+12 -11
View File
@@ -121,6 +121,7 @@
cabin_air.volume = 200
cabin_air.oxygen = O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
cabin_air.nitrogen = N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
cabin_air.update_values()
return cabin_air
/obj/mecha/proc/add_radio()
@@ -847,11 +848,11 @@
/obj/mecha/proc/return_temperature()
. = 0
if(use_internal_tank)
. = cabin_air.return_temperature()
. = cabin_air.temperature
else
var/datum/gas_mixture/t_air = get_turf_air()
if(t_air)
. = t_air.return_temperature()
. = t_air.temperature
return
/obj/mecha/proc/connect(obj/machinery/atmospherics/portables_connector/new_port)
@@ -1665,7 +1666,7 @@
delay = 20
process(var/obj/mecha/mecha)
if(mecha.cabin_air && mecha.cabin_air.return_volume() > 0)
if(mecha.cabin_air && mecha.cabin_air.volume > 0)
var/delta = mecha.cabin_air.temperature - T20C
mecha.cabin_air.temperature -= max(-10, min(10, round(delta/4,0.1)))
return
@@ -1683,8 +1684,8 @@
var/pressure_delta = min(release_pressure - cabin_pressure, (tank_air.return_pressure() - cabin_pressure)/2)
var/transfer_moles = 0
if(pressure_delta > 0) //cabin pressure lower than release pressure
if(tank_air.return_temperature() > 0)
transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION)
if(tank_air.temperature > 0)
transfer_moles = pressure_delta*max(0, cabin_air.volume)/(cabin_air.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = tank_air.remove(transfer_moles)
cabin_air.merge(removed)
else if(pressure_delta < 0) //cabin pressure higher than release pressure
@@ -1693,7 +1694,7 @@
if(t_air)
pressure_delta = min(cabin_pressure - t_air.return_pressure(), pressure_delta)
if(pressure_delta > 0) //if location pressure is lower than cabin pressure
transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION)
transfer_moles = pressure_delta*max(0, cabin_air.volume)/(cabin_air.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = cabin_air.remove(transfer_moles)
if(t_air)
t_air.merge(removed)
@@ -1726,12 +1727,12 @@
if(mecha.internal_tank.return_pressure()>mecha.internal_tank.maximum_pressure && !(mecha.hasInternalDamage(MECHA_INT_TANK_BREACH)))
mecha.setInternalDamage(MECHA_INT_TANK_BREACH)
var/datum/gas_mixture/int_tank_air = mecha.internal_tank.return_air()
if(int_tank_air && int_tank_air.return_volume()>0) //heat the air_contents
if(int_tank_air && int_tank_air.volume >0) //heat the air_contents
int_tank_air.temperature = min(6000+T0C, int_tank_air.temperature+rand(10,15))
if(mecha.cabin_air && mecha.cabin_air.return_volume()>0)
mecha.cabin_air.temperature = min(6000+T0C, mecha.cabin_air.return_temperature()+rand(10,15))
if(mecha.cabin_air.return_temperature()>mecha.max_temperature/2)
mecha.take_damage(4/round(mecha.max_temperature/mecha.cabin_air.return_temperature(),0.1),"fire")
if(mecha.cabin_air && mecha.cabin_air.volume>0)
mecha.cabin_air.temperature = min(6000+T0C, mecha.cabin_air.temperature+rand(10,15))
if(mecha.cabin_air.temperature>mecha.max_temperature/2)
mecha.take_damage(4/round(mecha.max_temperature/mecha.cabin_air.temperature,0.1),"fire")
if(mecha.hasInternalDamage(MECHA_INT_TEMP_CONTROL)) //stop the mecha_preserve_temp loop datum
mecha.pr_int_temp_processor.stop()
if(mecha.hasInternalDamage(MECHA_INT_TANK_BREACH)) //remove some air from internal tank
+1 -1
View File
@@ -331,7 +331,7 @@
var/datum/gas_mixture/environment = T.return_air()
var/pressure = environment.return_pressure()
var/total_moles = environment.total_moles()
var/total_moles = environment.total_moles
dat += "Air Pressure: [round(pressure,0.1)] kPa<br>"
+1 -1
View File
@@ -369,7 +369,7 @@ MASS SPECTROMETER
var/datum/gas_mixture/environment = location.return_air()
var/pressure = environment.return_pressure()
var/total_moles = environment.total_moles()
var/total_moles = environment.total_moles
user.show_message("\blue <B>Results:</B>", 1)
if(abs(pressure - ONE_ATMOSPHERE) < 10)
@@ -133,7 +133,7 @@
for (var/mob/O in viewers(user, null))
O << "\red [user] has used the analyzer on \icon[icon]"
var/pressure = src.ptank.air_contents.return_pressure()
var/total_moles = src.ptank.air_contents.total_moles()
var/total_moles = src.ptank.air_contents.total_moles
user << "\blue Results of analysis of \icon[icon]"
if (total_moles>0)
+2 -1
View File
@@ -234,6 +234,7 @@
napalm.toxins = toxinsToDeduce
napalm.temperature = 400+T0C
napalm.update_values()
target_tile.assume_air(napalm)
spawn (0) target_tile.hotspot_expose(temperature, 400)
@@ -304,4 +305,4 @@
isSwitchingStates = 0
Dismantle(devastated = 0)
del(src)
del(src)
+6 -2
View File
@@ -210,7 +210,7 @@
var/pressure = air_contents.return_pressure()
var/total_moles = air_contents.total_moles()
var/total_moles = air_contents.total_moles
user << "\blue Results of analysis of \icon[icon]"
if (total_moles>0)
@@ -258,6 +258,7 @@
..()
/obj/item/weapon/tank/examine()
set src in oview()
var/obj/icon = src
if (istype(src.loc, /obj/item/assembly))
icon = src.loc
@@ -290,6 +291,7 @@
src.air_contents.oxygen = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD
src.air_contents.nitrogen = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD
air_contents.update_values()
return
@@ -302,17 +304,19 @@
trace_gas.moles = (3*ONE_ATMOSPHERE)*70/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD
src.air_contents.trace_gases += trace_gas
air_contents.update_values()
return
/obj/item/weapon/tank/plasma/New()
..()
src.air_contents.toxins = (3*ONE_ATMOSPHERE)*70/(R_IDEAL_GAS_EQUATION*T20C)
air_contents.update_values()
return
/obj/item/weapon/tank/plasma/proc/release()
var/datum/gas_mixture/removed = air_contents.remove(air_contents.total_moles())
var/datum/gas_mixture/removed = air_contents.remove(air_contents.total_moles)
loc.assume_air(removed)
+2 -5
View File
@@ -11,7 +11,7 @@
New()
..()
src.air_contents.oxygen = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
air_contents.adjustGases((3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
return
@@ -41,10 +41,7 @@
New()
..()
src.air_contents.oxygen = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD
var/datum/gas/sleeping_agent/trace_gas = new()
trace_gas.moles = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD
src.air_contents.trace_gases += trace_gas
air_contents.adjustGases((3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD, traces = list(trace_gas))
return
+4 -4
View File
@@ -53,7 +53,7 @@
proc/allow_thrust(num, mob/living/user as mob)
if(!(src.on))
return 0
if((num < 0.005 || src.air_contents.total_moles() < num))
if((num < 0.005 || src.air_contents.total_moles < num))
src.ion_trail.stop()
return 0
@@ -75,7 +75,7 @@
New()
..()
src.air_contents.oxygen = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
air_contents.adjustGases((6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
return
/obj/item/weapon/tank/jetpack/oxygen
@@ -86,7 +86,7 @@
New()
..()
src.air_contents.oxygen = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
air_contents.adjustGases((6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
return
/obj/item/weapon/tank/jetpack/carbondioxide
@@ -99,7 +99,7 @@
..()
src.ion_trail = new /datum/effect/effect/system/ion_trail_follow()
src.ion_trail.set_up(src)
src.air_contents.carbon_dioxide = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
air_contents.adjustGases(0,(6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
return
examine()
+1 -1
View File
@@ -8,7 +8,7 @@
New()
..()
src.air_contents.oxygen = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
air_contents.adjustGases((6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
return
+2
View File
@@ -38,6 +38,7 @@
trace_gas.moles = 30
payload += trace_gas
payload.update_values()
target.air.merge(payload)
@@ -53,6 +54,7 @@
var/datum/gas_mixture/payload = new
payload.toxins = 30
payload.update_values()
target.air.merge(payload)
+1
View File
@@ -903,6 +903,7 @@ var/list/plating_icons = list("plating","platingdmg1","platingdmg2","platingdmg3
trace_gas.moles = 2000
adding.trace_gases += trace_gas
adding.temperature = T20C
adding.update_values()
assume_air(adding)
+6 -6
View File
@@ -46,7 +46,7 @@
delay = 20
process(var/obj/vehicle/airtight/V)
if(V.cabin_air && V.cabin_air.return_volume() > 0)
if(V.cabin_air && V.cabin_air.volume > 0)
var/delta = V.cabin_air.temperature - T20C
V.cabin_air.temperature -= max(-10, min(10, round(delta/4,0.1)))
return
@@ -65,8 +65,8 @@
var/pressure_delta = min(release_pressure - cabin_pressure, (tank_air.return_pressure() - cabin_pressure)/2)
var/transfer_moles = 0
if(pressure_delta > 0) //cabin pressure lower than release pressure
if(tank_air.return_temperature() > 0)
transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION)
if(tank_air.temperature > 0)
transfer_moles = pressure_delta*cabin_air.volume/(cabin_air.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = tank_air.remove(transfer_moles)
cabin_air.merge(removed)
else if(pressure_delta < 0) //cabin pressure higher than release pressure
@@ -75,7 +75,7 @@
if(t_air)
pressure_delta = min(cabin_pressure - t_air.return_pressure(), pressure_delta)
if(pressure_delta > 0) //if location pressure is lower than cabin pressure
transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION)
transfer_moles = pressure_delta*cabin_air.volume/(cabin_air.temperature * R_IDEAL_GAS_EQUATION)
var/datum/gas_mixture/removed = cabin_air.remove(transfer_moles)
if(t_air)
t_air.merge(removed)
@@ -123,11 +123,11 @@
/obj/vehicle/airtight/proc/return_temperature()
. = 0
if(use_internal_tank)
. = cabin_air.return_temperature()
. = cabin_air.temperature
else
var/datum/gas_mixture/t_air = get_turf_air()
if(t_air)
. = t_air.return_temperature()
. = t_air.temperature
return
/obj/vehicle/airtight/proc/connect(obj/machinery/atmospherics/portables_connector/new_port)
+5 -5
View File
@@ -166,12 +166,12 @@
if(mecha.internal_tank.return_pressure()>mecha.internal_tank.maximum_pressure && !(mecha.hasInternalDamage(MECHA_INT_TANK_BREACH)))
mecha.setInternalDamage(MECHA_INT_TANK_BREACH)
var/datum/gas_mixture/int_tank_air = mecha.internal_tank.return_air()
if(int_tank_air && int_tank_air.return_volume()>0) //heat the air_contents
if(int_tank_air && int_tank_air.volume>0) //heat the air_contents
int_tank_air.temperature = min(6000+T0C, int_tank_air.temperature+rand(10,15))
if(mecha.cabin_air && mecha.cabin_air.return_volume()>0)
mecha.cabin_air.temperature = min(6000+T0C, mecha.cabin_air.return_temperature()+rand(10,15))
if(mecha.cabin_air.return_temperature()>mecha.max_temperature/2)
mecha.take_damage(4/round(mecha.max_temperature/mecha.cabin_air.return_temperature(),0.1),"fire")
if(mecha.cabin_air && mecha.cabin_air.volume>0)
mecha.cabin_air.temperature = min(6000+T0C, mecha.cabin_air.temperature+rand(10,15))
if(mecha.cabin_air.temperature>mecha.max_temperature/2)
mecha.take_damage(4/round(mecha.max_temperature/mecha.cabin_air.temperature,0.1),"fire")
if(mecha.hasInternalDamage(MECHA_INT_TEMP_CONTROL)) //stop the mecha_preserve_temp loop datum
mecha.pr_int_temp_processor.stop()
if(mecha.hasInternalDamage(MECHA_INT_TANK_BREACH)) //remove some air from internal tank
-1
View File
@@ -217,7 +217,6 @@
var/turf/T = get_turf(usr)
if(istype(T, /turf/simulated))
var/datum/air_group/AG = T:parent
AG.next_check = 30
AG.group_processing = 0
else
usr << "Local airgroup is unsimulated!"
+1
View File
@@ -719,6 +719,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
T.air.nitrogen = T.nitrogen
T.air.toxins = T.toxins
T.air.temperature = T.temperature
T.air.update_values()
// make things update properly
T.assume_air(new /datum/gas_mixture())
+11 -3
View File
@@ -282,7 +282,7 @@ datum
var/hotspot = (locate(/obj/effect/hotspot) in T)
if(hotspot && !istype(T, /turf/space))
var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() )
var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles )
lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0)
lowertemp.react()
T.assume_air(lowertemp)
@@ -293,7 +293,7 @@ datum
var/turf/T = get_turf(O)
var/hotspot = (locate(/obj/effect/hotspot) in T)
if(hotspot && !istype(T, /turf/space))
var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() )
var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles )
lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0)
lowertemp.react()
T.assume_air(lowertemp)
@@ -543,12 +543,14 @@ datum
var/datum/gas_mixture/napalm = new
napalm.oxygen = volume*10
napalm.temperature = T0C
napalm.update_values()
the_turf.assume_air(napalm)
reaction_turf(var/turf/T, var/volume)
src = null
var/datum/gas_mixture/napalm = new
napalm.oxygen = volume*10
napalm.temperature = T0C
napalm.update_values()
T.assume_air(napalm)
return
@@ -571,12 +573,14 @@ datum
var/datum/gas_mixture/napalm = new
napalm.nitrogen = volume*10
napalm.temperature = T0C
napalm.update_values()
the_turf.assume_air(napalm)
reaction_turf(var/turf/T, var/volume)
src = null
var/datum/gas_mixture/napalm = new
napalm.nitrogen = volume*10
napalm.temperature = T0C
napalm.update_values()
T.assume_air(napalm)
return
@@ -1051,12 +1055,14 @@ datum
var/datum/gas_mixture/napalm = new
napalm.toxins = volume*10
napalm.temperature = T0C
napalm.update_values()
the_turf.assume_air(napalm)
reaction_turf(var/turf/T, var/volume)
src = null
var/datum/gas_mixture/napalm = new
napalm.toxins = volume*10
napalm.temperature = T0C
napalm.update_values()
T.assume_air(napalm)
return
on_mob_life(var/mob/living/M as mob)
@@ -1168,6 +1174,7 @@ datum
var/datum/gas/volatile_fuel/fuel = new
fuel.moles = 5
napalm.trace_gases += fuel
napalm.update_values()
the_turf.assume_air(napalm)
reaction_turf(var/turf/T, var/volume)
src = null
@@ -1175,6 +1182,7 @@ datum
var/datum/gas/volatile_fuel/fuel = new
fuel.moles = 5
napalm.trace_gases += fuel
napalm.update_values()
T.assume_air(napalm)
return
@@ -2154,7 +2162,7 @@ datum
T.wet_overlay = null
var/hotspot = (locate(/obj/effect/hotspot) in T)
if(hotspot)
var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() )
var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles )
lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0)
lowertemp.react()
T.assume_air(lowertemp)
@@ -357,6 +357,7 @@ datum
napalm.toxins = created_volume*10
napalm.temperature = 400+T0C
napalm.update_values()
target_tile.assume_air(napalm)
spawn (0) target_tile.hotspot_expose(700, 400)
@@ -211,7 +211,7 @@
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
else*/
// Not enough air around, take a percentage of what's there to model this properly
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
breath_moles = environment.total_moles*BREATH_PERCENTAGE
breath = loc.remove_air(breath_moles)
@@ -259,15 +259,15 @@
if(src.nodamage)
return
if(!breath || (breath.total_moles() == 0))
if(!breath || (breath.total_moles == 0))
//Aliens breathe in vaccuum
return 0
var/toxins_used = 0
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
var/breath_pressure = (breath.total_moles*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
//Partial pressure of the toxins in our breath
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
var/Toxins_pp = (breath.toxins/breath.total_moles)*breath_pressure
if(Toxins_pp) // Detect toxins in air
@@ -186,7 +186,7 @@
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
else*/
// Not enough air around, take a percentage of what's there to model this properly
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
breath_moles = environment.total_moles*BREATH_PERCENTAGE
breath = loc.remove_air(breath_moles)
@@ -234,15 +234,15 @@
if(nodamage)
return
if(!breath || (breath.total_moles() == 0))
if(!breath || (breath.total_moles == 0))
//Aliens breathe in vaccuum
return 0
var/toxins_used = 0
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
var/breath_pressure = (breath.total_moles*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
//Partial pressure of the toxins in our breath
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
var/Toxins_pp = (breath.toxins/breath.total_moles)*breath_pressure
if(Toxins_pp) // Detect toxins in air
+9 -9
View File
@@ -409,7 +409,7 @@
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
else*/
// Not enough air around, take a percentage of what's there to model this properly
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
breath_moles = environment.total_moles*BREATH_PERCENTAGE
breath = loc.remove_air(breath_moles)
@@ -473,7 +473,7 @@
if(nodamage || (mutations & mNobreath))
return
if(!breath || (breath.total_moles() == 0))
if(!breath || (breath.total_moles == 0))
if(reagents.has_reagent("inaprovaline"))
return
adjustOxyLoss(HUMAN_MAX_OXYLOSS)
@@ -491,15 +491,15 @@
var/SA_para_min = 1
var/SA_sleep_min = 5
var/oxygen_used = 0
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
var/breath_pressure = (breath.total_moles*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
//Partial pressure of the O2 in our breath
var/O2_pp = (breath.oxygen/breath.total_moles())*breath_pressure
var/O2_pp = (breath.oxygen/breath.total_moles)*breath_pressure
// Same, but for the toxins
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
var/Toxins_pp = (breath.toxins/breath.total_moles)*breath_pressure
// And CO2, lets say a PP of more than 10 will be bad (It's a little less really, but eh, being passed out all round aint no fun)
var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*breath_pressure // Tweaking to fit the hacky bullshit I've done with atmo -- TLE
//var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*0.5 // The default pressure value
var/CO2_pp = (breath.carbon_dioxide/breath.total_moles)*breath_pressure // Tweaking to fit the hacky bullshit I've done with atmo -- TLE
//var/CO2_pp = (breath.carbon_dioxide/breath.total_moles)*0.5 // The default pressure value
if(O2_pp < safe_oxygen_min) // Too little oxygen
if(prob(20) && isbreathing)
@@ -548,7 +548,7 @@
if(breath.trace_gases.len) // If there's some other shit in the air lets deal with it here.
for(var/datum/gas/sleeping_agent/SA in breath.trace_gases)
var/SA_pp = (SA.moles/breath.total_moles())*breath_pressure
var/SA_pp = (SA.moles/breath.total_moles)*breath_pressure
if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit
Paralyse(3) // 3 gives them one second to wake up and run away a bit!
if(SA_pp > SA_sleep_min) // Enough to make us sleep as well
@@ -1532,5 +1532,5 @@ snippets
src << "\red You collapse from heat exaustion!"
plcheck = t_plasma
oxcheck = t_oxygen
G.turf_add(T, G.total_moles())
G.turf_add(T, G.total_moles)
*/
@@ -206,7 +206,7 @@
var/obj/location_as_object = loc
breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME)
else if(istype(loc, /turf/))
var/breath_moles = environment.total_moles()*BREATH_PERCENTAGE
var/breath_moles = environment.total_moles*BREATH_PERCENTAGE
breath = loc.remove_air(breath_moles)
// Handle chem smoke effect -- Doohl
@@ -260,7 +260,7 @@
if(src.nodamage)
return
if(!breath || (breath.total_moles() == 0))
if(!breath || (breath.total_moles == 0))
adjustOxyLoss(7)
oxygen_alert = max(oxygen_alert, 1)
@@ -274,14 +274,14 @@
var/SA_para_min = 0.5
var/SA_sleep_min = 5
var/oxygen_used = 0
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
var/breath_pressure = (breath.total_moles*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
//Partial pressure of the O2 in our breath
var/O2_pp = (breath.oxygen/breath.total_moles())*breath_pressure
var/O2_pp = (breath.oxygen/breath.total_moles)*breath_pressure
// Same, but for the toxins
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
var/Toxins_pp = (breath.toxins/breath.total_moles)*breath_pressure
// And CO2, lets say a PP of more than 10 will be bad (It's a little less really, but eh, being passed out all round aint no fun)
var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*breath_pressure
var/CO2_pp = (breath.carbon_dioxide/breath.total_moles)*breath_pressure
if(O2_pp < safe_oxygen_min) // Too little oxygen
if(prob(20))
@@ -329,7 +329,7 @@
if(breath.trace_gases.len) // If there's some other shit in the air lets deal with it here.
for(var/datum/gas/sleeping_agent/SA in breath.trace_gases)
var/SA_pp = (SA.moles/breath.total_moles())*breath_pressure
var/SA_pp = (SA.moles/breath.total_moles)*breath_pressure
if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit
Paralyse(3) // 3 gives them one second to wake up and run away a bit!
if(SA_pp > SA_sleep_min) // Enough to make us sleep as well
@@ -508,7 +508,7 @@
var/datum/gas_mixture/environment = T.return_air()
var/pressure = environment.return_pressure()
var/total_moles = environment.total_moles()
var/total_moles = environment.total_moles
dat += "Air Pressure: [round(pressure,0.1)] kPa<br>"
+4 -4
View File
@@ -66,7 +66,7 @@
return
rpm = 0.9* rpm + 0.1 * rpmtarget
var/datum/gas_mixture/environment = inturf.return_air()
var/transfer_moles = environment.total_moles()/10
var/transfer_moles = environment.total_moles/10
//var/transfer_moles = rpm/10000*capacity
var/datum/gas_mixture/removed = inturf.remove_air(transfer_moles)
gas_contained.merge(removed)
@@ -122,14 +122,14 @@
lastgen = ((compressor.rpm / TURBGENQ)**TURBGENG) *TURBGENQ
add_avail(lastgen)
var/newrpm = ((compressor.gas_contained.temperature) * compressor.gas_contained.total_moles())/4
var/newrpm = ((compressor.gas_contained.temperature) * compressor.gas_contained.total_moles)/4
newrpm = max(0, newrpm)
if(!compressor.starter || newrpm > 1000)
compressor.rpmtarget = newrpm
if(compressor.gas_contained.total_moles()>0)
var/oamount = min(compressor.gas_contained.total_moles(), (compressor.rpm+100)/35000*compressor.capacity)
if(compressor.gas_contained.total_moles>0)
var/oamount = min(compressor.gas_contained.total_moles, (compressor.rpm+100)/35000*compressor.capacity)
var/datum/gas_mixture/removed = compressor.gas_contained.remove(oamount)
outturf.assume_air(removed)
+1 -1
View File
@@ -75,7 +75,7 @@
var/datum/gas_mixture/env = L.return_air()
if(env.temperature < (heat_amt+T0C))
var/transfer_moles = 0.25 * env.total_moles()
var/transfer_moles = 0.25 * env.total_moles
var/datum/gas_mixture/removed = env.remove(transfer_moles)
+3 -1
View File
@@ -138,6 +138,8 @@ var/MAX_EXPLOSION_RANGE = 14
#define BLOCKHAIR 32768 // temporarily removes the user's hair icon
#define PLASMAGUARD 65536 //Does not get contaminated by plasma.
//flags for pass_flags
#define PASSTABLE 1
#define PASSGLASS 2
@@ -288,4 +290,4 @@ var/static/list/scarySounds = list('thudswoosh.ogg','Taser.ogg','armbomb.ogg','h
// Maximum and minimum character ages.
var/const/minimum_age = 20
var/const/maximum_age = 65
var/const/maximum_age = 65
+4 -4
View File
@@ -22,7 +22,7 @@
else
T = null
if (src.h_status)
var/t1 = src.gas.total_moles()
var/t1 = src.gas.total_moles
if ((t1 > 0 && src.gas.temperature < (src.h_tar+T0C)))
var/increase = src.heatrate / t1
var/n_temp = src.gas.temperature + increase
@@ -31,7 +31,7 @@
switch(src.t_status)
if(1.0)
if (src.holding)
var/t1 = src.gas.total_moles()
var/t1 = src.gas.total_moles
var/t2 = t1
var/t = src.t_per
if (src.t_per > t2)
@@ -41,7 +41,7 @@
src.t_status = 3
if(2.0)
if (src.holding)
var/t1 = src.gas.total_moles()
var/t1 = src.gas.total_moles
var/t2 = src.maximum - t1
var/t = src.t_per
if (src.t_per > t2)
@@ -97,7 +97,7 @@
ct = text("<A href='?src=\ref[];c=1'>Release</A> <A href='?src=\ref[];c=2'>Accept</A> Stopped", src, src)
else
ct = "Disconnected"
var/dat = text("<TT><B>Canister Valves</B><BR>\n<FONT color = 'blue'><B>Contains/Capacity</B> [] / []</FONT><BR>\nUpper Valve Status: [][]<BR>\n\t<A href='?src=\ref[];tp=-[]'>M</A> <A href='?src=\ref[];tp=-10000'>-</A> <A href='?src=\ref[];tp=-1000'>-</A> <A href='?src=\ref[];tp=-100'>-</A> <A href='?src=\ref[];tp=-1'>-</A> [] <A href='?src=\ref[];tp=1'>+</A> <A href='?src=\ref[];tp=100'>+</A> <A href='?src=\ref[];tp=1000'>+</A> <A href='?src=\ref[];tp=10000'>+</A> <A href='?src=\ref[];tp=[]'>M</A><BR>\nHeater Status: [] - []<BR>\n\tTrg Tmp: <A href='?src=\ref[];ht=-50'>-</A> <A href='?src=\ref[];ht=-5'>-</A> <A href='?src=\ref[];ht=-1'>-</A> [] <A href='?src=\ref[];ht=1'>+</A> <A href='?src=\ref[];ht=5'>+</A> <A href='?src=\ref[];ht=50'>+</A><BR>\n<BR>\nPipe Valve Status: []<BR>\n\t<A href='?src=\ref[];cp=-[]'>M</A> <A href='?src=\ref[];cp=-10000'>-</A> <A href='?src=\ref[];cp=-1000'>-</A> <A href='?src=\ref[];cp=-100'>-</A> <A href='?src=\ref[];cp=-1'>-</A> [] <A href='?src=\ref[];cp=1'>+</A> <A href='?src=\ref[];cp=100'>+</A> <A href='?src=\ref[];cp=1000'>+</A> <A href='?src=\ref[];cp=10000'>+</A> <A href='?src=\ref[];cp=[]'>M</A><BR>\n<BR>\n<A href='?src=\ref[];mach_close=canister'>Close</A><BR>\n</TT>", src.gas.total_moles(), src.maximum, tt, (src.holding ? text("<BR><A href='?src=\ref[];tank=1'>Tank ([]</A>)", src, src.holding.gas.total_moles()) : null), src, num2text(1000000.0, 7), src, src, src, src, src.t_per, src, src, src, src, src, num2text(1000000.0, 7), ht, (src.gas.total_moles() ? (src.gas.temperature-T0C) : 20), src, src, src, src.h_tar, src, src, src, ct, src, num2text(1000000.0, 7), src, src, src, src, src.c_per, src, src, src, src, src, num2text(1000000.0, 7), user)
var/dat = text("<TT><B>Canister Valves</B><BR>\n<FONT color = 'blue'><B>Contains/Capacity</B> [] / []</FONT><BR>\nUpper Valve Status: [][]<BR>\n\t<A href='?src=\ref[];tp=-[]'>M</A> <A href='?src=\ref[];tp=-10000'>-</A> <A href='?src=\ref[];tp=-1000'>-</A> <A href='?src=\ref[];tp=-100'>-</A> <A href='?src=\ref[];tp=-1'>-</A> [] <A href='?src=\ref[];tp=1'>+</A> <A href='?src=\ref[];tp=100'>+</A> <A href='?src=\ref[];tp=1000'>+</A> <A href='?src=\ref[];tp=10000'>+</A> <A href='?src=\ref[];tp=[]'>M</A><BR>\nHeater Status: [] - []<BR>\n\tTrg Tmp: <A href='?src=\ref[];ht=-50'>-</A> <A href='?src=\ref[];ht=-5'>-</A> <A href='?src=\ref[];ht=-1'>-</A> [] <A href='?src=\ref[];ht=1'>+</A> <A href='?src=\ref[];ht=5'>+</A> <A href='?src=\ref[];ht=50'>+</A><BR>\n<BR>\nPipe Valve Status: []<BR>\n\t<A href='?src=\ref[];cp=-[]'>M</A> <A href='?src=\ref[];cp=-10000'>-</A> <A href='?src=\ref[];cp=-1000'>-</A> <A href='?src=\ref[];cp=-100'>-</A> <A href='?src=\ref[];cp=-1'>-</A> [] <A href='?src=\ref[];cp=1'>+</A> <A href='?src=\ref[];cp=100'>+</A> <A href='?src=\ref[];cp=1000'>+</A> <A href='?src=\ref[];cp=10000'>+</A> <A href='?src=\ref[];cp=[]'>M</A><BR>\n<BR>\n<A href='?src=\ref[];mach_close=canister'>Close</A><BR>\n</TT>", src.gas.total_moles, src.maximum, tt, (src.holding ? text("<BR><A href='?src=\ref[];tank=1'>Tank ([]</A>)", src, src.holding.gas.total_moles) : null), src, num2text(1000000.0, 7), src, src, src, src, src.t_per, src, src, src, src, src, num2text(1000000.0, 7), ht, (src.gas.total_moles ? (src.gas.temperature-T0C) : 20), src, src, src, src.h_tar, src, src, src, ct, src, num2text(1000000.0, 7), src, src, src, src, src.c_per, src, src, src, src, src, num2text(1000000.0, 7), user)
user << browse(dat, "window=canister;size=600x300")
onclose(user, "canister")
return */ //TODO: FIX
+4 -4
View File
@@ -59,17 +59,17 @@ var/linenums = 0
/*
/obj/machinery/pipeline/get_gas_moles(from)
return gas.total_moles()/capmult
return gas.total_moles/capmult
*/
/obj/machinery/pipeline/get_gas(from)
return gas
/obj/machinery/pipeline/gas_flow()
//if(suffix == "d" && Debug) world.log << "PLF1 [gas.total_moles()] ~ [ngas.total_moles()]"
//if(suffix == "d" && Debug) world.log << "PLF1 [gas.total_moles] ~ [ngas.total_moles]"
gas.copy_from(ngas)
//if(suffix == "d" && Debug) world.log << "PLF2 [gas.total_moles()] ~ [ngas.total_moles()]"
//if(suffix == "d" && Debug) world.log << "PLF2 [gas.total_moles] ~ [ngas.total_moles]"
/obj/machinery/pipeline/process()
/*
@@ -81,7 +81,7 @@ var/linenums = 0
// var/dbg = (suffix == "d") && Debug
//if(dbg) world.log << "PLP1 [gas.total_moles()] ~ [ngas.total_moles()]"
//if(dbg) world.log << "PLP1 [gas.total_moles] ~ [ngas.total_moles()]"
if(!numnodes)
return //dividing by zero is bad okay?
+7780 -7777
View File
File diff suppressed because it is too large Load Diff