diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index fa8b485ed8c..4460d6a1a20 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -155,7 +155,7 @@ Pipelines + Other Objects -> Pipe network var/datum/gas_mixture/int_air = return_air() var/datum/gas_mixture/env_air = loc.return_air() 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)) user << "You begin to open the pressure release valve on the pipe..." if(do_after(user, 50)) diff --git a/code/ATMOSPHERICS/components/binary_devices/circulator.dm b/code/ATMOSPHERICS/components/binary_devices/circulator.dm index c3e27234cbc..3852918de5b 100644 --- a/code/ATMOSPHERICS/components/binary_devices/circulator.dm +++ b/code/ATMOSPHERICS/components/binary_devices/circulator.dm @@ -25,8 +25,8 @@ /obj/machinery/atmospherics/binary/circulator/proc/return_transfer_air() var/datum/gas_mixture/removed if(anchored && !(stat&BROKEN) ) - var/input_starting_pressure = air1.return_pressure() - var/output_starting_pressure = air2.return_pressure() + var/input_starting_pressure = air1.pressure + var/output_starting_pressure = air2.pressure 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) @@ -38,7 +38,7 @@ //Actually transfer the gas removed = air1.remove(recent_moles_transferred) if(removed) - last_heat_capacity = removed.heat_capacity() + last_heat_capacity = removed.heat_capacity last_temperature = removed.temperature //Update the gas networks. diff --git a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm index 4dc3f31a817..6493435f05b 100644 --- a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm @@ -73,7 +73,7 @@ return var/datum/gas_mixture/environment = loc.return_air() - var/environment_pressure = environment.return_pressure() + var/environment_pressure = environment.pressure if(pump_direction) //input -> external var/pressure_delta = 10000 @@ -81,7 +81,7 @@ if(pressure_checks&1) pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure)) 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(air1.temperature > 0) @@ -100,7 +100,7 @@ if(pressure_checks&1) pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound)) 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(environment.temperature > 0) diff --git a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm index c8827405ef3..9c6839ad1a2 100644 --- a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm +++ b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm @@ -33,8 +33,8 @@ if(!on) return - var/output_starting_pressure = air2.return_pressure() - var/input_starting_pressure = air1.return_pressure() + var/output_starting_pressure = air2.pressure + var/input_starting_pressure = air1.pressure 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 @@ -42,7 +42,7 @@ return //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) //Can not have a pressure delta that would cause output_pressure > input_pressure diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm index 23c25451c1d..1830c294fed 100644 --- a/code/ATMOSPHERICS/components/binary_devices/pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm @@ -55,14 +55,14 @@ Thus, the two variables affect pump operation are set in New(): if((stat & (NOPOWER|BROKEN)) || !on) return - var/output_starting_pressure = air2.return_pressure() + var/output_starting_pressure = air2.pressure if( (target_pressure - output_starting_pressure) < 0.01) //No need to pump gas if target is already reached! return //Calculate necessary moles to transfer using PV=nRT - if((air1.total_moles() > 0) && (air1.temperature>0)) + if((air1.total_moles > 0) && (air1.temperature>0)) var/pressure_delta = target_pressure - output_starting_pressure var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION) diff --git a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm index 84c7236ee04..5fe5a558583 100644 --- a/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/volume_pump.dm @@ -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 - var/input_starting_pressure = air1.return_pressure() - var/output_starting_pressure = air2.return_pressure() + var/input_starting_pressure = air1.pressure + var/output_starting_pressure = air2.pressure if((input_starting_pressure < 0.01) || (output_starting_pressure > 9000)) return diff --git a/code/ATMOSPHERICS/components/trinary_devices/filter.dm b/code/ATMOSPHERICS/components/trinary_devices/filter.dm index a6128d42f09..145d94f6913 100755 --- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm @@ -58,9 +58,9 @@ obj/machinery/atmospherics/trinary/filter/process() if(!on) 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! return @@ -104,7 +104,7 @@ obj/machinery/atmospherics/trinary/filter/process() filtered_out = null 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) air2.merge(filtered_out) diff --git a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm index a1975011d7c..a11ad653e51 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm @@ -40,7 +40,7 @@ obj/machinery/atmospherics/trinary/mixer/process() if(!on) return - var/output_starting_pressure = air3.return_pressure() + var/output_starting_pressure = air3.pressure if(output_starting_pressure >= target_pressure) //No need to mix if target is already full! @@ -58,8 +58,8 @@ obj/machinery/atmospherics/trinary/mixer/process() if(air2.temperature > 0) transfer_moles2 = (node2_concentration*pressure_delta)*air3.volume/(air2.temperature * R_IDEAL_GAS_EQUATION) - var/air1_moles = air1.total_moles() - var/air2_moles = air2.total_moles() + var/air1_moles = air1.total_moles + var/air2_moles = air2.total_moles if((air1_moles < transfer_moles1) || (air2_moles < transfer_moles2)) if(!transfer_moles1 || !transfer_moles2) return diff --git a/code/ATMOSPHERICS/components/unary/cold_sink.dm b/code/ATMOSPHERICS/components/unary/cold_sink.dm index ebe794ba8b2..0ee7244eb49 100644 --- a/code/ATMOSPHERICS/components/unary/cold_sink.dm +++ b/code/ATMOSPHERICS/components/unary/cold_sink.dm @@ -26,7 +26,7 @@ . = ..() if(!on || !network) 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/old_temperature = air_contents.temperature diff --git a/code/ATMOSPHERICS/components/unary/heat_exchanger.dm b/code/ATMOSPHERICS/components/unary/heat_exchanger.dm index 82ddb66a70e..7065fd91824 100644 --- a/code/ATMOSPHERICS/components/unary/heat_exchanger.dm +++ b/code/ATMOSPHERICS/components/unary/heat_exchanger.dm @@ -38,8 +38,8 @@ update_cycle = air_master.current_cycle partner.update_cycle = air_master.current_cycle - var/air_heat_capacity = air_contents.heat_capacity() - var/other_air_heat_capacity = partner.air_contents.heat_capacity() + var/air_heat_capacity = 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/old_temperature = air_contents.temperature diff --git a/code/ATMOSPHERICS/components/unary/heat_source.dm b/code/ATMOSPHERICS/components/unary/heat_source.dm index f95e457cda9..97b117a58f0 100644 --- a/code/ATMOSPHERICS/components/unary/heat_source.dm +++ b/code/ATMOSPHERICS/components/unary/heat_source.dm @@ -28,7 +28,7 @@ . = ..() if(!on) 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/old_temperature = air_contents.temperature diff --git a/code/ATMOSPHERICS/components/unary/outlet_injector.dm b/code/ATMOSPHERICS/components/unary/outlet_injector.dm index 16a4c47626f..7fe3833eb52 100644 --- a/code/ATMOSPHERICS/components/unary/outlet_injector.dm +++ b/code/ATMOSPHERICS/components/unary/outlet_injector.dm @@ -45,7 +45,7 @@ return 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) @@ -63,7 +63,7 @@ injecting = 1 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) diff --git a/code/ATMOSPHERICS/components/unary/oxygen_generator.dm b/code/ATMOSPHERICS/components/unary/oxygen_generator.dm index 0380ed72228..c3d82f10c07 100644 --- a/code/ATMOSPHERICS/components/unary/oxygen_generator.dm +++ b/code/ATMOSPHERICS/components/unary/oxygen_generator.dm @@ -33,10 +33,10 @@ obj/machinery/atmospherics/unary/oxygen_generator/process() if(!on) return - var/total_moles = air_contents.total_moles() + var/total_moles = air_contents.total_moles if(total_moles < oxygen_content) - var/current_heat_capacity = air_contents.heat_capacity() + var/current_heat_capacity = air_contents.heat_capacity var/added_oxygen = oxygen_content - total_moles diff --git a/code/ATMOSPHERICS/components/unary/thermal_plate.dm b/code/ATMOSPHERICS/components/unary/thermal_plate.dm index 8b066480bf8..15855d3ccdd 100644 --- a/code/ATMOSPHERICS/components/unary/thermal_plate.dm +++ b/code/ATMOSPHERICS/components/unary/thermal_plate.dm @@ -26,26 +26,26 @@ //Get processable air sample and thermal info from environment - var/transfer_moles = 0.25 * environment.total_moles() + var/transfer_moles = 0.25 * environment.total_moles var/datum/gas_mixture/external_removed = environment.remove(transfer_moles) if (!external_removed) return radiate() - if (external_removed.total_moles() < 10) + if (external_removed.total_moles < 10) return radiate() //Get same info from connected gas - var/internal_transfer_moles = 0.25 * air_contents.total_moles() + var/internal_transfer_moles = 0.25 * air_contents.total_moles var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles) if (!internal_removed) environment.merge(external_removed) return - 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_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 if(!combined_heat_capacity) combined_heat_capacity = 1 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 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) if (!internal_removed) return - 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_heat_capacity = internal_removed.heat_capacity + RADIATION_CAPACITY + var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity + (RADIATION_CAPACITY * 6.4) var/final_temperature = combined_energy / combined_heat_capacity diff --git a/code/ATMOSPHERICS/components/unary/vent_pump.dm b/code/ATMOSPHERICS/components/unary/vent_pump.dm index b7b0270686d..e7ce13a3b0c 100644 --- a/code/ATMOSPHERICS/components/unary/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm @@ -93,7 +93,7 @@ if(!loc) return var/datum/gas_mixture/environment = loc.return_air() - var/environment_pressure = environment.return_pressure() + var/environment_pressure = environment.pressure if(pump_direction) //internal -> external var/pressure_delta = 10000 @@ -101,7 +101,7 @@ if(pressure_checks&1) pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure)) 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(air_contents.temperature > 0) @@ -119,7 +119,7 @@ if(pressure_checks&1) pressure_delta = min(pressure_delta, (environment_pressure - external_pressure_bound)) 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(environment.temperature > 0) diff --git a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm index 26c841d53ec..4f1a9fd8e7c 100644 --- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm @@ -124,7 +124,7 @@ if(scrubbing) 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 var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) @@ -137,15 +137,13 @@ if(!(gasid in scrubbing_gases)) continue - filtered_out.adjust_gas(gasid, removed.get_moles_by_id(gasid), 0) //move to filtered - removed.set_gas(gasid, 0, 0) //set to 0 + filtered_out.adjust_gas(gasid, removed.gases[gasid]) //move to filtered + removed.set_gas(gasid, 0) //set to 0 //Filter it - filtered_out.temperature = removed.temperature + filtered_out.set_temperature(removed.temperature) - filtered_out.update_values() - removed.update_values() //Remix the resulting gases air_contents.merge(filtered_out) @@ -156,10 +154,10 @@ network.update = 1 else //Just siphoning all air - if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE) + if (air_contents.pressure>=50*ONE_ATMOSPHERE) return - var/transfer_moles = environment.total_moles()*(volume_rate/environment.volume) + var/transfer_moles = environment.total_moles*(volume_rate/environment.volume) var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) diff --git a/code/ATMOSPHERICS/datum_pipe_network.dm b/code/ATMOSPHERICS/datum_pipe_network.dm index c4684db917f..10f6ffdfb25 100644 --- a/code/ATMOSPHERICS/datum_pipe_network.dm +++ b/code/ATMOSPHERICS/datum_pipe_network.dm @@ -107,13 +107,13 @@ for(var/datum/gas_mixture/gas in gases) 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_heat_capacity += temp_heatcap air_transient.add(gas) - air_transient.volume = air_transient_volume + air_transient.set_volume(air_transient_volume) if(air_transient_volume > 0) @@ -134,9 +134,6 @@ gas.copy_from(air_transient) gas.multiply(volume_ratio) - gas.update_values() - - air_transient.update_values() return 1 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) total_volume += gas.volume - total_thermal_energy += gas.temperature*gas.heat_capacity() + total_thermal_energy += gas.temperature*gas.heat_capacity total.add(gas) @@ -158,17 +155,16 @@ proc/equalize_gases(list/datum/gas_mixture/gases) //Calculate temperature var/temperature = 0 - if(total.heat_capacity() > 0) - temperature = total_thermal_energy/total.heat_capacity() + if(total.heat_capacity > 0) + temperature = total_thermal_energy/total.heat_capacity //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 - var/total_gas = total.get_moles_by_id(gasid) + var/total_gas = total.gases[gasid] 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 - gas_mix.temperature = temperature - gas_mix.update_values() + gas_mix.set_temperature(temperature) return 1 \ No newline at end of file diff --git a/code/ATMOSPHERICS/datum_pipeline.dm b/code/ATMOSPHERICS/datum_pipeline.dm index d5e1cf1843b..4f0453a65eb 100644 --- a/code/ATMOSPHERICS/datum_pipeline.dm +++ b/code/ATMOSPHERICS/datum_pipeline.dm @@ -29,7 +29,7 @@ /datum/pipeline/proc/process()//This use to be called called from the pipe networks if((world.timeofday - last_pressure_check) / 10 >= PRESSURE_CHECK_DELAY) //Check to see if pressure is within acceptable limits - var/pressure = air.return_pressure() + var/pressure = air.pressure if(pressure > alert_pressure) for(var/obj/machinery/atmospherics/pipe/member in members) if(!member.check_pressure(pressure)) @@ -46,13 +46,11 @@ for(var/obj/machinery/atmospherics/pipe/member in members) 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.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) var/list/possible_expansions = list(base) @@ -69,6 +67,8 @@ else air = new + air.set_volume(volume) + while(possible_expansions.len>0) for(var/obj/machinery/atmospherics/pipe/borderline in possible_expansions) @@ -96,9 +96,6 @@ possible_expansions -= borderline - air.volume = volume - air.update_values() - /datum/pipeline/proc/network_expand(datum/pipe_network/new_network, obj/machinery/atmospherics/pipe/reference) if(new_network.line_members.Find(src)) @@ -160,7 +157,7 @@ network.update = 1 /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) if(istype(target, /turf/simulated)) @@ -183,10 +180,10 @@ if(modeled_location.zone) 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 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/sharer_temperature_delta = 0 diff --git a/code/ATMOSPHERICS/he_pipes.dm b/code/ATMOSPHERICS/he_pipes.dm index 37d44d2c9e9..f3b58357d08 100644 --- a/code/ATMOSPHERICS/he_pipes.dm +++ b/code/ATMOSPHERICS/he_pipes.dm @@ -56,12 +56,12 @@ // Get gas from pipenet 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) //Get processable air sample and thermal info from environment 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) // No environmental gas? We radiate it, then. @@ -71,7 +71,7 @@ return 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) internal.merge(internal_removed) environment.merge(external_removed) @@ -83,8 +83,8 @@ return //Get same info from connected gas - 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_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 if(!combined_heat_capacity) combined_heat_capacity = 1 @@ -103,14 +103,14 @@ /obj/machinery/atmospherics/pipe/simple/heat_exchanging/proc/radiate() 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) if (!internal_removed) return - 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_heat_capacity = internal_removed.heat_capacity + RADIATION_CAPACITY + var/combined_energy = internal_removed.temperature * internal_removed.heat_capacity + (RADIATION_CAPACITY * ENERGY_MULT) var/final_temperature = combined_energy / combined_heat_capacity diff --git a/code/ATMOSPHERICS/hvac/chiller.dm b/code/ATMOSPHERICS/hvac/chiller.dm index 0e4af4c1e82..e881af106ba 100644 --- a/code/ATMOSPHERICS/hvac/chiller.dm +++ b/code/ATMOSPHERICS/hvac/chiller.dm @@ -93,11 +93,11 @@ var/turf/simulated/L = loc if(istype(L)) 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) if(removed) 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/old_temperature = removed.temperature diff --git a/code/ATMOSPHERICS/hvac/spaceheater.dm b/code/ATMOSPHERICS/hvac/spaceheater.dm index 8934b3f1edb..51e7dff78e1 100644 --- a/code/ATMOSPHERICS/hvac/spaceheater.dm +++ b/code/ATMOSPHERICS/hvac/spaceheater.dm @@ -165,7 +165,7 @@ var/datum/gas_mixture/env = L.return_air() if(env.temperature != set_temperature + T0C) - var/transfer_moles = 0.25 * env.total_moles() + var/transfer_moles = 0.25 * env.total_moles var/datum/gas_mixture/removed = env.remove(transfer_moles) @@ -173,7 +173,7 @@ if(removed) - var/heat_capacity = removed.heat_capacity() + var/heat_capacity = removed.heat_capacity //world << "heating ([heat_capacity])" if(heat_capacity) // Added check to avoid divide by zero (oshi-) runtime errors -- TLE if(removed.temperature < set_temperature + T0C) diff --git a/code/ATMOSPHERICS/pipes.dm b/code/ATMOSPHERICS/pipes.dm index 542b3f3fc44..9009b4b9f38 100644 --- a/code/ATMOSPHERICS/pipes.dm +++ b/code/ATMOSPHERICS/pipes.dm @@ -198,7 +198,7 @@ // 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/pressure_difference = pressure - environment.return_pressure() + var/pressure_difference = pressure - environment.pressure // Burst check first. if(pressure_difference > maximum_pressure && prob(1)) diff --git a/code/WorkInProgress/Cael_Aislinn/Rust/core_field.dm b/code/WorkInProgress/Cael_Aislinn/Rust/core_field.dm index 9fbd1f8a5c0..8c16db8d785 100644 --- a/code/WorkInProgress/Cael_Aislinn/Rust/core_field.dm +++ b/code/WorkInProgress/Cael_Aislinn/Rust/core_field.dm @@ -135,25 +135,24 @@ Deuterium-tritium fusion: 4.5 x 10^7 K //add plasma from the surrounding environment 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 //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 (?) //have a max of 1000 moles suspended 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 << "moles_covered: [moles_covered]" // var/datum/gas_mixture/gas_covered = environment.remove(moles_covered) 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 << "[plasma_captured.toxins] moles of plasma captured" - plasma_captured.temperature = gas_covered.temperature - plasma_captured.update_values() + plasma_captured.set_temperature(gas_covered.temperature) // - 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) // @@ -172,7 +171,7 @@ Deuterium-tritium fusion: 4.5 x 10^7 K //change held plasma temp according to energy levels //SPECIFIC_HEAT_TOXIN 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 held_plasma.temperature = (heat_capacity + mega_energy * 35000)/heat_capacity diff --git a/code/WorkInProgress/pomf/spacepods/spacepods.dm b/code/WorkInProgress/pomf/spacepods/spacepods.dm index d6336f4f354..c167aade0bc 100644 --- a/code/WorkInProgress/pomf/spacepods/spacepods.dm +++ b/code/WorkInProgress/pomf/spacepods/spacepods.dm @@ -263,21 +263,21 @@ /obj/spacepod/proc/return_pressure() . = 0 if(use_internal_tank) - . = cabin_air.return_pressure() + . = cabin_air.pressure else var/datum/gas_mixture/t_air = get_turf_air() if(t_air) - . = t_air.return_pressure() + . = t_air.pressure return /obj/spacepod/proc/return_temperature() . = 0 if(use_internal_tank) - . = cabin_air.return_temperature() + . = cabin_air.temperature else var/datum/gas_mixture/t_air = get_turf_air() if(t_air) - . = t_air.return_temperature() + . = t_air.temperature return /obj/spacepod/proc/moved_inside(var/mob/living/carbon/human/H as mob) @@ -366,7 +366,7 @@ delay = 20 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 spacepod.cabin_air.temperature -= max(-10, min(10, round(delta/4,0.1))) return @@ -380,21 +380,21 @@ var/datum/gas_mixture/cabin_air = spacepod.cabin_air var/release_pressure = ONE_ATMOSPHERE - var/cabin_pressure = cabin_air.return_pressure() - var/pressure_delta = min(release_pressure - cabin_pressure, (tank_air.return_pressure() - cabin_pressure)/2) + var/cabin_pressure = cabin_air.pressure + var/pressure_delta = min(release_pressure - cabin_pressure, (tank_air.pressure - cabin_pressure)/2) var/transfer_moles = 0 if(pressure_delta > 0) //cabin pressure lower than release pressure - if(tank_air.return_temperature() > 0) - transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION) + if(tank_air.temperature > 0) + transfer_moles = pressure_delta*cabin_air.volume/(cabin_air.temperature * R_IDEAL_GAS_EQUATION) var/datum/gas_mixture/removed = tank_air.remove(transfer_moles) cabin_air.merge(removed) else if(pressure_delta < 0) //cabin pressure higher than release pressure var/datum/gas_mixture/t_air = spacepod.get_turf_air() pressure_delta = cabin_pressure - release_pressure 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 - transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION) + transfer_moles = pressure_delta*cabin_air.volume/(cabin_air.temperature * R_IDEAL_GAS_EQUATION) var/datum/gas_mixture/removed = cabin_air.remove(transfer_moles) if(t_air) t_air.merge(removed) diff --git a/code/ZAS/Airflow.dm b/code/ZAS/Airflow.dm index 66497632826..85a5e941b85 100644 --- a/code/ZAS/Airflow.dm +++ b/code/ZAS/Airflow.dm @@ -118,7 +118,7 @@ obj/item/check_airflow_movable(n) proc/Airflow(zone/A, zone/B) 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. if(abs(n) < zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) return @@ -199,7 +199,7 @@ proc/AirflowSpace(zone/A) spawn() //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. if(n < zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) return diff --git a/code/ZAS/ConnectionGroup.dm b/code/ZAS/ConnectionGroup.dm index 692c29daa02..71f751b22b8 100644 --- a/code/ZAS/ConnectionGroup.dm +++ b/code/ZAS/ConnectionGroup.dm @@ -182,7 +182,7 @@ Class Procs: air_master.mark_zone_update(B) //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 var/list/attracted @@ -241,7 +241,7 @@ Class Procs: ShareSpace(A.air,air,dbg_out) 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 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] //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) @@ -267,21 +267,17 @@ proc/ShareRatio(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles) ratio = sharing_lookup_table[connecting_tiles] //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) - var/A_moles = A.get_moles_by_id(gasid) - var/B_moles = B.get_moles_by_id(gasid) + var/A_moles = A.gases[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) - 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 - B.set_gas(gasid, avg_gas + ((B_moles - avg_gas) * (1 - ratio)), 0) - - - 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() + 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))) return A.compare(B) @@ -303,7 +299,7 @@ proc/ShareSpace(datum/gas_mixture/A, list/unsimulated_tiles, dbg_output) tileslen = avg_unsim.group_multiplier 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)) 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/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 - 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()) + 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) 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] @@ -345,28 +341,26 @@ proc/ShareSpace(datum/gas_mixture/A, list/unsimulated_tiles, dbg_output) world << "Ratio: [ratio]" //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) - var/gas_moles = A.get_moles_by_id(gasid) - var/avg_gas = (gas_moles + unsim_mix.get_moles_by_id(gasid)*share_size) / (size + share_size) + var/gas_moles = A.gases[gasid] + 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.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() - - if(dbg_output) world << "Result: [abs(old_pressure - A.return_pressure())] kPa" - - return abs(old_pressure - A.return_pressure()) + return abs(old_pressure - A.pressure) proc/ShareHeat(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles) //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/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(energy_delta < 0) maximum_energy_delta *= -1 energy_delta = maximum_energy_delta - A.temperature -= energy_delta / (A.heat_capacity() * A.group_multiplier) - B.temperature += energy_delta / (B.heat_capacity() * B.group_multiplier) \ No newline at end of file + A.temperature -= energy_delta / (A.heat_capacity * A.group_multiplier) + B.temperature += energy_delta / (B.heat_capacity * B.group_multiplier) \ No newline at end of file diff --git a/code/ZAS/Controller.dm b/code/ZAS/Controller.dm index ed53ed802cd..e85a00773c8 100644 --- a/code/ZAS/Controller.dm +++ b/code/ZAS/Controller.dm @@ -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() 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 1 diff --git a/code/ZAS/Diagnostic.dm b/code/ZAS/Diagnostic.dm index 863e5023842..09443f7c4ae 100644 --- a/code/ZAS/Diagnostic.dm +++ b/code/ZAS/Diagnostic.dm @@ -18,11 +18,11 @@ client/proc/Zone_Info(turf/T as null|turf) else mob << "No zone here." 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 = "" for(var/gasid in mix.gases) 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 else if(zone_debug_images) @@ -112,8 +112,8 @@ client/proc/Test_ZAS_Connection(var/turf/simulated/T as turf) client << "Plasma: [air.toxins]" client << "Carbon Dioxide: [air.carbon_dioxide]" client << "Temperature: [air.temperature] K" - client << "Heat Energy: [air.temperature * air.heat_capacity()] J" - client << "Pressure: [air.return_pressure()] KPa" + client << "Heat Energy: [air.temperature * air.heat_capacity] J" + client << "Pressure: [air.pressure] KPa" client << "" client << "Unsimulated Zone(space/catwalk) Tiles: [length(unsimulated_tiles)]" client << "Movable Objects: [length(movables())]" diff --git a/code/ZAS/Fire.dm b/code/ZAS/Fire.dm index ec56e7af9c7..096a8ecd4ab 100644 --- a/code/ZAS/Fire.dm +++ b/code/ZAS/Fire.dm @@ -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 //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. 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 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) - 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. - S.fire_act(air_contents, air_contents.temperature, air_contents.return_volume()) + S.fire_act(air_contents, air_contents.temperature, air_contents.volume) //spread for(var/direction in cardinal) @@ -254,7 +254,7 @@ turf/simulated/apply_fire_protection() for(var/gasid in gases) var/datum/gas/gas = get_gas_by_id(gasid) if(gas.isFuel()) - total_fuel += get_moles_by_id(gasid) + total_fuel += gases[gasid] return total_fuel /datum/gas_mixture/proc/get_gas_oxidiser() @@ -262,7 +262,7 @@ turf/simulated/apply_fire_protection() for(var/gasid in gases) var/datum/gas/gas = get_gas_by_id(gasid) if(gas.isOxidiser()) - total_oxidiser += get_moles_by_id(gasid) + total_oxidiser += gases[gasid] return total_oxidiser 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 //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 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) var/datum/gas/current_gas = get_gas_by_id(gasid) 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 for(var/gasid in gases) var/datum/gas/current_gas = get_gas_by_id(gasid) 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(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) //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 return value @@ -406,7 +405,7 @@ datum/gas_mixture/proc/calculate_firelevel(var/turf/T) if(total_fuel > 0 && total_oxidiser > 0) //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 var/mix_multiplier = 1 / (1 + (5 * ((total_oxidiser / total_combustables) ** 2))) // Thanks, Mloc //toss everything together diff --git a/code/ZAS/Plasma.dm b/code/ZAS/Plasma.dm index 37c6d77cd85..c6d5967bef4 100644 --- a/code/ZAS/Plasma.dm +++ b/code/ZAS/Plasma.dm @@ -124,6 +124,6 @@ var/image/contamination_overlay = image('icons/effects/contamination.dmi') if(istype(I) && zas_settings.Get(/datum/ZAS_Setting/CLOTH_CONTAMINATION)) 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()) I.contaminate() diff --git a/code/ZAS/Turf.dm b/code/ZAS/Turf.dm index 5878493c711..a2586539d08 100644 --- a/code/ZAS/Turf.dm +++ b/code/ZAS/Turf.dm @@ -207,8 +207,7 @@ if(!air) make_air() - air.temperature = temperature - air.update_values() + air.set_temperature(temperature) return air diff --git a/code/ZAS/Zone.dm b/code/ZAS/Zone.dm index cf5167a15fd..6d63f4644cd 100644 --- a/code/ZAS/Zone.dm +++ b/code/ZAS/Zone.dm @@ -131,10 +131,10 @@ Class Procs: var/gas_message = "" for(var/gasid in air.gases) 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 << "P: [air.return_pressure()] kPa V: [air.volume]L T: [air.temperature]°K ([air.temperature - T0C]°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 << "P: [air.pressure] kPa V: [air.volume]L T: [air.temperature]°K ([air.temperature - T0C]°C)" + 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 << "Unsimulated: [unsimulated_contents.len]" //M << "Edges: [edges.len]" @@ -147,7 +147,7 @@ Class Procs: else space_edges++ space_coefficient += E.coefficient - M << "[E:air:return_pressure()]kPa" + M << "[E:air:pressure]kPa" M << "Zone Edges: [zone_edges]" M << "Space Edges: [space_edges] ([space_coefficient] connections)" diff --git a/code/ZAS/_gas_datum.dm b/code/ZAS/_gas_datum.dm index 8d0f0e388bc..0bef446f2db 100644 --- a/code/ZAS/_gas_datum.dm +++ b/code/ZAS/_gas_datum.dm @@ -1,4 +1,5 @@ var/global/list/gas_datum_list +var/global/list/gas_specific_heat /datum/gas var/display_name = "" diff --git a/code/ZAS/_gas_mixture.dm b/code/ZAS/_gas_mixture.dm index 574129a22de..6af6608cedc 100644 --- a/code/ZAS/_gas_mixture.dm +++ b/code/ZAS/_gas_mixture.dm @@ -49,6 +49,8 @@ What are the archived variables for? var/pressure=0 + var/heat_capacity = 0 + var/list/gases //stores all the gas numbers for this mixture var/list/archived_gases //archiving! @@ -65,6 +67,7 @@ What are the archived variables for? for(var/newgas in (typesof(/datum/gas) - /datum/gas)) 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_specific_heat = list(new_datum_gas.gas_id = new_datum_gas.specific_heat) for(var/gasid in gas_datum_list) //initialise the gases themselves gases += list("[gasid]" = 0) @@ -78,18 +81,6 @@ What are the archived variables for? else 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 //Call it with negative numbers to remove gases. @@ -101,147 +92,97 @@ What are the archived variables for? //Outputs: null 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 - update_values() + adjust_gas(a_gas, adjusts[a_gas], 0) 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 -/datum/gas_mixture/proc/adjust_gas(gasid, moles, update = 1, use_group = 1) - if(moles == 0) - return - - if(!(gasid in gases)) +//supports negative values +/datum/gas_mixture/proc/adjust_gas(gasid, moles, use_group = 1) + if(moles == 0 || !(gasid in gases)) return if(group_multiplier != 1 && use_group) - gases[gasid] = max(0, gases[gasid] + moles/group_multiplier) + set_gas(gasid, gases[gasid] + moles/group_multiplier) else - gases[gasid] = max(0, gases[gasid] + moles) + set_gas(gasid, gases[gasid] + moles) - - if(update) - update_values() - -//Sets the value of a gas -/datum/gas_mixture/proc/set_gas(gasid, moles, update = 1) - if(!(gasid in gases)) +//Sets the value of a gas using a gas string and a mole number +//Note: this should be the only way in which gas numbers should ever be edited +//The gas system must be airtight - never bypass this +/datum/gas_mixture/proc/set_gas(gasid, moles) + if(!(gasid in gases) || moles < 0) return + var/old_moles = gases[gasid] + gases[gasid] = max(0, moles) - if(update) - update_values() - -/* -/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) - + pressure += ((moles - old_moles) * R_IDEAL_GAS_EQUATION * temperature) / volume //add the maths of the new gas + heat_capacity += (moles - old_moles) * gas_specific_heat[gasid] + total_moles += (moles - old_moles) /datum/gas_mixture/proc/thermal_energy() - return temperature*heat_capacity() + return temperature*heat_capacity /////////////////////////////// //PV=nRT - related procedures// /////////////////////////////// -/datum/gas_mixture/proc/heat_capacity() - //Purpose: Returning the heat capacity of the gas mix +/datum/gas_mixture/proc/set_temperature(var/new_temperature) + //Purpose: Changes the temperature of a gas_mixture //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 - var/heat_capacity + var/hc_current - for(var/gasid in gases) - var/datum/gas/gas = get_gas_by_id(gasid) - heat_capacity += get_moles_by_id(gasid)*gas.specific_heat + for(var/gasid in hc_gases) + hc_current += gases[gasid] * gas_specific_heat[gasid] - return max(MINIMUM_HEAT_CAPACITY,heat_capacity) + return max(MINIMUM_HEAT_CAPACITY, hc_current) -/datum/gas_mixture/proc/heat_capacity_archived() - //Purpose: Returning the archived heat capacity of the gas mix - //Called by: UNKNOWN - //Inputs: None - //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 +/datum/gas_mixture/proc/round_values(var/rounding_error = STANDARD_GAS_ROUNDING) + //Purpose: Trims the fat off values + //Called by: Fire code that cleans up values after processing + //Inputs: Rounding error //Outputs: None - total_moles = 0 - for(var/gasid in gases) - var/gas_moles = get_moles_by_id(gasid) - 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 + adjust_gas(gasid, - (gases[gasid] - round(gases[gasid], rounding_error))) - if(volume>0) - pressure = total_moles()*R_IDEAL_GAS_EQUATION*temperature/volume - else - pressure = 0 - - return //////////////////////////////////////////// //Procedures used for very specific events// @@ -257,16 +198,16 @@ What are the archived variables for? // If configured and cold, maek ice 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~ // This ordering will hopefully keep it from sampling random noise every damn tick. //if(was_icy || (!was_icy && prob(25))) graphics |= GRAPHICS_COLD - if(get_moles_by_id(PLASMA) > MOLES_PLASMA_VISIBLE) + if(gases[PLASMA] > MOLES_PLASMA_VISIBLE) graphics |= GRAPHICS_PLASMA - if(get_moles_by_id(NITROUS_OXIDE) > MOLES_N2O_VISIBLE) + if(gases[NITROUS_OXIDE] > MOLES_N2O_VISIBLE) graphics |= GRAPHICS_N2O /* if(aerosols && aerosols.total_volume >= 1) @@ -294,7 +235,7 @@ What are the archived variables for? return zburn(null) /*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 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) if(energy_released > 0) - var/new_heat_capacity = heat_capacity() + var/new_heat_capacity = heat_capacity if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) temperature = (temperature*old_heat_capacity + energy_released)/new_heat_capacity update_values() @@ -379,7 +320,7 @@ What are the archived variables for? return 0 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 merge(giver) @@ -394,24 +335,18 @@ What are the archived variables for? return 0 if(abs(temperature-giver.temperature)>MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - var/self_heat_capacity = heat_capacity()*group_multiplier - var/giver_heat_capacity = giver.heat_capacity()*giver.group_multiplier + var/self_heat_capacity = heat_capacity*group_multiplier + var/giver_heat_capacity = giver.heat_capacity*giver.group_multiplier var/combined_heat_capacity = giver_heat_capacity + self_heat_capacity if(combined_heat_capacity != 0) temperature = (giver.temperature*giver_heat_capacity + temperature*self_heat_capacity)/combined_heat_capacity if(giver.group_multiplier>1) 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 for(var/gasid in gases) - adjust_gas(gasid, giver.get_moles_by_id(gasid), 0) - -/* - if(giver.aerosols.total_volume > 1) - giver.aerosols.trans_to_atmos(src,aerosols.total_volume) -*/ - update_values() + adjust_gas(gasid, giver.gases[gasid]) // Let the garbage collector handle it, faster according to /tg/ testers //del(giver) @@ -423,28 +358,23 @@ What are the archived variables for? //Inputs: How many moles to remove. //Outputs: Removed air. - update_values() - // Fix a singuloth problem if(group_multiplier==0) return null - var/sum = total_moles() + var/sum = total_moles amount = min(amount,sum) //Can not take more air than tile has! if(amount <= 0) return new/datum/gas_mixture var/datum/gas_mixture/removed = new + removed.set_temperature(temperature) for(var/gasid in gases) - var/taken_gas = QUANTIZE(get_moles_by_id(gasid) / sum) * amount //the gas we lose - not yet subtracted - adjust_gas(gasid, -taken_gas, 0) //don't update just yet - negative subtracts - removed.adjust_gas(gasid, taken_gas, 0) //slap the copied gas in - - removed.temperature = temperature - update_values() - removed.update_values() + var/taken_gas = QUANTIZE(gases[gasid] / sum) * amount //the gas we lose - not yet subtracted + adjust_gas(gasid, -taken_gas) //don't update just yet - negative subtracts + removed.adjust_gas(gasid, taken_gas) //slap the copied gas in return removed @@ -459,7 +389,7 @@ What are the archived variables for? 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) //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 //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 remove(amount) @@ -481,12 +411,10 @@ What are the archived variables for? //Inputs: Gas to copy //Outputs: 1 + set_temperature(sample.temperature) + for(var/gasid in sample.gases) - set_gas(gasid, sample.get_moles_by_id(gasid), 0) - - temperature = sample.temperature - - update_values() + set_gas(gasid, sample.gases[gasid], 0) return 1 @@ -504,8 +432,8 @@ What are the archived variables for? return 0 for(var/gasid in gases) - var/archived_own_gas = get_archived_moles_by_id(gasid) - var/archived_sharer_gas = sharer.get_archived_moles_by_id(gasid) + var/archived_own_gas = archived_gases[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 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 for(var/gasid in gases) - var/archived_gas = get_archived_moles_by_id(gasid) - var/gas_delta = abs((archived_gas - model.get_moles_by_id(gasid))/TRANSFER_FRACTION) + var/archived_gas = archived_gases[gasid] + 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)) return 0 return 1 @@ -558,7 +486,7 @@ What are the archived variables for? var/moved_moles = 0 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 var/datum/gas/current_gas = get_gas_by_id(gasid) 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_capacity_sharer_to_self -= gas_heat_capacity - adjust_gas(gasid, -gas_delta, 0) //delay update - adjust_gas handles the group multiplier - sharer.adjust_gas(gasid, gas_delta, 0) + adjust_gas(gasid, -gas_delta) //delay update - adjust_gas handles the group multiplier + sharer.adjust_gas(gasid, gas_delta) moved_moles += gas_delta if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - old_self_heat_capacity = heat_capacity()*group_multiplier - old_sharer_heat_capacity = sharer.heat_capacity()*sharer.group_multiplier + old_self_heat_capacity = heat_capacity*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) 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) if((delta_temperature > MINIMUM_TEMPERATURE_TO_MOVE) || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE) - var/delta_pressure = temperature_archived*(total_moles() + moved_moles) - sharer.temperature_archived*(sharer.total_moles() - moved_moles) + var/delta_pressure = temperature_archived*(total_moles + moved_moles) - sharer.temperature_archived*(sharer.total_moles - moved_moles) return delta_pressure*R_IDEAL_GAS_EQUATION/volume else @@ -619,39 +545,36 @@ What are the archived variables for? var/moved_moles 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) - var/datum/gas/current_gas = get_gas_by_id(gasid) - var/gas_heat_capacity = current_gas.specific_heat * gas_delta + var/gas_heat_capacity = gas_specific_heat[gasid] heat_transferred -= gas_heat_capacity * model.temperature heat_capacity_transferred -= gas_heat_capacity if(border_multiplier) - adjust_gas(gasid, -gas_delta*border_multiplier, 0) //the 0 delays updates + adjust_gas(gasid, -gas_delta*border_multiplier) else - adjust_gas(gasid, -gas_delta, 0) + adjust_gas(gasid, -gas_delta) moved_moles += gas_delta if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - old_self_heat_capacity = heat_capacity()*group_multiplier - - update_values() + old_self_heat_capacity = heat_capacity*group_multiplier if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) var/new_self_heat_capacity = old_self_heat_capacity - heat_capacity_transferred if(new_self_heat_capacity > MINIMUM_HEAT_CAPACITY) 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 - 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) 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 else 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) var/delta_temperature = (temperature_archived - sharer.temperature_archived) - var/self_heat_capacity = heat_capacity_archived() - var/sharer_heat_capacity = sharer.heat_capacity_archived() + var/self_heat_capacity = heat_capacity_calc(archived_gases) + var/sharer_heat_capacity = sharer.heat_capacity_calc(archived_gases) var/self_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) var/delta_temperature = (temperature_archived - sharer.temperature_archived) - var/self_heat_capacity = heat_capacity_archived() - var/sharer_heat_capacity = sharer.heat_capacity_archived() + var/self_heat_capacity = heat_capacity_calc(archived_gases) + var/sharer_heat_capacity = sharer.heat_capacity_calc(archived_gases) var/self_temperature_delta = 0 var/sharer_temperature_delta = 0 @@ -723,7 +646,7 @@ What are the archived variables for? var/sharer_temperature_delta = 0 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)) var/heat = conduction_coefficient*delta_temperature* \ @@ -749,7 +672,7 @@ What are the archived variables for? var/self_temperature_delta = 0 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)) 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)) return 0 - temperature += self_temperature_delta + set_temperature(temperature + self_temperature_delta) return 1 //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) var/delta_temperature = (temperature_archived - sharer.temperature_archived) if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - var/self_heat_capacity = heat_capacity_archived() - var/sharer_heat_capacity = sharer.heat_capacity_archived() + var/self_heat_capacity = heat_capacity_calc(archived_gases) + var/sharer_heat_capacity = sharer.heat_capacity_calc(archived_gases) if(!group_multiplier) message_admins("Error! The gas mixture (ref \ref[src]) has no group multiplier!") return @@ -785,7 +708,7 @@ What are the archived variables for? /datum/gas_mixture/proc/temperature_mimic(turf/model, conduction_coefficient, border_multiplier) var/delta_temperature = (temperature - model.temperature) if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - var/self_heat_capacity = heat_capacity()//_archived() + var/self_heat_capacity = heat_capacity//_archived() if(!group_multiplier) message_admins("Error! The gas mixture (ref \ref[src]) has no group multiplier!") return @@ -802,7 +725,7 @@ What are the archived variables for? /datum/gas_mixture/proc/temperature_turf_share(turf/simulated/sharer, conduction_coefficient) var/delta_temperature = (temperature_archived - sharer.temperature) if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) - var/self_heat_capacity = heat_capacity() + var/self_heat_capacity = heat_capacity if((sharer.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) var/heat = conduction_coefficient*delta_temperature* \ @@ -819,13 +742,13 @@ What are the archived variables for? if(!sample) return 0 for(var/gasid in gases) - var/current_gas = get_moles_by_id(gasid) - var/sample_gas = sample.get_moles_by_id(gasid) + var/current_gas = gases[gasid] + var/sample_gas = sample.gases[gasid] 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))) return 0 - if(total_moles() > MINIMUM_AIR_TO_SUSPEND) + if(total_moles > MINIMUM_AIR_TO_SUSPEND) if((abs(temperature-sample.temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) && \ ((temperature < (1-MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature) || (temperature > (1+MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature))) //world << "temp fail [temperature] & [sample.temperature]" @@ -837,9 +760,8 @@ What are the archived variables for? return 0 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 /datum/gas_mixture/proc/subtract(datum/gas_mixture/right_side) @@ -849,17 +771,15 @@ What are the archived variables for? //Outputs: 1 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 /datum/gas_mixture/proc/multiply(factor) 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 /datum/gas_mixture/proc/divide(factor) diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 3240e265d33..517757ddb9f 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -305,15 +305,15 @@ 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 - if(t.air_contents.get_moles_by_id(breathes)) + if(t.air_contents.gases[breathes]) var/toxic_found 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) toxic_found = 1 break if(!toxic_found) - tank_contents.Add(t.air_contents.get_moles_by_id(breathes)) + tank_contents.Add(t.air_contents.gases[breathes]) else //no tank so we set contents to 0 diff --git a/code/game/gamemodes/events/ninja_equipment.dm b/code/game/gamemodes/events/ninja_equipment.dm index ca83fab7591..64f29698408 100644 --- a/code/game/gamemodes/events/ninja_equipment.dm +++ b/code/game/gamemodes/events/ninja_equipment.dm @@ -313,15 +313,15 @@ ________________________________________________________________________________ else var/datum/gas_mixture/environment = T.return_air() - var/pressure = environment.return_pressure() - var/total_moles = environment.total_moles() + var/pressure = environment.pressure + var/total_moles = environment.total_moles dat += "Air Pressure: [round(pressure,0.1)] kPa" dat += "