mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 02:16:05 +00:00
Gas math stripping
Removed update_values(). RIP, shine on you CPU diamond. Removed get_moles_by_id and get_archived_moles_by_id, all moles are now accessed directly to reduce call cost. Added set_temperature and set_volume procs which recalc pressure when temperature or pressure change. Heat_capacity is now a var updated when gases update. Modified adjust_gas to use set_gas, modified set_gas to alter heat_capacity, total_moles, and pressure as needed.
This commit is contained in:
@@ -155,7 +155,7 @@ Pipelines + Other Objects -> Pipe network
|
|||||||
var/datum/gas_mixture/int_air = return_air()
|
var/datum/gas_mixture/int_air = return_air()
|
||||||
var/datum/gas_mixture/env_air = loc.return_air()
|
var/datum/gas_mixture/env_air = loc.return_air()
|
||||||
add_fingerprint(user)
|
add_fingerprint(user)
|
||||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
if ((int_air.pressure-env_air.pressure) > 2*ONE_ATMOSPHERE)
|
||||||
if(istype(W, /obj/item/weapon/wrench/socket) && istype(src, /obj/machinery/atmospherics/pipe))
|
if(istype(W, /obj/item/weapon/wrench/socket) && istype(src, /obj/machinery/atmospherics/pipe))
|
||||||
user << "<span class='warning'>You begin to open the pressure release valve on the pipe...</span>"
|
user << "<span class='warning'>You begin to open the pressure release valve on the pipe...</span>"
|
||||||
if(do_after(user, 50))
|
if(do_after(user, 50))
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
/obj/machinery/atmospherics/binary/circulator/proc/return_transfer_air()
|
/obj/machinery/atmospherics/binary/circulator/proc/return_transfer_air()
|
||||||
var/datum/gas_mixture/removed
|
var/datum/gas_mixture/removed
|
||||||
if(anchored && !(stat&BROKEN) )
|
if(anchored && !(stat&BROKEN) )
|
||||||
var/input_starting_pressure = air1.return_pressure()
|
var/input_starting_pressure = air1.pressure
|
||||||
var/output_starting_pressure = air2.return_pressure()
|
var/output_starting_pressure = air2.pressure
|
||||||
last_pressure_delta = max(input_starting_pressure - output_starting_pressure + 10, 0)
|
last_pressure_delta = max(input_starting_pressure - output_starting_pressure + 10, 0)
|
||||||
|
|
||||||
//only circulate air if there is a pressure difference (plus 10 kPa to represent friction in the machine)
|
//only circulate air if there is a pressure difference (plus 10 kPa to represent friction in the machine)
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
//Actually transfer the gas
|
//Actually transfer the gas
|
||||||
removed = air1.remove(recent_moles_transferred)
|
removed = air1.remove(recent_moles_transferred)
|
||||||
if(removed)
|
if(removed)
|
||||||
last_heat_capacity = removed.heat_capacity()
|
last_heat_capacity = removed.heat_capacity
|
||||||
last_temperature = removed.temperature
|
last_temperature = removed.temperature
|
||||||
|
|
||||||
//Update the gas networks.
|
//Update the gas networks.
|
||||||
|
|||||||
@@ -73,7 +73,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
var/datum/gas_mixture/environment = loc.return_air()
|
var/datum/gas_mixture/environment = loc.return_air()
|
||||||
var/environment_pressure = environment.return_pressure()
|
var/environment_pressure = environment.pressure
|
||||||
|
|
||||||
if(pump_direction) //input -> external
|
if(pump_direction) //input -> external
|
||||||
var/pressure_delta = 10000
|
var/pressure_delta = 10000
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
if(pressure_checks&1)
|
if(pressure_checks&1)
|
||||||
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
|
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
|
||||||
if(pressure_checks&2)
|
if(pressure_checks&2)
|
||||||
pressure_delta = min(pressure_delta, (air1.return_pressure() - input_pressure_min))
|
pressure_delta = min(pressure_delta, (air1.pressure - input_pressure_min))
|
||||||
|
|
||||||
if(pressure_delta > 0)
|
if(pressure_delta > 0)
|
||||||
if(air1.temperature > 0)
|
if(air1.temperature > 0)
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
if(pressure_checks&1)
|
if(pressure_checks&1)
|
||||||
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
|
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
|
||||||
if(pressure_checks&4)
|
if(pressure_checks&4)
|
||||||
pressure_delta = min(pressure_delta, (output_pressure_max - air2.return_pressure()))
|
pressure_delta = min(pressure_delta, (output_pressure_max - air2.pressure))
|
||||||
|
|
||||||
if(pressure_delta > 0)
|
if(pressure_delta > 0)
|
||||||
if(environment.temperature > 0)
|
if(environment.temperature > 0)
|
||||||
|
|||||||
@@ -33,8 +33,8 @@
|
|||||||
if(!on)
|
if(!on)
|
||||||
return
|
return
|
||||||
|
|
||||||
var/output_starting_pressure = air2.return_pressure()
|
var/output_starting_pressure = air2.pressure
|
||||||
var/input_starting_pressure = air1.return_pressure()
|
var/input_starting_pressure = air1.pressure
|
||||||
|
|
||||||
if(output_starting_pressure >= min(target_pressure,input_starting_pressure-10))
|
if(output_starting_pressure >= min(target_pressure,input_starting_pressure-10))
|
||||||
//No need to pump gas if target is already reached or input pressure is too low
|
//No need to pump gas if target is already reached or input pressure is too low
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
//Calculate necessary moles to transfer using PV = nRT
|
//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 = min(target_pressure - output_starting_pressure, (input_starting_pressure - output_starting_pressure)/2)
|
var/pressure_delta = min(target_pressure - output_starting_pressure, (input_starting_pressure - output_starting_pressure)/2)
|
||||||
//Can not have a pressure delta that would cause output_pressure > input_pressure
|
//Can not have a pressure delta that would cause output_pressure > input_pressure
|
||||||
|
|
||||||
|
|||||||
@@ -55,14 +55,14 @@ Thus, the two variables affect pump operation are set in New():
|
|||||||
if((stat & (NOPOWER|BROKEN)) || !on)
|
if((stat & (NOPOWER|BROKEN)) || !on)
|
||||||
return
|
return
|
||||||
|
|
||||||
var/output_starting_pressure = air2.return_pressure()
|
var/output_starting_pressure = air2.pressure
|
||||||
|
|
||||||
if( (target_pressure - output_starting_pressure) < 0.01)
|
if( (target_pressure - output_starting_pressure) < 0.01)
|
||||||
//No need to pump gas if target is already reached!
|
//No need to pump gas if target is already reached!
|
||||||
return
|
return
|
||||||
|
|
||||||
//Calculate necessary moles to transfer using PV=nRT
|
//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/pressure_delta = target_pressure - output_starting_pressure
|
||||||
var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ Thus, the two variables affect pump operation are set in New():
|
|||||||
|
|
||||||
// Pump mechanism just won't do anything if the pressure is too high/too low
|
// Pump mechanism just won't do anything if the pressure is too high/too low
|
||||||
|
|
||||||
var/input_starting_pressure = air1.return_pressure()
|
var/input_starting_pressure = air1.pressure
|
||||||
var/output_starting_pressure = air2.return_pressure()
|
var/output_starting_pressure = air2.pressure
|
||||||
|
|
||||||
if((input_starting_pressure < 0.01) || (output_starting_pressure > 9000))
|
if((input_starting_pressure < 0.01) || (output_starting_pressure > 9000))
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -58,9 +58,9 @@ obj/machinery/atmospherics/trinary/filter/process()
|
|||||||
if(!on)
|
if(!on)
|
||||||
return
|
return
|
||||||
|
|
||||||
var/output_starting_pressure = air3.return_pressure()
|
var/output_starting_pressure = air3.pressure
|
||||||
|
|
||||||
if(output_starting_pressure >= target_pressure || air2.return_pressure() >= target_pressure )
|
if(output_starting_pressure >= target_pressure || air2.pressure >= target_pressure )
|
||||||
//No need to mix if target is already full!
|
//No need to mix if target is already full!
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ obj/machinery/atmospherics/trinary/filter/process()
|
|||||||
filtered_out = null
|
filtered_out = null
|
||||||
|
|
||||||
for(var/gasid in gases_to_remove)
|
for(var/gasid in gases_to_remove)
|
||||||
filtered_out.adjust_gas(gasid, removed.get_moles_by_id(gasid), 0)
|
filtered_out.adjust_gas(gasid, removed.gases[gasid], 0)
|
||||||
removed.set_gas(gasid, 0, 0)
|
removed.set_gas(gasid, 0, 0)
|
||||||
|
|
||||||
air2.merge(filtered_out)
|
air2.merge(filtered_out)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ obj/machinery/atmospherics/trinary/mixer/process()
|
|||||||
if(!on)
|
if(!on)
|
||||||
return
|
return
|
||||||
|
|
||||||
var/output_starting_pressure = air3.return_pressure()
|
var/output_starting_pressure = air3.pressure
|
||||||
|
|
||||||
if(output_starting_pressure >= target_pressure)
|
if(output_starting_pressure >= target_pressure)
|
||||||
//No need to mix if target is already full!
|
//No need to mix if target is already full!
|
||||||
@@ -58,8 +58,8 @@ obj/machinery/atmospherics/trinary/mixer/process()
|
|||||||
if(air2.temperature > 0)
|
if(air2.temperature > 0)
|
||||||
transfer_moles2 = (node2_concentration*pressure_delta)*air3.volume/(air2.temperature * R_IDEAL_GAS_EQUATION)
|
transfer_moles2 = (node2_concentration*pressure_delta)*air3.volume/(air2.temperature * R_IDEAL_GAS_EQUATION)
|
||||||
|
|
||||||
var/air1_moles = air1.total_moles()
|
var/air1_moles = air1.total_moles
|
||||||
var/air2_moles = air2.total_moles()
|
var/air2_moles = air2.total_moles
|
||||||
|
|
||||||
if((air1_moles < transfer_moles1) || (air2_moles < transfer_moles2))
|
if((air1_moles < transfer_moles1) || (air2_moles < transfer_moles2))
|
||||||
if(!transfer_moles1 || !transfer_moles2) return
|
if(!transfer_moles1 || !transfer_moles2) return
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
. = ..()
|
. = ..()
|
||||||
if(!on || !network)
|
if(!on || !network)
|
||||||
return
|
return
|
||||||
var/air_heat_capacity = air_contents.heat_capacity()
|
var/air_heat_capacity = air_contents.heat_capacity
|
||||||
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
||||||
var/old_temperature = air_contents.temperature
|
var/old_temperature = air_contents.temperature
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,8 @@
|
|||||||
update_cycle = air_master.current_cycle
|
update_cycle = air_master.current_cycle
|
||||||
partner.update_cycle = air_master.current_cycle
|
partner.update_cycle = air_master.current_cycle
|
||||||
|
|
||||||
var/air_heat_capacity = air_contents.heat_capacity()
|
var/air_heat_capacity = air_contents.heat_capacity
|
||||||
var/other_air_heat_capacity = partner.air_contents.heat_capacity()
|
var/other_air_heat_capacity = partner.air_contents.heat_capacity
|
||||||
var/combined_heat_capacity = other_air_heat_capacity + air_heat_capacity
|
var/combined_heat_capacity = other_air_heat_capacity + air_heat_capacity
|
||||||
|
|
||||||
var/old_temperature = air_contents.temperature
|
var/old_temperature = air_contents.temperature
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
. = ..()
|
. = ..()
|
||||||
if(!on)
|
if(!on)
|
||||||
return
|
return
|
||||||
var/air_heat_capacity = air_contents.heat_capacity()
|
var/air_heat_capacity = air_contents.heat_capacity
|
||||||
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
||||||
var/old_temperature = air_contents.temperature
|
var/old_temperature = air_contents.temperature
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
if(air_contents.temperature > 0)
|
if(air_contents.temperature > 0)
|
||||||
var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
|
var/transfer_moles = (air_contents.pressure)*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
|
||||||
|
|
||||||
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
|
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
injecting = 1
|
injecting = 1
|
||||||
|
|
||||||
if(air_contents.temperature > 0)
|
if(air_contents.temperature > 0)
|
||||||
var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
|
var/transfer_moles = (air_contents.pressure)*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION)
|
||||||
|
|
||||||
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
|
var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
|
||||||
|
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ obj/machinery/atmospherics/unary/oxygen_generator/process()
|
|||||||
if(!on)
|
if(!on)
|
||||||
return
|
return
|
||||||
|
|
||||||
var/total_moles = air_contents.total_moles()
|
var/total_moles = air_contents.total_moles
|
||||||
|
|
||||||
if(total_moles < oxygen_content)
|
if(total_moles < oxygen_content)
|
||||||
var/current_heat_capacity = air_contents.heat_capacity()
|
var/current_heat_capacity = air_contents.heat_capacity
|
||||||
|
|
||||||
var/added_oxygen = oxygen_content - total_moles
|
var/added_oxygen = oxygen_content - total_moles
|
||||||
|
|
||||||
|
|||||||
@@ -26,26 +26,26 @@
|
|||||||
|
|
||||||
//Get processable air sample and thermal info from environment
|
//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)
|
var/datum/gas_mixture/external_removed = environment.remove(transfer_moles)
|
||||||
|
|
||||||
if (!external_removed)
|
if (!external_removed)
|
||||||
return radiate()
|
return radiate()
|
||||||
|
|
||||||
if (external_removed.total_moles() < 10)
|
if (external_removed.total_moles < 10)
|
||||||
return radiate()
|
return radiate()
|
||||||
|
|
||||||
//Get same info from connected gas
|
//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)
|
var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles)
|
||||||
|
|
||||||
if (!internal_removed)
|
if (!internal_removed)
|
||||||
environment.merge(external_removed)
|
environment.merge(external_removed)
|
||||||
return
|
return
|
||||||
|
|
||||||
var/combined_heat_capacity = internal_removed.heat_capacity() + external_removed.heat_capacity()
|
var/combined_heat_capacity = internal_removed.heat_capacity + external_removed.heat_capacity
|
||||||
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity() + external_removed.heat_capacity() * external_removed.temperature
|
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity + external_removed.heat_capacity * external_removed.temperature
|
||||||
|
|
||||||
if(!combined_heat_capacity) combined_heat_capacity = 1
|
if(!combined_heat_capacity) combined_heat_capacity = 1
|
||||||
var/final_temperature = combined_energy / combined_heat_capacity
|
var/final_temperature = combined_energy / combined_heat_capacity
|
||||||
@@ -73,14 +73,14 @@
|
|||||||
air_contents.copy_from(network.radiate) //We can cut down on processing time by only calculating radiate() once and then applying the result
|
air_contents.copy_from(network.radiate) //We can cut down on processing time by only calculating radiate() once and then applying the result
|
||||||
return
|
return
|
||||||
|
|
||||||
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)
|
var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles)
|
||||||
|
|
||||||
if (!internal_removed)
|
if (!internal_removed)
|
||||||
return
|
return
|
||||||
|
|
||||||
var/combined_heat_capacity = internal_removed.heat_capacity() + RADIATION_CAPACITY
|
var/combined_heat_capacity = internal_removed.heat_capacity + RADIATION_CAPACITY
|
||||||
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity() + (RADIATION_CAPACITY * 6.4)
|
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity + (RADIATION_CAPACITY * 6.4)
|
||||||
|
|
||||||
var/final_temperature = combined_energy / combined_heat_capacity
|
var/final_temperature = combined_energy / combined_heat_capacity
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
if(!loc) return
|
if(!loc) return
|
||||||
|
|
||||||
var/datum/gas_mixture/environment = loc.return_air()
|
var/datum/gas_mixture/environment = loc.return_air()
|
||||||
var/environment_pressure = environment.return_pressure()
|
var/environment_pressure = environment.pressure
|
||||||
|
|
||||||
if(pump_direction) //internal -> external
|
if(pump_direction) //internal -> external
|
||||||
var/pressure_delta = 10000
|
var/pressure_delta = 10000
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
if(pressure_checks&1)
|
if(pressure_checks&1)
|
||||||
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
|
pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure))
|
||||||
if(pressure_checks&2)
|
if(pressure_checks&2)
|
||||||
pressure_delta = min(pressure_delta, (air_contents.return_pressure() - internal_pressure_bound))
|
pressure_delta = min(pressure_delta, (air_contents.pressure - internal_pressure_bound))
|
||||||
|
|
||||||
if(pressure_delta > 0.1)
|
if(pressure_delta > 0.1)
|
||||||
if(air_contents.temperature > 0)
|
if(air_contents.temperature > 0)
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
if(pressure_checks&1)
|
if(pressure_checks&1)
|
||||||
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
|
pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound))
|
||||||
if(pressure_checks&2)
|
if(pressure_checks&2)
|
||||||
pressure_delta = min(pressure_delta, (internal_pressure_bound - air_contents.return_pressure()))
|
pressure_delta = min(pressure_delta, (internal_pressure_bound - air_contents.pressure))
|
||||||
|
|
||||||
if(pressure_delta > 0.1)
|
if(pressure_delta > 0.1)
|
||||||
if(environment.temperature > 0)
|
if(environment.temperature > 0)
|
||||||
|
|||||||
@@ -124,7 +124,7 @@
|
|||||||
|
|
||||||
if(scrubbing)
|
if(scrubbing)
|
||||||
if(scrubbing_gases.len)
|
if(scrubbing_gases.len)
|
||||||
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
|
//Take a gas sample
|
||||||
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
|
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
|
||||||
@@ -137,15 +137,13 @@
|
|||||||
if(!(gasid in scrubbing_gases))
|
if(!(gasid in scrubbing_gases))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
filtered_out.adjust_gas(gasid, removed.get_moles_by_id(gasid), 0) //move to filtered
|
filtered_out.adjust_gas(gasid, removed.gases[gasid]) //move to filtered
|
||||||
removed.set_gas(gasid, 0, 0) //set to 0
|
removed.set_gas(gasid, 0) //set to 0
|
||||||
|
|
||||||
//Filter it
|
//Filter it
|
||||||
|
|
||||||
filtered_out.temperature = removed.temperature
|
filtered_out.set_temperature(removed.temperature)
|
||||||
|
|
||||||
filtered_out.update_values()
|
|
||||||
removed.update_values()
|
|
||||||
|
|
||||||
//Remix the resulting gases
|
//Remix the resulting gases
|
||||||
air_contents.merge(filtered_out)
|
air_contents.merge(filtered_out)
|
||||||
@@ -156,10 +154,10 @@
|
|||||||
network.update = 1
|
network.update = 1
|
||||||
|
|
||||||
else //Just siphoning all air
|
else //Just siphoning all air
|
||||||
if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE)
|
if (air_contents.pressure>=50*ONE_ATMOSPHERE)
|
||||||
return
|
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)
|
var/datum/gas_mixture/removed = loc.remove_air(transfer_moles)
|
||||||
|
|
||||||
|
|||||||
@@ -107,13 +107,13 @@
|
|||||||
|
|
||||||
for(var/datum/gas_mixture/gas in gases)
|
for(var/datum/gas_mixture/gas in gases)
|
||||||
air_transient_volume += gas.volume
|
air_transient_volume += gas.volume
|
||||||
var/temp_heatcap = gas.heat_capacity()
|
var/temp_heatcap = gas.heat_capacity
|
||||||
total_thermal_energy += gas.temperature*temp_heatcap
|
total_thermal_energy += gas.temperature*temp_heatcap
|
||||||
total_heat_capacity += temp_heatcap
|
total_heat_capacity += temp_heatcap
|
||||||
|
|
||||||
air_transient.add(gas)
|
air_transient.add(gas)
|
||||||
|
|
||||||
air_transient.volume = air_transient_volume
|
air_transient.set_volume(air_transient_volume)
|
||||||
|
|
||||||
if(air_transient_volume > 0)
|
if(air_transient_volume > 0)
|
||||||
|
|
||||||
@@ -134,9 +134,6 @@
|
|||||||
gas.copy_from(air_transient)
|
gas.copy_from(air_transient)
|
||||||
gas.multiply(volume_ratio)
|
gas.multiply(volume_ratio)
|
||||||
|
|
||||||
gas.update_values()
|
|
||||||
|
|
||||||
air_transient.update_values()
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
proc/equalize_gases(list/datum/gas_mixture/gases)
|
proc/equalize_gases(list/datum/gas_mixture/gases)
|
||||||
@@ -148,7 +145,7 @@ proc/equalize_gases(list/datum/gas_mixture/gases)
|
|||||||
|
|
||||||
for(var/datum/gas_mixture/gas in gases)
|
for(var/datum/gas_mixture/gas in gases)
|
||||||
total_volume += gas.volume
|
total_volume += gas.volume
|
||||||
total_thermal_energy += gas.temperature*gas.heat_capacity()
|
total_thermal_energy += gas.temperature*gas.heat_capacity
|
||||||
|
|
||||||
total.add(gas)
|
total.add(gas)
|
||||||
|
|
||||||
@@ -158,17 +155,16 @@ proc/equalize_gases(list/datum/gas_mixture/gases)
|
|||||||
//Calculate temperature
|
//Calculate temperature
|
||||||
var/temperature = 0
|
var/temperature = 0
|
||||||
|
|
||||||
if(total.heat_capacity() > 0)
|
if(total.heat_capacity > 0)
|
||||||
temperature = total_thermal_energy/total.heat_capacity()
|
temperature = total_thermal_energy/total.heat_capacity
|
||||||
|
|
||||||
//Update individual gas_mixtures by volume ratio
|
//Update individual gas_mixtures by volume ratio
|
||||||
for(var/gasid in total.gases) //for each gas in the gas mix in our list of gas mixes
|
for(var/gasid in total.gases) //for each gas in the gas mix in our list of gas mixes
|
||||||
var/total_gas = total.get_moles_by_id(gasid)
|
var/total_gas = total.gases[gasid]
|
||||||
for(var/datum/gas_mixture/gas_mix in gases)
|
for(var/datum/gas_mixture/gas_mix in gases)
|
||||||
gas_mix.set_gas(gasid, total_gas * gas_mix.volume / total_volume, 0)
|
gas_mix.set_gas(gasid, total_gas * gas_mix.volume / total_volume)
|
||||||
|
|
||||||
for(var/datum/gas_mixture/gas_mix in gases) //cheaper to set here
|
for(var/datum/gas_mixture/gas_mix in gases) //cheaper to set here
|
||||||
gas_mix.temperature = temperature
|
gas_mix.set_temperature(temperature)
|
||||||
gas_mix.update_values()
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
/datum/pipeline/proc/process()//This use to be called called from the pipe networks
|
/datum/pipeline/proc/process()//This use to be called called from the pipe networks
|
||||||
if((world.timeofday - last_pressure_check) / 10 >= PRESSURE_CHECK_DELAY)
|
if((world.timeofday - last_pressure_check) / 10 >= PRESSURE_CHECK_DELAY)
|
||||||
//Check to see if pressure is within acceptable limits
|
//Check to see if pressure is within acceptable limits
|
||||||
var/pressure = air.return_pressure()
|
var/pressure = air.pressure
|
||||||
if(pressure > alert_pressure)
|
if(pressure > alert_pressure)
|
||||||
for(var/obj/machinery/atmospherics/pipe/member in members)
|
for(var/obj/machinery/atmospherics/pipe/member in members)
|
||||||
if(!member.check_pressure(pressure))
|
if(!member.check_pressure(pressure))
|
||||||
@@ -46,13 +46,11 @@
|
|||||||
|
|
||||||
for(var/obj/machinery/atmospherics/pipe/member in members)
|
for(var/obj/machinery/atmospherics/pipe/member in members)
|
||||||
member.air_temporary = new
|
member.air_temporary = new
|
||||||
member.air_temporary.volume = member.volume
|
member.air_temporary.set_volume(member.volume)
|
||||||
|
|
||||||
member.air_temporary.copy_from(air)
|
member.air_temporary.copy_from(air)
|
||||||
member.air_temporary.multiply(member.volume/air.volume)
|
member.air_temporary.multiply(member.volume/air.volume)
|
||||||
member.air_temporary.temperature = air.temperature
|
|
||||||
|
|
||||||
member.air_temporary.update_values()
|
|
||||||
|
|
||||||
/datum/pipeline/proc/build_pipeline(obj/machinery/atmospherics/pipe/base)
|
/datum/pipeline/proc/build_pipeline(obj/machinery/atmospherics/pipe/base)
|
||||||
var/list/possible_expansions = list(base)
|
var/list/possible_expansions = list(base)
|
||||||
@@ -69,6 +67,8 @@
|
|||||||
else
|
else
|
||||||
air = new
|
air = new
|
||||||
|
|
||||||
|
air.set_volume(volume)
|
||||||
|
|
||||||
while(possible_expansions.len>0)
|
while(possible_expansions.len>0)
|
||||||
for(var/obj/machinery/atmospherics/pipe/borderline in possible_expansions)
|
for(var/obj/machinery/atmospherics/pipe/borderline in possible_expansions)
|
||||||
|
|
||||||
@@ -96,9 +96,6 @@
|
|||||||
|
|
||||||
possible_expansions -= borderline
|
possible_expansions -= borderline
|
||||||
|
|
||||||
air.volume = volume
|
|
||||||
air.update_values()
|
|
||||||
|
|
||||||
/datum/pipeline/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
/datum/pipeline/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference)
|
||||||
|
|
||||||
if(new_network.line_members.Find(src))
|
if(new_network.line_members.Find(src))
|
||||||
@@ -160,7 +157,7 @@
|
|||||||
network.update = 1
|
network.update = 1
|
||||||
|
|
||||||
/datum/pipeline/proc/temperature_interact(turf/target, share_volume, thermal_conductivity)
|
/datum/pipeline/proc/temperature_interact(turf/target, share_volume, thermal_conductivity)
|
||||||
var/total_heat_capacity = air.heat_capacity()
|
var/total_heat_capacity = air.heat_capacity
|
||||||
var/partial_heat_capacity = total_heat_capacity*(share_volume/air.volume)
|
var/partial_heat_capacity = total_heat_capacity*(share_volume/air.volume)
|
||||||
|
|
||||||
if(istype(target, /turf/simulated))
|
if(istype(target, /turf/simulated))
|
||||||
@@ -183,10 +180,10 @@
|
|||||||
|
|
||||||
if(modeled_location.zone)
|
if(modeled_location.zone)
|
||||||
delta_temperature = (air.temperature - modeled_location.zone.air.temperature)
|
delta_temperature = (air.temperature - modeled_location.zone.air.temperature)
|
||||||
sharer_heat_capacity = modeled_location.zone.air.heat_capacity()
|
sharer_heat_capacity = modeled_location.zone.air.heat_capacity
|
||||||
else
|
else
|
||||||
delta_temperature = (air.temperature - modeled_location.air.temperature)
|
delta_temperature = (air.temperature - modeled_location.air.temperature)
|
||||||
sharer_heat_capacity = modeled_location.air.heat_capacity()
|
sharer_heat_capacity = modeled_location.air.heat_capacity
|
||||||
|
|
||||||
var/self_temperature_delta = 0
|
var/self_temperature_delta = 0
|
||||||
var/sharer_temperature_delta = 0
|
var/sharer_temperature_delta = 0
|
||||||
|
|||||||
@@ -56,12 +56,12 @@
|
|||||||
|
|
||||||
// Get gas from pipenet
|
// Get gas from pipenet
|
||||||
var/datum/gas_mixture/internal = return_air()
|
var/datum/gas_mixture/internal = return_air()
|
||||||
var/internal_transfer_moles = 0.25 * internal.total_moles()
|
var/internal_transfer_moles = 0.25 * internal.total_moles
|
||||||
var/datum/gas_mixture/internal_removed = internal.remove(internal_transfer_moles)
|
var/datum/gas_mixture/internal_removed = internal.remove(internal_transfer_moles)
|
||||||
|
|
||||||
//Get processable air sample and thermal info from environment
|
//Get processable air sample and thermal info from environment
|
||||||
var/datum/gas_mixture/environment = loc.return_air()
|
var/datum/gas_mixture/environment = loc.return_air()
|
||||||
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)
|
var/datum/gas_mixture/external_removed = environment.remove(transfer_moles)
|
||||||
|
|
||||||
// No environmental gas? We radiate it, then.
|
// No environmental gas? We radiate it, then.
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
return radiate()
|
return radiate()
|
||||||
|
|
||||||
// Not enough gas in the air around us to care about. Radiate.
|
// Not enough gas in the air around us to care about. Radiate.
|
||||||
if (external_removed.total_moles() < 10)
|
if (external_removed.total_moles < 10)
|
||||||
if(internal_removed)
|
if(internal_removed)
|
||||||
internal.merge(internal_removed)
|
internal.merge(internal_removed)
|
||||||
environment.merge(external_removed)
|
environment.merge(external_removed)
|
||||||
@@ -83,8 +83,8 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
//Get same info from connected gas
|
//Get same info from connected gas
|
||||||
var/combined_heat_capacity = internal_removed.heat_capacity() + external_removed.heat_capacity()
|
var/combined_heat_capacity = internal_removed.heat_capacity + external_removed.heat_capacity
|
||||||
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity() + external_removed.heat_capacity() * external_removed.temperature
|
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity + external_removed.heat_capacity * external_removed.temperature
|
||||||
|
|
||||||
if(!combined_heat_capacity)
|
if(!combined_heat_capacity)
|
||||||
combined_heat_capacity = 1
|
combined_heat_capacity = 1
|
||||||
@@ -103,14 +103,14 @@
|
|||||||
|
|
||||||
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/proc/radiate()
|
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/proc/radiate()
|
||||||
var/datum/gas_mixture/internal = return_air()
|
var/datum/gas_mixture/internal = return_air()
|
||||||
var/internal_transfer_moles = 0.25 * internal.total_moles()
|
var/internal_transfer_moles = 0.25 * internal.total_moles
|
||||||
var/datum/gas_mixture/internal_removed = internal.remove(internal_transfer_moles)
|
var/datum/gas_mixture/internal_removed = internal.remove(internal_transfer_moles)
|
||||||
|
|
||||||
if (!internal_removed)
|
if (!internal_removed)
|
||||||
return
|
return
|
||||||
|
|
||||||
var/combined_heat_capacity = internal_removed.heat_capacity() + RADIATION_CAPACITY
|
var/combined_heat_capacity = internal_removed.heat_capacity + RADIATION_CAPACITY
|
||||||
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity() + (RADIATION_CAPACITY * ENERGY_MULT)
|
var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity + (RADIATION_CAPACITY * ENERGY_MULT)
|
||||||
|
|
||||||
var/final_temperature = combined_energy / combined_heat_capacity
|
var/final_temperature = combined_energy / combined_heat_capacity
|
||||||
|
|
||||||
|
|||||||
@@ -93,11 +93,11 @@
|
|||||||
var/turf/simulated/L = loc
|
var/turf/simulated/L = loc
|
||||||
if(istype(L))
|
if(istype(L))
|
||||||
var/datum/gas_mixture/env = L.return_air()
|
var/datum/gas_mixture/env = L.return_air()
|
||||||
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)
|
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||||
if(removed)
|
if(removed)
|
||||||
if(removed.temperature > (set_temperature + T0C))
|
if(removed.temperature > (set_temperature + T0C))
|
||||||
var/air_heat_capacity = removed.heat_capacity()
|
var/air_heat_capacity = removed.heat_capacity
|
||||||
var/combined_heat_capacity = cooling_power + air_heat_capacity
|
var/combined_heat_capacity = cooling_power + air_heat_capacity
|
||||||
//var/old_temperature = removed.temperature
|
//var/old_temperature = removed.temperature
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,7 @@
|
|||||||
var/datum/gas_mixture/env = L.return_air()
|
var/datum/gas_mixture/env = L.return_air()
|
||||||
if(env.temperature != set_temperature + T0C)
|
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)
|
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@
|
|||||||
|
|
||||||
if(removed)
|
if(removed)
|
||||||
|
|
||||||
var/heat_capacity = removed.heat_capacity()
|
var/heat_capacity = removed.heat_capacity
|
||||||
//world << "heating ([heat_capacity])"
|
//world << "heating ([heat_capacity])"
|
||||||
if(heat_capacity) // Added check to avoid divide by zero (oshi-) runtime errors -- TLE
|
if(heat_capacity) // Added check to avoid divide by zero (oshi-) runtime errors -- TLE
|
||||||
if(removed.temperature < set_temperature + T0C)
|
if(removed.temperature < set_temperature + T0C)
|
||||||
|
|||||||
@@ -198,7 +198,7 @@
|
|||||||
// So, a pipe rated at 8,000 kPa in a 104kPa environment will explode at 8,104kPa.
|
// So, a pipe rated at 8,000 kPa in a 104kPa environment will explode at 8,104kPa.
|
||||||
var/datum/gas_mixture/environment = loc.return_air()
|
var/datum/gas_mixture/environment = loc.return_air()
|
||||||
|
|
||||||
var/pressure_difference = pressure - environment.return_pressure()
|
var/pressure_difference = pressure - environment.pressure
|
||||||
|
|
||||||
// Burst check first.
|
// Burst check first.
|
||||||
if(pressure_difference > maximum_pressure && prob(1))
|
if(pressure_difference > maximum_pressure && prob(1))
|
||||||
|
|||||||
@@ -135,25 +135,24 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
|
|||||||
|
|
||||||
//add plasma from the surrounding environment
|
//add plasma from the surrounding environment
|
||||||
var/datum/gas_mixture/environment = loc.return_air()
|
var/datum/gas_mixture/environment = loc.return_air()
|
||||||
var/held_plasma_moles = held_plasma.get_moles_by_id(PLASMA)
|
var/held_plasma_moles = held_plasma.gases[PLASMA]
|
||||||
|
|
||||||
//hack in some stuff to remove plasma from the air because SCIENCE
|
//hack in some stuff to remove plasma from the air because SCIENCE
|
||||||
//the amount of plasma pulled in each update is relative to the field strength, with 50T (max field strength) = 100% of area covered by the field
|
//the amount of plasma pulled in each update is relative to the field strength, with 50T (max field strength) = 100% of area covered by the field
|
||||||
//at minimum strength, 0.25% of the field volume is pulled in per update (?)
|
//at minimum strength, 0.25% of the field volume is pulled in per update (?)
|
||||||
//have a max of 1000 moles suspended
|
//have a max of 1000 moles suspended
|
||||||
if(held_plasma_moles < transfer_ratio * 1000)
|
if(held_plasma_moles < transfer_ratio * 1000)
|
||||||
var/moles_covered = environment.return_pressure()*volume_covered/(environment.temperature * R_IDEAL_GAS_EQUATION)
|
var/moles_covered = environment.pressure*volume_covered/(environment.temperature * R_IDEAL_GAS_EQUATION)
|
||||||
//world << "<span class='notice'>moles_covered: [moles_covered]</span>"
|
//world << "<span class='notice'>moles_covered: [moles_covered]</span>"
|
||||||
//
|
//
|
||||||
var/datum/gas_mixture/gas_covered = environment.remove(moles_covered)
|
var/datum/gas_mixture/gas_covered = environment.remove(moles_covered)
|
||||||
var/datum/gas_mixture/plasma_captured = new /datum/gas_mixture()
|
var/datum/gas_mixture/plasma_captured = new /datum/gas_mixture()
|
||||||
//
|
//
|
||||||
plasma_captured.set_gas(PLASMA, round(gas_covered.get_moles_by_id(PLASMA) * transfer_ratio), 0)
|
plasma_captured.set_gas(PLASMA, round(gas_covered.gases[PLASMA] * transfer_ratio))
|
||||||
//world << "<span class='warning'>[plasma_captured.toxins] moles of plasma captured</span>"
|
//world << "<span class='warning'>[plasma_captured.toxins] moles of plasma captured</span>"
|
||||||
plasma_captured.temperature = gas_covered.temperature
|
plasma_captured.set_temperature(gas_covered.temperature)
|
||||||
plasma_captured.update_values()
|
|
||||||
//
|
//
|
||||||
gas_covered.adjust_gas(PLASMA, -plasma_captured.get_moles_by_id(PLASMA))
|
gas_covered.adjust_gas(PLASMA, -plasma_captured.gases[PLASMA])
|
||||||
//
|
//
|
||||||
held_plasma.merge(plasma_captured)
|
held_plasma.merge(plasma_captured)
|
||||||
//
|
//
|
||||||
@@ -172,7 +171,7 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
|
|||||||
//change held plasma temp according to energy levels
|
//change held plasma temp according to energy levels
|
||||||
//SPECIFIC_HEAT_TOXIN
|
//SPECIFIC_HEAT_TOXIN
|
||||||
if(mega_energy > 0 && held_plasma_moles)
|
if(mega_energy > 0 && held_plasma_moles)
|
||||||
var/heat_capacity = held_plasma.heat_capacity()//200 * number of plasma moles
|
var/heat_capacity = held_plasma.heat_capacity//200 * number of plasma moles
|
||||||
if(heat_capacity > 0.0003) //formerly MINIMUM_HEAT_CAPACITY
|
if(heat_capacity > 0.0003) //formerly MINIMUM_HEAT_CAPACITY
|
||||||
held_plasma.temperature = (heat_capacity + mega_energy * 35000)/heat_capacity
|
held_plasma.temperature = (heat_capacity + mega_energy * 35000)/heat_capacity
|
||||||
|
|
||||||
|
|||||||
@@ -263,21 +263,21 @@
|
|||||||
/obj/spacepod/proc/return_pressure()
|
/obj/spacepod/proc/return_pressure()
|
||||||
. = 0
|
. = 0
|
||||||
if(use_internal_tank)
|
if(use_internal_tank)
|
||||||
. = cabin_air.return_pressure()
|
. = cabin_air.pressure
|
||||||
else
|
else
|
||||||
var/datum/gas_mixture/t_air = get_turf_air()
|
var/datum/gas_mixture/t_air = get_turf_air()
|
||||||
if(t_air)
|
if(t_air)
|
||||||
. = t_air.return_pressure()
|
. = t_air.pressure
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/spacepod/proc/return_temperature()
|
/obj/spacepod/proc/return_temperature()
|
||||||
. = 0
|
. = 0
|
||||||
if(use_internal_tank)
|
if(use_internal_tank)
|
||||||
. = cabin_air.return_temperature()
|
. = cabin_air.temperature
|
||||||
else
|
else
|
||||||
var/datum/gas_mixture/t_air = get_turf_air()
|
var/datum/gas_mixture/t_air = get_turf_air()
|
||||||
if(t_air)
|
if(t_air)
|
||||||
. = t_air.return_temperature()
|
. = t_air.temperature
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/spacepod/proc/moved_inside(var/mob/living/carbon/human/H as mob)
|
/obj/spacepod/proc/moved_inside(var/mob/living/carbon/human/H as mob)
|
||||||
@@ -366,7 +366,7 @@
|
|||||||
delay = 20
|
delay = 20
|
||||||
|
|
||||||
process(var/obj/spacepod/spacepod)
|
process(var/obj/spacepod/spacepod)
|
||||||
if(spacepod.cabin_air && spacepod.cabin_air.return_volume() > 0)
|
if(spacepod.cabin_air && spacepod.cabin_air.volume > 0)
|
||||||
var/delta = spacepod.cabin_air.temperature - T20C
|
var/delta = spacepod.cabin_air.temperature - T20C
|
||||||
spacepod.cabin_air.temperature -= max(-10, min(10, round(delta/4,0.1)))
|
spacepod.cabin_air.temperature -= max(-10, min(10, round(delta/4,0.1)))
|
||||||
return
|
return
|
||||||
@@ -380,21 +380,21 @@
|
|||||||
var/datum/gas_mixture/cabin_air = spacepod.cabin_air
|
var/datum/gas_mixture/cabin_air = spacepod.cabin_air
|
||||||
|
|
||||||
var/release_pressure = ONE_ATMOSPHERE
|
var/release_pressure = ONE_ATMOSPHERE
|
||||||
var/cabin_pressure = cabin_air.return_pressure()
|
var/cabin_pressure = cabin_air.pressure
|
||||||
var/pressure_delta = min(release_pressure - cabin_pressure, (tank_air.return_pressure() - cabin_pressure)/2)
|
var/pressure_delta = min(release_pressure - cabin_pressure, (tank_air.pressure - cabin_pressure)/2)
|
||||||
var/transfer_moles = 0
|
var/transfer_moles = 0
|
||||||
if(pressure_delta > 0) //cabin pressure lower than release pressure
|
if(pressure_delta > 0) //cabin pressure lower than release pressure
|
||||||
if(tank_air.return_temperature() > 0)
|
if(tank_air.temperature > 0)
|
||||||
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 = tank_air.remove(transfer_moles)
|
var/datum/gas_mixture/removed = tank_air.remove(transfer_moles)
|
||||||
cabin_air.merge(removed)
|
cabin_air.merge(removed)
|
||||||
else if(pressure_delta < 0) //cabin pressure higher than release pressure
|
else if(pressure_delta < 0) //cabin pressure higher than release pressure
|
||||||
var/datum/gas_mixture/t_air = spacepod.get_turf_air()
|
var/datum/gas_mixture/t_air = spacepod.get_turf_air()
|
||||||
pressure_delta = cabin_pressure - release_pressure
|
pressure_delta = cabin_pressure - release_pressure
|
||||||
if(t_air)
|
if(t_air)
|
||||||
pressure_delta = min(cabin_pressure - t_air.return_pressure(), pressure_delta)
|
pressure_delta = min(cabin_pressure - t_air.pressure, pressure_delta)
|
||||||
if(pressure_delta > 0) //if location pressure is lower than cabin pressure
|
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)
|
var/datum/gas_mixture/removed = cabin_air.remove(transfer_moles)
|
||||||
if(t_air)
|
if(t_air)
|
||||||
t_air.merge(removed)
|
t_air.merge(removed)
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ obj/item/check_airflow_movable(n)
|
|||||||
|
|
||||||
proc/Airflow(zone/A, zone/B)
|
proc/Airflow(zone/A, zone/B)
|
||||||
set background = 1
|
set background = 1
|
||||||
var/n = B.air.return_pressure() - A.air.return_pressure()
|
var/n = B.air.pressure - A.air.pressure
|
||||||
|
|
||||||
//Don't go any further if n is lower than the lowest value needed for airflow.
|
//Don't go any further if n is lower than the lowest value needed for airflow.
|
||||||
if(abs(n) < zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) return
|
if(abs(n) < zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) return
|
||||||
@@ -199,7 +199,7 @@ proc/AirflowSpace(zone/A)
|
|||||||
spawn()
|
spawn()
|
||||||
//The space version of the Airflow(A,B,n) proc.
|
//The space version of the Airflow(A,B,n) proc.
|
||||||
|
|
||||||
var/n = A.air.return_pressure()
|
var/n = A.air.pressure
|
||||||
//Here, n is determined by only the pressure in the room.
|
//Here, n is determined by only the pressure in the room.
|
||||||
|
|
||||||
if(n < zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) return
|
if(n < zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) return
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ Class Procs:
|
|||||||
air_master.mark_zone_update(B)
|
air_master.mark_zone_update(B)
|
||||||
//world << "equalized."
|
//world << "equalized."
|
||||||
|
|
||||||
var/differential = A.air.return_pressure() - B.air.return_pressure()
|
var/differential = A.air.pressure - B.air.pressure
|
||||||
if(abs(differential) < zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) return
|
if(abs(differential) < zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) return
|
||||||
|
|
||||||
var/list/attracted
|
var/list/attracted
|
||||||
@@ -241,7 +241,7 @@ Class Procs:
|
|||||||
ShareSpace(A.air,air,dbg_out)
|
ShareSpace(A.air,air,dbg_out)
|
||||||
air_master.mark_zone_update(A)
|
air_master.mark_zone_update(A)
|
||||||
|
|
||||||
var/differential = A.air.return_pressure() - air.return_pressure()
|
var/differential = A.air.pressure - air.pressure
|
||||||
if(abs(differential) < zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) return
|
if(abs(differential) < zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) return
|
||||||
|
|
||||||
var/list/attracted = A.movables()
|
var/list/attracted = A.movables()
|
||||||
@@ -256,9 +256,9 @@ proc/ShareRatio(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles)
|
|||||||
var/ratio = sharing_lookup_table[6]
|
var/ratio = sharing_lookup_table[6]
|
||||||
//WOOT WOOT TOUCH THIS AND YOU ARE A RETARD
|
//WOOT WOOT TOUCH THIS AND YOU ARE A RETARD
|
||||||
|
|
||||||
var/A_full_heat_capacity = A.heat_capacity() * A.group_multiplier
|
var/A_full_heat_capacity = A.heat_capacity * A.group_multiplier
|
||||||
|
|
||||||
var/B_full_heat_capacity = B.heat_capacity() * B.group_multiplier
|
var/B_full_heat_capacity = B.heat_capacity * B.group_multiplier
|
||||||
|
|
||||||
var/temp_avg = (A.temperature * A_full_heat_capacity + B.temperature * B_full_heat_capacity) / (A_full_heat_capacity + B_full_heat_capacity)
|
var/temp_avg = (A.temperature * A_full_heat_capacity + B.temperature * B_full_heat_capacity) / (A_full_heat_capacity + B_full_heat_capacity)
|
||||||
|
|
||||||
@@ -267,21 +267,17 @@ proc/ShareRatio(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles)
|
|||||||
ratio = sharing_lookup_table[connecting_tiles]
|
ratio = sharing_lookup_table[connecting_tiles]
|
||||||
//WOOT WOOT TOUCH THIS AND YOU ARE A RETARD
|
//WOOT WOOT TOUCH THIS AND YOU ARE A RETARD
|
||||||
|
|
||||||
|
A.set_temperature((A.temperature - temp_avg) * (1-ratio) + temp_avg)
|
||||||
|
|
||||||
|
B.set_temperature((B.temperature - temp_avg) * (1-ratio) + temp_avg)
|
||||||
|
|
||||||
for(var/gasid in A.gases)
|
for(var/gasid in A.gases)
|
||||||
var/A_moles = A.get_moles_by_id(gasid)
|
var/A_moles = A.gases[gasid]
|
||||||
var/B_moles = B.get_moles_by_id(gasid)
|
var/B_moles = B.gases[gasid]
|
||||||
var/avg_gas = (A_moles * A.group_multiplier + B_moles * B.group_multiplier) / (A.group_multiplier + B.group_multiplier)
|
var/avg_gas = (A_moles * A.group_multiplier + B_moles * B.group_multiplier) / (A.group_multiplier + B.group_multiplier)
|
||||||
|
|
||||||
A.set_gas(gasid, avg_gas + ((A_moles - avg_gas) * (1 - ratio)), 0) //we don't use adjust_gas because it interferes with the group multiplier
|
A.set_gas(gasid, avg_gas + ((A_moles - avg_gas) * (1 - ratio))) //we don't use adjust_gas because it interferes with the group multiplier
|
||||||
B.set_gas(gasid, avg_gas + ((B_moles - avg_gas) * (1 - ratio)), 0)
|
B.set_gas(gasid, avg_gas + ((B_moles - avg_gas) * (1 - ratio)))
|
||||||
|
|
||||||
|
|
||||||
A.temperature = max(0, (A.temperature - temp_avg) * (1-ratio) + temp_avg )
|
|
||||||
|
|
||||||
B.temperature = max(0, (B.temperature - temp_avg) * (1-ratio) + temp_avg )
|
|
||||||
|
|
||||||
A.update_values()
|
|
||||||
B.update_values()
|
|
||||||
|
|
||||||
return A.compare(B)
|
return A.compare(B)
|
||||||
|
|
||||||
@@ -303,7 +299,7 @@ proc/ShareSpace(datum/gas_mixture/A, list/unsimulated_tiles, dbg_output)
|
|||||||
tileslen = avg_unsim.group_multiplier
|
tileslen = avg_unsim.group_multiplier
|
||||||
|
|
||||||
if(dbg_output)
|
if(dbg_output)
|
||||||
world << "O2: [unsim_mix.get_moles_by_id(OXYGEN)] N2: [unsim_mix.get_moles_by_id(NITROGEN)] Size: [share_size] Tiles: [tileslen]"
|
world << "O2: [unsim_mix.gases[OXYGEN]] N2: [unsim_mix.gases[NITROGEN]] Size: [share_size] Tiles: [tileslen]"
|
||||||
|
|
||||||
else if(istype(unsimulated_tiles, /list))
|
else if(istype(unsimulated_tiles, /list))
|
||||||
if(!unsimulated_tiles.len)
|
if(!unsimulated_tiles.len)
|
||||||
@@ -329,14 +325,14 @@ proc/ShareSpace(datum/gas_mixture/A, list/unsimulated_tiles, dbg_output)
|
|||||||
|
|
||||||
var/ratio = sharing_lookup_table[6]
|
var/ratio = sharing_lookup_table[6]
|
||||||
|
|
||||||
var/old_pressure = A.return_pressure()
|
var/old_pressure = A.pressure
|
||||||
|
|
||||||
var/full_heat_capacity = A.heat_capacity() * A.group_multiplier
|
var/full_heat_capacity = A.heat_capacity * A.group_multiplier
|
||||||
|
|
||||||
var/temp_avg = 0
|
var/temp_avg = 0
|
||||||
|
|
||||||
if((full_heat_capacity + unsim_mix.heat_capacity()) > 0)
|
if((full_heat_capacity + unsim_mix.heat_capacity) > 0)
|
||||||
temp_avg = (A.temperature * full_heat_capacity + unsim_mix.temperature * unsim_mix.heat_capacity()) / (full_heat_capacity + unsim_mix.heat_capacity())
|
temp_avg = (A.temperature * full_heat_capacity + unsim_mix.temperature * unsim_mix.heat_capacity) / (full_heat_capacity + unsim_mix.heat_capacity)
|
||||||
|
|
||||||
if(sharing_lookup_table.len >= tileslen) //6 or more interconnecting tiles will max at 42% of air moved per tick.
|
if(sharing_lookup_table.len >= tileslen) //6 or more interconnecting tiles will max at 42% of air moved per tick.
|
||||||
ratio = sharing_lookup_table[tileslen]
|
ratio = sharing_lookup_table[tileslen]
|
||||||
@@ -345,28 +341,26 @@ proc/ShareSpace(datum/gas_mixture/A, list/unsimulated_tiles, dbg_output)
|
|||||||
world << "Ratio: [ratio]"
|
world << "Ratio: [ratio]"
|
||||||
//world << "Avg O2: [oxy_avg] N2: [nit_avg]"
|
//world << "Avg O2: [oxy_avg] N2: [nit_avg]"
|
||||||
|
|
||||||
|
A.set_temperature(max(TCMB, (A.temperature - temp_avg) * (1 - ratio) + temp_avg ))
|
||||||
|
|
||||||
for(var/gasid in A.gases)
|
for(var/gasid in A.gases)
|
||||||
var/gas_moles = A.get_moles_by_id(gasid)
|
var/gas_moles = A.gases[gasid]
|
||||||
var/avg_gas = (gas_moles + unsim_mix.get_moles_by_id(gasid)*share_size) / (size + share_size)
|
var/avg_gas = (gas_moles + unsim_mix.gases[gasid]*share_size) / (size + share_size)
|
||||||
A.set_gas(gasid, (gas_moles - avg_gas) * (1 - ratio) + avg_gas, 0 )
|
A.set_gas(gasid, (gas_moles - avg_gas) * (1 - ratio) + avg_gas, 0 )
|
||||||
|
|
||||||
A.temperature = max(TCMB, (A.temperature - temp_avg) * (1 - ratio) + temp_avg )
|
if(dbg_output) world << "Result: [abs(old_pressure - A.pressure)] kPa"
|
||||||
|
|
||||||
A.update_values()
|
return abs(old_pressure - A.pressure)
|
||||||
|
|
||||||
if(dbg_output) world << "Result: [abs(old_pressure - A.return_pressure())] kPa"
|
|
||||||
|
|
||||||
return abs(old_pressure - A.return_pressure())
|
|
||||||
|
|
||||||
|
|
||||||
proc/ShareHeat(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles)
|
proc/ShareHeat(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles)
|
||||||
//This implements a simplistic version of the Stefan-Boltzmann law.
|
//This implements a simplistic version of the Stefan-Boltzmann law.
|
||||||
var/energy_delta = ((A.temperature - B.temperature) ** 4) * 5.6704e-8 * connecting_tiles * 2.5
|
var/energy_delta = ((A.temperature - B.temperature) ** 4) * 5.6704e-8 * connecting_tiles * 2.5
|
||||||
var/maximum_energy_delta = max(0, min(A.temperature * A.heat_capacity() * A.group_multiplier, B.temperature * B.heat_capacity() * B.group_multiplier))
|
var/maximum_energy_delta = max(0, min(A.temperature * A.heat_capacity * A.group_multiplier, B.temperature * B.heat_capacity * B.group_multiplier))
|
||||||
if(maximum_energy_delta > abs(energy_delta))
|
if(maximum_energy_delta > abs(energy_delta))
|
||||||
if(energy_delta < 0)
|
if(energy_delta < 0)
|
||||||
maximum_energy_delta *= -1
|
maximum_energy_delta *= -1
|
||||||
energy_delta = maximum_energy_delta
|
energy_delta = maximum_energy_delta
|
||||||
|
|
||||||
A.temperature -= energy_delta / (A.heat_capacity() * A.group_multiplier)
|
A.temperature -= energy_delta / (A.heat_capacity * A.group_multiplier)
|
||||||
B.temperature += energy_delta / (B.heat_capacity() * B.group_multiplier)
|
B.temperature += energy_delta / (B.heat_capacity * B.group_multiplier)
|
||||||
@@ -316,7 +316,7 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
|
|||||||
var/datum/gas_mixture/B_mix = B.return_air()
|
var/datum/gas_mixture/B_mix = B.return_air()
|
||||||
|
|
||||||
for(var/gasid in A_mix.gases)
|
for(var/gasid in A_mix.gases)
|
||||||
if(A_mix.get_moles_by_id(gasid) != B_mix.get_moles_by_id(gasid))
|
if(A_mix.gases[gasid] != B_mix.gases[gasid])
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ client/proc/Zone_Info(turf/T as null|turf)
|
|||||||
else
|
else
|
||||||
mob << "No zone here."
|
mob << "No zone here."
|
||||||
var/datum/gas_mixture/mix = T.return_air()
|
var/datum/gas_mixture/mix = T.return_air()
|
||||||
mob << "[mix.return_pressure()] kPa [mix.temperature]C"
|
mob << "[mix.pressure] kPa [mix.temperature]C"
|
||||||
var/message = ""
|
var/message = ""
|
||||||
for(var/gasid in mix.gases)
|
for(var/gasid in mix.gases)
|
||||||
var/datum/gas/gas = mix.get_gas_by_id(gasid)
|
var/datum/gas/gas = mix.get_gas_by_id(gasid)
|
||||||
message += "[gas.display_short]: [mix.get_moles_by_id(gasid)]"
|
message += "[gas.display_short]: [mix.gases[gasid]]"
|
||||||
mob << message
|
mob << message
|
||||||
else
|
else
|
||||||
if(zone_debug_images)
|
if(zone_debug_images)
|
||||||
@@ -112,8 +112,8 @@ client/proc/Test_ZAS_Connection(var/turf/simulated/T as turf)
|
|||||||
client << "Plasma: [air.toxins]"
|
client << "Plasma: [air.toxins]"
|
||||||
client << "Carbon Dioxide: [air.carbon_dioxide]"
|
client << "Carbon Dioxide: [air.carbon_dioxide]"
|
||||||
client << "Temperature: [air.temperature] K"
|
client << "Temperature: [air.temperature] K"
|
||||||
client << "Heat Energy: [air.temperature * air.heat_capacity()] J"
|
client << "Heat Energy: [air.temperature * air.heat_capacity] J"
|
||||||
client << "Pressure: [air.return_pressure()] KPa"
|
client << "Pressure: [air.pressure] KPa"
|
||||||
client << ""
|
client << ""
|
||||||
client << "Unsimulated Zone(space/catwalk) Tiles: [length(unsimulated_tiles)]"
|
client << "Unsimulated Zone(space/catwalk) Tiles: [length(unsimulated_tiles)]"
|
||||||
client << "Movable Objects: [length(movables())]"
|
client << "Movable Objects: [length(movables())]"
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ Attach to transfer valve and open. BOOM.
|
|||||||
|
|
||||||
//since the air is processed in fractions, we need to make sure not to have any minuscle residue or
|
//since the air is processed in fractions, we need to make sure not to have any minuscle residue or
|
||||||
//the amount of moles might get to low for some functions to catch them and thus result in wonky behaviour
|
//the amount of moles might get to low for some functions to catch them and thus result in wonky behaviour
|
||||||
air_contents.update_values(FIRE_GAS_ROUNDING) //the define is the level we clean to
|
air_contents.round_values(FIRE_GAS_ROUNDING) //the define is the level we clean to
|
||||||
|
|
||||||
// Check if there is something to combust.
|
// Check if there is something to combust.
|
||||||
if (!air_contents.check_recombustability(S))
|
if (!air_contents.check_recombustability(S))
|
||||||
@@ -183,14 +183,14 @@ Attach to transfer valve and open. BOOM.
|
|||||||
|
|
||||||
//im not sure how to implement a version that works for every creature so for now monkeys are firesafe
|
//im not sure how to implement a version that works for every creature so for now monkeys are firesafe
|
||||||
for(var/mob/living/carbon/human/M in loc)
|
for(var/mob/living/carbon/human/M in loc)
|
||||||
M.FireBurn(firelevel, air_contents.temperature, air_contents.return_pressure() ) //Burn the humans!
|
M.FireBurn(firelevel, air_contents.temperature, air_contents.pressure ) //Burn the humans!
|
||||||
|
|
||||||
/*for(var/atom/A in loc)
|
/*for(var/atom/A in loc)
|
||||||
A.fire_act(air_contents, air_contents.temperature, air_contents.return_volume())
|
A.fire_act(air_contents, air_contents.temperature, air_contents.volume)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Burn the turf, too.
|
// Burn the turf, too.
|
||||||
S.fire_act(air_contents, air_contents.temperature, air_contents.return_volume())
|
S.fire_act(air_contents, air_contents.temperature, air_contents.volume)
|
||||||
|
|
||||||
//spread
|
//spread
|
||||||
for(var/direction in cardinal)
|
for(var/direction in cardinal)
|
||||||
@@ -254,7 +254,7 @@ turf/simulated/apply_fire_protection()
|
|||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
var/datum/gas/gas = get_gas_by_id(gasid)
|
var/datum/gas/gas = get_gas_by_id(gasid)
|
||||||
if(gas.isFuel())
|
if(gas.isFuel())
|
||||||
total_fuel += get_moles_by_id(gasid)
|
total_fuel += gases[gasid]
|
||||||
return total_fuel
|
return total_fuel
|
||||||
|
|
||||||
/datum/gas_mixture/proc/get_gas_oxidiser()
|
/datum/gas_mixture/proc/get_gas_oxidiser()
|
||||||
@@ -262,7 +262,7 @@ turf/simulated/apply_fire_protection()
|
|||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
var/datum/gas/gas = get_gas_by_id(gasid)
|
var/datum/gas/gas = get_gas_by_id(gasid)
|
||||||
if(gas.isOxidiser())
|
if(gas.isOxidiser())
|
||||||
total_oxidiser += get_moles_by_id(gasid)
|
total_oxidiser += gases[gasid]
|
||||||
return total_oxidiser
|
return total_oxidiser
|
||||||
|
|
||||||
datum/gas_mixture/proc/zburn(var/turf/T, force_burn)
|
datum/gas_mixture/proc/zburn(var/turf/T, force_burn)
|
||||||
@@ -289,7 +289,7 @@ datum/gas_mixture/proc/zburn(var/turf/T, force_burn)
|
|||||||
|
|
||||||
//get the current inner energy of the gas mix
|
//get the current inner energy of the gas mix
|
||||||
//this must be taken here to prevent the addition or deletion of energy by a changing heat capacity
|
//this must be taken here to prevent the addition or deletion of energy by a changing heat capacity
|
||||||
var/starting_energy = temperature * heat_capacity()
|
var/starting_energy = temperature * heat_capacity
|
||||||
|
|
||||||
//determine the amount of oxygen used
|
//determine the amount of oxygen used
|
||||||
total_oxidiser = min(total_oxidiser, 2 * total_fuel)
|
total_oxidiser = min(total_oxidiser, 2 * total_fuel)
|
||||||
@@ -307,15 +307,15 @@ datum/gas_mixture/proc/zburn(var/turf/T, force_burn)
|
|||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
var/datum/gas/current_gas = get_gas_by_id(gasid)
|
var/datum/gas/current_gas = get_gas_by_id(gasid)
|
||||||
if(current_gas.isOxidiser())
|
if(current_gas.isOxidiser())
|
||||||
adjust_gas(current_gas.gas_id, -get_moles_by_id(gasid) * used_reactants_ratio * current_gas.fuel_multiplier, 0, 0) //take the cost of oxidiser
|
adjust_gas(current_gas.gas_id, -gases[gasid] * used_reactants_ratio * current_gas.fuel_multiplier, 0, 0) //take the cost of oxidiser
|
||||||
|
|
||||||
//fuels
|
//fuels
|
||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
var/datum/gas/current_gas = get_gas_by_id(gasid)
|
var/datum/gas/current_gas = get_gas_by_id(gasid)
|
||||||
if(current_gas.isFuel())
|
if(current_gas.isFuel())
|
||||||
adjust_gas(current_gas.gas_id, -get_moles_by_id(gasid) * used_fuel_ratio * used_reactants_ratio * current_gas.fuel_multiplier, 0, 0) //take the cost of fuel
|
adjust_gas(current_gas.gas_id, -gases[gasid] * used_fuel_ratio * used_reactants_ratio * current_gas.fuel_multiplier, 0, 0) //take the cost of fuel
|
||||||
|
|
||||||
adjust_gas(CARBON_DIOXIDE, max(2 * total_fuel, 0), 0, 0)
|
adjust_gas(CARBON_DIOXIDE, max(2 * total_fuel, 0), 0)
|
||||||
|
|
||||||
if(can_use_turf)
|
if(can_use_turf)
|
||||||
if(T.getFireFuel()>0)
|
if(T.getFireFuel()>0)
|
||||||
@@ -325,9 +325,8 @@ datum/gas_mixture/proc/zburn(var/turf/T, force_burn)
|
|||||||
A.burnFireFuel(used_fuel_ratio, used_reactants_ratio)
|
A.burnFireFuel(used_fuel_ratio, used_reactants_ratio)
|
||||||
|
|
||||||
//calculate the energy produced by the reaction and then set the new temperature of the mix
|
//calculate the energy produced by the reaction and then set the new temperature of the mix
|
||||||
temperature = (starting_energy + zas_settings.Get(/datum/ZAS_Setting/fire_fuel_energy_release) * total_fuel) / heat_capacity()
|
temperature = (starting_energy + zas_settings.Get(/datum/ZAS_Setting/fire_fuel_energy_release) * total_fuel) / heat_capacity
|
||||||
|
|
||||||
update_values()
|
|
||||||
value = total_reactants * used_reactants_ratio
|
value = total_reactants * used_reactants_ratio
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@@ -406,7 +405,7 @@ datum/gas_mixture/proc/calculate_firelevel(var/turf/T)
|
|||||||
if(total_fuel > 0 && total_oxidiser > 0)
|
if(total_fuel > 0 && total_oxidiser > 0)
|
||||||
|
|
||||||
//slows down the burning when the concentration of the reactants is low
|
//slows down the burning when the concentration of the reactants is low
|
||||||
var/dampening_multiplier = total_combustables / (total_moles())
|
var/dampening_multiplier = total_combustables / (total_moles)
|
||||||
//calculates how close the mixture of the reactants is to the optimum
|
//calculates how close the mixture of the reactants is to the optimum
|
||||||
var/mix_multiplier = 1 / (1 + (5 * ((total_oxidiser / total_combustables) ** 2))) // Thanks, Mloc
|
var/mix_multiplier = 1 / (1 + (5 * ((total_oxidiser / total_combustables) ** 2))) // Thanks, Mloc
|
||||||
//toss everything together
|
//toss everything together
|
||||||
|
|||||||
@@ -124,6 +124,6 @@ var/image/contamination_overlay = image('icons/effects/contamination.dmi')
|
|||||||
if(istype(I) && zas_settings.Get(/datum/ZAS_Setting/CLOTH_CONTAMINATION))
|
if(istype(I) && zas_settings.Get(/datum/ZAS_Setting/CLOTH_CONTAMINATION))
|
||||||
var/datum/gas_mixture/environment = return_air()
|
var/datum/gas_mixture/environment = return_air()
|
||||||
|
|
||||||
if(environment.get_moles_by_id(PLASMA) > MOLES_PLASMA_VISIBLE + 1)
|
if(environment.gases[PLASMA] > MOLES_PLASMA_VISIBLE + 1)
|
||||||
if(I.can_contaminate())
|
if(I.can_contaminate())
|
||||||
I.contaminate()
|
I.contaminate()
|
||||||
|
|||||||
@@ -207,8 +207,7 @@
|
|||||||
if(!air)
|
if(!air)
|
||||||
make_air()
|
make_air()
|
||||||
|
|
||||||
air.temperature = temperature
|
air.set_temperature(temperature)
|
||||||
air.update_values()
|
|
||||||
|
|
||||||
return air
|
return air
|
||||||
|
|
||||||
|
|||||||
@@ -131,10 +131,10 @@ Class Procs:
|
|||||||
var/gas_message = ""
|
var/gas_message = ""
|
||||||
for(var/gasid in air.gases)
|
for(var/gasid in air.gases)
|
||||||
var/datum/gas/gas = air.get_gas_by_id(gasid)
|
var/datum/gas/gas = air.get_gas_by_id(gasid)
|
||||||
gas_message += "[gas.display_short]: [air.get_moles_by_id(gasid)]"
|
gas_message += "[gas.display_short]: [air.gases[gasid]]"
|
||||||
M << gas_message
|
M << gas_message
|
||||||
M << "P: [air.return_pressure()] kPa V: [air.volume]L T: [air.temperature]<5D>K ([air.temperature - T0C]<5D>C)"
|
M << "P: [air.pressure] kPa V: [air.volume]L T: [air.temperature]<5D>K ([air.temperature - T0C]<5D>C)"
|
||||||
M << "O2 per N2: [(air.get_moles_by_id(NITROGEN) ? air.get_moles_by_id(OXYGEN)/air.get_moles_by_id(NITROGEN) : "N/A")] Moles: [air.total_moles]"
|
M << "O2 per N2: [(air.gases[NITROGEN] ? air.gases[OXYGEN]/air.gases[NITROGEN] : "N/A")] Moles: [air.total_moles]"
|
||||||
M << "Simulated: [contents.len] ([air.group_multiplier])"
|
M << "Simulated: [contents.len] ([air.group_multiplier])"
|
||||||
//M << "Unsimulated: [unsimulated_contents.len]"
|
//M << "Unsimulated: [unsimulated_contents.len]"
|
||||||
//M << "Edges: [edges.len]"
|
//M << "Edges: [edges.len]"
|
||||||
@@ -147,7 +147,7 @@ Class Procs:
|
|||||||
else
|
else
|
||||||
space_edges++
|
space_edges++
|
||||||
space_coefficient += E.coefficient
|
space_coefficient += E.coefficient
|
||||||
M << "[E:air:return_pressure()]kPa"
|
M << "[E:air:pressure]kPa"
|
||||||
|
|
||||||
M << "Zone Edges: [zone_edges]"
|
M << "Zone Edges: [zone_edges]"
|
||||||
M << "Space Edges: [space_edges] ([space_coefficient] connections)"
|
M << "Space Edges: [space_edges] ([space_coefficient] connections)"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
var/global/list/gas_datum_list
|
var/global/list/gas_datum_list
|
||||||
|
var/global/list/gas_specific_heat
|
||||||
|
|
||||||
/datum/gas
|
/datum/gas
|
||||||
var/display_name = ""
|
var/display_name = ""
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ What are the archived variables for?
|
|||||||
|
|
||||||
var/pressure=0
|
var/pressure=0
|
||||||
|
|
||||||
|
var/heat_capacity = 0
|
||||||
|
|
||||||
var/list/gases //stores all the gas numbers for this mixture
|
var/list/gases //stores all the gas numbers for this mixture
|
||||||
var/list/archived_gases //archiving!
|
var/list/archived_gases //archiving!
|
||||||
|
|
||||||
@@ -65,6 +67,7 @@ What are the archived variables for?
|
|||||||
for(var/newgas in (typesof(/datum/gas) - /datum/gas))
|
for(var/newgas in (typesof(/datum/gas) - /datum/gas))
|
||||||
var/datum/gas/new_datum_gas = new newgas()
|
var/datum/gas/new_datum_gas = new newgas()
|
||||||
gas_datum_list += list(new_datum_gas.gas_id = new_datum_gas) //associates the gas with its id
|
gas_datum_list += list(new_datum_gas.gas_id = new_datum_gas) //associates the gas with its id
|
||||||
|
gas_specific_heat = list(new_datum_gas.gas_id = new_datum_gas.specific_heat)
|
||||||
|
|
||||||
for(var/gasid in gas_datum_list) //initialise the gases themselves
|
for(var/gasid in gas_datum_list) //initialise the gases themselves
|
||||||
gases += list("[gasid]" = 0)
|
gases += list("[gasid]" = 0)
|
||||||
@@ -78,18 +81,6 @@ What are the archived variables for?
|
|||||||
else
|
else
|
||||||
return null
|
return null
|
||||||
|
|
||||||
//just a shortcut for fetching moles
|
|
||||||
/datum/gas_mixture/proc/get_moles_by_id(gasid)
|
|
||||||
if(gasid in gases)
|
|
||||||
return gases[gasid]
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
|
|
||||||
/datum/gas_mixture/proc/get_archived_moles_by_id(gasid)
|
|
||||||
if(gasid in archived_gases)
|
|
||||||
return archived_gases[gasid]
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
|
|
||||||
//FOR THE LOVE OF GOD PLEASE USE THIS PROC
|
//FOR THE LOVE OF GOD PLEASE USE THIS PROC
|
||||||
//Call it with negative numbers to remove gases.
|
//Call it with negative numbers to remove gases.
|
||||||
@@ -101,147 +92,97 @@ What are the archived variables for?
|
|||||||
//Outputs: null
|
//Outputs: null
|
||||||
|
|
||||||
for(var/a_gas in adjusts)
|
for(var/a_gas in adjusts)
|
||||||
adjust_gas(a_gas, adjusts[a_gas], 0, 0) //we delay updating since we do it at the end
|
adjust_gas(a_gas, adjusts[a_gas], 0)
|
||||||
update_values()
|
|
||||||
return
|
return
|
||||||
|
|
||||||
//Takes a gas string, and the amount of moles to adjust by. Calls update_values() if update isn't 0.
|
//Takes a gas string, and the amount of moles to adjust by.
|
||||||
//if use_group is 0, the group_multiplier isn't considered
|
//if use_group is 0, the group_multiplier isn't considered
|
||||||
/datum/gas_mixture/proc/adjust_gas(gasid, moles, update = 1, use_group = 1)
|
//supports negative values
|
||||||
if(moles == 0)
|
/datum/gas_mixture/proc/adjust_gas(gasid, moles, use_group = 1)
|
||||||
return
|
if(moles == 0 || !(gasid in gases))
|
||||||
|
|
||||||
if(!(gasid in gases))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if(group_multiplier != 1 && use_group)
|
if(group_multiplier != 1 && use_group)
|
||||||
gases[gasid] = max(0, gases[gasid] + moles/group_multiplier)
|
set_gas(gasid, gases[gasid] + moles/group_multiplier)
|
||||||
else
|
else
|
||||||
gases[gasid] = max(0, gases[gasid] + moles)
|
set_gas(gasid, gases[gasid] + moles)
|
||||||
|
|
||||||
|
//Sets the value of a gas using a gas string and a mole number
|
||||||
if(update)
|
//Note: this should be the only way in which gas numbers should ever be edited
|
||||||
update_values()
|
//The gas system must be airtight - never bypass this
|
||||||
|
/datum/gas_mixture/proc/set_gas(gasid, moles)
|
||||||
//Sets the value of a gas
|
if(!(gasid in gases) || moles < 0)
|
||||||
/datum/gas_mixture/proc/set_gas(gasid, moles, update = 1)
|
|
||||||
if(!(gasid in gases))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
var/old_moles = gases[gasid]
|
||||||
|
|
||||||
gases[gasid] = max(0, moles)
|
gases[gasid] = max(0, moles)
|
||||||
|
|
||||||
if(update)
|
pressure += ((moles - old_moles) * R_IDEAL_GAS_EQUATION * temperature) / volume //add the maths of the new gas
|
||||||
update_values()
|
heat_capacity += (moles - old_moles) * gas_specific_heat[gasid]
|
||||||
|
total_moles += (moles - old_moles)
|
||||||
/*
|
|
||||||
/datum/gas_mixture/proc/create_reagents(var/max_vol)
|
|
||||||
aerosols = new /datum/reagents(max_vol)
|
|
||||||
aerosols.my_atom = src
|
|
||||||
*/
|
|
||||||
|
|
||||||
//tg seems to like using these a lot
|
|
||||||
/datum/gas_mixture/proc/return_temperature()
|
|
||||||
return temperature
|
|
||||||
|
|
||||||
|
|
||||||
/datum/gas_mixture/proc/return_volume()
|
|
||||||
return max(0, volume)
|
|
||||||
|
|
||||||
|
|
||||||
/datum/gas_mixture/proc/thermal_energy()
|
/datum/gas_mixture/proc/thermal_energy()
|
||||||
return temperature*heat_capacity()
|
return temperature*heat_capacity
|
||||||
|
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
//PV=nRT - related procedures//
|
//PV=nRT - related procedures//
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
|
||||||
/datum/gas_mixture/proc/heat_capacity()
|
/datum/gas_mixture/proc/set_temperature(var/new_temperature)
|
||||||
//Purpose: Returning the heat capacity of the gas mix
|
//Purpose: Changes the temperature of a gas_mixture
|
||||||
//Called by: UNKNOWN
|
//Called by: UNKNOWN
|
||||||
//Inputs: None
|
//Inputs: New temperature to set to
|
||||||
|
//Outputs: None
|
||||||
|
new_temperature = max(0, new_temperature)
|
||||||
|
|
||||||
|
var/old_temperature = temperature
|
||||||
|
|
||||||
|
temperature = new_temperature
|
||||||
|
|
||||||
|
if(old_temperature) //can't divide by 0 - and we only have pressure if T > 0
|
||||||
|
pressure *= new_temperature/old_temperature //V is unchanging, T changes by a factor, P must change by the same factor
|
||||||
|
else
|
||||||
|
pressure = (total_moles * R_IDEAL_GAS_EQUATION * temperature) / volume //recalc
|
||||||
|
|
||||||
|
/datum/gas_mixture/proc/set_volume(var/new_volume)
|
||||||
|
//Purpose: Changes the volume of a gas_mixture
|
||||||
|
//Called by: UNKNOWN
|
||||||
|
//Inputs: New volume to set to
|
||||||
|
//Outputs: None
|
||||||
|
new_volume = max(0, new_volume)
|
||||||
|
|
||||||
|
var/old_volume = volume
|
||||||
|
|
||||||
|
volume = new_volume
|
||||||
|
|
||||||
|
if(old_volume) //can't divide by 0
|
||||||
|
pressure /= new_volume/old_volume //since PV is a constant, the ratio change in V is inverse for P
|
||||||
|
else
|
||||||
|
pressure = (total_moles * R_IDEAL_GAS_EQUATION * temperature) / volume //recalc
|
||||||
|
|
||||||
|
/datum/gas_mixture/proc/heat_capacity_calc(var/list/hc_gases = gases)
|
||||||
|
//Purpose: Returning the heat capacity of a gas mix
|
||||||
|
//Called by: UNKNOWN
|
||||||
|
//Inputs: List of gases (or none, so the gas list itself)
|
||||||
//Outputs: Heat capacity
|
//Outputs: Heat capacity
|
||||||
|
|
||||||
var/heat_capacity
|
var/hc_current
|
||||||
|
|
||||||
for(var/gasid in gases)
|
for(var/gasid in hc_gases)
|
||||||
var/datum/gas/gas = get_gas_by_id(gasid)
|
hc_current += gases[gasid] * gas_specific_heat[gasid]
|
||||||
heat_capacity += get_moles_by_id(gasid)*gas.specific_heat
|
|
||||||
|
|
||||||
return max(MINIMUM_HEAT_CAPACITY,heat_capacity)
|
return max(MINIMUM_HEAT_CAPACITY, hc_current)
|
||||||
|
|
||||||
/datum/gas_mixture/proc/heat_capacity_archived()
|
/datum/gas_mixture/proc/round_values(var/rounding_error = STANDARD_GAS_ROUNDING)
|
||||||
//Purpose: Returning the archived heat capacity of the gas mix
|
//Purpose: Trims the fat off values
|
||||||
//Called by: UNKNOWN
|
//Called by: Fire code that cleans up values after processing
|
||||||
//Inputs: None
|
//Inputs: Rounding error
|
||||||
//Outputs: Archived heat capacity
|
|
||||||
|
|
||||||
var/heat_capacity_archived
|
|
||||||
|
|
||||||
for(var/gasid in gases)
|
|
||||||
var/datum/gas/gas = get_gas_by_id(gasid)
|
|
||||||
heat_capacity_archived += get_archived_moles_by_id(gasid)*gas.specific_heat
|
|
||||||
|
|
||||||
return max(MINIMUM_HEAT_CAPACITY,heat_capacity_archived)
|
|
||||||
|
|
||||||
/datum/gas_mixture/proc/total_moles()
|
|
||||||
// update_values()
|
|
||||||
return total_moles
|
|
||||||
/*var/moles = oxygen + carbon_dioxide + nitrogen + toxins
|
|
||||||
|
|
||||||
if(trace_gases.len)
|
|
||||||
for(var/datum/gas/trace_gas in trace_gases)
|
|
||||||
moles += trace_gas.moles
|
|
||||||
return moles*/
|
|
||||||
|
|
||||||
/datum/gas_mixture/proc/return_pressure()
|
|
||||||
//Purpose: Calculating Current Pressure
|
|
||||||
//Called by:
|
|
||||||
//Inputs: None
|
|
||||||
//Outputs: Gas pressure.
|
|
||||||
return pressure
|
|
||||||
|
|
||||||
// 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()
|
|
||||||
|
|
||||||
/datum/gas_mixture/proc/update_values(var/rounding_error = STANDARD_GAS_ROUNDING)
|
|
||||||
//Purpose: Calculating and storing values which were normally called CONSTANTLY
|
|
||||||
//Called by: Anything that changes values within a gas mix.
|
|
||||||
//Inputs: None
|
|
||||||
//Outputs: None
|
//Outputs: None
|
||||||
|
|
||||||
total_moles = 0
|
|
||||||
|
|
||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
var/gas_moles = get_moles_by_id(gasid)
|
adjust_gas(gasid, - (gases[gasid] - round(gases[gasid], rounding_error)))
|
||||||
if(!rounding_error || round(gas_moles, rounding_error) > 0) //the fraction isn't small enough to be discarded
|
|
||||||
total_moles += gas_moles
|
|
||||||
else
|
|
||||||
set_gas(gasid, 0, 0) //get rid of the remainder
|
|
||||||
|
|
||||||
if(volume>0)
|
|
||||||
pressure = total_moles()*R_IDEAL_GAS_EQUATION*temperature/volume
|
|
||||||
else
|
|
||||||
pressure = 0
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
//Procedures used for very specific events//
|
//Procedures used for very specific events//
|
||||||
@@ -257,16 +198,16 @@ What are the archived variables for?
|
|||||||
|
|
||||||
// If configured and cold, maek ice
|
// If configured and cold, maek ice
|
||||||
if(zas_settings.Get(/datum/ZAS_Setting/ice_formation))
|
if(zas_settings.Get(/datum/ZAS_Setting/ice_formation))
|
||||||
if(temperature <= TEMPERATURE_ICE_FORMATION && return_pressure()>MIN_PRESSURE_ICE_FORMATION)
|
if(temperature <= TEMPERATURE_ICE_FORMATION && pressure>MIN_PRESSURE_ICE_FORMATION)
|
||||||
// If we're just forming, do a probability check. Otherwise, KEEP IT ON~
|
// If we're just forming, do a probability check. Otherwise, KEEP IT ON~
|
||||||
// This ordering will hopefully keep it from sampling random noise every damn tick.
|
// This ordering will hopefully keep it from sampling random noise every damn tick.
|
||||||
//if(was_icy || (!was_icy && prob(25)))
|
//if(was_icy || (!was_icy && prob(25)))
|
||||||
graphics |= GRAPHICS_COLD
|
graphics |= GRAPHICS_COLD
|
||||||
|
|
||||||
if(get_moles_by_id(PLASMA) > MOLES_PLASMA_VISIBLE)
|
if(gases[PLASMA] > MOLES_PLASMA_VISIBLE)
|
||||||
graphics |= GRAPHICS_PLASMA
|
graphics |= GRAPHICS_PLASMA
|
||||||
|
|
||||||
if(get_moles_by_id(NITROUS_OXIDE) > MOLES_N2O_VISIBLE)
|
if(gases[NITROUS_OXIDE] > MOLES_N2O_VISIBLE)
|
||||||
graphics |= GRAPHICS_N2O
|
graphics |= GRAPHICS_N2O
|
||||||
/*
|
/*
|
||||||
if(aerosols && aerosols.total_volume >= 1)
|
if(aerosols && aerosols.total_volume >= 1)
|
||||||
@@ -294,7 +235,7 @@ What are the archived variables for?
|
|||||||
return zburn(null)
|
return zburn(null)
|
||||||
|
|
||||||
/*var/energy_released = 0
|
/*var/energy_released = 0
|
||||||
var/old_heat_capacity = heat_capacity()
|
var/old_heat_capacity = heat_capacity
|
||||||
|
|
||||||
var/datum/gas/volatile_fuel/fuel_store = locate(/datum/gas/volatile_fuel) in trace_gases
|
var/datum/gas/volatile_fuel/fuel_store = locate(/datum/gas/volatile_fuel) in trace_gases
|
||||||
if(fuel_store) //General volatile gas burn
|
if(fuel_store) //General volatile gas burn
|
||||||
@@ -339,7 +280,7 @@ What are the archived variables for?
|
|||||||
fuel_burnt += (plasma_burn_rate)*(1+oxygen_burn_rate)
|
fuel_burnt += (plasma_burn_rate)*(1+oxygen_burn_rate)
|
||||||
|
|
||||||
if(energy_released > 0)
|
if(energy_released > 0)
|
||||||
var/new_heat_capacity = heat_capacity()
|
var/new_heat_capacity = heat_capacity
|
||||||
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
|
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
|
||||||
temperature = (temperature*old_heat_capacity + energy_released)/new_heat_capacity
|
temperature = (temperature*old_heat_capacity + energy_released)/new_heat_capacity
|
||||||
update_values()
|
update_values()
|
||||||
@@ -379,7 +320,7 @@ What are the archived variables for?
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
if((giver.get_moles_by_id(gasid) > MINIMUM_AIR_TO_SUSPEND) && (giver.get_moles_by_id(gasid) >= get_moles_by_id(gasid)*MINIMUM_AIR_RATIO_TO_SUSPEND))
|
if((giver.gases[gasid] > MINIMUM_AIR_TO_SUSPEND) && (giver.gases[gasid] >= gases[gasid]*MINIMUM_AIR_RATIO_TO_SUSPEND))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
return merge(giver)
|
return merge(giver)
|
||||||
@@ -394,24 +335,18 @@ What are the archived variables for?
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
if(abs(temperature-giver.temperature)>MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
if(abs(temperature-giver.temperature)>MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
||||||
var/self_heat_capacity = heat_capacity()*group_multiplier
|
var/self_heat_capacity = heat_capacity*group_multiplier
|
||||||
var/giver_heat_capacity = giver.heat_capacity()*giver.group_multiplier
|
var/giver_heat_capacity = giver.heat_capacity*giver.group_multiplier
|
||||||
var/combined_heat_capacity = giver_heat_capacity + self_heat_capacity
|
var/combined_heat_capacity = giver_heat_capacity + self_heat_capacity
|
||||||
if(combined_heat_capacity != 0)
|
if(combined_heat_capacity != 0)
|
||||||
temperature = (giver.temperature*giver_heat_capacity + temperature*self_heat_capacity)/combined_heat_capacity
|
temperature = (giver.temperature*giver_heat_capacity + temperature*self_heat_capacity)/combined_heat_capacity
|
||||||
|
|
||||||
if(giver.group_multiplier>1)
|
if(giver.group_multiplier>1)
|
||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
adjust_gas(gasid, giver.get_moles_by_id(gasid) * giver.group_multiplier, 0) //delay updates
|
adjust_gas(gasid, giver.gases[gasid] * giver.group_multiplier)
|
||||||
else
|
else
|
||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
adjust_gas(gasid, giver.get_moles_by_id(gasid), 0)
|
adjust_gas(gasid, giver.gases[gasid])
|
||||||
|
|
||||||
/*
|
|
||||||
if(giver.aerosols.total_volume > 1)
|
|
||||||
giver.aerosols.trans_to_atmos(src,aerosols.total_volume)
|
|
||||||
*/
|
|
||||||
update_values()
|
|
||||||
|
|
||||||
// Let the garbage collector handle it, faster according to /tg/ testers
|
// Let the garbage collector handle it, faster according to /tg/ testers
|
||||||
//del(giver)
|
//del(giver)
|
||||||
@@ -423,28 +358,23 @@ What are the archived variables for?
|
|||||||
//Inputs: How many moles to remove.
|
//Inputs: How many moles to remove.
|
||||||
//Outputs: Removed air.
|
//Outputs: Removed air.
|
||||||
|
|
||||||
update_values()
|
|
||||||
|
|
||||||
// Fix a singuloth problem
|
// Fix a singuloth problem
|
||||||
if(group_multiplier==0)
|
if(group_multiplier==0)
|
||||||
return null
|
return null
|
||||||
|
|
||||||
var/sum = total_moles()
|
var/sum = total_moles
|
||||||
amount = min(amount,sum) //Can not take more air than tile has!
|
amount = min(amount,sum) //Can not take more air than tile has!
|
||||||
if(amount <= 0)
|
if(amount <= 0)
|
||||||
return new/datum/gas_mixture
|
return new/datum/gas_mixture
|
||||||
|
|
||||||
var/datum/gas_mixture/removed = new
|
var/datum/gas_mixture/removed = new
|
||||||
|
|
||||||
|
removed.set_temperature(temperature)
|
||||||
|
|
||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
var/taken_gas = QUANTIZE(get_moles_by_id(gasid) / sum) * amount //the gas we lose - not yet subtracted
|
var/taken_gas = QUANTIZE(gases[gasid] / sum) * amount //the gas we lose - not yet subtracted
|
||||||
adjust_gas(gasid, -taken_gas, 0) //don't update just yet - negative subtracts
|
adjust_gas(gasid, -taken_gas) //don't update just yet - negative subtracts
|
||||||
removed.adjust_gas(gasid, taken_gas, 0) //slap the copied gas in
|
removed.adjust_gas(gasid, taken_gas) //slap the copied gas in
|
||||||
|
|
||||||
removed.temperature = temperature
|
|
||||||
update_values()
|
|
||||||
removed.update_values()
|
|
||||||
|
|
||||||
return removed
|
return removed
|
||||||
|
|
||||||
@@ -459,7 +389,7 @@ What are the archived variables for?
|
|||||||
|
|
||||||
ratio = min(ratio, 1)
|
ratio = min(ratio, 1)
|
||||||
|
|
||||||
return remove(total_moles() * ratio) //use the sum removal
|
return remove(total_moles * ratio) //use the sum removal
|
||||||
|
|
||||||
/datum/gas_mixture/proc/check_then_remove(amount)
|
/datum/gas_mixture/proc/check_then_remove(amount)
|
||||||
//Purpose: Similar to remove(...) but first checks to see if the amount of air removed is small enough
|
//Purpose: Similar to remove(...) but first checks to see if the amount of air removed is small enough
|
||||||
@@ -468,9 +398,9 @@ What are the archived variables for?
|
|||||||
//Inputs: Number of moles to remove
|
//Inputs: Number of moles to remove
|
||||||
//Outputs: Removed air or 0 if it can remove air or not.
|
//Outputs: Removed air or 0 if it can remove air or not.
|
||||||
|
|
||||||
amount = Clamp(amount, 0, total_moles()) //Can not take more air than tile has!
|
amount = Clamp(amount, 0, total_moles) //Can not take more air than tile has!
|
||||||
|
|
||||||
if((amount > MINIMUM_AIR_RATIO_TO_SUSPEND) && (amount > total_moles()*MINIMUM_AIR_RATIO_TO_SUSPEND))
|
if((amount > MINIMUM_AIR_RATIO_TO_SUSPEND) && (amount > total_moles*MINIMUM_AIR_RATIO_TO_SUSPEND))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
return remove(amount)
|
return remove(amount)
|
||||||
@@ -481,12 +411,10 @@ What are the archived variables for?
|
|||||||
//Inputs: Gas to copy
|
//Inputs: Gas to copy
|
||||||
//Outputs: 1
|
//Outputs: 1
|
||||||
|
|
||||||
|
set_temperature(sample.temperature)
|
||||||
|
|
||||||
for(var/gasid in sample.gases)
|
for(var/gasid in sample.gases)
|
||||||
set_gas(gasid, sample.get_moles_by_id(gasid), 0)
|
set_gas(gasid, sample.gases[gasid], 0)
|
||||||
|
|
||||||
temperature = sample.temperature
|
|
||||||
|
|
||||||
update_values()
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@@ -504,8 +432,8 @@ What are the archived variables for?
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
var/archived_own_gas = get_archived_moles_by_id(gasid)
|
var/archived_own_gas = archived_gases[gasid]
|
||||||
var/archived_sharer_gas = sharer.get_archived_moles_by_id(gasid)
|
var/archived_sharer_gas = sharer.archived_gases[gasid]
|
||||||
var/gas_delta = abs(QUANTIZE(archived_own_gas - archived_sharer_gas)/TRANSFER_FRACTION) //the difference in gas moles
|
var/gas_delta = abs(QUANTIZE(archived_own_gas - archived_sharer_gas)/TRANSFER_FRACTION) //the difference in gas moles
|
||||||
|
|
||||||
if((gas_delta > MINIMUM_AIR_TO_SUSPEND) && (gas_delta >= archived_own_gas*MINIMUM_AIR_RATIO_TO_SUSPEND))
|
if((gas_delta > MINIMUM_AIR_TO_SUSPEND) && (gas_delta >= archived_own_gas*MINIMUM_AIR_RATIO_TO_SUSPEND))
|
||||||
@@ -528,8 +456,8 @@ What are the archived variables for?
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
var/archived_gas = get_archived_moles_by_id(gasid)
|
var/archived_gas = archived_gases[gasid]
|
||||||
var/gas_delta = abs((archived_gas - model.get_moles_by_id(gasid))/TRANSFER_FRACTION)
|
var/gas_delta = abs((archived_gas - model.gases[gasid])/TRANSFER_FRACTION)
|
||||||
if((gas_delta > MINIMUM_AIR_TO_SUSPEND) && (gas_delta >= archived_gas*MINIMUM_AIR_RATIO_TO_SUSPEND))
|
if((gas_delta > MINIMUM_AIR_TO_SUSPEND) && (gas_delta >= archived_gas*MINIMUM_AIR_RATIO_TO_SUSPEND))
|
||||||
return 0
|
return 0
|
||||||
return 1
|
return 1
|
||||||
@@ -558,7 +486,7 @@ What are the archived variables for?
|
|||||||
var/moved_moles = 0
|
var/moved_moles = 0
|
||||||
|
|
||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
var/gas_delta = QUANTIZE(get_archived_moles_by_id(gasid) - sharer.get_archived_moles_by_id(gasid))/TRANSFER_FRACTION
|
var/gas_delta = QUANTIZE(archived_gases[gasid] - sharer.archived_gases[gasid])/TRANSFER_FRACTION
|
||||||
if(gas_delta && abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) //difference in gases and temperature
|
if(gas_delta && abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) //difference in gases and temperature
|
||||||
var/datum/gas/current_gas = get_gas_by_id(gasid)
|
var/datum/gas/current_gas = get_gas_by_id(gasid)
|
||||||
var/gas_heat_capacity = current_gas.specific_heat
|
var/gas_heat_capacity = current_gas.specific_heat
|
||||||
@@ -569,17 +497,15 @@ What are the archived variables for?
|
|||||||
heat_sharer_to_self -= gas_heat_capacity * temperature_archived
|
heat_sharer_to_self -= gas_heat_capacity * temperature_archived
|
||||||
heat_capacity_sharer_to_self -= gas_heat_capacity
|
heat_capacity_sharer_to_self -= gas_heat_capacity
|
||||||
|
|
||||||
adjust_gas(gasid, -gas_delta, 0) //delay update - adjust_gas handles the group multiplier
|
adjust_gas(gasid, -gas_delta) //delay update - adjust_gas handles the group multiplier
|
||||||
sharer.adjust_gas(gasid, gas_delta, 0)
|
sharer.adjust_gas(gasid, gas_delta)
|
||||||
|
|
||||||
moved_moles += gas_delta
|
moved_moles += gas_delta
|
||||||
|
|
||||||
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
||||||
old_self_heat_capacity = heat_capacity()*group_multiplier
|
old_self_heat_capacity = heat_capacity*group_multiplier
|
||||||
old_sharer_heat_capacity = sharer.heat_capacity()*sharer.group_multiplier
|
old_sharer_heat_capacity = sharer.heat_capacity*sharer.group_multiplier
|
||||||
|
|
||||||
update_values()
|
|
||||||
sharer.update_values()
|
|
||||||
|
|
||||||
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
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
|
var/new_self_heat_capacity = old_self_heat_capacity + heat_capacity_sharer_to_self - heat_capacity_self_to_sharer
|
||||||
@@ -596,7 +522,7 @@ What are the archived variables for?
|
|||||||
temperature_share(sharer, OPEN_HEAT_TRANSFER_COEFFICIENT)
|
temperature_share(sharer, OPEN_HEAT_TRANSFER_COEFFICIENT)
|
||||||
|
|
||||||
if((delta_temperature > MINIMUM_TEMPERATURE_TO_MOVE) || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE)
|
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
|
return delta_pressure*R_IDEAL_GAS_EQUATION/volume
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -619,39 +545,36 @@ What are the archived variables for?
|
|||||||
var/moved_moles
|
var/moved_moles
|
||||||
|
|
||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
var/gas_delta = QUANTIZE(get_archived_moles_by_id(gasid) - model.get_moles_by_id(gasid))/TRANSFER_FRACTION
|
var/gas_delta = QUANTIZE(archived_gases[gasid] - model.gases[gasid])/TRANSFER_FRACTION
|
||||||
|
|
||||||
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
||||||
var/datum/gas/current_gas = get_gas_by_id(gasid)
|
var/gas_heat_capacity = gas_specific_heat[gasid]
|
||||||
var/gas_heat_capacity = current_gas.specific_heat * gas_delta
|
|
||||||
heat_transferred -= gas_heat_capacity * model.temperature
|
heat_transferred -= gas_heat_capacity * model.temperature
|
||||||
heat_capacity_transferred -= gas_heat_capacity
|
heat_capacity_transferred -= gas_heat_capacity
|
||||||
|
|
||||||
if(border_multiplier)
|
if(border_multiplier)
|
||||||
adjust_gas(gasid, -gas_delta*border_multiplier, 0) //the 0 delays updates
|
adjust_gas(gasid, -gas_delta*border_multiplier)
|
||||||
else
|
else
|
||||||
adjust_gas(gasid, -gas_delta, 0)
|
adjust_gas(gasid, -gas_delta)
|
||||||
|
|
||||||
moved_moles += gas_delta
|
moved_moles += gas_delta
|
||||||
|
|
||||||
|
|
||||||
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
||||||
old_self_heat_capacity = heat_capacity()*group_multiplier
|
old_self_heat_capacity = heat_capacity*group_multiplier
|
||||||
|
|
||||||
update_values()
|
|
||||||
|
|
||||||
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
||||||
var/new_self_heat_capacity = old_self_heat_capacity - heat_capacity_transferred
|
var/new_self_heat_capacity = old_self_heat_capacity - heat_capacity_transferred
|
||||||
if(new_self_heat_capacity > MINIMUM_HEAT_CAPACITY)
|
if(new_self_heat_capacity > MINIMUM_HEAT_CAPACITY)
|
||||||
if(border_multiplier)
|
if(border_multiplier)
|
||||||
temperature = (old_self_heat_capacity*temperature - heat_capacity_transferred*border_multiplier*temperature_archived)/new_self_heat_capacity
|
set_temperature((old_self_heat_capacity*temperature - heat_capacity_transferred*border_multiplier*temperature_archived)/new_self_heat_capacity)
|
||||||
else
|
else
|
||||||
temperature = (old_self_heat_capacity*temperature - heat_capacity_transferred*border_multiplier*temperature_archived)/new_self_heat_capacity
|
set_temperature((old_self_heat_capacity*temperature - heat_capacity_transferred*border_multiplier*temperature_archived)/new_self_heat_capacity)
|
||||||
|
|
||||||
temperature_mimic(model, model_turf.thermal_conductivity, border_multiplier)
|
temperature_mimic(model, model_turf.thermal_conductivity, border_multiplier)
|
||||||
|
|
||||||
if((delta_temperature > MINIMUM_TEMPERATURE_TO_MOVE) || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE)
|
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.total_moles())
|
var/delta_pressure = temperature_archived*(total_moles + moved_moles) - model.temperature*(model.total_moles)
|
||||||
return delta_pressure*R_IDEAL_GAS_EQUATION/volume
|
return delta_pressure*R_IDEAL_GAS_EQUATION/volume
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
@@ -659,8 +582,8 @@ What are the archived variables for?
|
|||||||
/datum/gas_mixture/proc/check_both_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
|
/datum/gas_mixture/proc/check_both_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
|
||||||
var/delta_temperature = (temperature_archived - sharer.temperature_archived)
|
var/delta_temperature = (temperature_archived - sharer.temperature_archived)
|
||||||
|
|
||||||
var/self_heat_capacity = heat_capacity_archived()
|
var/self_heat_capacity = heat_capacity_calc(archived_gases)
|
||||||
var/sharer_heat_capacity = sharer.heat_capacity_archived()
|
var/sharer_heat_capacity = sharer.heat_capacity_calc(archived_gases)
|
||||||
|
|
||||||
var/self_temperature_delta = 0
|
var/self_temperature_delta = 0
|
||||||
var/sharer_temperature_delta = 0
|
var/sharer_temperature_delta = 0
|
||||||
@@ -691,8 +614,8 @@ What are the archived variables for?
|
|||||||
/datum/gas_mixture/proc/check_me_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
|
/datum/gas_mixture/proc/check_me_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
|
||||||
var/delta_temperature = (temperature_archived - sharer.temperature_archived)
|
var/delta_temperature = (temperature_archived - sharer.temperature_archived)
|
||||||
|
|
||||||
var/self_heat_capacity = heat_capacity_archived()
|
var/self_heat_capacity = heat_capacity_calc(archived_gases)
|
||||||
var/sharer_heat_capacity = sharer.heat_capacity_archived()
|
var/sharer_heat_capacity = sharer.heat_capacity_calc(archived_gases)
|
||||||
|
|
||||||
var/self_temperature_delta = 0
|
var/self_temperature_delta = 0
|
||||||
var/sharer_temperature_delta = 0
|
var/sharer_temperature_delta = 0
|
||||||
@@ -723,7 +646,7 @@ What are the archived variables for?
|
|||||||
var/sharer_temperature_delta = 0
|
var/sharer_temperature_delta = 0
|
||||||
|
|
||||||
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
||||||
var/self_heat_capacity = heat_capacity_archived()
|
var/self_heat_capacity = heat_capacity_calc(archived_gases)
|
||||||
|
|
||||||
if((sharer.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY))
|
if((sharer.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY))
|
||||||
var/heat = conduction_coefficient*delta_temperature* \
|
var/heat = conduction_coefficient*delta_temperature* \
|
||||||
@@ -749,7 +672,7 @@ What are the archived variables for?
|
|||||||
var/self_temperature_delta = 0
|
var/self_temperature_delta = 0
|
||||||
|
|
||||||
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
||||||
var/self_heat_capacity = heat_capacity_archived()
|
var/self_heat_capacity = heat_capacity_calc(archived_gases)
|
||||||
|
|
||||||
if((model.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY))
|
if((model.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY))
|
||||||
var/heat = conduction_coefficient*delta_temperature* \
|
var/heat = conduction_coefficient*delta_temperature* \
|
||||||
@@ -761,7 +684,7 @@ What are the archived variables for?
|
|||||||
&& (abs(self_temperature_delta) > MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND*temperature_archived))
|
&& (abs(self_temperature_delta) > MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND*temperature_archived))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
temperature += self_temperature_delta
|
set_temperature(temperature + self_temperature_delta)
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
//Logic integrated from: temperature_mimic(model, conduction_coefficient) for efficiency
|
//Logic integrated from: temperature_mimic(model, conduction_coefficient) for efficiency
|
||||||
@@ -769,8 +692,8 @@ What are the archived variables for?
|
|||||||
/datum/gas_mixture/proc/temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
|
/datum/gas_mixture/proc/temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
|
||||||
var/delta_temperature = (temperature_archived - sharer.temperature_archived)
|
var/delta_temperature = (temperature_archived - sharer.temperature_archived)
|
||||||
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
||||||
var/self_heat_capacity = heat_capacity_archived()
|
var/self_heat_capacity = heat_capacity_calc(archived_gases)
|
||||||
var/sharer_heat_capacity = sharer.heat_capacity_archived()
|
var/sharer_heat_capacity = sharer.heat_capacity_calc(archived_gases)
|
||||||
if(!group_multiplier)
|
if(!group_multiplier)
|
||||||
message_admins("Error! The gas mixture (ref \ref[src]) has no group multiplier!")
|
message_admins("Error! The gas mixture (ref \ref[src]) has no group multiplier!")
|
||||||
return
|
return
|
||||||
@@ -785,7 +708,7 @@ What are the archived variables for?
|
|||||||
/datum/gas_mixture/proc/temperature_mimic(turf/model, conduction_coefficient, border_multiplier)
|
/datum/gas_mixture/proc/temperature_mimic(turf/model, conduction_coefficient, border_multiplier)
|
||||||
var/delta_temperature = (temperature - model.temperature)
|
var/delta_temperature = (temperature - model.temperature)
|
||||||
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
||||||
var/self_heat_capacity = heat_capacity()//_archived()
|
var/self_heat_capacity = heat_capacity//_archived()
|
||||||
if(!group_multiplier)
|
if(!group_multiplier)
|
||||||
message_admins("Error! The gas mixture (ref \ref[src]) has no group multiplier!")
|
message_admins("Error! The gas mixture (ref \ref[src]) has no group multiplier!")
|
||||||
return
|
return
|
||||||
@@ -802,7 +725,7 @@ What are the archived variables for?
|
|||||||
/datum/gas_mixture/proc/temperature_turf_share(turf/simulated/sharer, conduction_coefficient)
|
/datum/gas_mixture/proc/temperature_turf_share(turf/simulated/sharer, conduction_coefficient)
|
||||||
var/delta_temperature = (temperature_archived - sharer.temperature)
|
var/delta_temperature = (temperature_archived - sharer.temperature)
|
||||||
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
|
||||||
var/self_heat_capacity = heat_capacity()
|
var/self_heat_capacity = heat_capacity
|
||||||
|
|
||||||
if((sharer.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY))
|
if((sharer.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY))
|
||||||
var/heat = conduction_coefficient*delta_temperature* \
|
var/heat = conduction_coefficient*delta_temperature* \
|
||||||
@@ -819,13 +742,13 @@ What are the archived variables for?
|
|||||||
if(!sample) return 0
|
if(!sample) return 0
|
||||||
|
|
||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
var/current_gas = get_moles_by_id(gasid)
|
var/current_gas = gases[gasid]
|
||||||
var/sample_gas = sample.get_moles_by_id(gasid)
|
var/sample_gas = sample.gases[gasid]
|
||||||
if((abs(current_gas - sample_gas) > MINIMUM_AIR_TO_SUSPEND) && \
|
if((abs(current_gas - sample_gas) > MINIMUM_AIR_TO_SUSPEND) && \
|
||||||
((current_gas < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample_gas) || (current_gas > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample_gas)))
|
((current_gas < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample_gas) || (current_gas > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample_gas)))
|
||||||
return 0
|
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) && \
|
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)))
|
((temperature < (1-MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature) || (temperature > (1+MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature)))
|
||||||
//world << "temp fail [temperature] & [sample.temperature]"
|
//world << "temp fail [temperature] & [sample.temperature]"
|
||||||
@@ -837,9 +760,8 @@ What are the archived variables for?
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
for(var/gasid in right_side.gases)
|
for(var/gasid in right_side.gases)
|
||||||
adjust_gas(gasid, right_side.get_moles_by_id(gasid), 0, 0)
|
adjust_gas(gasid, right_side.gases[gasid], 0, 0)
|
||||||
|
|
||||||
update_values()
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
/datum/gas_mixture/proc/subtract(datum/gas_mixture/right_side)
|
/datum/gas_mixture/proc/subtract(datum/gas_mixture/right_side)
|
||||||
@@ -849,17 +771,15 @@ What are the archived variables for?
|
|||||||
//Outputs: 1
|
//Outputs: 1
|
||||||
|
|
||||||
for(var/gasid in right_side.gases)
|
for(var/gasid in right_side.gases)
|
||||||
adjust_gas(gasid, -right_side.get_moles_by_id(gasid), 0, 0)
|
adjust_gas(gasid, -right_side.gases[gasid], 0, 0)
|
||||||
|
|
||||||
update_values()
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
/datum/gas_mixture/proc/multiply(factor)
|
/datum/gas_mixture/proc/multiply(factor)
|
||||||
|
|
||||||
for(var/gasid in gases)
|
for(var/gasid in gases)
|
||||||
adjust_gas(gasid, (factor - 1) * get_moles_by_id(gasid), 0, 0)
|
adjust_gas(gasid, (factor - 1) * gases[gasid], 0, 0)
|
||||||
|
|
||||||
update_values()
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
/datum/gas_mixture/proc/divide(factor)
|
/datum/gas_mixture/proc/divide(factor)
|
||||||
|
|||||||
@@ -305,15 +305,15 @@
|
|||||||
contents.Add(t.air_contents.total_moles) //Someone messed with the tank and put unknown gasses
|
contents.Add(t.air_contents.total_moles) //Someone messed with the tank and put unknown gasses
|
||||||
continue //in it, so we're going to believe the tank is what it says it is
|
continue //in it, so we're going to believe the tank is what it says it is
|
||||||
|
|
||||||
if(t.air_contents.get_moles_by_id(breathes))
|
if(t.air_contents.gases[breathes])
|
||||||
var/toxic_found
|
var/toxic_found
|
||||||
for(var/toxicid in C.toxic_to_breathe)
|
for(var/toxicid in C.toxic_to_breathe)
|
||||||
if(t.air_contents.get_moles_by_id(toxicid))
|
if(t.air_contents.gases[toxicid])
|
||||||
tank_contents.Add(0)
|
tank_contents.Add(0)
|
||||||
toxic_found = 1
|
toxic_found = 1
|
||||||
break
|
break
|
||||||
if(!toxic_found)
|
if(!toxic_found)
|
||||||
tank_contents.Add(t.air_contents.get_moles_by_id(breathes))
|
tank_contents.Add(t.air_contents.gases[breathes])
|
||||||
|
|
||||||
else
|
else
|
||||||
//no tank so we set contents to 0
|
//no tank so we set contents to 0
|
||||||
|
|||||||
@@ -313,15 +313,15 @@ ________________________________________________________________________________
|
|||||||
else
|
else
|
||||||
var/datum/gas_mixture/environment = T.return_air()
|
var/datum/gas_mixture/environment = T.return_air()
|
||||||
|
|
||||||
var/pressure = environment.return_pressure()
|
var/pressure = environment.pressure
|
||||||
var/total_moles = environment.total_moles()
|
var/total_moles = environment.total_moles
|
||||||
|
|
||||||
dat += "Air Pressure: [round(pressure,0.1)] kPa"
|
dat += "Air Pressure: [round(pressure,0.1)] kPa"
|
||||||
|
|
||||||
dat += "<ul>"
|
dat += "<ul>"
|
||||||
for(var/gasid in environment.gases)
|
for(var/gasid in environment.gases)
|
||||||
var/datum/gas/gas = environment.get_gas_by_id(gasid)
|
var/datum/gas/gas = environment.get_gas_by_id(gasid)
|
||||||
dat += "<li>[gas.display_name]: [round(environment.get_moles_by_id(gasid)/total_moles)]%</li>"
|
dat += "<li>[gas.display_name]: [round(environment.gases[gasid]/total_moles)]%</li>"
|
||||||
|
|
||||||
dat += "Temperature: [round(environment.temperature-T0C)]°C"
|
dat += "Temperature: [round(environment.temperature-T0C)]°C"
|
||||||
if(2)
|
if(2)
|
||||||
|
|||||||
@@ -219,7 +219,7 @@
|
|||||||
max=28
|
max=28
|
||||||
|
|
||||||
/datum/theft_objective/number/traitor/plasma_gas/getAmountStolen(var/obj/item/I)
|
/datum/theft_objective/number/traitor/plasma_gas/getAmountStolen(var/obj/item/I)
|
||||||
return I:air_contents:get_moles_by_id(PLASMA)
|
return I:air_contents:gases[PLASMA]
|
||||||
|
|
||||||
/datum/theft_objective/number/traitor/coins
|
/datum/theft_objective/number/traitor/coins
|
||||||
name = "credits of coins (in bag)"
|
name = "credits of coins (in bag)"
|
||||||
|
|||||||
@@ -105,7 +105,7 @@
|
|||||||
var/dat = {"<B>Cryo gas cooling system</B><BR>
|
var/dat = {"<B>Cryo gas cooling system</B><BR>
|
||||||
Current status: [ on ? "<A href='?src=\ref[src];start=1'>Off</A> <B>On</B>" : "<B>Off</B> <A href='?src=\ref[src];start=1'>On</A>"]<BR>
|
Current status: [ on ? "<A href='?src=\ref[src];start=1'>Off</A> <B>On</B>" : "<B>Off</B> <A href='?src=\ref[src];start=1'>On</A>"]<BR>
|
||||||
Current gas temperature: [temp_text]<BR>
|
Current gas temperature: [temp_text]<BR>
|
||||||
Current air pressure: [air_contents.return_pressure()]<BR>
|
Current air pressure: [air_contents.pressure]<BR>
|
||||||
Target gas temperature: <A href='?src=\ref[src];temp=-100'>-</A> <A href='?src=\ref[src];temp=-10'>-</A> <A href='?src=\ref[src];temp=-1'>-</A> [current_temperature] <A href='?src=\ref[src];temp=1'>+</A> <A href='?src=\ref[src];temp=10'>+</A> <A href='?src=\ref[src];temp=100'>+</A><BR>
|
Target gas temperature: <A href='?src=\ref[src];temp=-100'>-</A> <A href='?src=\ref[src];temp=-10'>-</A> <A href='?src=\ref[src];temp=-1'>-</A> [current_temperature] <A href='?src=\ref[src];temp=1'>+</A> <A href='?src=\ref[src];temp=10'>+</A> <A href='?src=\ref[src];temp=100'>+</A><BR>
|
||||||
"}
|
"}
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@
|
|||||||
var/dat = {"<B>Heating system</B><BR>
|
var/dat = {"<B>Heating system</B><BR>
|
||||||
Current status: [ on ? "<A href='?src=\ref[src];start=1'>Off</A> <B>On</B>" : "<B>Off</B> <A href='?src=\ref[src];start=1'>On</A>"]<BR>
|
Current status: [ on ? "<A href='?src=\ref[src];start=1'>Off</A> <B>On</B>" : "<B>Off</B> <A href='?src=\ref[src];start=1'>On</A>"]<BR>
|
||||||
Current gas temperature: [temp_text]<BR>
|
Current gas temperature: [temp_text]<BR>
|
||||||
Current air pressure: [air_contents.return_pressure()]<BR>
|
Current air pressure: [air_contents.pressure]<BR>
|
||||||
Target gas temperature: <A href='?src=\ref[src];temp=-100'>-</A> <A href='?src=\ref[src];temp=-10'>-</A> <A href='?src=\ref[src];temp=-1'>-</A> [current_temperature] <A href='?src=\ref[src];temp=1'>+</A> <A href='?src=\ref[src];temp=10'>+</A> <A href='?src=\ref[src];temp=100'>+</A><BR>
|
Target gas temperature: <A href='?src=\ref[src];temp=-100'>-</A> <A href='?src=\ref[src];temp=-10'>-</A> <A href='?src=\ref[src];temp=-1'>-</A> [current_temperature] <A href='?src=\ref[src];temp=1'>+</A> <A href='?src=\ref[src];temp=10'>+</A> <A href='?src=\ref[src];temp=100'>+</A><BR>
|
||||||
"}
|
"}
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ obj/machinery/airlock_sensor/process()
|
|||||||
|
|
||||||
var/datum/gas_mixture/air_sample = return_air()
|
var/datum/gas_mixture/air_sample = return_air()
|
||||||
|
|
||||||
var/pressure = round(air_sample.return_pressure(),0.1)
|
var/pressure = round(air_sample.pressure,0.1)
|
||||||
alert = (pressure < ONE_ATMOSPHERE*0.8)
|
alert = (pressure < ONE_ATMOSPHERE*0.8)
|
||||||
|
|
||||||
signal.data["pressure"] = pressure
|
signal.data["pressure"] = pressure
|
||||||
|
|||||||
@@ -209,7 +209,7 @@
|
|||||||
|
|
||||||
var/datum/gas_mixture/gas = location.remove_air(0.25 * environment.total_moles)
|
var/datum/gas_mixture/gas = location.remove_air(0.25 * environment.total_moles)
|
||||||
if(gas)
|
if(gas)
|
||||||
var/heat_capacity = gas.heat_capacity()
|
var/heat_capacity = gas.heat_capacity
|
||||||
var/energy_used = min(abs(heat_capacity * (gas.temperature - target_temperature)), MAX_ENERGY_CHANGE)
|
var/energy_used = min(abs(heat_capacity * (gas.temperature - target_temperature)), MAX_ENERGY_CHANGE)
|
||||||
|
|
||||||
// We need to cool ourselves.
|
// We need to cool ourselves.
|
||||||
@@ -241,7 +241,7 @@
|
|||||||
danger_averted_confidence = 0 // Reset counter.
|
danger_averted_confidence = 0 // Reset counter.
|
||||||
use_power = 2
|
use_power = 2
|
||||||
|
|
||||||
if (mode==AALARM_MODE_CYCLE && environment.return_pressure()<ONE_ATMOSPHERE*0.05)
|
if (mode==AALARM_MODE_CYCLE && environment.pressure<ONE_ATMOSPHERE*0.05)
|
||||||
mode=AALARM_MODE_FILL
|
mode=AALARM_MODE_FILL
|
||||||
apply_mode()
|
apply_mode()
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
|
var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
|
||||||
var/environment_pressure = environment.return_pressure()
|
var/environment_pressure = environment.pressure
|
||||||
|
|
||||||
var/pressure_dangerlevel = get_danger_level(environment_pressure, TLV["pressure"])
|
var/pressure_dangerlevel = get_danger_level(environment_pressure, TLV["pressure"])
|
||||||
var/temperature_dangerlevel = get_danger_level(environment.temperature, TLV["temperature"])
|
var/temperature_dangerlevel = get_danger_level(environment.temperature, TLV["temperature"])
|
||||||
@@ -277,7 +277,7 @@
|
|||||||
var/tempid = gasid
|
var/tempid = gasid
|
||||||
if(!(tempid in list(OXYGEN, NITROGEN, CARBON_DIOXIDE, PLASMA)))
|
if(!(tempid in list(OXYGEN, NITROGEN, CARBON_DIOXIDE, PLASMA)))
|
||||||
tempid = "other"
|
tempid = "other"
|
||||||
gas_danger_levels += get_danger_level(environment.get_moles_by_id(gasid) * partial_pressure, TLV[tempid])
|
gas_danger_levels += get_danger_level(environment.gases[gasid] * partial_pressure, TLV[tempid])
|
||||||
|
|
||||||
return max(
|
return max(
|
||||||
pressure_dangerlevel,
|
pressure_dangerlevel,
|
||||||
@@ -481,37 +481,37 @@
|
|||||||
/obj/machinery/alarm/proc/ui_air_status()
|
/obj/machinery/alarm/proc/ui_air_status()
|
||||||
var/turf/location = get_turf(src)
|
var/turf/location = get_turf(src)
|
||||||
var/datum/gas_mixture/environment = location.return_air()
|
var/datum/gas_mixture/environment = location.return_air()
|
||||||
var/total = environment.total_moles()
|
var/total = environment.total_moles
|
||||||
if(total==0)
|
if(total==0)
|
||||||
return null
|
return null
|
||||||
|
|
||||||
var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
|
var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
|
||||||
|
|
||||||
var/list/current_settings = TLV["pressure"]
|
var/list/current_settings = TLV["pressure"]
|
||||||
var/environment_pressure = environment.return_pressure()
|
var/environment_pressure = environment.pressure
|
||||||
var/pressure_dangerlevel = get_danger_level(environment_pressure, current_settings)
|
var/pressure_dangerlevel = get_danger_level(environment_pressure, current_settings)
|
||||||
|
|
||||||
current_settings = TLV[OXYGEN]
|
current_settings = TLV[OXYGEN]
|
||||||
var/oxygen_dangerlevel = get_danger_level(environment.get_moles_by_id(OXYGEN)*partial_pressure, current_settings)
|
var/oxygen_dangerlevel = get_danger_level(environment.gases[OXYGEN]*partial_pressure, current_settings)
|
||||||
var/oxygen_percent = round(environment.get_moles_by_id(OXYGEN) / total * 100, 2)
|
var/oxygen_percent = round(environment.gases[OXYGEN] / total * 100, 2)
|
||||||
|
|
||||||
current_settings = TLV[NITROGEN]
|
current_settings = TLV[NITROGEN]
|
||||||
var/nitrogen_dangerlevel = get_danger_level(environment.get_moles_by_id(NITROGEN)*partial_pressure, current_settings)
|
var/nitrogen_dangerlevel = get_danger_level(environment.gases[NITROGEN]*partial_pressure, current_settings)
|
||||||
var/nitrogen_percent = round(environment.get_moles_by_id(NITROGEN) / total * 100, 2)
|
var/nitrogen_percent = round(environment.gases[NITROGEN] / total * 100, 2)
|
||||||
|
|
||||||
current_settings = TLV[CARBON_DIOXIDE]
|
current_settings = TLV[CARBON_DIOXIDE]
|
||||||
var/co2_dangerlevel = get_danger_level(environment.get_moles_by_id(CARBON_DIOXIDE)*partial_pressure, current_settings)
|
var/co2_dangerlevel = get_danger_level(environment.gases[CARBON_DIOXIDE]*partial_pressure, current_settings)
|
||||||
var/co2_percent = round(environment.get_moles_by_id(CARBON_DIOXIDE) / total * 100, 2)
|
var/co2_percent = round(environment.gases[CARBON_DIOXIDE] / total * 100, 2)
|
||||||
|
|
||||||
current_settings = TLV[PLASMA]
|
current_settings = TLV[PLASMA]
|
||||||
var/plasma_dangerlevel = get_danger_level(environment.get_moles_by_id(PLASMA)*partial_pressure, current_settings)
|
var/plasma_dangerlevel = get_danger_level(environment.gases[PLASMA]*partial_pressure, current_settings)
|
||||||
var/plasma_percent = round(environment.get_moles_by_id(PLASMA) / total * 100, 2)
|
var/plasma_percent = round(environment.gases[PLASMA] / total * 100, 2)
|
||||||
|
|
||||||
current_settings = TLV["other"]
|
current_settings = TLV["other"]
|
||||||
var/other_moles = 0.0
|
var/other_moles = 0.0
|
||||||
for(var/gasid in environment.gases)
|
for(var/gasid in environment.gases)
|
||||||
if(!(gasid in list(OXYGEN, NITROGEN, CARBON_DIOXIDE, PLASMA)))
|
if(!(gasid in list(OXYGEN, NITROGEN, CARBON_DIOXIDE, PLASMA)))
|
||||||
other_moles += environment.get_moles_by_id(gasid)
|
other_moles += environment.gases[gasid]
|
||||||
var/other_dangerlevel = get_danger_level(other_moles*partial_pressure, current_settings)
|
var/other_dangerlevel = get_danger_level(other_moles*partial_pressure, current_settings)
|
||||||
|
|
||||||
current_settings = TLV["temperature"]
|
current_settings = TLV["temperature"]
|
||||||
|
|||||||
@@ -73,22 +73,22 @@
|
|||||||
|
|
||||||
if(output&1)
|
if(output&1)
|
||||||
// Fucking why do we need num2text
|
// Fucking why do we need num2text
|
||||||
//signal.data["pressure"] = num2text(round(air_sample.return_pressure(),0.1),)
|
//signal.data["pressure"] = num2text(round(air_sample.pressure,0.1),)
|
||||||
signal.data["pressure"] =round(air_sample.return_pressure(),0.1)
|
signal.data["pressure"] =round(air_sample.pressure,0.1)
|
||||||
if(output&2)
|
if(output&2)
|
||||||
signal.data["temperature"] = round(air_sample.temperature,0.1)
|
signal.data["temperature"] = round(air_sample.temperature,0.1)
|
||||||
|
|
||||||
if(output>4)
|
if(output>4)
|
||||||
var/total_moles = air_sample.total_moles()
|
var/total_moles = air_sample.total_moles
|
||||||
if(total_moles > 0)
|
if(total_moles > 0)
|
||||||
if(output&4)
|
if(output&4)
|
||||||
signal.data[OXYGEN] = round(100*air_sample.get_moles_by_id(OXYGEN)/total_moles,0.1)
|
signal.data[OXYGEN] = round(100*air_sample.gases[OXYGEN]/total_moles,0.1)
|
||||||
if(output&8)
|
if(output&8)
|
||||||
signal.data[PLASMA] = round(100*air_sample.get_moles_by_id(PLASMA)/total_moles,0.1)
|
signal.data[PLASMA] = round(100*air_sample.gases[PLASMA]/total_moles,0.1)
|
||||||
if(output&16)
|
if(output&16)
|
||||||
signal.data[NITROGEN] = round(100*air_sample.get_moles_by_id(NITROGEN)/total_moles,0.1)
|
signal.data[NITROGEN] = round(100*air_sample.gases[NITROGEN]/total_moles,0.1)
|
||||||
if(output&32)
|
if(output&32)
|
||||||
signal.data[CARBON_DIOXIDE] = round(100*air_sample.get_moles_by_id(CARBON_DIOXIDE)/total_moles,0.1)
|
signal.data[CARBON_DIOXIDE] = round(100*air_sample.gases[CARBON_DIOXIDE]/total_moles,0.1)
|
||||||
else
|
else
|
||||||
signal.data[OXYGEN] = 0
|
signal.data[OXYGEN] = 0
|
||||||
signal.data[PLASMA] = 0
|
signal.data[PLASMA] = 0
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
if (connected_port)
|
if (connected_port)
|
||||||
overlays.Add("can-connector")
|
overlays.Add("can-connector")
|
||||||
|
|
||||||
var/tank_pressure = air_contents.return_pressure()
|
var/tank_pressure = air_contents.pressure
|
||||||
|
|
||||||
if (tank_pressure < 10)
|
if (tank_pressure < 10)
|
||||||
overlays.Add("can-o0")
|
overlays.Add("can-o0")
|
||||||
@@ -132,8 +132,8 @@
|
|||||||
else
|
else
|
||||||
environment = loc.return_air()
|
environment = loc.return_air()
|
||||||
|
|
||||||
var/env_pressure = environment.return_pressure()
|
var/env_pressure = environment.pressure
|
||||||
var/pressure_delta = min(release_pressure - env_pressure, (air_contents.return_pressure() - env_pressure)/2)
|
var/pressure_delta = min(release_pressure - env_pressure, (air_contents.pressure - env_pressure)/2)
|
||||||
//Can not have a pressure delta that would cause environment pressure > tank pressure
|
//Can not have a pressure delta that would cause environment pressure > tank pressure
|
||||||
|
|
||||||
var/transfer_moles = 0
|
var/transfer_moles = 0
|
||||||
@@ -149,7 +149,7 @@
|
|||||||
loc.assume_air(removed)
|
loc.assume_air(removed)
|
||||||
src.update_icon()
|
src.update_icon()
|
||||||
|
|
||||||
if(air_contents.return_pressure() < 1)
|
if(air_contents.pressure < 1)
|
||||||
can_label = 1
|
can_label = 1
|
||||||
else
|
else
|
||||||
can_label = 0
|
can_label = 0
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
/obj/machinery/portable_atmospherics/canister/proc/return_pressure()
|
/obj/machinery/portable_atmospherics/canister/proc/return_pressure()
|
||||||
var/datum/gas_mixture/GM = src.return_air()
|
var/datum/gas_mixture/GM = src.return_air()
|
||||||
if(GM && GM.volume>0)
|
if(GM && GM.volume>0)
|
||||||
return GM.return_pressure()
|
return GM.pressure
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
/obj/machinery/portable_atmospherics/canister/blob_act()
|
/obj/machinery/portable_atmospherics/canister/blob_act()
|
||||||
@@ -207,8 +207,8 @@
|
|||||||
|
|
||||||
if(istype(user, /mob/living/silicon/robot) && istype(W, /obj/item/weapon/tank/jetpack))
|
if(istype(user, /mob/living/silicon/robot) && istype(W, /obj/item/weapon/tank/jetpack))
|
||||||
var/datum/gas_mixture/thejetpack = W:air_contents
|
var/datum/gas_mixture/thejetpack = W:air_contents
|
||||||
var/env_pressure = thejetpack.return_pressure()
|
var/env_pressure = thejetpack.pressure
|
||||||
var/pressure_delta = min(10*ONE_ATMOSPHERE - env_pressure, (air_contents.return_pressure() - env_pressure)/2)
|
var/pressure_delta = min(10*ONE_ATMOSPHERE - env_pressure, (air_contents.pressure - env_pressure)/2)
|
||||||
//Can not have a pressure delta that would cause environment pressure > tank pressure
|
//Can not have a pressure delta that would cause environment pressure > tank pressure
|
||||||
var/transfer_moles = 0
|
var/transfer_moles = 0
|
||||||
if((air_contents.temperature > 0) && (pressure_delta > 0))
|
if((air_contents.temperature > 0) && (pressure_delta > 0))
|
||||||
@@ -246,7 +246,7 @@
|
|||||||
data["name"] = name
|
data["name"] = name
|
||||||
data["canLabel"] = can_label ? 1 : 0
|
data["canLabel"] = can_label ? 1 : 0
|
||||||
data["portConnected"] = connected_port ? 1 : 0
|
data["portConnected"] = connected_port ? 1 : 0
|
||||||
data["tankPressure"] = round(air_contents.return_pressure() > 0 ? air_contents.return_pressure() : 0)//This used to be redundant, made it into a fix for -1 kPA showing up in the UI
|
data["tankPressure"] = round(air_contents.pressure > 0 ? air_contents.pressure : 0)//This used to be redundant, made it into a fix for -1 kPA showing up in the UI
|
||||||
data["releasePressure"] = round(release_pressure)
|
data["releasePressure"] = round(release_pressure)
|
||||||
data["minReleasePressure"] = round(ONE_ATMOSPHERE/10)
|
data["minReleasePressure"] = round(ONE_ATMOSPHERE/10)
|
||||||
data["maxReleasePressure"] = round(10*ONE_ATMOSPHERE)
|
data["maxReleasePressure"] = round(10*ONE_ATMOSPHERE)
|
||||||
@@ -254,7 +254,7 @@
|
|||||||
|
|
||||||
data["hasHoldingTank"] = holding ? 1 : 0
|
data["hasHoldingTank"] = holding ? 1 : 0
|
||||||
if (holding)
|
if (holding)
|
||||||
data["holdingTank"] = list("name" = holding.name, "tankPressure" = round(holding.air_contents.return_pressure() > 0 ? holding.air_contents.return_pressure() : 0))
|
data["holdingTank"] = list("name" = holding.name, "tankPressure" = round(holding.air_contents.pressure > 0 ? holding.air_contents.pressure : 0))
|
||||||
|
|
||||||
// update the ui if it exists, returns null if no ui is passed/found
|
// update the ui if it exists, returns null if no ui is passed/found
|
||||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||||
@@ -288,7 +288,7 @@
|
|||||||
var/list/contents_l=list()
|
var/list/contents_l=list()
|
||||||
for(var/gasid in src.air_contents.gases)
|
for(var/gasid in src.air_contents.gases)
|
||||||
var/datum/gas/gas = air_contents.get_gas_by_id(gasid)
|
var/datum/gas/gas = air_contents.get_gas_by_id(gasid)
|
||||||
if(gas.gas_flags & AUTO_LOGGING && air_contents.get_moles_by_id(gasid) > 0)
|
if(gas.gas_flags & AUTO_LOGGING && air_contents.gases[gasid] > 0)
|
||||||
contents_l += "<b><font color='red'>[gas.display_name]</font></b>"
|
contents_l += "<b><font color='red'>[gas.display_name]</font></b>"
|
||||||
var/contents_str = english_list(contents_l)
|
var/contents_str = english_list(contents_l)
|
||||||
investigation_log(I_ATMOS, "had its valve <b>OPENED</b> by [key_name(usr)], starting transfer into the <font color='red'><b>air</b></font> ([contents_str])")
|
investigation_log(I_ATMOS, "had its valve <b>OPENED</b> by [key_name(usr)], starting transfer into the <font color='red'><b>air</b></font> ([contents_str])")
|
||||||
@@ -304,7 +304,7 @@
|
|||||||
var/list/contents_l=list()
|
var/list/contents_l=list()
|
||||||
for(var/gasid in src.air_contents.gases)
|
for(var/gasid in src.air_contents.gases)
|
||||||
var/datum/gas/gas = air_contents.get_gas_by_id(gasid)
|
var/datum/gas/gas = air_contents.get_gas_by_id(gasid)
|
||||||
if(gas.gas_flags & AUTO_LOGGING && air_contents.get_moles_by_id(gasid) > 0)
|
if(gas.gas_flags & AUTO_LOGGING && air_contents.gases[gasid] > 0)
|
||||||
contents_l += "<b><font color='red'>[gas.display_name]</font></b>"
|
contents_l += "<b><font color='red'>[gas.display_name]</font></b>"
|
||||||
var/contents_str = english_list(contents_l)
|
var/contents_str = english_list(contents_l)
|
||||||
if(contents_l.len>0)
|
if(contents_l.len>0)
|
||||||
@@ -439,4 +439,4 @@
|
|||||||
// New beam damage code (per-tick)
|
// New beam damage code (per-tick)
|
||||||
for(var/obj/effect/beam/B in beams)
|
for(var/obj/effect/beam/B in beams)
|
||||||
apply_beam_damage(B)
|
apply_beam_damage(B)
|
||||||
healthcheck()
|
healthcheck()
|
||||||
|
|||||||
@@ -25,10 +25,9 @@
|
|||||||
/obj/machinery/atmospherics/miner/New()
|
/obj/machinery/atmospherics/miner/New()
|
||||||
..()
|
..()
|
||||||
air_contents = new
|
air_contents = new
|
||||||
air_contents.volume=1000
|
air_contents.set_volume(1000)
|
||||||
air_contents.temperature = T20C
|
air_contents.set_temperature(T20C)
|
||||||
AddAir()
|
AddAir()
|
||||||
air_contents.update_values()
|
|
||||||
update_icon()
|
update_icon()
|
||||||
|
|
||||||
/obj/machinery/atmospherics/miner/wrenchAnchor(mob/user)
|
/obj/machinery/atmospherics/miner/wrenchAnchor(mob/user)
|
||||||
@@ -100,7 +99,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
var/datum/gas_mixture/environment = loc.return_air()
|
var/datum/gas_mixture/environment = loc.return_air()
|
||||||
var/environment_pressure = environment.return_pressure()
|
var/environment_pressure = environment.pressure
|
||||||
|
|
||||||
pumping.copy_from(air_contents)
|
pumping.copy_from(air_contents)
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
spawn(0) qdel(src)
|
spawn(0) qdel(src)
|
||||||
return PROCESS_KILL
|
return PROCESS_KILL
|
||||||
|
|
||||||
var/env_pressure = environment.return_pressure()
|
var/env_pressure = environment.pressure
|
||||||
if(env_pressure <= 0.15*ONE_ATMOSPHERE)
|
if(env_pressure <= 0.15*ONE_ATMOSPHERE)
|
||||||
icon_state = "meter0"
|
icon_state = "meter0"
|
||||||
else if(env_pressure <= 1.8*ONE_ATMOSPHERE)
|
else if(env_pressure <= 1.8*ONE_ATMOSPHERE)
|
||||||
@@ -74,10 +74,10 @@
|
|||||||
"sigtype" = "status"
|
"sigtype" = "status"
|
||||||
)
|
)
|
||||||
|
|
||||||
var/total_moles = environment.total_moles()
|
var/total_moles = environment.total_moles
|
||||||
if(total_moles > 0)
|
if(total_moles > 0)
|
||||||
for(var/gasid in environment.gases)
|
for(var/gasid in environment.gases)
|
||||||
signal.data[gasid] = round(100 * environment.get_moles_by_id(gasid) / total_moles, 0.1)
|
signal.data[gasid] = round(100 * environment.gases[gasid] / total_moles, 0.1)
|
||||||
else
|
else
|
||||||
for(var/gasid in environment.gases)
|
for(var/gasid in environment.gases)
|
||||||
signal.data[gasid] = 0
|
signal.data[gasid] = 0
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
if (src.target)
|
if (src.target)
|
||||||
var/datum/gas_mixture/environment = target.return_air()
|
var/datum/gas_mixture/environment = target.return_air()
|
||||||
if(environment)
|
if(environment)
|
||||||
t += "The pressure gauge reads [round(environment.return_pressure(), 0.01)] kPa; [round(environment.temperature,0.01)]K ([round(environment.temperature-T0C,0.01)]°C)"
|
t += "The pressure gauge reads [round(environment.pressure, 0.01)] kPa; [round(environment.temperature,0.01)]K ([round(environment.temperature-T0C,0.01)]°C)"
|
||||||
else
|
else
|
||||||
t += "The sensor error light is blinking."
|
t += "The sensor error light is blinking."
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -107,7 +107,7 @@
|
|||||||
var/list/contents_l=list()
|
var/list/contents_l=list()
|
||||||
for(var/gasid in src.air_contents.gases)
|
for(var/gasid in src.air_contents.gases)
|
||||||
var/datum/gas/gas = air_contents.get_gas_by_id(gasid)
|
var/datum/gas/gas = air_contents.get_gas_by_id(gasid)
|
||||||
if(gas.gas_flags & AUTO_LOGGING && air_contents.get_moles_by_id(gasid) > 0)
|
if(gas.gas_flags & AUTO_LOGGING && air_contents.gases[gasid] > 0)
|
||||||
contents_l += "<span class='danger'>[gas.display_name]</span>"
|
contents_l += "<span class='danger'>[gas.display_name]</span>"
|
||||||
var/contents_str = english_list(contents_l)
|
var/contents_str = english_list(contents_l)
|
||||||
if(contents_l.len>0)
|
if(contents_l.len>0)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
else
|
else
|
||||||
environment = loc.return_air()
|
environment = loc.return_air()
|
||||||
if(direction_out)
|
if(direction_out)
|
||||||
var/pressure_delta = target_pressure - environment.return_pressure()
|
var/pressure_delta = target_pressure - environment.pressure
|
||||||
//Can not have a pressure delta that would cause environment pressure > tank pressure
|
//Can not have a pressure delta that would cause environment pressure > tank pressure
|
||||||
|
|
||||||
var/transfer_moles = 0
|
var/transfer_moles = 0
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
else
|
else
|
||||||
loc.assume_air(removed)
|
loc.assume_air(removed)
|
||||||
else
|
else
|
||||||
var/pressure_delta = target_pressure - air_contents.return_pressure()
|
var/pressure_delta = target_pressure - air_contents.pressure
|
||||||
//Can not have a pressure delta that would cause environment pressure > tank pressure
|
//Can not have a pressure delta that would cause environment pressure > tank pressure
|
||||||
|
|
||||||
var/transfer_moles = 0
|
var/transfer_moles = 0
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
/obj/machinery/portable_atmospherics/pump/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
/obj/machinery/portable_atmospherics/pump/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||||
var/list/data[0]
|
var/list/data[0]
|
||||||
data["portConnected"] = connected_port ? 1 : 0
|
data["portConnected"] = connected_port ? 1 : 0
|
||||||
data["tankPressure"] = round(air_contents.return_pressure() > 0 ? air_contents.return_pressure() : 0)
|
data["tankPressure"] = round(air_contents.pressure > 0 ? air_contents.pressure : 0)
|
||||||
data["targetpressure"] = round(target_pressure)
|
data["targetpressure"] = round(target_pressure)
|
||||||
data["pump_dir"] = direction_out
|
data["pump_dir"] = direction_out
|
||||||
data["minpressure"] = round(pressuremin)
|
data["minpressure"] = round(pressuremin)
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
|
|
||||||
data["hasHoldingTank"] = holding ? 1 : 0
|
data["hasHoldingTank"] = holding ? 1 : 0
|
||||||
if (holding)
|
if (holding)
|
||||||
data["holdingTank"] = list("name" = holding.name, "tankPressure" = round(holding.air_contents.return_pressure() > 0 ? holding.air_contents.return_pressure() : 0))
|
data["holdingTank"] = list("name" = holding.name, "tankPressure" = round(holding.air_contents.pressure > 0 ? holding.air_contents.pressure : 0))
|
||||||
|
|
||||||
// update the ui if it exists, returns null if no ui is passed/found
|
// update the ui if it exists, returns null if no ui is passed/found
|
||||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
environment = holding.air_contents
|
environment = holding.air_contents
|
||||||
else
|
else
|
||||||
environment = loc.return_air()
|
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
|
//Take a gas sample
|
||||||
var/datum/gas_mixture/removed
|
var/datum/gas_mixture/removed
|
||||||
@@ -114,14 +114,13 @@
|
|||||||
if (removed)
|
if (removed)
|
||||||
var/datum/gas_mixture/filtered_out = new
|
var/datum/gas_mixture/filtered_out = new
|
||||||
|
|
||||||
filtered_out.temperature = removed.temperature
|
filtered_out.set_temperature(removed.temperature)
|
||||||
|
|
||||||
for(var/gasid in removed.gases)
|
for(var/gasid in removed.gases)
|
||||||
var/datum/gas/gas_to_remove = removed.get_gas_by_id(gasid)
|
var/datum/gas/gas_to_remove = removed.get_gas_by_id(gasid)
|
||||||
if(gas_to_remove.gas_flags & AUTO_FILTERED)
|
if(gas_to_remove.gas_flags & AUTO_FILTERED)
|
||||||
filtered_out.adjust_gas(gasid, removed.get_moles_by_id(gasid), 0)
|
filtered_out.adjust_gas(gasid, removed.gases[gasid])
|
||||||
removed.set_gas(gasid, 0, 0)
|
removed.set_gas(gasid, 0)
|
||||||
removed.update_values()
|
|
||||||
|
|
||||||
//Remix the resulting gases
|
//Remix the resulting gases
|
||||||
air_contents.merge(filtered_out)
|
air_contents.merge(filtered_out)
|
||||||
@@ -151,7 +150,7 @@
|
|||||||
/obj/machinery/portable_atmospherics/scrubber/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
/obj/machinery/portable_atmospherics/scrubber/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||||
var/list/data[0]
|
var/list/data[0]
|
||||||
data["portConnected"] = connected_port ? 1 : 0
|
data["portConnected"] = connected_port ? 1 : 0
|
||||||
data["tankPressure"] = round(air_contents.return_pressure() > 0 ? air_contents.return_pressure() : 0)
|
data["tankPressure"] = round(air_contents.pressure > 0 ? air_contents.pressure : 0)
|
||||||
data["rate"] = round(volume_rate)
|
data["rate"] = round(volume_rate)
|
||||||
data["minrate"] = round(minrate)
|
data["minrate"] = round(minrate)
|
||||||
data["maxrate"] = round(maxrate)
|
data["maxrate"] = round(maxrate)
|
||||||
@@ -159,7 +158,7 @@
|
|||||||
|
|
||||||
data["hasHoldingTank"] = holding ? 1 : 0
|
data["hasHoldingTank"] = holding ? 1 : 0
|
||||||
if (holding)
|
if (holding)
|
||||||
data["holdingTank"] = list("name" = holding.name, "tankPressure" = round(holding.air_contents.return_pressure() > 0 ? holding.air_contents.return_pressure() : 0))
|
data["holdingTank"] = list("name" = holding.name, "tankPressure" = round(holding.air_contents.pressure > 0 ? holding.air_contents.pressure : 0))
|
||||||
|
|
||||||
// update the ui if it exists, returns null if no ui is passed/found
|
// update the ui if it exists, returns null if no ui is passed/found
|
||||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||||
@@ -192,4 +191,4 @@
|
|||||||
var/diff = text2num(href_list["volume_adj"])
|
var/diff = text2num(href_list["volume_adj"])
|
||||||
volume_rate = Clamp(volume_rate+diff, minrate, maxrate)
|
volume_rate = Clamp(volume_rate+diff, minrate, maxrate)
|
||||||
|
|
||||||
src.add_fingerprint(usr)
|
src.add_fingerprint(usr)
|
||||||
|
|||||||
@@ -339,18 +339,18 @@ var/global/list/cryo_health_indicator = list( "full" = image("icon" = 'icons/obj
|
|||||||
icon_state = "cell-off"
|
icon_state = "cell-off"
|
||||||
|
|
||||||
/obj/machinery/atmospherics/unary/cryo_cell/proc/process_occupant()
|
/obj/machinery/atmospherics/unary/cryo_cell/proc/process_occupant()
|
||||||
if(air_contents.total_moles() < 10)
|
if(air_contents.total_moles < 10)
|
||||||
return
|
return
|
||||||
if(occupant)
|
if(occupant)
|
||||||
if(occupant.stat == 2)
|
if(occupant.stat == 2)
|
||||||
return
|
return
|
||||||
occupant.bodytemperature += 2*(air_contents.temperature - occupant.bodytemperature)*current_heat_capacity/(current_heat_capacity + air_contents.heat_capacity())
|
occupant.bodytemperature += 2*(air_contents.temperature - occupant.bodytemperature)*current_heat_capacity/(current_heat_capacity + air_contents.heat_capacity)
|
||||||
occupant.bodytemperature = max(occupant.bodytemperature, air_contents.temperature) // this is so ugly i'm sorry for doing it i'll fix it later i promise
|
occupant.bodytemperature = max(occupant.bodytemperature, air_contents.temperature) // this is so ugly i'm sorry for doing it i'll fix it later i promise
|
||||||
occupant.stat = 1
|
occupant.stat = 1
|
||||||
if(occupant.bodytemperature < T0C)
|
if(occupant.bodytemperature < T0C)
|
||||||
occupant.sleeping = max(5, (1/occupant.bodytemperature)*2000)
|
occupant.sleeping = max(5, (1/occupant.bodytemperature)*2000)
|
||||||
occupant.Paralyse(max(5, (1/occupant.bodytemperature)*3000))
|
occupant.Paralyse(max(5, (1/occupant.bodytemperature)*3000))
|
||||||
if(air_contents.get_moles_by_id(OXYGEN) > 2)
|
if(air_contents.gases[OXYGEN] > 2)
|
||||||
if(occupant.getOxyLoss()) occupant.adjustOxyLoss(-1)
|
if(occupant.getOxyLoss()) occupant.adjustOxyLoss(-1)
|
||||||
else
|
else
|
||||||
occupant.adjustOxyLoss(-1)
|
occupant.adjustOxyLoss(-1)
|
||||||
@@ -369,19 +369,19 @@ var/global/list/cryo_health_indicator = list( "full" = image("icon" = 'icons/obj
|
|||||||
beaker.reagents.reaction(occupant)
|
beaker.reagents.reaction(occupant)
|
||||||
|
|
||||||
/obj/machinery/atmospherics/unary/cryo_cell/proc/heat_gas_contents()
|
/obj/machinery/atmospherics/unary/cryo_cell/proc/heat_gas_contents()
|
||||||
if(air_contents.total_moles() < 1)
|
if(air_contents.total_moles < 1)
|
||||||
return
|
return
|
||||||
var/air_heat_capacity = air_contents.heat_capacity()
|
var/air_heat_capacity = air_contents.heat_capacity
|
||||||
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
var/combined_heat_capacity = current_heat_capacity + air_heat_capacity
|
||||||
if(combined_heat_capacity > 0)
|
if(combined_heat_capacity > 0)
|
||||||
var/combined_energy = T20C*current_heat_capacity + air_heat_capacity*air_contents.temperature
|
var/combined_energy = T20C*current_heat_capacity + air_heat_capacity*air_contents.temperature
|
||||||
air_contents.temperature = combined_energy/combined_heat_capacity
|
air_contents.temperature = combined_energy/combined_heat_capacity
|
||||||
|
|
||||||
/obj/machinery/atmospherics/unary/cryo_cell/proc/expel_gas()
|
/obj/machinery/atmospherics/unary/cryo_cell/proc/expel_gas()
|
||||||
if(air_contents.total_moles() < 1)
|
if(air_contents.total_moles < 1)
|
||||||
return
|
return
|
||||||
// var/datum/gas_mixture/expel_gas = new
|
// var/datum/gas_mixture/expel_gas = new
|
||||||
// var/remove_amount = air_contents.total_moles()/50
|
// var/remove_amount = air_contents.total_moles/50
|
||||||
// expel_gas = air_contents.remove(remove_amount)
|
// expel_gas = air_contents.remove(remove_amount)
|
||||||
|
|
||||||
// Just have the gas disappear to nowhere.
|
// Just have the gas disappear to nowhere.
|
||||||
|
|||||||
@@ -124,7 +124,7 @@
|
|||||||
|
|
||||||
if(!colour2 && !T.density)
|
if(!colour2 && !T.density)
|
||||||
var/datum/gas_mixture/environment = T.return_air()
|
var/datum/gas_mixture/environment = T.return_air()
|
||||||
var/turf_total = environment.total_moles()
|
var/turf_total = environment.total_moles
|
||||||
//var/turf_total = T.co2 + T.oxygen + T.poison + T.sl_gas + T.n2
|
//var/turf_total = T.co2 + T.oxygen + T.poison + T.sl_gas + T.n2
|
||||||
|
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@
|
|||||||
|
|
||||||
if("/turf/simulated/floor", "/turf/simulated/floor/engine")
|
if("/turf/simulated/floor", "/turf/simulated/floor/engine")
|
||||||
var/datum/gas_mixture/environment = T.return_air()
|
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
|
var/t1 = turf_total / MOLES_CELLSTANDARD * 175
|
||||||
|
|
||||||
if(t1<=100)
|
if(t1<=100)
|
||||||
|
|||||||
@@ -236,13 +236,13 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
|
|||||||
var/datum/gas_mixture/env = L.return_air()
|
var/datum/gas_mixture/env = L.return_air()
|
||||||
if(env.temperature < (heat_amt+T0C))
|
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)
|
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||||
|
|
||||||
if(removed)
|
if(removed)
|
||||||
|
|
||||||
var/heat_capacity = removed.heat_capacity()
|
var/heat_capacity = removed.heat_capacity
|
||||||
if(heat_capacity == 0 || heat_capacity == null)
|
if(heat_capacity == 0 || heat_capacity == null)
|
||||||
heat_capacity = 1
|
heat_capacity = 1
|
||||||
removed.temperature = min((removed.temperature*heat_capacity + heating_power)/heat_capacity, 1000)
|
removed.temperature = min((removed.temperature*heat_capacity + heating_power)/heat_capacity, 1000)
|
||||||
|
|||||||
@@ -942,14 +942,13 @@
|
|||||||
var/datum/gas_mixture/GM = T.return_air()
|
var/datum/gas_mixture/GM = T.return_air()
|
||||||
if(prob(10))
|
if(prob(10))
|
||||||
GM.adjust_gas(PLASMA, 100, 0, 0)
|
GM.adjust_gas(PLASMA, 100, 0, 0)
|
||||||
GM.temperature = 1500+T0C //should be enough to start a fire
|
GM.set_temperature(1500+T0C) //should be enough to start a fire
|
||||||
T.visible_message("The [src] suddenly disgorges a cloud of heated plasma.")
|
T.visible_message("The [src] suddenly disgorges a cloud of heated plasma.")
|
||||||
destroy()
|
destroy()
|
||||||
else
|
else
|
||||||
GM.adjust_gas(PLASMA, 5, 0, 0)
|
GM.adjust_gas(PLASMA, 5, 0, 0)
|
||||||
GM.temperature = istype(T) ? T.air.temperature : T20C
|
GM.set_temperature(istype(T) ? T.air.temperature : T20C)
|
||||||
T.visible_message("The [src] suddenly disgorges a cloud of plasma.")
|
T.visible_message("The [src] suddenly disgorges a cloud of plasma.")
|
||||||
GM.update_values()
|
|
||||||
return
|
return
|
||||||
|
|
||||||
/datum/global_iterator/mecha_generator
|
/datum/global_iterator/mecha_generator
|
||||||
|
|||||||
@@ -821,22 +821,22 @@
|
|||||||
/obj/mecha/proc/return_pressure()
|
/obj/mecha/proc/return_pressure()
|
||||||
. = 0
|
. = 0
|
||||||
if(use_internal_tank)
|
if(use_internal_tank)
|
||||||
. = cabin_air.return_pressure()
|
. = cabin_air.pressure
|
||||||
else
|
else
|
||||||
var/datum/gas_mixture/t_air = get_turf_air()
|
var/datum/gas_mixture/t_air = get_turf_air()
|
||||||
if(t_air)
|
if(t_air)
|
||||||
. = t_air.return_pressure()
|
. = t_air.pressure
|
||||||
return
|
return
|
||||||
|
|
||||||
//skytodo: //No idea what you want me to do here, mate.
|
//skytodo: //No idea what you want me to do here, mate.
|
||||||
/obj/mecha/proc/return_temperature()
|
/obj/mecha/proc/return_temperature()
|
||||||
. = 0
|
. = 0
|
||||||
if(use_internal_tank)
|
if(use_internal_tank)
|
||||||
. = cabin_air.return_temperature()
|
. = cabin_air.temperature
|
||||||
else
|
else
|
||||||
var/datum/gas_mixture/t_air = get_turf_air()
|
var/datum/gas_mixture/t_air = get_turf_air()
|
||||||
if(t_air)
|
if(t_air)
|
||||||
. = t_air.return_temperature()
|
. = t_air.temperature
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/mecha/proc/connect(obj/machinery/atmospherics/unary/portables_connector/new_port)
|
/obj/mecha/proc/connect(obj/machinery/atmospherics/unary/portables_connector/new_port)
|
||||||
@@ -1118,17 +1118,17 @@
|
|||||||
return
|
return
|
||||||
if(mob_container.forceMove(src.loc))//ejecting mob container
|
if(mob_container.forceMove(src.loc))//ejecting mob container
|
||||||
/*
|
/*
|
||||||
if(ishuman(occupant) && (return_pressure() > HAZARD_HIGH_PRESSURE))
|
if(ishuman(occupant) && (pressure > HAZARD_HIGH_PRESSURE))
|
||||||
use_internal_tank = 0
|
use_internal_tank = 0
|
||||||
var/datum/gas_mixture/environment = get_turf_air()
|
var/datum/gas_mixture/environment = get_turf_air()
|
||||||
if(environment)
|
if(environment)
|
||||||
var/env_pressure = environment.return_pressure()
|
var/env_pressure = environment.pressure
|
||||||
var/pressure_delta = (cabin.return_pressure() - env_pressure)
|
var/pressure_delta = (cabin.pressure - env_pressure)
|
||||||
//Can not have a pressure delta that would cause environment pressure > tank pressure
|
//Can not have a pressure delta that would cause environment pressure > tank pressure
|
||||||
|
|
||||||
var/transfer_moles = 0
|
var/transfer_moles = 0
|
||||||
if(pressure_delta > 0)
|
if(pressure_delta > 0)
|
||||||
transfer_moles = pressure_delta*environment.volume/(cabin.return_temperature() * R_IDEAL_GAS_EQUATION)
|
transfer_moles = pressure_delta*environment.volume/(cabin.temperature * R_IDEAL_GAS_EQUATION)
|
||||||
|
|
||||||
//Actually transfer the gas
|
//Actually transfer the gas
|
||||||
var/datum/gas_mixture/removed = cabin.air_contents.remove(transfer_moles)
|
var/datum/gas_mixture/removed = cabin.air_contents.remove(transfer_moles)
|
||||||
@@ -1688,7 +1688,7 @@
|
|||||||
delay = 20
|
delay = 20
|
||||||
|
|
||||||
process(var/obj/mecha/mecha)
|
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
|
var/delta = mecha.cabin_air.temperature - T20C
|
||||||
mecha.cabin_air.temperature -= max(-10, min(10, round(delta/4,0.1)))
|
mecha.cabin_air.temperature -= max(-10, min(10, round(delta/4,0.1)))
|
||||||
return
|
return
|
||||||
@@ -1702,21 +1702,21 @@
|
|||||||
var/datum/gas_mixture/cabin_air = mecha.cabin_air
|
var/datum/gas_mixture/cabin_air = mecha.cabin_air
|
||||||
|
|
||||||
var/release_pressure = mecha.internal_tank_valve
|
var/release_pressure = mecha.internal_tank_valve
|
||||||
var/cabin_pressure = cabin_air.return_pressure()
|
var/cabin_pressure = cabin_air.pressure
|
||||||
var/pressure_delta = min(release_pressure - cabin_pressure, (tank_air.return_pressure() - cabin_pressure)/2)
|
var/pressure_delta = min(release_pressure - cabin_pressure, (tank_air.pressure - cabin_pressure)/2)
|
||||||
var/transfer_moles = 0
|
var/transfer_moles = 0
|
||||||
if(pressure_delta > 0) //cabin pressure lower than release pressure
|
if(pressure_delta > 0) //cabin pressure lower than release pressure
|
||||||
if(tank_air.return_temperature() > 0)
|
if(tank_air.temperature > 0)
|
||||||
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 = tank_air.remove(transfer_moles)
|
var/datum/gas_mixture/removed = tank_air.remove(transfer_moles)
|
||||||
cabin_air.merge(removed)
|
cabin_air.merge(removed)
|
||||||
else if(pressure_delta < 0) //cabin pressure higher than release pressure
|
else if(pressure_delta < 0) //cabin pressure higher than release pressure
|
||||||
var/datum/gas_mixture/t_air = mecha.get_turf_air()
|
var/datum/gas_mixture/t_air = mecha.get_turf_air()
|
||||||
pressure_delta = cabin_pressure - release_pressure
|
pressure_delta = cabin_pressure - release_pressure
|
||||||
if(t_air)
|
if(t_air)
|
||||||
pressure_delta = min(cabin_pressure - t_air.return_pressure(), pressure_delta)
|
pressure_delta = min(cabin_pressure - t_air.pressure, pressure_delta)
|
||||||
if(pressure_delta > 0) //if location pressure is lower than cabin pressure
|
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)
|
var/datum/gas_mixture/removed = cabin_air.remove(transfer_moles)
|
||||||
if(t_air)
|
if(t_air)
|
||||||
t_air.merge(removed)
|
t_air.merge(removed)
|
||||||
@@ -1749,12 +1749,12 @@
|
|||||||
if(mecha.internal_tank.return_pressure()>mecha.internal_tank.maximum_pressure && !(mecha.hasInternalDamage(MECHA_INT_TANK_BREACH)))
|
if(mecha.internal_tank.return_pressure()>mecha.internal_tank.maximum_pressure && !(mecha.hasInternalDamage(MECHA_INT_TANK_BREACH)))
|
||||||
mecha.setInternalDamage(MECHA_INT_TANK_BREACH)
|
mecha.setInternalDamage(MECHA_INT_TANK_BREACH)
|
||||||
var/datum/gas_mixture/int_tank_air = mecha.internal_tank.return_air()
|
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))
|
int_tank_air.temperature = min(6000+T0C, int_tank_air.temperature+rand(10,15))
|
||||||
if(mecha.cabin_air && mecha.cabin_air.return_volume()>0)
|
if(mecha.cabin_air && mecha.cabin_air.volume>0)
|
||||||
mecha.cabin_air.temperature = min(6000+T0C, mecha.cabin_air.return_temperature()+rand(10,15))
|
mecha.cabin_air.temperature = min(6000+T0C, mecha.cabin_air.temperature+rand(10,15))
|
||||||
if(mecha.cabin_air.return_temperature()>mecha.max_temperature/2)
|
if(mecha.cabin_air.temperature>mecha.max_temperature/2)
|
||||||
mecha.take_damage(4/round(mecha.max_temperature/mecha.cabin_air.return_temperature(),0.1),"fire")
|
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
|
if(mecha.hasInternalDamage(MECHA_INT_TEMP_CONTROL)) //stop the mecha_preserve_temp loop datum
|
||||||
mecha.pr_int_temp_processor.stop()
|
mecha.pr_int_temp_processor.stop()
|
||||||
if(mecha.hasInternalDamage(MECHA_INT_TANK_BREACH)) //remove some air from internal tank
|
if(mecha.hasInternalDamage(MECHA_INT_TANK_BREACH)) //remove some air from internal tank
|
||||||
|
|||||||
@@ -734,7 +734,7 @@ steam.start() -- spawns the effect
|
|||||||
if(reagents.has_reagent("water"))
|
if(reagents.has_reagent("water"))
|
||||||
var/turf/simulated/T = get_turf(src)
|
var/turf/simulated/T = get_turf(src)
|
||||||
if(istype(T))
|
if(istype(T))
|
||||||
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-500,lowertemp.temperature / 2) ,0)
|
lowertemp.temperature = max( min(lowertemp.temperature-500,lowertemp.temperature / 2) ,0)
|
||||||
lowertemp.react()
|
lowertemp.react()
|
||||||
T.assume_air(lowertemp)
|
T.assume_air(lowertemp)
|
||||||
|
|||||||
@@ -136,14 +136,12 @@
|
|||||||
PT.master = V
|
PT.master = V
|
||||||
OT.master = V
|
OT.master = V
|
||||||
|
|
||||||
PT.air_contents.temperature = PLASMA_FLASHPOINT
|
PT.air_contents.set_temperature(PLASMA_FLASHPOINT)
|
||||||
PT.air_contents.set_gas(PLASMA, 15, 0)
|
PT.air_contents.set_gas(PLASMA, 15, 0)
|
||||||
PT.air_contents.set_gas(CARBON_DIOXIDE, 33, 0)
|
PT.air_contents.set_gas(CARBON_DIOXIDE, 33, 0)
|
||||||
PT.air_contents.update_values()
|
|
||||||
|
|
||||||
OT.air_contents.temperature = PLASMA_FLASHPOINT
|
PT.air_contents.set_temperature(PLASMA_FLASHPOINT)
|
||||||
OT.air_contents.set_gas(OXYGEN, 48, 0)
|
OT.air_contents.set_gas(OXYGEN, 48, 0)
|
||||||
OT.air_contents.update_values()
|
|
||||||
|
|
||||||
var/obj/item/device/assembly/S
|
var/obj/item/device/assembly/S
|
||||||
|
|
||||||
|
|||||||
@@ -278,9 +278,8 @@ proc/healthanalyze(mob/living/M as mob, mob/living/user as mob, var/mode = 0)
|
|||||||
/obj/item/device/analyzer/proc/output_gas_scan(var/datum/gas_mixture/scanned, var/atom/container, human_standard = 0)
|
/obj/item/device/analyzer/proc/output_gas_scan(var/datum/gas_mixture/scanned, var/atom/container, human_standard = 0)
|
||||||
if(!scanned)
|
if(!scanned)
|
||||||
return "<span class='warning'>No gas mixture found.</span>"
|
return "<span class='warning'>No gas mixture found.</span>"
|
||||||
scanned.update_values()
|
var/pressure = scanned.pressure
|
||||||
var/pressure = scanned.return_pressure()
|
var/total_moles = scanned.total_moles
|
||||||
var/total_moles = scanned.total_moles()
|
|
||||||
var/message = ""
|
var/message = ""
|
||||||
if(!container || istype(container, /turf))
|
if(!container || istype(container, /turf))
|
||||||
message += "<span class='notice'><B>Results:</B><br></span>"
|
message += "<span class='notice'><B>Results:</B><br></span>"
|
||||||
@@ -290,7 +289,7 @@ proc/healthanalyze(mob/living/M as mob, mob/living/user as mob, var/mode = 0)
|
|||||||
message += "[human_standard && abs(pressure - ONE_ATMOSPHERE) > 10 ? "<span class='bad'>" : "<span class='notice'>"] Pressure: [round(pressure,0.1)] kPa</span><br>"
|
message += "[human_standard && abs(pressure - ONE_ATMOSPHERE) > 10 ? "<span class='bad'>" : "<span class='notice'>"] Pressure: [round(pressure,0.1)] kPa</span><br>"
|
||||||
|
|
||||||
for(var/gasid in scanned.gases)
|
for(var/gasid in scanned.gases)
|
||||||
var/gas_moles = scanned.get_moles_by_id(gasid)
|
var/gas_moles = scanned.gases[gasid]
|
||||||
var/datum/gas/gas = scanned.get_gas_by_id(gasid)
|
var/datum/gas/gas = scanned.get_gas_by_id(gasid)
|
||||||
if(!gas_moles && !(gas.gas_flags & ALWAYS_SHOW)) //no gas, and we aren't configured to show a 0 number
|
if(!gas_moles && !(gas.gas_flags & ALWAYS_SHOW)) //no gas, and we aren't configured to show a 0 number
|
||||||
continue //skip it
|
continue //skip it
|
||||||
@@ -303,7 +302,7 @@ proc/healthanalyze(mob/living/M as mob, mob/living/user as mob, var/mode = 0)
|
|||||||
if(gas_moles >= human_standards["[gas.gas_id]_max"])
|
if(gas_moles >= human_standards["[gas.gas_id]_max"])
|
||||||
danger = 1
|
danger = 1
|
||||||
|
|
||||||
message += "[danger ? "<span class='bad'>" : "<span class='notice'>"] [gas.display_short]: [round(gas_moles, 0.1)] mol, [round((gas_moles / scanned.total_moles())*100)]%</span><br>"
|
message += "[danger ? "<span class='bad'>" : "<span class='notice'>"] [gas.display_short]: [round(gas_moles, 0.1)] mol, [round((gas_moles / scanned.total_moles)*100)]%</span><br>"
|
||||||
|
|
||||||
message += "[human_standard && !(abs(scanned.temperature-T0C - 20) < 20) ? "<span class='bad'>" : "<span class='notice'>"] Temperature: [round(scanned.temperature-T0C)]°C</span>"
|
message += "[human_standard && !(abs(scanned.temperature-T0C - 20) < 20) ? "<span class='bad'>" : "<span class='notice'>"] Temperature: [round(scanned.temperature-T0C)]°C</span>"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -128,7 +128,7 @@
|
|||||||
if(!ptank)
|
if(!ptank)
|
||||||
user << "<span class='notice'>Attach a plasma tank first!</span>"
|
user << "<span class='notice'>Attach a plasma tank first!</span>"
|
||||||
return
|
return
|
||||||
var/dat = text("<TT><B>Flamethrower (<A HREF='?src=\ref[src];light=1'>[lit ? "<font color='red'>Lit</font>" : "Unlit"]</a>)</B><BR>\n Tank Pressure: [ptank.air_contents.return_pressure()]<BR>\nAmount to throw: <A HREF='?src=\ref[src];amount=-100'>-</A> <A HREF='?src=\ref[src];amount=-10'>-</A> <A HREF='?src=\ref[src];amount=-1'>-</A> [throw_amount] <A HREF='?src=\ref[src];amount=1'>+</A> <A HREF='?src=\ref[src];amount=10'>+</A> <A HREF='?src=\ref[src];amount=100'>+</A><BR>\n<A HREF='?src=\ref[src];remove=1'>Remove plasmatank</A> - <A HREF='?src=\ref[src];close=1'>Close</A></TT>")
|
var/dat = text("<TT><B>Flamethrower (<A HREF='?src=\ref[src];light=1'>[lit ? "<font color='red'>Lit</font>" : "Unlit"]</a>)</B><BR>\n Tank Pressure: [ptank.air_contents.pressure]<BR>\nAmount to throw: <A HREF='?src=\ref[src];amount=-100'>-</A> <A HREF='?src=\ref[src];amount=-10'>-</A> <A HREF='?src=\ref[src];amount=-1'>-</A> [throw_amount] <A HREF='?src=\ref[src];amount=1'>+</A> <A HREF='?src=\ref[src];amount=10'>+</A> <A HREF='?src=\ref[src];amount=100'>+</A><BR>\n<A HREF='?src=\ref[src];remove=1'>Remove plasmatank</A> - <A HREF='?src=\ref[src];close=1'>Close</A></TT>")
|
||||||
user << browse(dat, "window=flamethrower;size=600x300")
|
user << browse(dat, "window=flamethrower;size=600x300")
|
||||||
onclose(user, "flamethrower")
|
onclose(user, "flamethrower")
|
||||||
return
|
return
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
usr.set_machine(src)
|
usr.set_machine(src)
|
||||||
if(href_list["light"])
|
if(href_list["light"])
|
||||||
if(!ptank) return
|
if(!ptank) return
|
||||||
if(ptank.air_contents.get_moles_by_id(PLASMA) < 1) return
|
if(ptank.air_contents.gases[PLASMA] < 1) return
|
||||||
if(!status) return
|
if(!status) return
|
||||||
lit = !lit
|
lit = !lit
|
||||||
if(lit)
|
if(lit)
|
||||||
@@ -192,7 +192,7 @@
|
|||||||
//Transfer 5% of current tank air contents to turf
|
//Transfer 5% of current tank air contents to turf
|
||||||
var/datum/gas_mixture/air_transfer = ptank.air_contents.remove_ratio(0.02*(throw_amount/100))
|
var/datum/gas_mixture/air_transfer = ptank.air_contents.remove_ratio(0.02*(throw_amount/100))
|
||||||
//air_transfer.toxins = air_transfer.toxins * 5 // This is me not comprehending the air system. I realize this is retarded and I could probably make it work without fucking it up like this, but there you have it. -- TLE
|
//air_transfer.toxins = air_transfer.toxins * 5 // This is me not comprehending the air system. I realize this is retarded and I could probably make it work without fucking it up like this, but there you have it. -- TLE
|
||||||
new/obj/effect/decal/cleanable/liquid_fuel/flamethrower_fuel(target,air_transfer.get_moles_by_id(PLASMA)*10,get_dir(loc,target))
|
new/obj/effect/decal/cleanable/liquid_fuel/flamethrower_fuel(target,air_transfer.gases[PLASMA]*10,get_dir(loc,target))
|
||||||
air_transfer.set_gas(PLASMA, 0)
|
air_transfer.set_gas(PLASMA, 0)
|
||||||
target.assume_air(air_transfer)
|
target.assume_air(air_transfer)
|
||||||
//Burn it based on transfered gas
|
//Burn it based on transfered gas
|
||||||
|
|||||||
@@ -39,13 +39,13 @@
|
|||||||
/obj/item/weapon/tank/jetpack/proc/allow_thrust(num, mob/living/user as mob)
|
/obj/item/weapon/tank/jetpack/proc/allow_thrust(num, mob/living/user as mob)
|
||||||
if(!(src.on))
|
if(!(src.on))
|
||||||
return 0
|
return 0
|
||||||
if((num < 0.005 || src.air_contents.total_moles() < num))
|
if((num < 0.005 || src.air_contents.total_moles < num))
|
||||||
src.toggle()
|
src.toggle()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
var/datum/gas_mixture/G = src.air_contents.remove(num)
|
var/datum/gas_mixture/G = src.air_contents.remove(num)
|
||||||
|
|
||||||
if(G.total_moles() >= 0.005)
|
if(G.total_moles >= 0.005)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
G = null //let the GC get it
|
G = null //let the GC get it
|
||||||
|
|||||||
@@ -117,7 +117,7 @@
|
|||||||
|
|
||||||
// this is the data which will be sent to the ui
|
// this is the data which will be sent to the ui
|
||||||
var/data[0]
|
var/data[0]
|
||||||
data["tankPressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
|
data["tankPressure"] = round(air_contents.pressure ? air_contents.pressure : 0)
|
||||||
data["releasePressure"] = round(distribute_pressure ? distribute_pressure : 0)
|
data["releasePressure"] = round(distribute_pressure ? distribute_pressure : 0)
|
||||||
data["defaultReleasePressure"] = round(TANK_DEFAULT_RELEASE_PRESSURE)
|
data["defaultReleasePressure"] = round(TANK_DEFAULT_RELEASE_PRESSURE)
|
||||||
data["maxReleasePressure"] = round(TANK_MAX_RELEASE_PRESSURE)
|
data["maxReleasePressure"] = round(TANK_MAX_RELEASE_PRESSURE)
|
||||||
@@ -199,7 +199,7 @@
|
|||||||
if(!air_contents)
|
if(!air_contents)
|
||||||
return null
|
return null
|
||||||
|
|
||||||
var/tank_pressure = air_contents.return_pressure()
|
var/tank_pressure = air_contents.pressure
|
||||||
if(tank_pressure < distribute_pressure)
|
if(tank_pressure < distribute_pressure)
|
||||||
distribute_pressure = tank_pressure
|
distribute_pressure = tank_pressure
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@
|
|||||||
if(!air_contents)
|
if(!air_contents)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
var/pressure = air_contents.return_pressure()
|
var/pressure = air_contents.pressure
|
||||||
if(pressure > TANK_FRAGMENT_PRESSURE)
|
if(pressure > TANK_FRAGMENT_PRESSURE)
|
||||||
if(!istype(src.loc,/obj/item/device/transfer_valve))
|
if(!istype(src.loc,/obj/item/device/transfer_valve))
|
||||||
message_admins("Explosive tank rupture! last key to touch the tank was [src.fingerprintslast].")
|
message_admins("Explosive tank rupture! last key to touch the tank was [src.fingerprintslast].")
|
||||||
@@ -231,7 +231,7 @@
|
|||||||
air_contents.react()
|
air_contents.react()
|
||||||
air_contents.react()
|
air_contents.react()
|
||||||
air_contents.react()
|
air_contents.react()
|
||||||
pressure = air_contents.return_pressure()
|
pressure = air_contents.pressure
|
||||||
var/range = (pressure-TANK_FRAGMENT_PRESSURE)/TANK_FRAGMENT_SCALE
|
var/range = (pressure-TANK_FRAGMENT_PRESSURE)/TANK_FRAGMENT_SCALE
|
||||||
if(range > MAX_EXPLOSION_RANGE)
|
if(range > MAX_EXPLOSION_RANGE)
|
||||||
cap = 1
|
cap = 1
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
var/cp=0
|
var/cp=0
|
||||||
if(T && istype(T) && T.zone)
|
if(T && istype(T) && T.zone)
|
||||||
var/datum/gas_mixture/environment = T.return_air()
|
var/datum/gas_mixture/environment = T.return_air()
|
||||||
cp = environment.return_pressure()
|
cp = environment.pressure
|
||||||
else
|
else
|
||||||
if(istype(T,/turf/simulated))
|
if(istype(T,/turf/simulated))
|
||||||
continue
|
continue
|
||||||
@@ -32,13 +32,13 @@
|
|||||||
if(!istype(lT) || !lT.zone)
|
if(!istype(lT) || !lT.zone)
|
||||||
return 0
|
return 0
|
||||||
var/datum/gas_mixture/myenv=lT.return_air()
|
var/datum/gas_mixture/myenv=lT.return_air()
|
||||||
var/pressure=myenv.return_pressure()
|
var/pressure=myenv.pressure
|
||||||
|
|
||||||
for(var/dir in cardinal)
|
for(var/dir in cardinal)
|
||||||
var/turf/simulated/T=get_turf(get_step(loc,dir))
|
var/turf/simulated/T=get_turf(get_step(loc,dir))
|
||||||
if(T && istype(T) && T.zone)
|
if(T && istype(T) && T.zone)
|
||||||
var/datum/gas_mixture/environment = T.return_air()
|
var/datum/gas_mixture/environment = T.return_air()
|
||||||
var/pdiff = abs(pressure - environment.return_pressure())
|
var/pdiff = abs(pressure - environment.pressure)
|
||||||
if(pdiff > FALSEDOOR_MAX_PRESSURE_DIFF)
|
if(pdiff > FALSEDOOR_MAX_PRESSURE_DIFF)
|
||||||
return pdiff
|
return pdiff
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -75,11 +75,9 @@ obj/structure/ex_act(severity)
|
|||||||
|
|
||||||
/obj/structure/transit_tube_pod/New()
|
/obj/structure/transit_tube_pod/New()
|
||||||
. = ..()
|
. = ..()
|
||||||
air_contents.adjust_gas(OXYGEN, MOLES_O2STANDARD * 2, 0)
|
air_contents.set_temperature(T20C)
|
||||||
air_contents.adjust_gas(NITROGEN, MOLES_N2STANDARD, 0)
|
air_contents.adjust_gas(OXYGEN, MOLES_O2STANDARD * 2)
|
||||||
air_contents.temperature = T20C
|
air_contents.adjust_gas(NITROGEN, MOLES_N2STANDARD)
|
||||||
air_contents.update_values()
|
|
||||||
|
|
||||||
// Give auto tubes time to align before trying to start moving
|
// Give auto tubes time to align before trying to start moving
|
||||||
spawn (5)
|
spawn (5)
|
||||||
follow_tube()
|
follow_tube()
|
||||||
@@ -384,8 +382,8 @@ obj/structure/ex_act(severity)
|
|||||||
// currently on.
|
// currently on.
|
||||||
/obj/structure/transit_tube_pod/proc/mix_air()
|
/obj/structure/transit_tube_pod/proc/mix_air()
|
||||||
var/datum/gas_mixture/environment = loc.return_air()
|
var/datum/gas_mixture/environment = loc.return_air()
|
||||||
var/env_pressure = environment.return_pressure()
|
var/env_pressure = environment.pressure
|
||||||
var/int_pressure = air_contents.return_pressure()
|
var/int_pressure = air_contents.pressure
|
||||||
var/total_pressure = env_pressure + int_pressure
|
var/total_pressure = env_pressure + int_pressure
|
||||||
|
|
||||||
if(total_pressure == 0)
|
if(total_pressure == 0)
|
||||||
@@ -400,8 +398,8 @@ obj/structure/ex_act(severity)
|
|||||||
var/transfer_in = max(0.1, 0.5 * (env_pressure - int_pressure) / total_pressure)
|
var/transfer_in = max(0.1, 0.5 * (env_pressure - int_pressure) / total_pressure)
|
||||||
var/transfer_out = max(0.1, 0.3 * (int_pressure - env_pressure) / total_pressure)
|
var/transfer_out = max(0.1, 0.3 * (int_pressure - env_pressure) / total_pressure)
|
||||||
|
|
||||||
var/datum/gas_mixture/from_env = loc.remove_air(environment.total_moles() * transfer_in)
|
var/datum/gas_mixture/from_env = loc.remove_air(environment.total_moles * transfer_in)
|
||||||
var/datum/gas_mixture/from_int = air_contents.remove(air_contents.total_moles() * transfer_out)
|
var/datum/gas_mixture/from_int = air_contents.remove(air_contents.total_moles * transfer_out)
|
||||||
|
|
||||||
loc.assume_air(from_int)
|
loc.assume_air(from_int)
|
||||||
air_contents.merge(from_env)
|
air_contents.merge(from_env)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ var/list/mommicomment_sound = list('sound/voice/mommi_comment1.ogg', 'sound/voic
|
|||||||
var/atmosphere = 0
|
var/atmosphere = 0
|
||||||
var/datum/gas_mixture/current_air = turf_source.return_air()
|
var/datum/gas_mixture/current_air = turf_source.return_air()
|
||||||
if(current_air)
|
if(current_air)
|
||||||
atmosphere = current_air.return_pressure()
|
atmosphere = current_air.pressure
|
||||||
else
|
else
|
||||||
atmosphere = 0 //no air
|
atmosphere = 0 //no air
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ var/const/SURROUND_CAP = 7
|
|||||||
var/datum/gas_mixture/environment = current_turf.return_air()
|
var/datum/gas_mixture/environment = current_turf.return_air()
|
||||||
var/atmosphere = 0
|
var/atmosphere = 0
|
||||||
if(environment)
|
if(environment)
|
||||||
atmosphere = environment.return_pressure()
|
atmosphere = environment.pressure
|
||||||
|
|
||||||
/// Local sound modifications ///
|
/// Local sound modifications ///
|
||||||
if(atmosphere < MIN_SOUND_PRESSURE) //no sound reception in space, boyos
|
if(atmosphere < MIN_SOUND_PRESSURE) //no sound reception in space, boyos
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
|
|||||||
|
|
||||||
for(var/gasid in env.gases)
|
for(var/gasid in env.gases)
|
||||||
var/datum/gas/gas = env.get_gas_by_id(gasid)
|
var/datum/gas/gas = env.get_gas_by_id(gasid)
|
||||||
t += "[gas.display_name] : [env.get_moles_by_id(gasid)]<br>"
|
t += "[gas.display_name] : [env.gases[gasid]]<br>"
|
||||||
usr.show_message(t, 1)
|
usr.show_message(t, 1)
|
||||||
feedback_add_details("admin_verb","ASL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
feedback_add_details("admin_verb","ASL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
if(T.active_hotspot)
|
if(T.active_hotspot)
|
||||||
burning = 1
|
burning = 1
|
||||||
|
|
||||||
usr << "<span class='notice'>@[target.x],[target.y] ([GM.group_multiplier]): O:[GM.oxygen] T:[GM.toxins] N:[GM.nitrogen] C:[GM.carbon_dioxide] w [GM.temperature] Kelvin, [GM.return_pressure()] kPa [(burning)?("<span class='warning'>BURNING</span>"):(null)]</span>"
|
usr << "<span class='notice'>@[target.x],[target.y] ([GM.group_multiplier]): O:[GM.oxygen] T:[GM.toxins] N:[GM.nitrogen] C:[GM.carbon_dioxide] w [GM.temperature] Kelvin, [GM.pressure] kPa [(burning)?("<span class='warning'>BURNING</span>"):(null)]</span>"
|
||||||
for(var/datum/gas/trace_gas in GM.trace_gases)
|
for(var/datum/gas/trace_gas in GM.trace_gases)
|
||||||
usr << "[trace_gas.type]: [trace_gas.moles]"
|
usr << "[trace_gas.type]: [trace_gas.moles]"
|
||||||
feedback_add_details("admin_verb","DAST") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
feedback_add_details("admin_verb","DAST") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||||
|
|||||||
@@ -109,7 +109,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
/obj/item/weapon/tank/proc/detonate() //This happens when a bomb is told to explode
|
/obj/item/weapon/tank/proc/detonate() //This happens when a bomb is told to explode
|
||||||
var/fuel_moles = air_contents.get_moles_by_id(PLASMA) + air_contents.get_moles_by_id(OXYGEN)/6
|
var/fuel_moles = air_contents.gases[PLASMA] + air_contents.gases[OXYGEN]/6
|
||||||
var/strength = 1
|
var/strength = 1
|
||||||
|
|
||||||
var/turf/ground_zero = get_turf(loc)
|
var/turf/ground_zero = get_turf(loc)
|
||||||
@@ -157,7 +157,7 @@
|
|||||||
del(src)
|
del(src)
|
||||||
|
|
||||||
/obj/item/weapon/tank/proc/release() //This happens when the bomb is not welded. Tank contents are just spat out.
|
/obj/item/weapon/tank/proc/release() //This happens when the bomb is not welded. Tank contents are just spat out.
|
||||||
var/datum/gas_mixture/removed = air_contents.remove(air_contents.total_moles())
|
var/datum/gas_mixture/removed = air_contents.remove(air_contents.total_moles)
|
||||||
var/turf/simulated/T = get_turf(src)
|
var/turf/simulated/T = get_turf(src)
|
||||||
if(!T)
|
if(!T)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -258,14 +258,14 @@
|
|||||||
for(var/gas in seed.consume_gasses)
|
for(var/gas in seed.consume_gasses)
|
||||||
if(environment)
|
if(environment)
|
||||||
if(gas == OXYGEN)
|
if(gas == OXYGEN)
|
||||||
if(environment.get_moles_by_id(OXYGEN) <= seed.consume_gasses[OXYGEN])
|
if(environment.gases[OXYGEN] <= seed.consume_gasses[OXYGEN])
|
||||||
missing_gas++
|
missing_gas++
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
if(environment.get_moles_by_id(gas) >= seed.consume_gasses[gas])
|
if(environment.gases[gas] >= seed.consume_gasses[gas])
|
||||||
missing_gas++
|
missing_gas++
|
||||||
continue
|
continue
|
||||||
environment.adjust_gas(gas,-seed.consume_gasses[gas],1)
|
environment.adjust_gas(gas,-seed.consume_gasses[gas])
|
||||||
else
|
else
|
||||||
missing_gas++
|
missing_gas++
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@
|
|||||||
health -= missing_gas * HYDRO_SPEED_MULTIPLIER
|
health -= missing_gas * HYDRO_SPEED_MULTIPLIER
|
||||||
|
|
||||||
// Process it.
|
// Process it.
|
||||||
var/pressure = environment.return_pressure()
|
var/pressure = environment.pressure
|
||||||
if(pressure < seed.lowkpa_tolerance || pressure > seed.highkpa_tolerance)
|
if(pressure < seed.lowkpa_tolerance || pressure > seed.highkpa_tolerance)
|
||||||
health -= healthmod
|
health -= healthmod
|
||||||
|
|
||||||
|
|||||||
@@ -280,7 +280,7 @@
|
|||||||
if(!environment)
|
if(!environment)
|
||||||
return
|
return
|
||||||
|
|
||||||
var/pressure = environment.return_pressure()
|
var/pressure = environment.pressure
|
||||||
if(pressure < seed.lowkpa_tolerance || pressure > seed.highkpa_tolerance)
|
if(pressure < seed.lowkpa_tolerance || pressure > seed.highkpa_tolerance)
|
||||||
die()
|
die()
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -175,7 +175,7 @@
|
|||||||
var/datum/gas_mixture/env = L.return_air()
|
var/datum/gas_mixture/env = L.return_air()
|
||||||
if(env.temperature != MAX_TEMP + T0C)
|
if(env.temperature != MAX_TEMP + 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)
|
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@
|
|||||||
|
|
||||||
if(removed)
|
if(removed)
|
||||||
|
|
||||||
var/heat_capacity = removed.heat_capacity()
|
var/heat_capacity = removed.heat_capacity
|
||||||
//world << "heating ([heat_capacity])"
|
//world << "heating ([heat_capacity])"
|
||||||
if(heat_capacity) // Added check to avoid divide by zero (oshi-) runtime errors -- TLE
|
if(heat_capacity) // Added check to avoid divide by zero (oshi-) runtime errors -- TLE
|
||||||
if(removed.temperature < MAX_TEMP + T0C)
|
if(removed.temperature < MAX_TEMP + T0C)
|
||||||
|
|||||||
@@ -495,7 +495,7 @@
|
|||||||
del(src)
|
del(src)
|
||||||
else
|
else
|
||||||
var/datum/gas_mixture/environment = proj_turf.return_air()
|
var/datum/gas_mixture/environment = proj_turf.return_air()
|
||||||
var/pressure = environment.return_pressure()
|
var/pressure = environment.pressure
|
||||||
if(pressure < 50)
|
if(pressure < 50)
|
||||||
name = "strong resonance field"
|
name = "strong resonance field"
|
||||||
resonance_damage = 60
|
resonance_damage = 60
|
||||||
|
|||||||
@@ -117,12 +117,12 @@
|
|||||||
breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME)
|
breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME)
|
||||||
else if(istype(loc, /turf/))
|
else if(istype(loc, /turf/))
|
||||||
var/breath_moles = 0
|
var/breath_moles = 0
|
||||||
/*if(environment.return_pressure() > ONE_ATMOSPHERE)
|
/*if(environment.pressure > ONE_ATMOSPHERE)
|
||||||
// Loads of air around (pressure effect will be handled elsewhere), so lets just take a enough to fill our lungs at normal atmos pressure (using n = Pv/RT)
|
// Loads of air around (pressure effect will be handled elsewhere), so lets just take a enough to fill our lungs at normal atmos pressure (using n = Pv/RT)
|
||||||
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
|
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
|
||||||
else*/
|
else*/
|
||||||
// Not enough air around, take a percentage of what's there to model this properly
|
// 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)
|
breath = loc.remove_air(breath_moles)
|
||||||
|
|
||||||
@@ -171,11 +171,11 @@
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
var/plasma_used = 0
|
var/plasma_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
|
//Partial pressure of the toxins in our breath
|
||||||
var/plasma_gas = breath.get_moles_by_id(PLASMA)
|
var/plasma_gas = breath.gases[PLASMA]
|
||||||
var/Plasma_pp = (plasma_gas/breath.total_moles())*breath_pressure
|
var/Plasma_pp = (plasma_gas/breath.total_moles)*breath_pressure
|
||||||
|
|
||||||
if(Plasma_pp) // Detect toxins in air
|
if(Plasma_pp) // Detect toxins in air
|
||||||
|
|
||||||
|
|||||||
@@ -98,12 +98,12 @@
|
|||||||
breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME)
|
breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME)
|
||||||
else if(istype(loc, /turf/))
|
else if(istype(loc, /turf/))
|
||||||
var/breath_moles = 0
|
var/breath_moles = 0
|
||||||
/*if(environment.return_pressure() > ONE_ATMOSPHERE)
|
/*if(environment.pressure > ONE_ATMOSPHERE)
|
||||||
// Loads of air around (pressure effect will be handled elsewhere), so lets just take a enough to fill our lungs at normal atmos pressure (using n = Pv/RT)
|
// Loads of air around (pressure effect will be handled elsewhere), so lets just take a enough to fill our lungs at normal atmos pressure (using n = Pv/RT)
|
||||||
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
|
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
|
||||||
else*/
|
else*/
|
||||||
// Not enough air around, take a percentage of what's there to model this properly
|
// 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)
|
breath = loc.remove_air(breath_moles)
|
||||||
|
|
||||||
@@ -152,11 +152,11 @@
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
var/plasma_used = 0
|
var/plasma_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
|
//Partial pressure of the toxins in our breath
|
||||||
var/plasma_gas = breath.get_moles_by_id(PLASMA)
|
var/plasma_gas = breath.gases[PLASMA]
|
||||||
var/Plasma_pp = (plasma_gas/breath.total_moles())*breath_pressure
|
var/Plasma_pp = (plasma_gas/breath.total_moles)*breath_pressure
|
||||||
|
|
||||||
if(Plasma_pp) // Detect toxins in air
|
if(Plasma_pp) // Detect toxins in air
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
proc/handle_environment(datum/gas_mixture/environment)
|
proc/handle_environment(datum/gas_mixture/environment)
|
||||||
if(!environment || (flags & INVULNERABLE))
|
if(!environment || (flags & INVULNERABLE))
|
||||||
return
|
return
|
||||||
var/environment_heat_capacity = environment.heat_capacity()
|
var/environment_heat_capacity = environment.heat_capacity
|
||||||
if(istype(get_turf(src), /turf/space))
|
if(istype(get_turf(src), /turf/space))
|
||||||
var/turf/heat_turf = get_turf(src)
|
var/turf/heat_turf = get_turf(src)
|
||||||
environment_heat_capacity = heat_turf.heat_capacity
|
environment_heat_capacity = heat_turf.heat_capacity
|
||||||
|
|||||||
@@ -165,7 +165,7 @@
|
|||||||
del(internal)
|
del(internal)
|
||||||
else
|
else
|
||||||
stat("Internal Atmosphere Info", internal.name)
|
stat("Internal Atmosphere Info", internal.name)
|
||||||
stat("Tank Pressure", internal.air_contents.return_pressure())
|
stat("Tank Pressure", internal.air_contents.pressure)
|
||||||
stat("Distribution Pressure", internal.distribute_pressure)
|
stat("Distribution Pressure", internal.distribute_pressure)
|
||||||
if(mind)
|
if(mind)
|
||||||
if(mind.changeling)
|
if(mind.changeling)
|
||||||
@@ -1733,4 +1733,4 @@
|
|||||||
return .
|
return .
|
||||||
if(!species)
|
if(!species)
|
||||||
return null
|
return null
|
||||||
return species.default_language ? all_languages[species.default_language] : null
|
return species.default_language ? all_languages[species.default_language] : null
|
||||||
|
|||||||
@@ -550,12 +550,12 @@ var/global/list/organ_damage_overlays = list(
|
|||||||
breath = location_as_object.handle_internal_lifeform(src, BREATH_MOLES)
|
breath = location_as_object.handle_internal_lifeform(src, BREATH_MOLES)
|
||||||
else if(isturf(loc))
|
else if(isturf(loc))
|
||||||
var/breath_moles = 0
|
var/breath_moles = 0
|
||||||
/*if(environment.return_pressure() > ONE_ATMOSPHERE)
|
/*if(environment.pressure > ONE_ATMOSPHERE)
|
||||||
// Loads of air around (pressure effect will be handled elsewhere), so lets just take a enough to fill our lungs at normal atmos pressure (using n = Pv/RT)
|
// Loads of air around (pressure effect will be handled elsewhere), so lets just take a enough to fill our lungs at normal atmos pressure (using n = Pv/RT)
|
||||||
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
|
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
|
||||||
else*/
|
else*/
|
||||||
// Not enough air around, take a percentage of what's there to model this properly
|
// 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)
|
breath = loc.remove_air(breath_moles)
|
||||||
|
|
||||||
@@ -600,9 +600,9 @@ var/global/list/organ_damage_overlays = list(
|
|||||||
//testing("Plasmaman [src] leakin'. coverflags=[cover_flags]")
|
//testing("Plasmaman [src] leakin'. coverflags=[cover_flags]")
|
||||||
// OH FUCK HE LEAKIN'.
|
// OH FUCK HE LEAKIN'.
|
||||||
// This was OP.
|
// This was OP.
|
||||||
//environment.adjust(tx = environment.total_moles()*BREATH_PERCENTAGE) // About one breath's worth. (I know we aren't breathing it out, but this should be about the right amount)
|
//environment.adjust(tx = environment.total_moles*BREATH_PERCENTAGE) // About one breath's worth. (I know we aren't breathing it out, but this should be about the right amount)
|
||||||
if(environment)
|
if(environment)
|
||||||
if(environment.total_moles() && (environment.get_moles_by_id(OXYGEN) / environment.total_moles()) >= OXYCONCEN_PLASMEN_IGNITION) //how's the concentration doing?
|
if(environment.total_moles && (environment.gases[OXYGEN] / environment.total_moles) >= OXYCONCEN_PLASMEN_IGNITION) //how's the concentration doing?
|
||||||
if(!on_fire)
|
if(!on_fire)
|
||||||
src << "<span class='warning'>Your body reacts with the atmosphere and bursts into flame!</span>"
|
src << "<span class='warning'>Your body reacts with the atmosphere and bursts into flame!</span>"
|
||||||
adjust_fire_stacks(0.5)
|
adjust_fire_stacks(0.5)
|
||||||
@@ -640,7 +640,7 @@ var/global/list/organ_damage_overlays = list(
|
|||||||
if((status_flags & GODMODE) || (flags & INVULNERABLE))
|
if((status_flags & GODMODE) || (flags & INVULNERABLE))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if(!breath || (breath.total_moles() == 0) || suiciding)
|
if(!breath || (breath.total_moles == 0) || suiciding)
|
||||||
if(reagents.has_reagent("inaprovaline"))
|
if(reagents.has_reagent("inaprovaline"))
|
||||||
return 0
|
return 0
|
||||||
if(suiciding)
|
if(suiciding)
|
||||||
@@ -738,7 +738,7 @@ var/global/list/organ_damage_overlays = list(
|
|||||||
// Account for massive pressure differences. Done by Polymorph
|
// Account for massive pressure differences. Done by Polymorph
|
||||||
// Made it possible to actually have something that can protect against high pressure... Done by Errorage. Polymorph now has an axe sticking from his head for his previous hardcoded nonsense!
|
// Made it possible to actually have something that can protect against high pressure... Done by Errorage. Polymorph now has an axe sticking from his head for his previous hardcoded nonsense!
|
||||||
|
|
||||||
var/pressure = environment.return_pressure()
|
var/pressure = environment.pressure
|
||||||
var/adjusted_pressure = calculate_affecting_pressure(pressure) //Returns how much pressure actually affects the mob.
|
var/adjusted_pressure = calculate_affecting_pressure(pressure) //Returns how much pressure actually affects the mob.
|
||||||
if(status_flags & GODMODE) return 1 //godmode
|
if(status_flags & GODMODE) return 1 //godmode
|
||||||
|
|
||||||
@@ -759,7 +759,7 @@ var/global/list/organ_damage_overlays = list(
|
|||||||
else
|
else
|
||||||
pressure_alert = -1
|
pressure_alert = -1
|
||||||
|
|
||||||
if(environment.get_moles_by_id(PLASMA) > MOLES_PLASMA_VISIBLE)
|
if(environment.gases[PLASMA] > MOLES_PLASMA_VISIBLE)
|
||||||
pl_effects()
|
pl_effects()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -122,14 +122,14 @@
|
|||||||
var/N2O_emote_min = 0.15
|
var/N2O_emote_min = 0.15
|
||||||
var/plasma_used = 0
|
var/plasma_used = 0
|
||||||
var/nitrogen_used = 0
|
var/nitrogen_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 plasma
|
// Partial pressure of plasma
|
||||||
var/Plasma_pp = (breath.get_moles_by_id(PLASMA)/breath.total_moles())*breath_pressure
|
var/Plasma_pp = (breath.gases[PLASMA]/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)
|
// 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.get_moles_by_id(CARBON_DIOXIDE)/breath.total_moles())*breath_pressure // Tweaking to fit the hacky bullshit I've done with atmo -- TLE
|
var/CO2_pp = (breath.gases[CARBON_DIOXIDE]/breath.total_moles)*breath_pressure // Tweaking to fit the hacky bullshit I've done with atmo -- TLE
|
||||||
|
|
||||||
var/N2O_pp = (breath.get_moles_by_id(NITROUS_OXIDE)/breath.total_moles())*breath_pressure
|
var/N2O_pp = (breath.gases[NITROUS_OXIDE]/breath.total_moles)*breath_pressure
|
||||||
|
|
||||||
if(Plasma_pp < safe_plasma_min)
|
if(Plasma_pp < safe_plasma_min)
|
||||||
if(prob(20))
|
if(prob(20))
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
var/ratio = safe_plasma_min/Plasma_pp
|
var/ratio = safe_plasma_min/Plasma_pp
|
||||||
H.adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS)) // Don't fuck them up too fast (space only does HUMAN_MAX_OXYLOSS after all!)
|
H.adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS)) // Don't fuck them up too fast (space only does HUMAN_MAX_OXYLOSS after all!)
|
||||||
H.failed_last_breath = 1
|
H.failed_last_breath = 1
|
||||||
plasma_used = breath.get_moles_by_id(PLASMA)*ratio/6
|
plasma_used = breath.gases[PLASMA]*ratio/6
|
||||||
else
|
else
|
||||||
H.adjustOxyLoss(HUMAN_MAX_OXYLOSS)
|
H.adjustOxyLoss(HUMAN_MAX_OXYLOSS)
|
||||||
H.failed_last_breath = 1
|
H.failed_last_breath = 1
|
||||||
@@ -148,7 +148,7 @@
|
|||||||
else // We're in safe limits
|
else // We're in safe limits
|
||||||
H.failed_last_breath = 0
|
H.failed_last_breath = 0
|
||||||
H.adjustOxyLoss(-5)
|
H.adjustOxyLoss(-5)
|
||||||
plasma_used = breath.get_moles_by_id(PLASMA)/6
|
plasma_used = breath.gases[PLASMA]/6
|
||||||
H.oxygen_alert = 0
|
H.oxygen_alert = 0
|
||||||
|
|
||||||
breath.adjust_gas(PLASMA, -plasma_used, 0)
|
breath.adjust_gas(PLASMA, -plasma_used, 0)
|
||||||
@@ -179,7 +179,7 @@
|
|||||||
if(prob(20))
|
if(prob(20))
|
||||||
spawn(0)
|
spawn(0)
|
||||||
H.emote(pick("giggle", "laugh"))
|
H.emote(pick("giggle", "laugh"))
|
||||||
breath.adjust_gas(NITROUS_OXIDE, -breath.get_moles_by_id(NITROUS_OXIDE))
|
breath.adjust_gas(NITROUS_OXIDE, -breath.gases[NITROUS_OXIDE])
|
||||||
|
|
||||||
if( (abs(310.15 - breath.temperature) > 50) && !(M_RESIST_HEAT in H.mutations)) // Hot air hurts :(
|
if( (abs(310.15 - breath.temperature) > 50) && !(M_RESIST_HEAT in H.mutations)) // Hot air hurts :(
|
||||||
if(H.status_flags & GODMODE)
|
if(H.status_flags & GODMODE)
|
||||||
|
|||||||
@@ -158,7 +158,7 @@
|
|||||||
adjustToxLoss(rand(10,20))
|
adjustToxLoss(rand(10,20))
|
||||||
return
|
return
|
||||||
|
|
||||||
//var/environment_heat_capacity = environment.heat_capacity()
|
//var/environment_heat_capacity = environment.heat_capacity
|
||||||
var/loc_temp = T0C
|
var/loc_temp = T0C
|
||||||
if(istype(get_turf(src), /turf/space))
|
if(istype(get_turf(src), /turf/space))
|
||||||
//environment_heat_capacity = loc:heat_capacity
|
//environment_heat_capacity = loc:heat_capacity
|
||||||
|
|||||||
@@ -253,7 +253,7 @@
|
|||||||
var/obj/location_as_object = loc
|
var/obj/location_as_object = loc
|
||||||
breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME)
|
breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME)
|
||||||
else if(istype(loc, /turf/))
|
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)
|
breath = loc.remove_air(breath_moles)
|
||||||
|
|
||||||
// Handle chem smoke effect -- Doohl
|
// Handle chem smoke effect -- Doohl
|
||||||
@@ -317,16 +317,16 @@
|
|||||||
var/N2O_sleep_min = 5
|
var/N2O_sleep_min = 5
|
||||||
var/N2O_emote_min = 0.01
|
var/N2O_emote_min = 0.01
|
||||||
var/oxygen_used = 0
|
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
|
//Partial pressure of the O2 in our breath
|
||||||
var/O2_pp = (breath.get_moles_by_id(OXYGEN)/breath.total_moles())*breath_pressure
|
var/O2_pp = (breath.gases[OXYGEN]/breath.total_moles)*breath_pressure
|
||||||
// Same, but for the toxins
|
// Same, but for the toxins
|
||||||
var/Plasma_pp = (breath.get_moles_by_id(PLASMA)/breath.total_moles())*breath_pressure
|
var/Plasma_pp = (breath.gases[PLASMA]/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)
|
// 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.get_moles_by_id(CARBON_DIOXIDE)/breath.total_moles())*breath_pressure
|
var/CO2_pp = (breath.gases[CARBON_DIOXIDE]/breath.total_moles)*breath_pressure
|
||||||
|
|
||||||
var/N2O_pp = (breath.get_moles_by_id(NITROUS_OXIDE)/breath.total_moles())*breath_pressure
|
var/N2O_pp = (breath.gases[NITROUS_OXIDE]/breath.total_moles)*breath_pressure
|
||||||
|
|
||||||
if(O2_pp < safe_oxygen_min) // Too little oxygen
|
if(O2_pp < safe_oxygen_min) // Too little oxygen
|
||||||
if(prob(20))
|
if(prob(20))
|
||||||
@@ -335,7 +335,7 @@
|
|||||||
O2_pp = 0.01
|
O2_pp = 0.01
|
||||||
var/ratio = safe_oxygen_min/O2_pp
|
var/ratio = safe_oxygen_min/O2_pp
|
||||||
adjustOxyLoss(min(5*ratio, 7)) // Don't fuck them up too fast (space only does 7 after all!)
|
adjustOxyLoss(min(5*ratio, 7)) // Don't fuck them up too fast (space only does 7 after all!)
|
||||||
oxygen_used = breath.get_moles_by_id(OXYGEN)*ratio/6
|
oxygen_used = breath.gases[OXYGEN]*ratio/6
|
||||||
oxygen_alert = max(oxygen_alert, 1)
|
oxygen_alert = max(oxygen_alert, 1)
|
||||||
/*else if (O2_pp > safe_oxygen_max) // Too much oxygen (commented this out for now, I'll deal with pressure damage elsewhere I suppose)
|
/*else if (O2_pp > safe_oxygen_max) // Too much oxygen (commented this out for now, I'll deal with pressure damage elsewhere I suppose)
|
||||||
spawn(0) emote("cough")
|
spawn(0) emote("cough")
|
||||||
@@ -345,7 +345,7 @@
|
|||||||
oxygen_alert = max(oxygen_alert, 1)*/
|
oxygen_alert = max(oxygen_alert, 1)*/
|
||||||
else // We're in safe limits
|
else // We're in safe limits
|
||||||
adjustOxyLoss(-5)
|
adjustOxyLoss(-5)
|
||||||
oxygen_used = breath.get_moles_by_id(OXYGEN)/6
|
oxygen_used = breath.gases[OXYGEN]/6
|
||||||
oxygen_alert = 0
|
oxygen_alert = 0
|
||||||
|
|
||||||
breath.adjust_gas(OXYGEN, -oxygen_used)
|
breath.adjust_gas(OXYGEN, -oxygen_used)
|
||||||
@@ -366,7 +366,7 @@
|
|||||||
co2overloadtime = 0
|
co2overloadtime = 0
|
||||||
|
|
||||||
if(Plasma_pp > safe_toxins_max) // Too much toxins
|
if(Plasma_pp > safe_toxins_max) // Too much toxins
|
||||||
var/plasma_level = breath.get_moles_by_id(PLASMA)
|
var/plasma_level = breath.gases[PLASMA]
|
||||||
var/ratio = (plasma_level/safe_toxins_max) * 10
|
var/ratio = (plasma_level/safe_toxins_max) * 10
|
||||||
//adjustToxLoss(Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE)) //Limit amount of damage toxin exposure can do per second
|
//adjustToxLoss(Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE)) //Limit amount of damage toxin exposure can do per second
|
||||||
if(wear_mask)
|
if(wear_mask)
|
||||||
@@ -409,7 +409,7 @@
|
|||||||
if(hat && istype(hat, /obj/item/clothing/head/helmet/space) && uniform && istype(uniform, /obj/item/clothing/monkeyclothes/space))
|
if(hat && istype(hat, /obj/item/clothing/head/helmet/space) && uniform && istype(uniform, /obj/item/clothing/monkeyclothes/space))
|
||||||
spaceproof = 1 //quick and dirt cheap. no need for the Life() of monkeys to become as complicated as the Life() of humans. man that's deep.
|
spaceproof = 1 //quick and dirt cheap. no need for the Life() of monkeys to become as complicated as the Life() of humans. man that's deep.
|
||||||
|
|
||||||
var/environment_heat_capacity = environment.heat_capacity()
|
var/environment_heat_capacity = environment.heat_capacity
|
||||||
if(istype(get_turf(src), /turf/space))
|
if(istype(get_turf(src), /turf/space))
|
||||||
var/turf/heat_turf = get_turf(src)
|
var/turf/heat_turf = get_turf(src)
|
||||||
environment_heat_capacity = heat_turf.heat_capacity
|
environment_heat_capacity = heat_turf.heat_capacity
|
||||||
@@ -424,7 +424,7 @@
|
|||||||
|
|
||||||
//Account for massive pressure differences
|
//Account for massive pressure differences
|
||||||
|
|
||||||
var/pressure = environment.return_pressure()
|
var/pressure = environment.pressure
|
||||||
var/adjusted_pressure = calculate_affecting_pressure(pressure) //Returns how much pressure actually affects the mob.
|
var/adjusted_pressure = calculate_affecting_pressure(pressure) //Returns how much pressure actually affects the mob.
|
||||||
switch(adjusted_pressure)
|
switch(adjusted_pressure)
|
||||||
if(HAZARD_HIGH_PRESSURE to INFINITY)
|
if(HAZARD_HIGH_PRESSURE to INFINITY)
|
||||||
|
|||||||
@@ -180,19 +180,19 @@ var/global/list/whitelisted_species = list("Human")
|
|||||||
var/N2O_emote_min = 0.15
|
var/N2O_emote_min = 0.15
|
||||||
var/oxygen_used = 0
|
var/oxygen_used = 0
|
||||||
var/nitrogen_used = 0
|
var/nitrogen_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
|
||||||
var/vox_oxygen_max = 1 // For vox.
|
var/vox_oxygen_max = 1 // For vox.
|
||||||
|
|
||||||
//Partial pressure of the O2 in our breath
|
//Partial pressure of the O2 in our breath
|
||||||
var/O2_pp = (breath.get_moles_by_id(OXYGEN)/breath.total_moles())*breath_pressure
|
var/O2_pp = (breath.gases[OXYGEN]/breath.total_moles)*breath_pressure
|
||||||
// Same, but for the toxins
|
// Same, but for the toxins
|
||||||
var/Plasma_pp = (breath.get_moles_by_id(PLASMA)/breath.total_moles())*breath_pressure
|
var/Plasma_pp = (breath.gases[PLASMA]/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)
|
// 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.get_moles_by_id(CARBON_DIOXIDE)/breath.total_moles())*breath_pressure // Tweaking to fit the hacky bullshit I've done with atmo -- TLE
|
var/CO2_pp = (breath.gases[CARBON_DIOXIDE]/breath.total_moles)*breath_pressure // Tweaking to fit the hacky bullshit I've done with atmo -- TLE
|
||||||
// Nitrogen, for Vox.
|
// Nitrogen, for Vox.
|
||||||
var/Nitrogen_pp = (breath.get_moles_by_id(NITROGEN)/breath.total_moles())*breath_pressure
|
var/Nitrogen_pp = (breath.gases[NITROGEN]/breath.total_moles)*breath_pressure
|
||||||
|
|
||||||
var/N2O_pp = (breath.get_moles_by_id(NITROUS_OXIDE)/breath.total_moles())*breath_pressure
|
var/N2O_pp = (breath.gases[NITROUS_OXIDE]/breath.total_moles)*breath_pressure
|
||||||
|
|
||||||
// TODO: Split up into Voxs' own proc.
|
// TODO: Split up into Voxs' own proc.
|
||||||
if(O2_pp < safe_oxygen_min && name != "Vox") // Too little oxygen
|
if(O2_pp < safe_oxygen_min && name != "Vox") // Too little oxygen
|
||||||
@@ -203,7 +203,7 @@ var/global/list/whitelisted_species = list("Human")
|
|||||||
var/ratio = safe_oxygen_min/O2_pp
|
var/ratio = safe_oxygen_min/O2_pp
|
||||||
H.adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS)) // Don't fuck them up too fast (space only does HUMAN_MAX_OXYLOSS after all!)
|
H.adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS)) // Don't fuck them up too fast (space only does HUMAN_MAX_OXYLOSS after all!)
|
||||||
H.failed_last_breath = 1
|
H.failed_last_breath = 1
|
||||||
oxygen_used = breath.get_moles_by_id(OXYGEN)*ratio/6
|
oxygen_used = breath.gases[OXYGEN]*ratio/6
|
||||||
else
|
else
|
||||||
H.adjustOxyLoss(HUMAN_MAX_OXYLOSS)
|
H.adjustOxyLoss(HUMAN_MAX_OXYLOSS)
|
||||||
H.failed_last_breath = 1
|
H.failed_last_breath = 1
|
||||||
@@ -216,7 +216,7 @@ var/global/list/whitelisted_species = list("Human")
|
|||||||
var/ratio = safe_oxygen_min/Nitrogen_pp
|
var/ratio = safe_oxygen_min/Nitrogen_pp
|
||||||
H.adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS))
|
H.adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS))
|
||||||
H.failed_last_breath = 1
|
H.failed_last_breath = 1
|
||||||
nitrogen_used = breath.get_moles_by_id(NITROGEN)*ratio/6
|
nitrogen_used = breath.gases[NITROGEN]*ratio/6
|
||||||
else
|
else
|
||||||
H.adjustOxyLoss(HUMAN_MAX_OXYLOSS)
|
H.adjustOxyLoss(HUMAN_MAX_OXYLOSS)
|
||||||
H.failed_last_breath = 1
|
H.failed_last_breath = 1
|
||||||
@@ -225,7 +225,7 @@ var/global/list/whitelisted_species = list("Human")
|
|||||||
else // We're in safe limits
|
else // We're in safe limits
|
||||||
H.failed_last_breath = 0
|
H.failed_last_breath = 0
|
||||||
H.adjustOxyLoss(-5)
|
H.adjustOxyLoss(-5)
|
||||||
oxygen_used = breath.get_moles_by_id(OXYGEN)/6
|
oxygen_used = breath.gases[OXYGEN]/6
|
||||||
H.oxygen_alert = 0
|
H.oxygen_alert = 0
|
||||||
|
|
||||||
breath.adjust_gas(OXYGEN, -oxygen_used, 0)
|
breath.adjust_gas(OXYGEN, -oxygen_used, 0)
|
||||||
@@ -248,12 +248,12 @@ var/global/list/whitelisted_species = list("Human")
|
|||||||
H.co2overloadtime = 0
|
H.co2overloadtime = 0
|
||||||
|
|
||||||
if(Plasma_pp > safe_plasma_max) // Too much toxins
|
if(Plasma_pp > safe_plasma_max) // Too much toxins
|
||||||
var/ratio = (breath.get_moles_by_id(PLASMA)/safe_plasma_max) * 10
|
var/ratio = (breath.gases[PLASMA]/safe_plasma_max) * 10
|
||||||
//adjustToxLoss(Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE)) //Limit amount of damage toxin exposure can do per second
|
//adjustToxLoss(Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE)) //Limit amount of damage toxin exposure can do per second
|
||||||
if(H.wear_mask)
|
if(H.wear_mask)
|
||||||
if(H.wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT)
|
if(H.wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT)
|
||||||
if(breath.get_moles_by_id(PLASMA) > safe_plasma_mask)
|
if(breath.gases[PLASMA] > safe_plasma_mask)
|
||||||
ratio = (breath.get_moles_by_id(PLASMA)/safe_plasma_mask) * 10
|
ratio = (breath.gases[PLASMA]/safe_plasma_mask) * 10
|
||||||
else
|
else
|
||||||
ratio = 0
|
ratio = 0
|
||||||
if(ratio)
|
if(ratio)
|
||||||
@@ -261,7 +261,7 @@ var/global/list/whitelisted_species = list("Human")
|
|||||||
H.reagents.add_reagent("plasma", Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE))
|
H.reagents.add_reagent("plasma", Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE))
|
||||||
H.toxins_alert = max(H.toxins_alert, 1)
|
H.toxins_alert = max(H.toxins_alert, 1)
|
||||||
else if(O2_pp > vox_oxygen_max && name == "Vox") //Oxygen is toxic to vox.
|
else if(O2_pp > vox_oxygen_max && name == "Vox") //Oxygen is toxic to vox.
|
||||||
var/ratio = (breath.get_moles_by_id(OXYGEN)/vox_oxygen_max) * 1000
|
var/ratio = (breath.gases[OXYGEN]/vox_oxygen_max) * 1000
|
||||||
H.adjustToxLoss(Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE))
|
H.adjustToxLoss(Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE))
|
||||||
H.toxins_alert = max(H.toxins_alert, 1)
|
H.toxins_alert = max(H.toxins_alert, 1)
|
||||||
else
|
else
|
||||||
@@ -274,7 +274,7 @@ var/global/list/whitelisted_species = list("Human")
|
|||||||
else if(N2O_pp > N2O_emote_min) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning
|
else if(N2O_pp > N2O_emote_min) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning
|
||||||
if(prob(20))
|
if(prob(20))
|
||||||
spawn(0) H.emote(pick("giggle", "laugh"))
|
spawn(0) H.emote(pick("giggle", "laugh"))
|
||||||
breath.adjust_gas(NITROUS_OXIDE, -breath.get_moles_by_id(NITROUS_OXIDE)) //purge it
|
breath.adjust_gas(NITROUS_OXIDE, -breath.gases[NITROUS_OXIDE]) //purge it
|
||||||
|
|
||||||
if( (abs(310.15 - breath.temperature) > 50) && !(M_RESIST_HEAT in H.mutations)) // Hot air hurts :(
|
if( (abs(310.15 - breath.temperature) > 50) && !(M_RESIST_HEAT in H.mutations)) // Hot air hurts :(
|
||||||
if(H.status_flags & GODMODE) return 1 //godmode
|
if(H.status_flags & GODMODE) return 1 //godmode
|
||||||
|
|||||||
@@ -168,7 +168,7 @@
|
|||||||
if(istype(T))
|
if(istype(T))
|
||||||
var/datum/gas_mixture/G = loc.return_air() // Check if we're standing in an oxygenless environment
|
var/datum/gas_mixture/G = loc.return_air() // Check if we're standing in an oxygenless environment
|
||||||
if(G)
|
if(G)
|
||||||
oxy=G.get_moles_by_id(OXYGEN)
|
oxy=G.gases[OXYGEN]
|
||||||
if(oxy < 1 || fire_stacks <= 0)
|
if(oxy < 1 || fire_stacks <= 0)
|
||||||
ExtinguishMob() //If there's no oxygen in the tile we're on, put out the fire
|
ExtinguishMob() //If there's no oxygen in the tile we're on, put out the fire
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -505,7 +505,7 @@
|
|||||||
var/obj/item/weapon/tank/jetpack/current_jetpack = installed_jetpack()
|
var/obj/item/weapon/tank/jetpack/current_jetpack = installed_jetpack()
|
||||||
if (current_jetpack)
|
if (current_jetpack)
|
||||||
stat("Internal Atmosphere Info", current_jetpack.name)
|
stat("Internal Atmosphere Info", current_jetpack.name)
|
||||||
stat("Tank Pressure", current_jetpack.air_contents.return_pressure())
|
stat("Tank Pressure", current_jetpack.air_contents.pressure)
|
||||||
|
|
||||||
|
|
||||||
// this function returns the robots jetpack, if one is installed
|
// this function returns the robots jetpack, if one is installed
|
||||||
|
|||||||
@@ -68,13 +68,13 @@ var/global/list/spider_types = typesof(/mob/living/simple_animal/hostile/giant_s
|
|||||||
if(!istype(lT) || !lT.zone)
|
if(!istype(lT) || !lT.zone)
|
||||||
return 0
|
return 0
|
||||||
var/datum/gas_mixture/myenv=lT.return_air()
|
var/datum/gas_mixture/myenv=lT.return_air()
|
||||||
var/pressure=myenv.return_pressure()
|
var/pressure=myenv.pressure
|
||||||
|
|
||||||
for(var/dir in cardinal)
|
for(var/dir in cardinal)
|
||||||
var/turf/simulated/T=get_turf(get_step(loc,dir))
|
var/turf/simulated/T=get_turf(get_step(loc,dir))
|
||||||
if(T && istype(T) && T.zone)
|
if(T && istype(T) && T.zone)
|
||||||
var/datum/gas_mixture/environment = T.return_air()
|
var/datum/gas_mixture/environment = T.return_air()
|
||||||
var/pdiff = abs(pressure - environment.return_pressure())
|
var/pdiff = abs(pressure - environment.pressure)
|
||||||
if(pdiff > SPIDER_MAX_PRESSURE_DIFF)
|
if(pdiff > SPIDER_MAX_PRESSURE_DIFF)
|
||||||
return pdiff
|
return pdiff
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -205,41 +205,41 @@
|
|||||||
bodytemperature += ((Environment.temperature - bodytemperature) / 5)
|
bodytemperature += ((Environment.temperature - bodytemperature) / 5)
|
||||||
|
|
||||||
if(min_oxy)
|
if(min_oxy)
|
||||||
if(Environment.get_moles_by_id(OXYGEN) < min_oxy)
|
if(Environment.gases[OXYGEN] < min_oxy)
|
||||||
atmos_suitable = 0
|
atmos_suitable = 0
|
||||||
oxygen_alert = 1
|
oxygen_alert = 1
|
||||||
else
|
else
|
||||||
oxygen_alert = 0
|
oxygen_alert = 0
|
||||||
|
|
||||||
if(max_oxy)
|
if(max_oxy)
|
||||||
if(Environment.get_moles_by_id(OXYGEN) > max_oxy)
|
if(Environment.gases[OXYGEN] > max_oxy)
|
||||||
atmos_suitable = 0
|
atmos_suitable = 0
|
||||||
|
|
||||||
if(min_tox)
|
if(min_tox)
|
||||||
if(Environment.get_moles_by_id(PLASMA) < min_tox)
|
if(Environment.gases[PLASMA] < min_tox)
|
||||||
atmos_suitable = 0
|
atmos_suitable = 0
|
||||||
|
|
||||||
if(max_tox)
|
if(max_tox)
|
||||||
if(Environment.get_moles_by_id(PLASMA) > max_tox)
|
if(Environment.gases[PLASMA] > max_tox)
|
||||||
atmos_suitable = 0
|
atmos_suitable = 0
|
||||||
toxins_alert = 1
|
toxins_alert = 1
|
||||||
else
|
else
|
||||||
toxins_alert = 0
|
toxins_alert = 0
|
||||||
|
|
||||||
if(min_n2)
|
if(min_n2)
|
||||||
if(Environment.get_moles_by_id(NITROGEN) < min_n2)
|
if(Environment.gases[NITROGEN] < min_n2)
|
||||||
atmos_suitable = 0
|
atmos_suitable = 0
|
||||||
|
|
||||||
if(max_n2)
|
if(max_n2)
|
||||||
if(Environment.get_moles_by_id(NITROGEN) > max_n2)
|
if(Environment.gases[NITROGEN] > max_n2)
|
||||||
atmos_suitable = 0
|
atmos_suitable = 0
|
||||||
|
|
||||||
if(min_co2)
|
if(min_co2)
|
||||||
if(Environment.get_moles_by_id(CARBON_DIOXIDE) < min_co2)
|
if(Environment.gases[CARBON_DIOXIDE] < min_co2)
|
||||||
atmos_suitable = 0
|
atmos_suitable = 0
|
||||||
|
|
||||||
if(max_co2)
|
if(max_co2)
|
||||||
if(Environment.get_moles_by_id(CARBON_DIOXIDE) > max_co2)
|
if(Environment.gases[CARBON_DIOXIDE] > max_co2)
|
||||||
atmos_suitable = 0
|
atmos_suitable = 0
|
||||||
|
|
||||||
//Atmos effect
|
//Atmos effect
|
||||||
@@ -598,4 +598,4 @@
|
|||||||
/mob/living/simple_animal/say_understands(var/mob/other,var/datum/language/speaking = null)
|
/mob/living/simple_animal/say_understands(var/mob/other,var/datum/language/speaking = null)
|
||||||
if(issilicon(other))
|
if(issilicon(other))
|
||||||
return 1
|
return 1
|
||||||
return ..()
|
return ..()
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
t += {"<span class='warning'> Temperature: [environment.temperature] \n</span>"}
|
t += {"<span class='warning'> Temperature: [environment.temperature] \n</span>"}
|
||||||
for(var/gasid in environment.gases)
|
for(var/gasid in environment.gases)
|
||||||
var/datum/gas/gas = environment.get_gas_by_id(gasid)
|
var/datum/gas/gas = environment.get_gas_by_id(gasid)
|
||||||
t += {"<span class='notice'> [gas.display_name]: [environment.get_moles_by_id(gasid)] \n</span>"}
|
t += {"<span class='notice'> [gas.display_name]: [environment.gases[gasid]] \n</span>"}
|
||||||
// END AUTOFIX
|
// END AUTOFIX
|
||||||
usr.show_message(t, 1)
|
usr.show_message(t, 1)
|
||||||
|
|
||||||
|
|||||||
@@ -75,8 +75,8 @@
|
|||||||
lastgen = 0
|
lastgen = 0
|
||||||
|
|
||||||
if(air1 && air2)
|
if(air1 && air2)
|
||||||
var/air1_heat_capacity = air1.heat_capacity()
|
var/air1_heat_capacity = air1.heat_capacity
|
||||||
var/air2_heat_capacity = air2.heat_capacity()
|
var/air2_heat_capacity = air2.heat_capacity
|
||||||
var/delta_temperature = abs(air2.temperature - air1.temperature)
|
var/delta_temperature = abs(air2.temperature - air1.temperature)
|
||||||
|
|
||||||
if(delta_temperature > 0 && air1_heat_capacity > 0 && air2_heat_capacity > 0)
|
if(delta_temperature > 0 && air1_heat_capacity > 0 && air2_heat_capacity > 0)
|
||||||
@@ -152,14 +152,14 @@
|
|||||||
// C:\Users\Rob\Documents\Projects\vgstation13\code\modules\power\generator.dm:142: t += "Output : [round(lastgen)] W<BR><BR>"
|
// C:\Users\Rob\Documents\Projects\vgstation13\code\modules\power\generator.dm:142: t += "Output : [round(lastgen)] W<BR><BR>"
|
||||||
t += {"Output : [round(lastgen)] W<BR>
|
t += {"Output : [round(lastgen)] W<BR>
|
||||||
<B>Primary Circulator (top or right)</B>
|
<B>Primary Circulator (top or right)</B>
|
||||||
Inlet Pressure: [round(circ1.air1.return_pressure(), 0.1)] kPa
|
Inlet Pressure: [round(circ1.air1.pressure, 0.1)] kPa
|
||||||
Inlet Temperature: [round(circ1.air1.temperature, 0.1)] K
|
Inlet Temperature: [round(circ1.air1.temperature, 0.1)] K
|
||||||
Outlet Pressure: [round(circ1.air2.return_pressure(), 0.1)] kPa
|
Outlet Pressure: [round(circ1.air2.pressure, 0.1)] kPa
|
||||||
Outlet Temperature: [round(circ1.air2.temperature, 0.1)] K<BR>
|
Outlet Temperature: [round(circ1.air2.temperature, 0.1)] K<BR>
|
||||||
<B>Secondary Circulator (bottom or left)</B><BR>
|
<B>Secondary Circulator (bottom or left)</B><BR>
|
||||||
Inlet Pressure: [round(circ2.air1.return_pressure(), 0.1)] kPa
|
Inlet Pressure: [round(circ2.air1.pressure, 0.1)] kPa
|
||||||
Inlet Temperature: [round(circ2.air1.temperature, 0.1)] K
|
Inlet Temperature: [round(circ2.air1.temperature, 0.1)] K
|
||||||
Outlet Pressure: [round(circ2.air2.return_pressure(), 0.1)] kPa
|
Outlet Pressure: [round(circ2.air2.pressure, 0.1)] kPa
|
||||||
Outlet Temperature: [round(circ2.air2.temperature, 0.1)] K<BR>"}
|
Outlet Temperature: [round(circ2.air2.temperature, 0.1)] K<BR>"}
|
||||||
// END AUTOFIX
|
// END AUTOFIX
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -41,8 +41,8 @@
|
|||||||
hot_air = air2
|
hot_air = air2
|
||||||
cold_air = air1
|
cold_air = air1
|
||||||
|
|
||||||
var/hot_air_heat_capacity = hot_air.heat_capacity()
|
var/hot_air_heat_capacity = hot_air.heat_capacity
|
||||||
var/cold_air_heat_capacity = cold_air.heat_capacity()
|
var/cold_air_heat_capacity = cold_air.heat_capacity
|
||||||
|
|
||||||
var/delta_temperature = hot_air.temperature - cold_air.temperature
|
var/delta_temperature = hot_air.temperature - cold_air.temperature
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
return {"<B>Cold Loop</B> ([dir2text(loop_dir)])
|
return {"<B>Cold Loop</B> ([dir2text(loop_dir)])
|
||||||
<ul>
|
<ul>
|
||||||
<li><b>Temperature:</b> [round(loop.air_contents.temperature, 0.1)] K</li>
|
<li><b>Temperature:</b> [round(loop.air_contents.temperature, 0.1)] K</li>
|
||||||
<li><b>Pressure:</b> [round(loop.air_contents.return_pressure(), 0.1)] kPa</li>
|
<li><b>Pressure:</b> [round(loop.air_contents.pressure, 0.1)] kPa</li>
|
||||||
</ul>"}
|
</ul>"}
|
||||||
|
|
||||||
/obj/machinery/power/generator/type2/interact(mob/user)
|
/obj/machinery/power/generator/type2/interact(mob/user)
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ var/global/list/rad_collectors = list()
|
|||||||
|
|
||||||
/obj/machinery/power/rad_collector/process()
|
/obj/machinery/power/rad_collector/process()
|
||||||
if (P)
|
if (P)
|
||||||
if (P.air_contents.get_moles_by_id(PLASMA) <= 0)
|
if (P.air_contents.gases[PLASMA] <= 0)
|
||||||
investigation_log(I_SINGULO,"<font color='red'>out of fuel</font>.")
|
investigation_log(I_SINGULO,"<font color='red'>out of fuel</font>.")
|
||||||
P.air_contents.adjust_gas(PLASMA, -P.air_contents.get_moles_by_id(PLASMA)) //set it to 0
|
P.air_contents.adjust_gas(PLASMA, -P.air_contents.gases[PLASMA]) //set it to 0
|
||||||
eject()
|
eject()
|
||||||
else if(!active)
|
else if(!active)
|
||||||
return
|
return
|
||||||
@@ -45,7 +45,7 @@ var/global/list/rad_collectors = list()
|
|||||||
toggle_power()
|
toggle_power()
|
||||||
user.visible_message("<span class='notice'>[user] turns the [src] [active? "on":"off"].</span>", \
|
user.visible_message("<span class='notice'>[user] turns the [src] [active? "on":"off"].</span>", \
|
||||||
"<span class='notice'>You turn the [src] [active? "on":"off"].</span>")
|
"<span class='notice'>You turn the [src] [active? "on":"off"].</span>")
|
||||||
investigation_log(I_SINGULO,"turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [user.key]. [P?"Fuel: [round(P.air_contents.get_moles_by_id(PLASMA)/0.29)]%":"<font color='red'>It is empty</font>"].")
|
investigation_log(I_SINGULO,"turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [user.key]. [P?"Fuel: [round(P.air_contents.gases[PLASMA]/0.29)]%":"<font color='red'>It is empty</font>"].")
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
user << "<span class='warning'>The controls are locked!</span>"
|
user << "<span class='warning'>The controls are locked!</span>"
|
||||||
@@ -127,7 +127,7 @@ var/global/list/rad_collectors = list()
|
|||||||
|
|
||||||
/obj/machinery/power/rad_collector/proc/receive_pulse(const/pulse_strength)
|
/obj/machinery/power/rad_collector/proc/receive_pulse(const/pulse_strength)
|
||||||
if (P && active)
|
if (P && active)
|
||||||
var/power_produced = P.air_contents.get_moles_by_id(PLASMA) * pulse_strength * 3.5 // original was 20, nerfed to 2 now 3.5 should get you about 500kw
|
var/power_produced = P.air_contents.gases[PLASMA] * pulse_strength * 3.5 // original was 20, nerfed to 2 now 3.5 should get you about 500kw
|
||||||
add_avail(power_produced)
|
add_avail(power_produced)
|
||||||
last_power = power_produced
|
last_power = power_produced
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
return
|
return
|
||||||
rpm = 0.9* rpm + 0.1 * rpmtarget
|
rpm = 0.9* rpm + 0.1 * rpmtarget
|
||||||
var/datum/gas_mixture/environment = inturf.return_air()
|
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/transfer_moles = rpm/10000*capacity
|
||||||
var/datum/gas_mixture/removed = inturf.remove_air(transfer_moles)
|
var/datum/gas_mixture/removed = inturf.remove_air(transfer_moles)
|
||||||
gas_contained.merge(removed)
|
gas_contained.merge(removed)
|
||||||
@@ -123,14 +123,14 @@
|
|||||||
lastgen = ((compressor.rpm / TURBGENQ)**TURBGENG) *TURBGENQ
|
lastgen = ((compressor.rpm / TURBGENQ)**TURBGENG) *TURBGENQ
|
||||||
|
|
||||||
add_avail(lastgen)
|
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)
|
newrpm = max(0, newrpm)
|
||||||
|
|
||||||
if(!compressor.starter || newrpm > 1000)
|
if(!compressor.starter || newrpm > 1000)
|
||||||
compressor.rpmtarget = newrpm
|
compressor.rpmtarget = newrpm
|
||||||
|
|
||||||
if(compressor.gas_contained.total_moles()>0)
|
if(compressor.gas_contained.total_moles>0)
|
||||||
var/oamount = min(compressor.gas_contained.total_moles(), (compressor.rpm+100)/35000*compressor.capacity)
|
var/oamount = min(compressor.gas_contained.total_moles, (compressor.rpm+100)/35000*compressor.capacity)
|
||||||
var/datum/gas_mixture/removed = compressor.gas_contained.remove(oamount)
|
var/datum/gas_mixture/removed = compressor.gas_contained.remove(oamount)
|
||||||
outturf.assume_air(removed)
|
outturf.assume_air(removed)
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
..()
|
..()
|
||||||
user << "<span class='info'>The valve is dialed to [pressure_setting]%.</span>"
|
user << "<span class='info'>The valve is dialed to [pressure_setting]%.</span>"
|
||||||
if(tank)
|
if(tank)
|
||||||
user << "<span class='info'>The tank dial reads [tank.air_contents.return_pressure()] kPa.</span>"
|
user << "<span class='info'>The tank dial reads [tank.air_contents.pressure] kPa.</span>"
|
||||||
else
|
else
|
||||||
user << "<span class='warning'>Nothing is attached to the tank valve!</span>"
|
user << "<span class='warning'>Nothing is attached to the tank valve!</span>"
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
if (!istype(targloc) || !istype(curloc))
|
if (!istype(targloc) || !istype(curloc))
|
||||||
return
|
return
|
||||||
|
|
||||||
var/fire_pressure = (tank.air_contents.return_pressure()/100)*pressure_setting
|
var/fire_pressure = (tank.air_contents.pressure/100)*pressure_setting
|
||||||
|
|
||||||
if (fire_pressure < minimum_tank_pressure)
|
if (fire_pressure < minimum_tank_pressure)
|
||||||
user << "There isn't enough gas in the tank to fire [src]."
|
user << "There isn't enough gas in the tank to fire [src]."
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ obj/item/projectile/kinetic/New()
|
|||||||
if(!istype(proj_turf, /turf))
|
if(!istype(proj_turf, /turf))
|
||||||
return
|
return
|
||||||
var/datum/gas_mixture/environment = proj_turf.return_air()
|
var/datum/gas_mixture/environment = proj_turf.return_air()
|
||||||
var/pressure = environment.return_pressure()
|
var/pressure = environment.pressure
|
||||||
if(pressure < 50)
|
if(pressure < 50)
|
||||||
name = "full strength kinetic force"
|
name = "full strength kinetic force"
|
||||||
damage = 30
|
damage = 30
|
||||||
|
|||||||
@@ -316,7 +316,7 @@
|
|||||||
|
|
||||||
var/hotspot = (locate(/obj/fire) in T)
|
var/hotspot = (locate(/obj/fire) in T)
|
||||||
if(hotspot && !istype(T, /turf/space))
|
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.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0)
|
||||||
lowertemp.react()
|
lowertemp.react()
|
||||||
T.assume_air(lowertemp)
|
T.assume_air(lowertemp)
|
||||||
@@ -328,7 +328,7 @@
|
|||||||
var/turf/T = get_turf(O)
|
var/turf/T = get_turf(O)
|
||||||
var/hotspot = (locate(/obj/fire) in T)
|
var/hotspot = (locate(/obj/fire) in T)
|
||||||
if(hotspot && !istype(T, /turf/space))
|
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.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0)
|
||||||
lowertemp.react()
|
lowertemp.react()
|
||||||
T.assume_air(lowertemp)
|
T.assume_air(lowertemp)
|
||||||
@@ -2889,7 +2889,7 @@
|
|||||||
T.wet(800)
|
T.wet(800)
|
||||||
var/hotspot = (locate(/obj/fire) in T)
|
var/hotspot = (locate(/obj/fire) in T)
|
||||||
if(hotspot)
|
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.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0)
|
||||||
lowertemp.react()
|
lowertemp.react()
|
||||||
T.assume_air(lowertemp)
|
T.assume_air(lowertemp)
|
||||||
|
|||||||
@@ -467,10 +467,8 @@ datum
|
|||||||
for(var/turf/simulated/floor/target_tile in range(0,location))
|
for(var/turf/simulated/floor/target_tile in range(0,location))
|
||||||
|
|
||||||
var/datum/gas_mixture/napalm = new
|
var/datum/gas_mixture/napalm = new
|
||||||
napalm.set_gas(VOLATILE_FUEL, created_volume, 0)
|
napalm.set_temperature(400+T0C)
|
||||||
|
napalm.set_gas(VOLATILE_FUEL, created_volume)
|
||||||
napalm.temperature = 400+T0C
|
|
||||||
napalm.update_values()
|
|
||||||
|
|
||||||
target_tile.assume_air(napalm)
|
target_tile.assume_air(napalm)
|
||||||
spawn (0) target_tile.hotspot_expose(700, 400,surfaces=1)
|
spawn (0) target_tile.hotspot_expose(700, 400,surfaces=1)
|
||||||
@@ -2541,4 +2539,4 @@ datum
|
|||||||
name = "Tide"
|
name = "Tide"
|
||||||
id = "greytea"
|
id = "greytea"
|
||||||
result = "greytea"
|
result = "greytea"
|
||||||
required_reagents = list("water" = 5, "fuel" = 5)
|
required_reagents = list("water" = 5, "fuel" = 5)
|
||||||
|
|||||||
@@ -216,7 +216,7 @@
|
|||||||
/obj/machinery/disposal/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
/obj/machinery/disposal/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||||
var/list/data[0]
|
var/list/data[0]
|
||||||
|
|
||||||
data["pressure"] = round(100 * air_contents.return_pressure() / (SEND_PRESSURE))
|
data["pressure"] = round(100 * air_contents.pressure / (SEND_PRESSURE))
|
||||||
data["flush"] = flush
|
data["flush"] = flush
|
||||||
data["mode"] = mode
|
data["mode"] = mode
|
||||||
data["isAI"] = isAI(user)
|
data["isAI"] = isAI(user)
|
||||||
@@ -325,7 +325,7 @@
|
|||||||
|
|
||||||
src.updateDialog()
|
src.updateDialog()
|
||||||
|
|
||||||
if(flush && air_contents.return_pressure() >= SEND_PRESSURE ) // flush can happen even without power
|
if(flush && air_contents.pressure >= SEND_PRESSURE ) // flush can happen even without power
|
||||||
spawn(0)
|
spawn(0)
|
||||||
flush()
|
flush()
|
||||||
|
|
||||||
@@ -343,7 +343,7 @@
|
|||||||
var/atom/L = loc // recharging from loc turf
|
var/atom/L = loc // recharging from loc turf
|
||||||
|
|
||||||
var/datum/gas_mixture/env = L.return_air()
|
var/datum/gas_mixture/env = L.return_air()
|
||||||
var/pressure_delta = (SEND_PRESSURE*1.01) - air_contents.return_pressure()
|
var/pressure_delta = (SEND_PRESSURE*1.01) - air_contents.pressure
|
||||||
|
|
||||||
if(env.temperature > 0)
|
if(env.temperature > 0)
|
||||||
var/transfer_moles = 0.1 * pressure_delta*air_contents.volume/(env.temperature * R_IDEAL_GAS_EQUATION)
|
var/transfer_moles = 0.1 * pressure_delta*air_contents.volume/(env.temperature * R_IDEAL_GAS_EQUATION)
|
||||||
@@ -354,7 +354,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// if full enough, switch to ready mode
|
// if full enough, switch to ready mode
|
||||||
if(air_contents.return_pressure() >= SEND_PRESSURE)
|
if(air_contents.pressure >= SEND_PRESSURE)
|
||||||
mode = 2
|
mode = 2
|
||||||
update_icon()
|
update_icon()
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -113,13 +113,13 @@
|
|||||||
var/datum/gas_mixture/env = L.return_air()
|
var/datum/gas_mixture/env = L.return_air()
|
||||||
if(env.temperature < (heat_amt+T0C))
|
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)
|
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||||
|
|
||||||
if(removed)
|
if(removed)
|
||||||
|
|
||||||
var/heat_capacity = removed.heat_capacity()
|
var/heat_capacity = removed.heat_capacity
|
||||||
if(heat_capacity == 0 || heat_capacity == null)
|
if(heat_capacity == 0 || heat_capacity == null)
|
||||||
heat_capacity = 1
|
heat_capacity = 1
|
||||||
removed.temperature = min((removed.temperature*heat_capacity + heating_power)/heat_capacity, 1000)
|
removed.temperature = min((removed.temperature*heat_capacity + heating_power)/heat_capacity, 1000)
|
||||||
|
|||||||
@@ -152,13 +152,13 @@ var/list/valid_secondary_effect_types = list(\
|
|||||||
else if(env.temperature > 375)
|
else if(env.temperature > 375)
|
||||||
trigger_hot = 1
|
trigger_hot = 1
|
||||||
|
|
||||||
if(env.get_moles_by_id(PLASMA) >= 10)
|
if(env.gases[PLASMA] >= 10)
|
||||||
trigger_plasma = 1
|
trigger_plasma = 1
|
||||||
if(env.get_moles_by_id(OXYGEN) >= 10)
|
if(env.gases[OXYGEN] >= 10)
|
||||||
trigger_oxy = 1
|
trigger_oxy = 1
|
||||||
if(env.get_moles_by_id(CARBON_DIOXIDE) >= 10)
|
if(env.gases[CARBON_DIOXIDE] >= 10)
|
||||||
trigger_co2 = 1
|
trigger_co2 = 1
|
||||||
if(env.get_moles_by_id(NITROGEN) >= 10)
|
if(env.gases[NITROGEN] >= 10)
|
||||||
trigger_nitro = 1
|
trigger_nitro = 1
|
||||||
|
|
||||||
//COLD ACTIVATION
|
//COLD ACTIVATION
|
||||||
|
|||||||
@@ -76,8 +76,8 @@
|
|||||||
temperature += heat_added/XENOARCH_HEAT_CAPACITY
|
temperature += heat_added/XENOARCH_HEAT_CAPACITY
|
||||||
|
|
||||||
var/temperature_difference = abs(environmental_temp-temperature)
|
var/temperature_difference = abs(environmental_temp-temperature)
|
||||||
var/datum/gas_mixture/removed = env.remove(env.total_moles()*0.25)
|
var/datum/gas_mixture/removed = env.remove(env.total_moles*0.25)
|
||||||
var/heat_capacity = removed.heat_capacity()
|
var/heat_capacity = removed.heat_capacity
|
||||||
|
|
||||||
heat_added = max(temperature_difference*heat_capacity, XENOARCH_MAX_ENERGY_TRANSFER)
|
heat_added = max(temperature_difference*heat_capacity, XENOARCH_MAX_ENERGY_TRANSFER)
|
||||||
|
|
||||||
|
|||||||
@@ -227,7 +227,7 @@
|
|||||||
damage = max( damage + ( (removed.temperature - 800) / 150 ) , 0 )
|
damage = max( damage + ( (removed.temperature - 800) / 150 ) , 0 )
|
||||||
//Ok, 100% oxygen atmosphere = best reaction
|
//Ok, 100% oxygen atmosphere = best reaction
|
||||||
//Maxes out at 100% oxygen pressure
|
//Maxes out at 100% oxygen pressure
|
||||||
oxygen = Clamp((removed.get_moles_by_id(OXYGEN) - (removed.get_moles_by_id(NITROGEN) * NITROGEN_RETARDATION_FACTOR)) / MOLES_CELLSTANDARD, 0, 1)
|
oxygen = Clamp((removed.gases[OXYGEN] - (removed.gases[NITROGEN] * NITROGEN_RETARDATION_FACTOR)) / MOLES_CELLSTANDARD, 0, 1)
|
||||||
|
|
||||||
var/temp_factor = 100
|
var/temp_factor = 100
|
||||||
|
|
||||||
@@ -253,16 +253,14 @@
|
|||||||
|
|
||||||
//Also keep in mind we are only adding this temperature to (efficiency)% of the one tile the rock
|
//Also keep in mind we are only adding this temperature to (efficiency)% of the one tile the rock
|
||||||
//is on. An increase of 4*C @ 25% efficiency here results in an increase of 1*C / (#tilesincore) overall.
|
//is on. An increase of 4*C @ 25% efficiency here results in an increase of 1*C / (#tilesincore) overall.
|
||||||
removed.temperature += (device_energy / THERMAL_RELEASE_MODIFIER)
|
removed.set_temperature(removed.temperature + (device_energy / THERMAL_RELEASE_MODIFIER))
|
||||||
|
|
||||||
removed.temperature = max(0, min(removed.temperature, 2500))
|
removed.set_temperature(Clamp(removed.temperature, 0, 2500))
|
||||||
|
|
||||||
//Calculate how much gas to release
|
//Calculate how much gas to release
|
||||||
removed.adjust_gas(PLASMA, max(device_energy / PLASMA_RELEASE_MODIFIER, 0), 0) //last 0 means don't update yet
|
removed.adjust_gas(PLASMA, max(device_energy / PLASMA_RELEASE_MODIFIER, 0))
|
||||||
|
|
||||||
removed.adjust_gas(OXYGEN, max((device_energy + removed.temperature - T0C) / OXYGEN_RELEASE_MODIFIER, 0), 0)
|
removed.adjust_gas(OXYGEN, max((device_energy + removed.temperature - T0C) / OXYGEN_RELEASE_MODIFIER, 0))
|
||||||
|
|
||||||
removed.update_values()
|
|
||||||
|
|
||||||
env.merge(removed)
|
env.merge(removed)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user