diff --git a/code/ATMOSPHERICS/components/binary_devices/circulator.dm b/code/ATMOSPHERICS/components/binary_devices/circulator.dm index 3624742d047..378aa319032 100644 --- a/code/ATMOSPHERICS/components/binary_devices/circulator.dm +++ b/code/ATMOSPHERICS/components/binary_devices/circulator.dm @@ -25,7 +25,7 @@ return null //Calculate necessary moles to transfer using PV = nRT - if((air1.total_moles() > 0) && (air1.temperature>0)) + if((air1.total_moles > 0) && (air1.temperature>0)) var/pressure_delta = (input_starting_pressure - output_starting_pressure)/2 var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION) diff --git a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm index 60408b77b67..1163f9860af 100644 --- a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm +++ b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm @@ -37,7 +37,7 @@ obj/machinery/atmospherics/binary/passive_gate return 1 //Calculate necessary moles to transfer using PV = nRT - if((air1.total_moles() > 0) && (air1.temperature>0)) + if((air1.total_moles > 0) && (air1.temperature>0)) var/pressure_delta = (input_starting_pressure - output_starting_pressure)/2 //Can not have a pressure delta that would cause output_pressure > input_pressure @@ -59,4 +59,4 @@ obj/machinery/atmospherics/binary/passive_gate attack_hand(mob/user as mob) src.on = !src.on src.update_icon() - return \ No newline at end of file + return diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm index a008536187d..7c9f1dfdfe6 100644 --- a/code/ATMOSPHERICS/components/binary_devices/pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm @@ -65,7 +65,7 @@ obj/machinery/atmospherics/binary/pump return 1 //Calculate necessary moles to transfer using PV=nRT - if((air1.total_moles() > 0) && (air1.temperature>0)) + if((air1.total_moles > 0) && (air1.temperature>0)) var/pressure_delta = target_pressure - output_starting_pressure var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION) diff --git a/code/ATMOSPHERICS/components/trinary_devices/filter.dm b/code/ATMOSPHERICS/components/trinary_devices/filter.dm index 987081d5993..624a731e3e1 100755 --- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm @@ -86,12 +86,6 @@ Filter types: filtered_out.toxins = removed.toxins removed.toxins = 0 - if(removed.trace_gases.len>0) - for(var/datum/gas/trace_gas in removed.trace_gases) - if(istype(trace_gas, /datum/gas/oxygen_agent_b)) - removed.trace_gases -= trace_gas - filtered_out.trace_gases += trace_gas - if(1) //removing O2 filtered_out.oxygen = removed.oxygen removed.oxygen = 0 @@ -115,6 +109,7 @@ Filter types: filtered_out = null + filtered_out.update_values() air2.merge(filtered_out) air3.merge(removed) diff --git a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm index 774bd852974..595fb31fa3d 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm @@ -51,8 +51,8 @@ obj/machinery/atmospherics/trinary/mixer if(air2.temperature > 0) transfer_moles2 = (node2_concentration*pressure_delta)*air3.volume/(air2.temperature * R_IDEAL_GAS_EQUATION) - var/air1_moles = air1.total_moles() - var/air2_moles = air2.total_moles() + var/air1_moles = air1.total_moles + var/air2_moles = air2.total_moles if((air1_moles < transfer_moles1) || (air2_moles < transfer_moles2)) if(!transfer_moles1 || !transfer_moles2) return diff --git a/code/ATMOSPHERICS/components/unary/oxygen_generator.dm b/code/ATMOSPHERICS/components/unary/oxygen_generator.dm index 38447efa0e0..721365e6be2 100644 --- a/code/ATMOSPHERICS/components/unary/oxygen_generator.dm +++ b/code/ATMOSPHERICS/components/unary/oxygen_generator.dm @@ -33,7 +33,7 @@ obj/machinery/atmospherics/unary/oxygen_generator if(!on) return 0 - var/total_moles = air_contents.total_moles() + var/total_moles = air_contents.total_moles if(total_moles < oxygen_content) var/current_heat_capacity = air_contents.heat_capacity() diff --git a/code/ATMOSPHERICS/components/unary/thermal_plate.dm b/code/ATMOSPHERICS/components/unary/thermal_plate.dm index 7814eb57eda..868c3a73b42 100644 --- a/code/ATMOSPHERICS/components/unary/thermal_plate.dm +++ b/code/ATMOSPHERICS/components/unary/thermal_plate.dm @@ -25,18 +25,18 @@ //Get processable air sample and thermal info from environment - var/transfer_moles = 0.25 * environment.total_moles() + var/transfer_moles = 0.25 * environment.total_moles var/datum/gas_mixture/external_removed = environment.remove(transfer_moles) if (!external_removed) return radiate() - if (external_removed.total_moles() < 10) + if (external_removed.total_moles < 10) return radiate() //Get same info from connected gas - var/internal_transfer_moles = 0.25 * air_contents.total_moles() + var/internal_transfer_moles = 0.25 * air_contents.total_moles var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles) if (!internal_removed) @@ -61,7 +61,7 @@ proc/radiate() - var/internal_transfer_moles = 0.25 * air_contents.total_moles() + var/internal_transfer_moles = 0.25 * air_contents.total_moles var/datum/gas_mixture/internal_removed = air_contents.remove(internal_transfer_moles) if (!internal_removed) diff --git a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm index 6c427baab38..5606d8113f8 100644 --- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm @@ -98,7 +98,7 @@ if(scrubbing) if((environment.toxins>0) || (environment.carbon_dioxide>0) || (environment.trace_gases.len>0)) - var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles() + var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles //Take a gas sample var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) @@ -117,15 +117,13 @@ if(removed.trace_gases.len>0) for(var/datum/gas/trace_gas in removed.trace_gases) - if(istype(trace_gas, /datum/gas/oxygen_agent_b)) - removed.trace_gases -= trace_gas - filtered_out.trace_gases += trace_gas - else if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O) + if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O) removed.trace_gases -= trace_gas filtered_out.trace_gases += trace_gas //Remix the resulting gases + filtered_out.update_values() air_contents.merge(filtered_out) loc.assume_air(removed) @@ -137,7 +135,7 @@ if (air_contents.return_pressure()>=50*ONE_ATMOSPHERE) return - var/transfer_moles = environment.total_moles()*(volume_rate/environment.volume) + var/transfer_moles = environment.total_moles*(volume_rate/environment.volume) var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) diff --git a/code/ATMOSPHERICS/datum_pipe_network.dm b/code/ATMOSPHERICS/datum_pipe_network.dm index ce74f6cfbfc..ae4ef741307 100644 --- a/code/ATMOSPHERICS/datum_pipe_network.dm +++ b/code/ATMOSPHERICS/datum_pipe_network.dm @@ -92,8 +92,9 @@ datum/pipe_network for(var/datum/gas_mixture/gas in gases) air_transient.volume += gas.volume - total_thermal_energy += gas.thermal_energy() - total_heat_capacity += gas.heat_capacity() + var/temp_heatcap = gas.heat_capacity() + total_thermal_energy += gas.temperature*temp_heatcap + total_heat_capacity += temp_heatcap air_transient.oxygen += gas.oxygen air_transient.nitrogen += gas.nitrogen @@ -157,8 +158,9 @@ proc/equalize_gases(datum/gas_mixture/list/gases) for(var/datum/gas_mixture/gas in gases) total_volume += gas.volume - total_thermal_energy += gas.thermal_energy() - total_heat_capacity += gas.heat_capacity() + var/temp_heatcap = gas.heat_capacity() + total_thermal_energy += gas.temperature*temp_heatcap + total_heat_capacity += temp_heatcap total_oxygen += gas.oxygen total_nitrogen += gas.nitrogen diff --git a/code/ATMOSPHERICS/pipes.dm b/code/ATMOSPHERICS/pipes.dm index 78bd890fe12..74e76392002 100644 --- a/code/ATMOSPHERICS/pipes.dm +++ b/code/ATMOSPHERICS/pipes.dm @@ -381,22 +381,6 @@ obj/machinery/atmospherics/pipe ..() - oxygen_agent_b - icon = 'red_orange_pipe_tank.dmi' - name = "Pressure Tank (Oxygen + Plasma)" - - New() - air_temporary = new - air_temporary.volume = volume - air_temporary.temperature = T0C - - var/datum/gas/oxygen_agent_b/trace_gas = new - trace_gas.moles = (25*ONE_ATMOSPHERE)*(air_temporary.volume)/(R_IDEAL_GAS_EQUATION*air_temporary.temperature) - - air_temporary.trace_gases += trace_gas - - ..() - oxygen icon = 'blue_pipe_tank.dmi' name = "Pressure Tank (Oxygen)" @@ -599,7 +583,7 @@ obj/machinery/atmospherics/pipe O << "\red [user] has used the analyzer on \icon[icon]" var/pressure = parent.air.return_pressure() - var/total_moles = parent.air.total_moles() + var/total_moles = parent.air.total_moles user << "\blue Results of analysis of \icon[icon]" if (total_moles>0) diff --git a/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm b/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm index ed68cce383b..c3b549b10c3 100644 --- a/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm +++ b/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm @@ -441,6 +441,7 @@ turf/simulated trace_gas.moles = amount adding.trace_gases += trace_gas adding.temperature = T20C + adding.update_values() assume_air(adding) @@ -474,7 +475,7 @@ obj/indicator return "error" return "[round(GM.nitrogen/MOLES_CELLSTANDARD*10+0.5)]" else - return "[round((GM.total_moles())/MOLES_CELLSTANDARD*10+0.5)]" + return "[round((GM.total_moles)/MOLES_CELLSTANDARD*10+0.5)]" Click() diff --git a/code/FEA/FEA_gas_mixture.dm b/code/FEA/FEA_gas_mixture.dm index 7e4c565b708..5ceb602436a 100644 --- a/code/FEA/FEA_gas_mixture.dm +++ b/code/FEA/FEA_gas_mixture.dm @@ -14,13 +14,10 @@ What are the archived variables for? #define QUANTIZE(variable) (round(variable,0.0001)) datum - gas + gas //These are used for the "Trace Gases" stuff, but is buggy. sleeping_agent specific_heat = 40 - oxygen_agent_b - specific_heat = 300 - volatile_fuel specific_heat = 30 @@ -31,11 +28,12 @@ datum moles_archived = 0 gas_mixture - var + var //Holds the "moles" of each of the four gases. oxygen = 0 carbon_dioxide = 0 nitrogen = 0 toxins = 0 + total_moles = 0 //Updated when a reaction occurs. volume = CELL_VOLUME @@ -47,9 +45,9 @@ datum graphic - list/datum/gas/trace_gases = list() + list/datum/gas/trace_gases = list() //Seemed to be a good idea that was abandoned - tmp + tmp //These are variables for use with the archived data oxygen_archived carbon_dioxide_archived nitrogen_archived @@ -59,227 +57,190 @@ datum graphic_archived fuel_burnt = 0 +/////////////////////////////// +//PV=nRT - related procedures// +/////////////////////////////// - proc //PV=nRT - related procedures - heat_capacity() - var/heat_capacity = HEAT_CAPACITY_CALCULATION(oxygen,carbon_dioxide,nitrogen,toxins) - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) - heat_capacity += trace_gas.moles*trace_gas.specific_heat + proc/heat_capacity() + //Purpose: Returning the heat capacity of the gas mix + //Called by: UNKNOWN + //Inputs: None + //Outputs: Heat capacity - return heat_capacity + var/heat_capacity = HEAT_CAPACITY_CALCULATION(oxygen,carbon_dioxide,nitrogen,toxins) - heat_capacity_archived() - var/heat_capacity_archived = HEAT_CAPACITY_CALCULATION(oxygen_archived,carbon_dioxide_archived,nitrogen_archived,toxins_archived) + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) + heat_capacity += trace_gas.moles*trace_gas.specific_heat - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) - heat_capacity_archived += trace_gas.moles_archived*trace_gas.specific_heat + return heat_capacity - return heat_capacity_archived + proc/heat_capacity_archived() + //Purpose: Returning the archived heat capacity of the gas mix + //Called by: UNKNOWN + //Inputs: None + //Outputs: Archived heat capacity - total_moles() - var/moles = oxygen + carbon_dioxide + nitrogen + toxins + var/heat_capacity_archived = HEAT_CAPACITY_CALCULATION(oxygen_archived,carbon_dioxide_archived,nitrogen_archived,toxins_archived) - if(trace_gases.len) - for(var/datum/gas/trace_gas in trace_gases) - moles += trace_gas.moles + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) + heat_capacity_archived += trace_gas.moles_archived*trace_gas.specific_heat - return moles + return heat_capacity_archived - return_pressure() - if(volume>0) - return total_moles()*R_IDEAL_GAS_EQUATION*temperature/volume - return 0 + proc/return_pressure() + //Purpose: Calculating Current Pressure + //Called by: + //Inputs: None + //Outputs: Gas pressure. - return_temperature() - return temperature + if(volume>0) + return total_moles*R_IDEAL_GAS_EQUATION*temperature/volume + return 0 - return_volume() - return max(0, volume) +// proc/return_temperature() + //Purpose: + //Inputs: + //Outputs: - thermal_energy() - return temperature*heat_capacity() +// return temperature - proc //Procedures used for very specific events - check_tile_graphic() - //returns 1 if graphic changed - graphic = null - if(toxins > MOLES_PLASMA_VISIBLE) - graphic = "plasma" +// proc/return_volume() + //Purpose: + //Inputs: + //Outputs: + +// return max(0, volume) + +// proc/thermal_energy() + //Purpose: + //Inputs: + //Outputs: + +// return temperature*heat_capacity() + + proc/update_values() + //Purpose: Calculating and storing values which were normally called CONSTANTLY + //Called by: Anything that changes values within a gas mix. + //Inputs: None + //Outputs: None + + total_moles = oxygen + carbon_dioxide + nitrogen + toxins + + if(trace_gases.len) + for(var/datum/gas/trace_gas in trace_gases) + total_moles += trace_gas.moles + return + +//////////////////////////////////////////// +//Procedures used for very specific events// +//////////////////////////////////////////// + + + proc/check_tile_graphic() + //Purpose: Calculating the graphic for a tile + //Called by: Turfs updating + //Inputs: None + //Outputs: 1 if graphic changed, 0 if unchanged + + graphic = null + if(toxins > MOLES_PLASMA_VISIBLE) + graphic = "plasma" + else + var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in trace_gases + if(sleeping_agent && (sleeping_agent.moles > 1)) + graphic = "sleeping_agent" else - var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in trace_gases - if(sleeping_agent && (sleeping_agent.moles > 1)) - graphic = "sleeping_agent" + graphic = null + + return graphic != graphic_archived + + proc/react(atom/dump_location) + //Purpose: Calculating if it is possible for a fire to occur in the airmix + //Called by: Air mixes updating? + //Inputs: None + //Outputs: If a fire occured + + var/reacting = 0 //set to 1 if a notable reaction occured (used by pipe_network) + + if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) + if(fire() > 0) + reacting = 1 + + return reacting + + proc/fire() + //Purpose: Calculating any fire reactions. + //Called by: react() (See above) + //Inputs: None + //Outputs: How much fuel burned + + var/energy_released = 0 + var/old_heat_capacity = heat_capacity() + + var/datum/gas/volatile_fuel/fuel_store = locate(/datum/gas/volatile_fuel) in trace_gases + if(fuel_store) //General volatile gas burn + var/burned_fuel = 0 + + if(oxygen < fuel_store.moles) + burned_fuel = oxygen + fuel_store.moles -= burned_fuel + oxygen = 0 + else + burned_fuel = fuel_store.moles + oxygen -= fuel_store.moles + del(fuel_store) + + energy_released += FIRE_CARBON_ENERGY_RELEASED * burned_fuel + carbon_dioxide += burned_fuel + fuel_burnt += burned_fuel + + //Handle plasma burning + if(toxins > MINIMUM_HEAT_CAPACITY) + var/plasma_burn_rate = 0 + var/oxygen_burn_rate = 0 + //more plasma released at higher temperatures + var/temperature_scale + if(temperature > PLASMA_UPPER_TEMPERATURE) + temperature_scale = 1 + else + temperature_scale = (temperature-PLASMA_MINIMUM_BURN_TEMPERATURE)/(PLASMA_UPPER_TEMPERATURE-PLASMA_MINIMUM_BURN_TEMPERATURE) + if(temperature_scale > 0) + oxygen_burn_rate = 1.4 - temperature_scale + if(oxygen > toxins*PLASMA_OXYGEN_FULLBURN) + plasma_burn_rate = (toxins*temperature_scale)/4 else - graphic = null + plasma_burn_rate = (temperature_scale*(oxygen/PLASMA_OXYGEN_FULLBURN))/4 + if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY) + toxins -= plasma_burn_rate + oxygen -= plasma_burn_rate*oxygen_burn_rate + carbon_dioxide += plasma_burn_rate - return graphic != graphic_archived + energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate) - react(atom/dump_location) - var/reacting = 0 //set to 1 if a notable reaction occured (used by pipe_network) + fuel_burnt += (plasma_burn_rate)*(1+oxygen_burn_rate) - if(trace_gases.len > 0) - if(temperature > 900) - if(toxins > MINIMUM_HEAT_CAPACITY && carbon_dioxide > MINIMUM_HEAT_CAPACITY) - var/datum/gas/oxygen_agent_b/trace_gas = locate(/datum/gas/oxygen_agent_b/) in trace_gases - if(trace_gas) - var/reaction_rate = min(carbon_dioxide*0.75, toxins*0.25, trace_gas.moles*0.05) + if(energy_released > 0) + var/new_heat_capacity = heat_capacity() + if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) + temperature = (temperature*old_heat_capacity + energy_released)/new_heat_capacity + update_values() - carbon_dioxide -= reaction_rate - oxygen += reaction_rate + return fuel_burnt - trace_gas.moles -= reaction_rate*0.05 - - temperature -= (reaction_rate*20000)/heat_capacity() - - reacting = 1 - - fuel_burnt = 0 - if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) - //world << "pre [temperature], [oxygen], [toxins]" - if(fire() > 0) - reacting = 1 - //world << "post [temperature], [oxygen], [toxins]" - - return reacting - - fire() - var/energy_released = 0 - var/old_heat_capacity = heat_capacity() - - var/datum/gas/volatile_fuel/fuel_store = locate(/datum/gas/volatile_fuel/) in trace_gases - if(fuel_store) //General volatile gas burn - var/burned_fuel = 0 - - if(oxygen < fuel_store.moles) - burned_fuel = oxygen - fuel_store.moles -= burned_fuel - oxygen = 0 - else - burned_fuel = fuel_store.moles - oxygen -= fuel_store.moles - del(fuel_store) - - energy_released += FIRE_CARBON_ENERGY_RELEASED * burned_fuel - carbon_dioxide += burned_fuel - fuel_burnt += burned_fuel - - //Handle plasma burning - if(toxins > MINIMUM_HEAT_CAPACITY) - var/plasma_burn_rate = 0 - var/oxygen_burn_rate = 0 - //more plasma released at higher temperatures - var/temperature_scale - if(temperature > PLASMA_UPPER_TEMPERATURE) - temperature_scale = 1 - else - temperature_scale = (temperature-PLASMA_MINIMUM_BURN_TEMPERATURE)/(PLASMA_UPPER_TEMPERATURE-PLASMA_MINIMUM_BURN_TEMPERATURE) - if(temperature_scale > 0) - oxygen_burn_rate = 1.4 - temperature_scale - if(oxygen > toxins*PLASMA_OXYGEN_FULLBURN) - plasma_burn_rate = (toxins*temperature_scale)/4 - else - plasma_burn_rate = (temperature_scale*(oxygen/PLASMA_OXYGEN_FULLBURN))/4 - if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY) - toxins -= plasma_burn_rate - oxygen -= plasma_burn_rate*oxygen_burn_rate - carbon_dioxide += plasma_burn_rate - - energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate) - - fuel_burnt += (plasma_burn_rate)*(1+oxygen_burn_rate) - - if(energy_released > 0) - var/new_heat_capacity = heat_capacity() - if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - temperature = (temperature*old_heat_capacity + energy_released)/new_heat_capacity - - return fuel_burnt - - proc - archive() - //Update archived versions of variables - //Returns: 1 in all cases - - merge(datum/gas_mixture/giver) - //Merges all air from giver into self. Deletes giver. - //Returns: 1 on success (no failure cases yet) - - check_then_merge(datum/gas_mixture/giver) - //Similar to merge(...) but first checks to see if the amount of air assumed is small enough - // that group processing is still accurate for source (aborts if not) - //Returns: 1 on successful merge, 0 if the check failed - - remove(amount) - //Proportionally removes amount of gas from the gas_mixture - //Returns: gas_mixture with the gases removed - - remove_ratio(ratio) - //Proportionally removes amount of gas from the gas_mixture - //Returns: gas_mixture with the gases removed - - subtract(datum/gas_mixture/right_side) - //Subtracts right_side from air_mixture. Used to help turfs mingle - - check_then_remove(amount) - //Similar to remove(...) but first checks to see if the amount of air removed is small enough - // that group processing is still accurate for source (aborts if not) - //Returns: gas_mixture with the gases removed or null - - copy_from(datum/gas_mixture/sample) - //Copies variables from sample - - share(datum/gas_mixture/sharer) - //Performs air sharing calculations between two gas_mixtures assuming only 1 boundary length - //Return: amount of gas exchanged (+ if sharer received) - - mimic(turf/model) - //Similar to share(...), except the model is not modified - //Return: amount of gas exchanged - - check_gas_mixture(datum/gas_mixture/sharer) - //Returns: 0 if the self-check failed then -1 if sharer-check failed then 1 if both checks pass - - check_turf(turf/model) - //Returns: 0 if self-check failed or 1 if check passes - - // check_me_then_share(datum/gas_mixture/sharer) - //Similar to share(...) but first checks to see if amount of air moved is small enough - // that group processing is still accurate for source (aborts if not) - //Returns: 1 on successful share, 0 if the check failed - - // check_me_then_mimic(turf/model) - //Similar to mimic(...) but first checks to see if amount of air moved is small enough - // that group processing is still accurate (aborts if not) - //Returns: 1 on successful mimic, 0 if the check failed - - // check_both_then_share(datum/gas_mixture/sharer) - //Similar to check_me_then_share(...) but also checks to see if amount of air moved is small enough - // that group processing is still accurate for the sharer (aborts if not) - //Returns: 0 if the self-check failed then -1 if sharer-check failed then 1 if successful share +////////////////////////////////////////////// +//Procs for general gas spread calculations.// +////////////////////////////////////////////// - temperature_mimic(turf/model, conduction_coefficient) + proc/archive() + //Purpose: Archives the current gas values + //Called by: UNKNOWN + //Inputs: None + //Outputs: 1 - temperature_share(datum/gas_mixture/sharer, conduction_coefficient) - - temperature_turf_share(turf/simulated/sharer, conduction_coefficient) - - - check_me_then_temperature_mimic(turf/model, conduction_coefficient) - - check_me_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient) - - check_both_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient) - - check_me_then_temperature_turf_share(turf/simulated/sharer, conduction_coefficient) - - compare(datum/gas_mixture/sample) - //Compares sample to self to see if within acceptable ranges that group processing may be enabled - - archive() oxygen_archived = oxygen carbon_dioxide_archived = carbon_dioxide nitrogen_archived = nitrogen @@ -295,7 +256,13 @@ datum return 1 - check_then_merge(datum/gas_mixture/giver) + proc/check_then_merge(datum/gas_mixture/giver) + //Purpose: Similar to merge(...) but first checks to see if the amount of air assumed is small enough + // that group processing is still accurate for source (aborts if not) + //Called by: airgroups/machinery expelling air, ? + //Inputs: The gas to try and merge + //Outputs: 1 on successful merge. 0 otherwise. + if(!giver) return 0 if(((giver.oxygen > MINIMUM_AIR_TO_SUSPEND) && (giver.oxygen >= oxygen*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ @@ -314,7 +281,12 @@ datum return merge(giver) - merge(datum/gas_mixture/giver) + proc/merge(datum/gas_mixture/giver) + //Purpose: Merges all air from giver into self. Deletes giver. + //Called by: Machinery expelling air, check_then_merge, ? + //Inputs: The gas to merge. + //Outputs: 1 + if(!giver) return 0 @@ -343,13 +315,18 @@ datum corresponding = new trace_gas.type() trace_gases += corresponding corresponding.moles += trace_gas.moles*giver.group_multiplier/group_multiplier + update_values() del(giver) return 1 - remove(amount) + proc/remove(amount) + //Purpose: Removes a certain number of moles from the air. + //Called by: ? + //Inputs: How many moles to remove. + //Outputs: Removed air. - var/sum = total_moles() + var/sum = total_moles amount = min(amount,sum) //Can not take more air than tile has! if(amount <= 0) return null @@ -376,10 +353,16 @@ datum trace_gas.moles -= corresponding.moles/group_multiplier removed.temperature = temperature + update_values() + removed.update_values() return removed - remove_ratio(ratio) + proc/remove_ratio(ratio) + //Purpose: Removes a certain ratio of the air. + //Called by: ? + //Inputs: Percentage to remove. + //Outputs: Removed air. if(ratio <= 0) return null @@ -407,25 +390,36 @@ datum trace_gas.moles -= corresponding.moles/group_multiplier removed.temperature = temperature + update_values() + removed.update_values() return removed - check_then_remove(amount) + proc/check_then_remove(amount) + //Purpose: Similar to remove(...) but first checks to see if the amount of air removed is small enough + // that group processing is still accurate for source (aborts if not) + //Called by: ? + //Inputs: Number of moles to remove + //Outputs: Removed air or 0 if it can remove air or not. - //Since it is all proportional, the check may be done on the gas as a whole - var/sum = total_moles() - amount = min(amount,sum) //Can not take more air than tile has! + amount = min(amount,total_moles) //Can not take more air than tile has! - if((amount > MINIMUM_AIR_RATIO_TO_SUSPEND) && (amount > sum*MINIMUM_AIR_RATIO_TO_SUSPEND)) + if((amount > MINIMUM_AIR_RATIO_TO_SUSPEND) && (amount > total_moles*MINIMUM_AIR_RATIO_TO_SUSPEND)) return 0 return remove(amount) - copy_from(datum/gas_mixture/sample) + proc/copy_from(datum/gas_mixture/sample) + //Purpose: Duplicates the sample air mixture. + //Called by: airgroups splitting, ? + //Inputs: Gas to copy + //Outputs: 1 + oxygen = sample.oxygen carbon_dioxide = sample.carbon_dioxide nitrogen = sample.nitrogen toxins = sample.toxins + total_moles = sample.total_moles trace_gases.len=null if(sample.trace_gases.len > 0) @@ -439,43 +433,14 @@ datum return 1 - subtract(datum/gas_mixture/right_side) - oxygen -= right_side.oxygen - carbon_dioxide -= right_side.carbon_dioxide - nitrogen -= right_side.nitrogen - toxins -= right_side.toxins + proc/check_gas_mixture(datum/gas_mixture/sharer) + //Purpose: Telling if one or both airgroups needs to disable group processing. + //Called by: Airgroups sharing air, checking if group processing needs disabled. + //Inputs: Gas to compare from other airgroup + //Outputs: 0 if the self-check failed (local airgroup breaks?) + // then -1 if sharer-check failed (sharing airgroup breaks?) + // then 1 if both checks pass (share succesful?) - if((trace_gases.len > 0)||(right_side.trace_gases.len > 0)) - for(var/datum/gas/trace_gas in right_side.trace_gases) - var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases - if(!corresponding) - corresponding = new trace_gas.type() - trace_gases += corresponding - - corresponding.moles -= trace_gas.moles - - return 1 - - /* check_me_then_share(datum/gas_mixture/sharer) - var/delta_oxygen = (oxygen_archived - sharer.oxygen_archived)/5 - var/delta_carbon_dioxide = (carbon_dioxide_archived - sharer.carbon_dioxide_archived)/5 - var/delta_nitrogen = (nitrogen_archived - sharer.nitrogen_archived)/5 - var/delta_toxins = (toxins_archived - sharer.toxins_archived)/5 - - var/delta_temperature = (temperature_archived - sharer.temperature_archived) - - if(((abs(delta_oxygen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_oxygen) >= oxygen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_carbon_dioxide) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_carbon_dioxide) >= carbon_dioxide_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_nitrogen) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_nitrogen) >= nitrogen_archived*MINIMUM_AIR_RATIO_TO_SUSPEND)) \ - || ((abs(delta_toxins) > MINIMUM_AIR_TO_SUSPEND) && (abs(delta_toxins) >= toxins_archived*MINIMUM_AIR_RATIO_TO_SUSPEND))) - return 0 - if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) - return 0 - - return share(sharer)*/ - - check_gas_mixture(datum/gas_mixture/sharer) - if(!sharer) return 0 var/delta_oxygen = (oxygen_archived - sharer.oxygen_archived)/5 var/delta_carbon_dioxide = (carbon_dioxide_archived - sharer.carbon_dioxide_archived)/5 var/delta_nitrogen = (nitrogen_archived - sharer.nitrogen_archived)/5 @@ -526,7 +491,12 @@ datum return 1 - check_turf(turf/model) + proc/check_turf(turf/model) + //Purpose: Used to compare the gases in an unsimulated turf with the gas in a simulated one. + //Called by: Sharing air (mimicing) with adjacent unsimulated turfs + //Inputs: Unsimulated turf + //Outputs: 1 if safe to mimic, 0 if needs to break airgroup. + var/delta_oxygen = (oxygen_archived - model.oxygen)/5 var/delta_carbon_dioxide = (carbon_dioxide_archived - model.carbon_dioxide)/5 var/delta_nitrogen = (nitrogen_archived - model.nitrogen)/5 @@ -549,7 +519,13 @@ datum return 1 - share(datum/gas_mixture/sharer) + proc/share(datum/gas_mixture/sharer) + //Purpose: Used to transfer gas from a more pressurised tile to a less presurised tile + // (Two directional, if the other tile is more pressurised, air travels to current tile) + //Called by: Sharing air with adjacent simulated turfs + //Inputs: Air datum to share with + //Outputs: Amount of gas exchanged (Negative if lost air, positive if gained.) + if(!sharer) return 0 var/delta_oxygen = QUANTIZE(oxygen_archived - sharer.oxygen_archived)/5 var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - sharer.carbon_dioxide_archived)/5 @@ -667,6 +643,8 @@ datum heat_capacity_sharer_to_self += individual_heat_capacity moved_moles += -delta + update_values() + sharer.update_values() if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) var/new_self_heat_capacity = old_self_heat_capacity + heat_capacity_sharer_to_self - heat_capacity_self_to_sharer @@ -683,13 +661,18 @@ datum temperature_share(sharer, OPEN_HEAT_TRANSFER_COEFFICIENT) if((delta_temperature > MINIMUM_TEMPERATURE_TO_MOVE) || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE) - var/delta_pressure = temperature_archived*(total_moles() + moved_moles) - sharer.temperature_archived*(sharer.total_moles() - moved_moles) + var/delta_pressure = temperature_archived*(total_moles + moved_moles) - sharer.temperature_archived*(sharer.total_moles - moved_moles) return delta_pressure*R_IDEAL_GAS_EQUATION/volume else return 0 - mimic(turf/model, border_multiplier) + proc/mimic(turf/model, border_multiplier) + //Purpose: Used transfer gas from a more pressurised tile to a less presurised unsimulated tile. + //Called by: "sharing" from unsimulated to simulated turfs. + //Inputs: Unsimulated turf, Multiplier for gas transfer (optional) + //Outputs: Amount of gas exchanged + var/delta_oxygen = QUANTIZE(oxygen_archived - model.oxygen)/5 var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - model.carbon_dioxide)/5 var/delta_nitrogen = QUANTIZE(nitrogen_archived - model.nitrogen)/5 @@ -749,6 +732,7 @@ datum heat_transferred += heat_cap_transferred*temperature_archived heat_capacity_transferred += heat_cap_transferred moved_moles += delta + update_values() if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) var/new_self_heat_capacity = old_self_heat_capacity - heat_capacity_transferred @@ -761,12 +745,12 @@ datum temperature_mimic(model, model.thermal_conductivity, border_multiplier) if((delta_temperature > MINIMUM_TEMPERATURE_TO_MOVE) || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE) - var/delta_pressure = temperature_archived*(total_moles() + moved_moles) - model.temperature*(model.oxygen+model.carbon_dioxide+model.nitrogen+model.toxins) + var/delta_pressure = temperature_archived*(total_moles + moved_moles) - model.temperature*(model.oxygen+model.carbon_dioxide+model.nitrogen+model.toxins) return delta_pressure*R_IDEAL_GAS_EQUATION/volume else return 0 - check_both_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient) + proc/check_both_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient) var/delta_temperature = (temperature_archived - sharer.temperature_archived) var/self_heat_capacity = heat_capacity_archived() @@ -798,7 +782,7 @@ datum return 1 //Logic integrated from: temperature_share(sharer, conduction_coefficient) for efficiency - check_me_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient) + proc/check_me_then_temperature_share(datum/gas_mixture/sharer, conduction_coefficient) var/delta_temperature = (temperature_archived - sharer.temperature_archived) var/self_heat_capacity = heat_capacity_archived() @@ -826,7 +810,7 @@ datum return 1 //Logic integrated from: temperature_share(sharer, conduction_coefficient) for efficiency - check_me_then_temperature_turf_share(turf/simulated/sharer, conduction_coefficient) + proc/check_me_then_temperature_turf_share(turf/simulated/sharer, conduction_coefficient) var/delta_temperature = (temperature_archived - sharer.temperature) var/self_temperature_delta = 0 @@ -854,7 +838,7 @@ datum return 1 //Logic integrated from: temperature_turf_share(sharer, conduction_coefficient) for efficiency - check_me_then_temperature_mimic(turf/model, conduction_coefficient) + proc/check_me_then_temperature_mimic(turf/model, conduction_coefficient) var/delta_temperature = (temperature_archived - model.temperature) var/self_temperature_delta = 0 @@ -876,7 +860,7 @@ datum return 1 //Logic integrated from: temperature_mimic(model, conduction_coefficient) for efficiency - temperature_share(datum/gas_mixture/sharer, conduction_coefficient) + proc/temperature_share(datum/gas_mixture/sharer, conduction_coefficient) var/delta_temperature = (temperature_archived - sharer.temperature_archived) if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) @@ -890,7 +874,7 @@ datum temperature -= heat/(self_heat_capacity*group_multiplier) sharer.temperature += heat/(sharer_heat_capacity*sharer.group_multiplier) - temperature_mimic(turf/model, conduction_coefficient, border_multiplier) + proc/temperature_mimic(turf/model, conduction_coefficient, border_multiplier) var/delta_temperature = (temperature - model.temperature) if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) var/self_heat_capacity = heat_capacity()//_archived() @@ -906,7 +890,7 @@ datum else temperature -= heat/(self_heat_capacity*group_multiplier) - temperature_turf_share(turf/simulated/sharer, conduction_coefficient) + proc/temperature_turf_share(turf/simulated/sharer, conduction_coefficient) var/delta_temperature = (temperature_archived - sharer.temperature) if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) var/self_heat_capacity = heat_capacity() @@ -918,7 +902,12 @@ datum temperature -= heat/(self_heat_capacity*group_multiplier) sharer.temperature += heat/sharer.heat_capacity - compare(datum/gas_mixture/sample) + proc/compare(datum/gas_mixture/sample) + //Purpose: Compares sample to self to see if within acceptable ranges that group processing may be enabled + //Called by: Airgroups trying to rebuild + //Inputs: Gas mix to compare + //Outputs: 1 if can rebuild, 0 if not. + if((abs(oxygen-sample.oxygen) > MINIMUM_AIR_TO_SUSPEND) && \ ((oxygen < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.oxygen) || (oxygen > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.oxygen))) return 0 @@ -932,7 +921,7 @@ datum ((toxins < (1-MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.toxins) || (toxins > (1+MINIMUM_AIR_RATIO_TO_SUSPEND)*sample.toxins))) return 0 - if(total_moles() > MINIMUM_AIR_TO_SUSPEND) + if(total_moles > MINIMUM_AIR_TO_SUSPEND) if((abs(temperature-sample.temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND) && \ ((temperature < (1-MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature) || (temperature > (1+MINIMUM_TEMPERATURE_RATIO_TO_SUSPEND)*sample.temperature))) //world << "temp fail [temperature] & [sample.temperature]" @@ -959,4 +948,27 @@ datum return 0 else return 0 + return 1 + + + proc/subtract(datum/gas_mixture/right_side) + //Purpose: Subtracts right_side from air_mixture. Used to help turfs mingle + //Called by: Pipelines ending in a break (or something) + //Inputs: Gas mix to remove + //Outputs: 1 + + oxygen -= right_side.oxygen + carbon_dioxide -= right_side.carbon_dioxide + nitrogen -= right_side.nitrogen + toxins -= right_side.toxins + + if((trace_gases.len > 0)||(right_side.trace_gases.len > 0)) + for(var/datum/gas/trace_gas in right_side.trace_gases) + var/datum/gas/corresponding = locate(trace_gas.type) in trace_gases + if(!corresponding) + corresponding = new trace_gas.type() + trace_gases += corresponding + + corresponding.moles -= trace_gas.moles + update_values() return 1 \ No newline at end of file diff --git a/code/FEA/FEA_system.dm b/code/FEA/FEA_system.dm index 5be14387a74..1f63fcdb67b 100644 --- a/code/FEA/FEA_system.dm +++ b/code/FEA/FEA_system.dm @@ -147,7 +147,7 @@ datum setup() set background = 1 world << "\red \b Processing Geometry..." - sleep(1) + sleep(-1) var/start_time = world.timeofday diff --git a/code/FEA/FEA_turf_tile.dm b/code/FEA/FEA_turf_tile.dm index f42b0719915..3dd1204c2ac 100644 --- a/code/FEA/FEA_turf_tile.dm +++ b/code/FEA/FEA_turf_tile.dm @@ -25,6 +25,7 @@ turf GM.toxins = toxins GM.temperature = temperature + GM.update_values() return GM @@ -39,6 +40,7 @@ turf GM.toxins = (toxins/sum)*amount GM.temperature = temperature + GM.update_values() return GM @@ -149,6 +151,7 @@ turf air.toxins = toxins air.temperature = temperature + air.update_values() if(air_master) air_master.tiles_to_update.Add(src) @@ -189,7 +192,7 @@ turf parent.suspend_group_processing() air.merge(giver) else - if (giver.total_moles() > MINIMUM_AIR_TO_SUSPEND) + if (giver.total_moles > MINIMUM_AIR_TO_SUSPEND) reset_delay() air.merge(giver) @@ -239,7 +242,6 @@ turf if(!processing) if(air.check_tile_graphic()) update_visuals(air) - return removed else diff --git a/code/WorkInProgress/Cael_Aislinn/Rust/core_field.dm b/code/WorkInProgress/Cael_Aislinn/Rust/core_field.dm index cd738d201a1..321b835209f 100644 --- a/code/WorkInProgress/Cael_Aislinn/Rust/core_field.dm +++ b/code/WorkInProgress/Cael_Aislinn/Rust/core_field.dm @@ -161,6 +161,8 @@ Deuterium-tritium fusion: 4.5 x 10^7 K plasma_captured.toxins = round(gas_covered.toxins * transfer_ratio) plasma_captured.temperature = gas_covered.temperature gas_covered.toxins -= plasma_captured.toxins + plasma_captured.update_values() + gas_covered.update_values() held_plasma.merge(plasma_captured) // environment.merge(gas_covered) @@ -302,7 +304,9 @@ Deuterium-tritium fusion: 4.5 x 10^7 K plasma_lost.temperature = held_plasma.temperature // plasma_lost.toxins = held_plasma.toxins * loss_ratio + plasma_lost.update_values() held_plasma.toxins -= held_plasma.toxins * loss_ratio + held_plasma.update_values() // environment.merge(plasma_lost) radiation += loss_ratio * mega_energy * 0.1 @@ -310,6 +314,7 @@ Deuterium-tritium fusion: 4.5 x 10^7 K return 1 else held_plasma.toxins = 0 + held_plasma.update_values() return 0 //the !!fun!! part diff --git a/code/WorkInProgress/Ported/ZeroPoint/SuperMatter.dm b/code/WorkInProgress/Ported/ZeroPoint/SuperMatter.dm new file mode 100644 index 00000000000..9b77e9626b0 --- /dev/null +++ b/code/WorkInProgress/Ported/ZeroPoint/SuperMatter.dm @@ -0,0 +1,120 @@ +#define NITROGEN_RETARDATION_FACTOR 4 //Higher == N2 slows reaction more +#define THERMAL_RELEASE_MODIFIER 50 //Higher == less heat released during reaction +#define PLASMA_RELEASE_MODIFIER 750 //Higher == less plasma released by reaction +#define OXYGEN_RELEASE_MODIFIER 1500 //Higher == less oxygen released at high temperature/power +#define REACTION_POWER_MODIFIER 1.1 //Higher == more overall power + +/obj/machinery/engine/supermatter + name = "Supermatter" + desc = "A strangely translucent and iridescent crystal. \red You get headaches just from looking at it." + icon = 'engine.dmi' + icon_state = "darkmatter" + density = 1 + anchored = 1 + + var/gasefficency = 0.25 + + var/det = 0 + var/previousdet = 0 + var/const/explosiondet = 3500 + + var/const/warningtime = 50 // Make the CORE OVERLOAD message repeat only every aprox. ?? seconds + var/lastwarning = 0 // Time in 1/10th of seconds since the last sent warning + +/obj/machinery/engine/klaxon + name = "Emergency Klaxon" + icon = 'engine.dmi' + icon_state = "darkmatter" + density = 1 + anchored = 1 + var/obj/machinery/engine/supermatter/sup + +/obj/machinery/engine/klaxon/process() + if(!sup) + for(var/obj/machinery/engine/supermatter/T in world) + sup = T + break + if(sup.det >= 1) + return + +/obj/machinery/engine/supermatter/process() + + var/turf/simulated/L = loc + + //Ok, get the air from the turf + var/datum/gas_mixture/env = L.return_air() + + //Remove gas from surrounding area + var/transfer_moles = gasefficency * env.total_moles + var/datum/gas_mixture/removed = env.remove(transfer_moles) + + previousdet = det + det += (removed.temperature - 1000) / 150 + det = max(det, 0) + + if(det > 0 && removed.temperature > 1000) // while the core is still damaged and it's still worth noting its status + if((world.realtime - lastwarning) / 10 >= warningtime) + lastwarning = world.realtime + if(explosiondet - det <= 300) + radioalert("CORE EXPLOSION IMMINENT","Core control computer") + else if(det >= previousdet) // The damage is still going up + radioalert("CORE OVERLOAD","Core control computer") + else // Phew, we're safe + radioalert("Core returning to safe operating levels.","Core control computer") + + if(det > explosiondet) + roundinfo.core = 1 + //proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, force = 0) + explosion(src.loc,8,15,20,30,1) + det = 0 + + if (!removed) + return 1 + + var/power = max(round((removed.temperature - T0C) / 20), 0) //Total laser power plus an overload factor + + //Get the collective laser power + for(var/dir in cardinal) + var/turf/T = get_step(L, dir) + for(var/obj/effect/beam/e_beam/item in T) + power += item.power + + //Ok, 100% oxygen atmosphere = best reaction + //Maxes out at 100% oxygen pressure + var/oxygen = max(min((removed.oxygen - (removed.nitrogen * NITROGEN_RETARDATION_FACTOR)) / MOLES_CELLSTANDARD, 1), 0) + + var/device_energy = oxygen * power + + device_energy *= removed.temperature / T0C + + device_energy = round(device_energy * REACTION_POWER_MODIFIER) + + //To figure out how much temperature to add each tick, consider that at one atmosphere's worth + //of pure oxygen, with all four lasers firing at standard energy and no N2 present, at room temperature + //that the device energy is around 2140. At that stage, we don't want too much heat to be put out + //Since the core is effectively "cold" + + //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. + removed.temperature += max((device_energy / THERMAL_RELEASE_MODIFIER), 0) + + removed.temperature = min(removed.temperature, 1500) + + //Calculate how much gas to release + removed.toxins += max(round(device_energy / PLASMA_RELEASE_MODIFIER), 0) + + removed.oxygen += max(round((device_energy + removed.temperature - T0C) / OXYGEN_RELEASE_MODIFIER), 0) + + env.merge(removed) + +//Not functional currently. -- SkyMarshal +/* + for(var/mob/living/carbon/l in view(src, 6)) // you have to be seeing the core to get hallucinations + if(prob(10) && !(l.glasses && istype(l.glasses, /obj/item/clothing/glasses/meson))) + l.hallucination = 50 +*/ + for(var/mob/living/l in view(src,3)) + l.bruteloss += 50 + l.updatehealth() + + return 1 \ No newline at end of file diff --git a/code/defines/turf.dm b/code/defines/turf.dm index c1bddae221f..e33bb523029 100644 --- a/code/defines/turf.dm +++ b/code/defines/turf.dm @@ -301,6 +301,7 @@ napalm.toxins = toxinsToDeduce napalm.temperature = 400+T0C + napalm.update_values() target_tile.assume_air(napalm) spawn (0) target_tile.hotspot_expose(temperature, 400) diff --git a/code/game/events/EventProcs/ninja_equipment.dm b/code/game/events/EventProcs/ninja_equipment.dm index d0bc9efdaac..bf09f2f7c33 100644 --- a/code/game/events/EventProcs/ninja_equipment.dm +++ b/code/game/events/EventProcs/ninja_equipment.dm @@ -311,7 +311,7 @@ ________________________________________________________________________________ var/datum/gas_mixture/environment = T.return_air() var/pressure = environment.return_pressure() - var/total_moles = environment.total_moles() + var/total_moles = environment.total_moles dat += "Air Pressure: [round(pressure,0.1)] kPa" diff --git a/code/game/machinery/atmo_control.dm b/code/game/machinery/atmo_control.dm index e0274cf54dc..23013ab1d3a 100644 --- a/code/game/machinery/atmo_control.dm +++ b/code/game/machinery/atmo_control.dm @@ -40,7 +40,7 @@ obj/machinery/air_sensor signal.data["temperature"] = round(air_sample.temperature,0.1) if(output>4) - var/total_moles = air_sample.total_moles() + var/total_moles = air_sample.total_moles if(total_moles > 0) if(output&4) signal.data["oxygen"] = round(100*air_sample.oxygen/total_moles,0.1) diff --git a/code/game/machinery/atmoalter/portable_atmospherics.dm b/code/game/machinery/atmoalter/portable_atmospherics.dm index 5130c37be47..a15e0550c41 100644 --- a/code/game/machinery/atmoalter/portable_atmospherics.dm +++ b/code/game/machinery/atmoalter/portable_atmospherics.dm @@ -15,6 +15,7 @@ air_contents.volume = volume air_contents.temperature = T20C + air_contents.update_values() return 1 @@ -110,7 +111,7 @@ O << "\red [user] has used [W] on \icon[icon]" if(air_contents) var/pressure = air_contents.return_pressure() - var/total_moles = air_contents.total_moles() + var/total_moles = air_contents.total_moles user << "\blue Results of analysis of \icon[icon]" if (total_moles>0) diff --git a/code/game/machinery/atmoalter/scrubber.dm b/code/game/machinery/atmoalter/scrubber.dm index c3ea2164a1d..94933468428 100644 --- a/code/game/machinery/atmoalter/scrubber.dm +++ b/code/game/machinery/atmoalter/scrubber.dm @@ -56,7 +56,7 @@ environment = holding.air_contents else environment = loc.return_air() - var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles() + var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles //Take a gas sample var/datum/gas_mixture/removed @@ -83,12 +83,7 @@ if(istype(trace_gas, /datum/gas/sleeping_agent)) removed.trace_gases -= trace_gas filtered_out.trace_gases += trace_gas - - if(removed.trace_gases.len>0) - for(var/datum/gas/trace_gas in removed.trace_gases) - if(istype(trace_gas, /datum/gas/oxygen_agent_b)) - removed.trace_gases -= trace_gas - filtered_out.trace_gases += trace_gas + filtered_out.update_values() //Remix the resulting gases air_contents.merge(filtered_out) diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index 791b3db0617..eed8e9fd64d 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -44,7 +44,7 @@ if(air_contents) temperature_archived = air_contents.temperature - heat_gas_contents() +// heat_gas_contents() expel_gas() if(abs(temperature_archived-air_contents.temperature) > 1) @@ -156,7 +156,7 @@ add_overlays() process_occupant() - if(air_contents.total_moles() < 10) + if(air_contents.total_moles < 10) return if(occupant) if(occupant.stat == 2) @@ -185,22 +185,24 @@ if(next_trans == 10) next_trans = 0 - heat_gas_contents() - if(air_contents.total_moles() < 1) - return - var/air_heat_capacity = air_contents.heat_capacity() - var/combined_heat_capacity = current_heat_capacity + air_heat_capacity - if(combined_heat_capacity > 0) - var/combined_energy = T20C*current_heat_capacity + air_heat_capacity*air_contents.temperature - air_contents.temperature = combined_energy/combined_heat_capacity +//Fucking ghost-heating. +// heat_gas_contents() +// if(air_contents.total_moles < 1) +// return +// var/air_heat_capacity = air_contents.heat_capacity() +// var/combined_heat_capacity = current_heat_capacity + air_heat_capacity +// if(combined_heat_capacity > 0) +// var/combined_energy = T20C*current_heat_capacity + air_heat_capacity*air_contents.temperature +// air_contents.temperature = combined_energy/combined_heat_capacity expel_gas() - if(air_contents.total_moles() < 1) + if(air_contents.total_moles < 1) return var/datum/gas_mixture/expel_gas = new - var/remove_amount = air_contents.total_moles()/100 + var/remove_amount = air_contents.total_moles/100 expel_gas = air_contents.remove(remove_amount) expel_gas.temperature = T20C // Lets expel hot gas and see if that helps people not die as they are removed + expel_gas.update_values() loc.assume_air(expel_gas) go_out() diff --git a/code/game/machinery/overview.dm b/code/game/machinery/overview.dm index a278fd1f1ab..185c33ae6f2 100644 --- a/code/game/machinery/overview.dm +++ b/code/game/machinery/overview.dm @@ -208,7 +208,7 @@ if("/turf/simulated/floor", "/turf/simulated/floor/engine") var/datum/gas_mixture/environment = T.return_air() - var/turf_total = environment.total_moles() + var/turf_total = environment.total_moles var/t1 = turf_total / MOLES_CELLSTANDARD * 175 if(t1<=100) diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index 128f4190576..27436096cf6 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -166,7 +166,7 @@ var/datum/gas_mixture/env = L.return_air() if(env.temperature < (set_temperature+T0C)) - var/transfer_moles = 0.25 * env.total_moles() + var/transfer_moles = 0.25 * env.total_moles var/datum/gas_mixture/removed = env.remove(transfer_moles) diff --git a/code/game/machinery/telecomms/telecommunications.dm b/code/game/machinery/telecomms/telecommunications.dm index b9e042240ca..3881a10b6b8 100644 --- a/code/game/machinery/telecomms/telecommunications.dm +++ b/code/game/machinery/telecomms/telecommunications.dm @@ -205,7 +205,7 @@ var/datum/gas_mixture/env = L.return_air() if(env.temperature < (heat_amt+T0C)) - var/transfer_moles = 0.25 * env.total_moles() + var/transfer_moles = 0.25 * env.total_moles var/datum/gas_mixture/removed = env.remove(transfer_moles) diff --git a/code/game/mecha/equipment/tools/tools.dm b/code/game/mecha/equipment/tools/tools.dm index 532aea59a36..21d019eec23 100644 --- a/code/game/mecha/equipment/tools/tools.dm +++ b/code/game/mecha/equipment/tools/tools.dm @@ -853,8 +853,9 @@ destroy() else GM.toxins += 5 - GM.temperature = istype(T) ? T.air.return_temperature() : T20C + GM.temperature = istype(T) ? T.air.temperature : T20C T.visible_message("The [src] suddenly disgorges a cloud of plasma.") + GM.update_values() T.assume_air(GM) return diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index cba65072aed..4b7fd385845 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -121,6 +121,7 @@ cabin_air.volume = 200 cabin_air.oxygen = O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature) cabin_air.nitrogen = N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature) + cabin_air.update_values() return cabin_air /obj/mecha/proc/add_radio() @@ -847,11 +848,11 @@ /obj/mecha/proc/return_temperature() . = 0 if(use_internal_tank) - . = cabin_air.return_temperature() + . = cabin_air.temperature else var/datum/gas_mixture/t_air = get_turf_air() if(t_air) - . = t_air.return_temperature() + . = t_air.temperature return /obj/mecha/proc/connect(obj/machinery/atmospherics/portables_connector/new_port) @@ -1665,7 +1666,7 @@ delay = 20 process(var/obj/mecha/mecha) - if(mecha.cabin_air && mecha.cabin_air.return_volume() > 0) + if(mecha.cabin_air && mecha.cabin_air.volume > 0) var/delta = mecha.cabin_air.temperature - T20C mecha.cabin_air.temperature -= max(-10, min(10, round(delta/4,0.1))) return @@ -1683,8 +1684,8 @@ var/pressure_delta = min(release_pressure - cabin_pressure, (tank_air.return_pressure() - cabin_pressure)/2) var/transfer_moles = 0 if(pressure_delta > 0) //cabin pressure lower than release pressure - if(tank_air.return_temperature() > 0) - transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION) + if(tank_air.temperature > 0) + transfer_moles = pressure_delta*max(0, cabin_air.volume)/(cabin_air.temperature * R_IDEAL_GAS_EQUATION) var/datum/gas_mixture/removed = tank_air.remove(transfer_moles) cabin_air.merge(removed) else if(pressure_delta < 0) //cabin pressure higher than release pressure @@ -1693,7 +1694,7 @@ if(t_air) pressure_delta = min(cabin_pressure - t_air.return_pressure(), pressure_delta) if(pressure_delta > 0) //if location pressure is lower than cabin pressure - transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION) + transfer_moles = pressure_delta*max(0, cabin_air.volume)/(cabin_air.temperature * R_IDEAL_GAS_EQUATION) var/datum/gas_mixture/removed = cabin_air.remove(transfer_moles) if(t_air) t_air.merge(removed) @@ -1726,12 +1727,12 @@ if(mecha.internal_tank.return_pressure()>mecha.internal_tank.maximum_pressure && !(mecha.hasInternalDamage(MECHA_INT_TANK_BREACH))) mecha.setInternalDamage(MECHA_INT_TANK_BREACH) var/datum/gas_mixture/int_tank_air = mecha.internal_tank.return_air() - if(int_tank_air && int_tank_air.return_volume()>0) //heat the air_contents + if(int_tank_air && int_tank_air.volume >0) //heat the air_contents int_tank_air.temperature = min(6000+T0C, int_tank_air.temperature+rand(10,15)) - if(mecha.cabin_air && mecha.cabin_air.return_volume()>0) - mecha.cabin_air.temperature = min(6000+T0C, mecha.cabin_air.return_temperature()+rand(10,15)) - if(mecha.cabin_air.return_temperature()>mecha.max_temperature/2) - mecha.take_damage(4/round(mecha.max_temperature/mecha.cabin_air.return_temperature(),0.1),"fire") + if(mecha.cabin_air && mecha.cabin_air.volume>0) + mecha.cabin_air.temperature = min(6000+T0C, mecha.cabin_air.temperature+rand(10,15)) + if(mecha.cabin_air.temperature>mecha.max_temperature/2) + mecha.take_damage(4/round(mecha.max_temperature/mecha.cabin_air.temperature,0.1),"fire") if(mecha.hasInternalDamage(MECHA_INT_TEMP_CONTROL)) //stop the mecha_preserve_temp loop datum mecha.pr_int_temp_processor.stop() if(mecha.hasInternalDamage(MECHA_INT_TANK_BREACH)) //remove some air from internal tank diff --git a/code/game/objects/devices/PDA/PDA.dm b/code/game/objects/devices/PDA/PDA.dm index 6c502d18c10..39cec7c3054 100755 --- a/code/game/objects/devices/PDA/PDA.dm +++ b/code/game/objects/devices/PDA/PDA.dm @@ -331,7 +331,7 @@ var/datum/gas_mixture/environment = T.return_air() var/pressure = environment.return_pressure() - var/total_moles = environment.total_moles() + var/total_moles = environment.total_moles dat += "Air Pressure: [round(pressure,0.1)] kPa
" diff --git a/code/game/objects/devices/scanners.dm b/code/game/objects/devices/scanners.dm index 17b62e1f119..8d0211e7f29 100644 --- a/code/game/objects/devices/scanners.dm +++ b/code/game/objects/devices/scanners.dm @@ -369,7 +369,7 @@ MASS SPECTROMETER var/datum/gas_mixture/environment = location.return_air() var/pressure = environment.return_pressure() - var/total_moles = environment.total_moles() + var/total_moles = environment.total_moles user.show_message("\blue Results:", 1) if(abs(pressure - ONE_ATMOSPHERE) < 10) diff --git a/code/game/objects/items/weapons/flamethrower.dm b/code/game/objects/items/weapons/flamethrower.dm index d206312b0a2..7ed926c801d 100644 --- a/code/game/objects/items/weapons/flamethrower.dm +++ b/code/game/objects/items/weapons/flamethrower.dm @@ -133,7 +133,7 @@ for (var/mob/O in viewers(user, null)) O << "\red [user] has used the analyzer on \icon[icon]" var/pressure = src.ptank.air_contents.return_pressure() - var/total_moles = src.ptank.air_contents.total_moles() + var/total_moles = src.ptank.air_contents.total_moles user << "\blue Results of analysis of \icon[icon]" if (total_moles>0) diff --git a/code/game/objects/mineral_doors.dm b/code/game/objects/mineral_doors.dm index 17118f65f19..310cdfd8805 100644 --- a/code/game/objects/mineral_doors.dm +++ b/code/game/objects/mineral_doors.dm @@ -234,6 +234,7 @@ napalm.toxins = toxinsToDeduce napalm.temperature = 400+T0C + napalm.update_values() target_tile.assume_air(napalm) spawn (0) target_tile.hotspot_expose(temperature, 400) @@ -304,4 +305,4 @@ isSwitchingStates = 0 Dismantle(devastated = 0) - del(src) \ No newline at end of file + del(src) diff --git a/code/game/objects/tank.dm b/code/game/objects/tank.dm index cb2bb08bc53..ed1cdbd865b 100644 --- a/code/game/objects/tank.dm +++ b/code/game/objects/tank.dm @@ -210,7 +210,7 @@ var/pressure = air_contents.return_pressure() - var/total_moles = air_contents.total_moles() + var/total_moles = air_contents.total_moles user << "\blue Results of analysis of \icon[icon]" if (total_moles>0) @@ -244,6 +244,7 @@ src.air_contents = new /datum/gas_mixture() src.air_contents.volume = volume //liters src.air_contents.temperature = T20C + air_contents.update_values() processing_objects.Add(src) @@ -258,6 +259,7 @@ ..() /obj/item/weapon/tank/examine() + set src in oview() var/obj/icon = src if (istype(src.loc, /obj/item/assembly)) icon = src.loc @@ -290,6 +292,7 @@ src.air_contents.oxygen = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD src.air_contents.nitrogen = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD + air_contents.update_values() return @@ -302,17 +305,19 @@ trace_gas.moles = (3*ONE_ATMOSPHERE)*70/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD src.air_contents.trace_gases += trace_gas + air_contents.update_values() return /obj/item/weapon/tank/plasma/New() ..() src.air_contents.toxins = (3*ONE_ATMOSPHERE)*70/(R_IDEAL_GAS_EQUATION*T20C) + air_contents.update_values() return /obj/item/weapon/tank/plasma/proc/release() - var/datum/gas_mixture/removed = air_contents.remove(air_contents.total_moles()) + var/datum/gas_mixture/removed = air_contents.remove(air_contents.total_moles) loc.assume_air(removed) diff --git a/code/game/objects/tanks/jetpack.dm b/code/game/objects/tanks/jetpack.dm index 87552b99486..7e829f4a9a0 100644 --- a/code/game/objects/tanks/jetpack.dm +++ b/code/game/objects/tanks/jetpack.dm @@ -53,7 +53,7 @@ proc/allow_thrust(num, mob/living/user as mob) if(!(src.on)) return 0 - if((num < 0.005 || src.air_contents.total_moles() < num)) + if((num < 0.005 || src.air_contents.total_moles < num)) src.ion_trail.stop() return 0 diff --git a/code/game/objects/weapons.dm b/code/game/objects/weapons.dm index 15c395310b6..6d04a7d4ea0 100644 --- a/code/game/objects/weapons.dm +++ b/code/game/objects/weapons.dm @@ -38,6 +38,7 @@ trace_gas.moles = 30 payload += trace_gas + payload.update_values() target.air.merge(payload) @@ -53,6 +54,7 @@ var/datum/gas_mixture/payload = new payload.toxins = 30 + payload.update_values() target.air.merge(payload) diff --git a/code/game/turf.dm b/code/game/turf.dm index 7932512bdab..ac32981a41f 100644 --- a/code/game/turf.dm +++ b/code/game/turf.dm @@ -903,6 +903,7 @@ var/list/plating_icons = list("plating","platingdmg1","platingdmg2","platingdmg3 trace_gas.moles = 2000 adding.trace_gases += trace_gas adding.temperature = T20C + adding.update_values() assume_air(adding) diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 774c8dece0e..82358e2e624 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -719,6 +719,7 @@ Traitors and the like can also be revived with the previous role mostly intact. T.air.nitrogen = T.nitrogen T.air.toxins = T.toxins T.air.temperature = T.temperature + T.air.update_values() // make things update properly T.assume_air(new /datum/gas_mixture()) diff --git a/code/modules/chemical/Chemistry-Reagents.dm b/code/modules/chemical/Chemistry-Reagents.dm index e0755c21585..ca89fcc58f3 100644 --- a/code/modules/chemical/Chemistry-Reagents.dm +++ b/code/modules/chemical/Chemistry-Reagents.dm @@ -282,7 +282,7 @@ datum var/hotspot = (locate(/obj/effect/hotspot) in T) if(hotspot && !istype(T, /turf/space)) - var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() ) + var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles ) lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0) lowertemp.react() T.assume_air(lowertemp) @@ -293,7 +293,7 @@ datum var/turf/T = get_turf(O) var/hotspot = (locate(/obj/effect/hotspot) in T) if(hotspot && !istype(T, /turf/space)) - var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() ) + var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles ) lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0) lowertemp.react() T.assume_air(lowertemp) @@ -543,12 +543,14 @@ datum var/datum/gas_mixture/napalm = new napalm.oxygen = volume*10 napalm.temperature = T0C + napalm.update_values() the_turf.assume_air(napalm) reaction_turf(var/turf/T, var/volume) src = null var/datum/gas_mixture/napalm = new napalm.oxygen = volume*10 napalm.temperature = T0C + napalm.update_values() T.assume_air(napalm) return @@ -571,12 +573,14 @@ datum var/datum/gas_mixture/napalm = new napalm.nitrogen = volume*10 napalm.temperature = T0C + napalm.update_values() the_turf.assume_air(napalm) reaction_turf(var/turf/T, var/volume) src = null var/datum/gas_mixture/napalm = new napalm.nitrogen = volume*10 napalm.temperature = T0C + napalm.update_values() T.assume_air(napalm) return @@ -1051,12 +1055,14 @@ datum var/datum/gas_mixture/napalm = new napalm.toxins = volume*10 napalm.temperature = T0C + napalm.update_values() the_turf.assume_air(napalm) reaction_turf(var/turf/T, var/volume) src = null var/datum/gas_mixture/napalm = new napalm.toxins = volume*10 napalm.temperature = T0C + napalm.update_values() T.assume_air(napalm) return on_mob_life(var/mob/living/M as mob) @@ -1168,6 +1174,7 @@ datum var/datum/gas/volatile_fuel/fuel = new fuel.moles = 5 napalm.trace_gases += fuel + napalm.update_values() the_turf.assume_air(napalm) reaction_turf(var/turf/T, var/volume) src = null @@ -1175,6 +1182,7 @@ datum var/datum/gas/volatile_fuel/fuel = new fuel.moles = 5 napalm.trace_gases += fuel + napalm.update_values() T.assume_air(napalm) return @@ -2154,7 +2162,7 @@ datum T.wet_overlay = null var/hotspot = (locate(/obj/effect/hotspot) in T) if(hotspot) - var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() ) + var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles ) lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0) lowertemp.react() T.assume_air(lowertemp) diff --git a/code/modules/chemical/Chemistry-Recipes.dm b/code/modules/chemical/Chemistry-Recipes.dm index 89c44b841cf..10914601d01 100644 --- a/code/modules/chemical/Chemistry-Recipes.dm +++ b/code/modules/chemical/Chemistry-Recipes.dm @@ -357,6 +357,7 @@ datum napalm.toxins = created_volume*10 napalm.temperature = 400+T0C + napalm.update_values() target_tile.assume_air(napalm) spawn (0) target_tile.hotspot_expose(700, 400) diff --git a/code/modules/mob/living/carbon/alien/humanoid/life.dm b/code/modules/mob/living/carbon/alien/humanoid/life.dm index 6356a385efe..38bf7ceb528 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/life.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/life.dm @@ -211,7 +211,7 @@ breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature) else*/ // Not enough air around, take a percentage of what's there to model this properly - breath_moles = environment.total_moles()*BREATH_PERCENTAGE + breath_moles = environment.total_moles*BREATH_PERCENTAGE breath = loc.remove_air(breath_moles) @@ -259,15 +259,15 @@ if(src.nodamage) return - if(!breath || (breath.total_moles() == 0)) + if(!breath || (breath.total_moles == 0)) //Aliens breathe in vaccuum return 0 var/toxins_used = 0 - var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME + var/breath_pressure = (breath.total_moles*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME //Partial pressure of the toxins in our breath - var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure + var/Toxins_pp = (breath.toxins/breath.total_moles)*breath_pressure if(Toxins_pp) // Detect toxins in air diff --git a/code/modules/mob/living/carbon/alien/larva/life.dm b/code/modules/mob/living/carbon/alien/larva/life.dm index 334676870a8..a79f290a0dc 100644 --- a/code/modules/mob/living/carbon/alien/larva/life.dm +++ b/code/modules/mob/living/carbon/alien/larva/life.dm @@ -186,7 +186,7 @@ breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature) else*/ // Not enough air around, take a percentage of what's there to model this properly - breath_moles = environment.total_moles()*BREATH_PERCENTAGE + breath_moles = environment.total_moles*BREATH_PERCENTAGE breath = loc.remove_air(breath_moles) @@ -234,15 +234,15 @@ if(nodamage) return - if(!breath || (breath.total_moles() == 0)) + if(!breath || (breath.total_moles == 0)) //Aliens breathe in vaccuum return 0 var/toxins_used = 0 - var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME + var/breath_pressure = (breath.total_moles*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME //Partial pressure of the toxins in our breath - var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure + var/Toxins_pp = (breath.toxins/breath.total_moles)*breath_pressure if(Toxins_pp) // Detect toxins in air diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 792b68e56a2..9e2070097b8 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -409,7 +409,7 @@ breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature) else*/ // Not enough air around, take a percentage of what's there to model this properly - breath_moles = environment.total_moles()*BREATH_PERCENTAGE + breath_moles = environment.total_moles*BREATH_PERCENTAGE breath = loc.remove_air(breath_moles) @@ -473,7 +473,7 @@ if(nodamage || (mutations & mNobreath)) return - if(!breath || (breath.total_moles() == 0)) + if(!breath || (breath.total_moles == 0)) if(reagents.has_reagent("inaprovaline")) return adjustOxyLoss(HUMAN_MAX_OXYLOSS) @@ -491,15 +491,15 @@ var/SA_para_min = 1 var/SA_sleep_min = 5 var/oxygen_used = 0 - var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME + var/breath_pressure = (breath.total_moles*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME //Partial pressure of the O2 in our breath - var/O2_pp = (breath.oxygen/breath.total_moles())*breath_pressure + var/O2_pp = (breath.oxygen/breath.total_moles)*breath_pressure // Same, but for the toxins - var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure + var/Toxins_pp = (breath.toxins/breath.total_moles)*breath_pressure // And CO2, lets say a PP of more than 10 will be bad (It's a little less really, but eh, being passed out all round aint no fun) - var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*breath_pressure // Tweaking to fit the hacky bullshit I've done with atmo -- TLE - //var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*0.5 // The default pressure value + var/CO2_pp = (breath.carbon_dioxide/breath.total_moles)*breath_pressure // Tweaking to fit the hacky bullshit I've done with atmo -- TLE + //var/CO2_pp = (breath.carbon_dioxide/breath.total_moles)*0.5 // The default pressure value if(O2_pp < safe_oxygen_min) // Too little oxygen if(prob(20) && isbreathing) @@ -548,7 +548,7 @@ if(breath.trace_gases.len) // If there's some other shit in the air lets deal with it here. for(var/datum/gas/sleeping_agent/SA in breath.trace_gases) - var/SA_pp = (SA.moles/breath.total_moles())*breath_pressure + var/SA_pp = (SA.moles/breath.total_moles)*breath_pressure if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit Paralyse(3) // 3 gives them one second to wake up and run away a bit! if(SA_pp > SA_sleep_min) // Enough to make us sleep as well @@ -1532,5 +1532,5 @@ snippets src << "\red You collapse from heat exaustion!" plcheck = t_plasma oxcheck = t_oxygen - G.turf_add(T, G.total_moles()) + G.turf_add(T, G.total_moles) */ \ No newline at end of file diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index 266bd3fc601..70489c1117a 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -206,7 +206,7 @@ var/obj/location_as_object = loc breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME) else if(istype(loc, /turf/)) - var/breath_moles = environment.total_moles()*BREATH_PERCENTAGE + var/breath_moles = environment.total_moles*BREATH_PERCENTAGE breath = loc.remove_air(breath_moles) // Handle chem smoke effect -- Doohl @@ -260,7 +260,7 @@ if(src.nodamage) return - if(!breath || (breath.total_moles() == 0)) + if(!breath || (breath.total_moles == 0)) adjustOxyLoss(7) oxygen_alert = max(oxygen_alert, 1) @@ -274,14 +274,14 @@ var/SA_para_min = 0.5 var/SA_sleep_min = 5 var/oxygen_used = 0 - var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME + var/breath_pressure = (breath.total_moles*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME //Partial pressure of the O2 in our breath - var/O2_pp = (breath.oxygen/breath.total_moles())*breath_pressure + var/O2_pp = (breath.oxygen/breath.total_moles)*breath_pressure // Same, but for the toxins - var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure + var/Toxins_pp = (breath.toxins/breath.total_moles)*breath_pressure // And CO2, lets say a PP of more than 10 will be bad (It's a little less really, but eh, being passed out all round aint no fun) - var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*breath_pressure + var/CO2_pp = (breath.carbon_dioxide/breath.total_moles)*breath_pressure if(O2_pp < safe_oxygen_min) // Too little oxygen if(prob(20)) @@ -329,7 +329,7 @@ if(breath.trace_gases.len) // If there's some other shit in the air lets deal with it here. for(var/datum/gas/sleeping_agent/SA in breath.trace_gases) - var/SA_pp = (SA.moles/breath.total_moles())*breath_pressure + var/SA_pp = (SA.moles/breath.total_moles)*breath_pressure if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit Paralyse(3) // 3 gives them one second to wake up and run away a bit! if(SA_pp > SA_sleep_min) // Enough to make us sleep as well diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm index 30338c21fc4..e233ff3d990 100644 --- a/code/modules/mob/living/silicon/pai/software.dm +++ b/code/modules/mob/living/silicon/pai/software.dm @@ -508,7 +508,7 @@ var/datum/gas_mixture/environment = T.return_air() var/pressure = environment.return_pressure() - var/total_moles = environment.total_moles() + var/total_moles = environment.total_moles dat += "Air Pressure: [round(pressure,0.1)] kPa
" diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm index adf09a57d29..e851c2d6b40 100644 --- a/code/modules/power/turbine.dm +++ b/code/modules/power/turbine.dm @@ -66,7 +66,7 @@ return rpm = 0.9* rpm + 0.1 * rpmtarget var/datum/gas_mixture/environment = inturf.return_air() - var/transfer_moles = environment.total_moles()/10 + var/transfer_moles = environment.total_moles/10 //var/transfer_moles = rpm/10000*capacity var/datum/gas_mixture/removed = inturf.remove_air(transfer_moles) gas_contained.merge(removed) @@ -122,14 +122,14 @@ lastgen = ((compressor.rpm / TURBGENQ)**TURBGENG) *TURBGENQ add_avail(lastgen) - var/newrpm = ((compressor.gas_contained.temperature) * compressor.gas_contained.total_moles())/4 + var/newrpm = ((compressor.gas_contained.temperature) * compressor.gas_contained.total_moles)/4 newrpm = max(0, newrpm) if(!compressor.starter || newrpm > 1000) compressor.rpmtarget = newrpm - if(compressor.gas_contained.total_moles()>0) - var/oamount = min(compressor.gas_contained.total_moles(), (compressor.rpm+100)/35000*compressor.capacity) + if(compressor.gas_contained.total_moles>0) + var/oamount = min(compressor.gas_contained.total_moles, (compressor.rpm+100)/35000*compressor.capacity) var/datum/gas_mixture/removed = compressor.gas_contained.remove(oamount) outturf.assume_air(removed) diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm index 1c525f22e75..604a31c5d57 100644 --- a/code/modules/research/server.dm +++ b/code/modules/research/server.dm @@ -75,7 +75,7 @@ var/datum/gas_mixture/env = L.return_air() if(env.temperature < (heat_amt+T0C)) - var/transfer_moles = 0.25 * env.total_moles() + var/transfer_moles = 0.25 * env.total_moles var/datum/gas_mixture/removed = env.remove(transfer_moles) diff --git a/code/unused/heater.dm b/code/unused/heater.dm index 3af7770a066..b735141151e 100644 --- a/code/unused/heater.dm +++ b/code/unused/heater.dm @@ -22,7 +22,7 @@ else T = null if (src.h_status) - var/t1 = src.gas.total_moles() + var/t1 = src.gas.total_moles if ((t1 > 0 && src.gas.temperature < (src.h_tar+T0C))) var/increase = src.heatrate / t1 var/n_temp = src.gas.temperature + increase @@ -31,7 +31,7 @@ switch(src.t_status) if(1.0) if (src.holding) - var/t1 = src.gas.total_moles() + var/t1 = src.gas.total_moles var/t2 = t1 var/t = src.t_per if (src.t_per > t2) @@ -41,7 +41,7 @@ src.t_status = 3 if(2.0) if (src.holding) - var/t1 = src.gas.total_moles() + var/t1 = src.gas.total_moles var/t2 = src.maximum - t1 var/t = src.t_per if (src.t_per > t2) @@ -97,7 +97,7 @@ ct = text("Release Accept Stopped", src, src) else ct = "Disconnected" - var/dat = text("Canister Valves
\nContains/Capacity [] / []
\nUpper Valve Status: [][]
\n\tM - - - - [] + + + + M
\nHeater Status: [] - []
\n\tTrg Tmp: - - - [] + + +
\n
\nPipe Valve Status: []
\n\tM - - - - [] + + + + M
\n
\nClose
\n
", src.gas.total_moles(), src.maximum, tt, (src.holding ? text("
Tank ([])", src, src.holding.gas.total_moles()) : null), src, num2text(1000000.0, 7), src, src, src, src, src.t_per, src, src, src, src, src, num2text(1000000.0, 7), ht, (src.gas.total_moles() ? (src.gas.temperature-T0C) : 20), src, src, src, src.h_tar, src, src, src, ct, src, num2text(1000000.0, 7), src, src, src, src, src.c_per, src, src, src, src, src, num2text(1000000.0, 7), user) + var/dat = text("Canister Valves
\nContains/Capacity [] / []
\nUpper Valve Status: [][]
\n\tM - - - - [] + + + + M
\nHeater Status: [] - []
\n\tTrg Tmp: - - - [] + + +
\n
\nPipe Valve Status: []
\n\tM - - - - [] + + + + M
\n
\nClose
\n
", src.gas.total_moles, src.maximum, tt, (src.holding ? text("
Tank ([])", src, src.holding.gas.total_moles) : null), src, num2text(1000000.0, 7), src, src, src, src, src.t_per, src, src, src, src, src, num2text(1000000.0, 7), ht, (src.gas.total_moles ? (src.gas.temperature-T0C) : 20), src, src, src, src.h_tar, src, src, src, ct, src, num2text(1000000.0, 7), src, src, src, src, src.c_per, src, src, src, src, src, num2text(1000000.0, 7), user) user << browse(dat, "window=canister;size=600x300") onclose(user, "canister") return */ //TODO: FIX diff --git a/code/unused/pipe.dm b/code/unused/pipe.dm index 29de0c78cd3..ce4e9a10d04 100644 --- a/code/unused/pipe.dm +++ b/code/unused/pipe.dm @@ -59,17 +59,17 @@ var/linenums = 0 /* /obj/machinery/pipeline/get_gas_moles(from) - return gas.total_moles()/capmult + return gas.total_moles/capmult */ /obj/machinery/pipeline/get_gas(from) return gas /obj/machinery/pipeline/gas_flow() - //if(suffix == "d" && Debug) world.log << "PLF1 [gas.total_moles()] ~ [ngas.total_moles()]" + //if(suffix == "d" && Debug) world.log << "PLF1 [gas.total_moles] ~ [ngas.total_moles]" gas.copy_from(ngas) - //if(suffix == "d" && Debug) world.log << "PLF2 [gas.total_moles()] ~ [ngas.total_moles()]" + //if(suffix == "d" && Debug) world.log << "PLF2 [gas.total_moles] ~ [ngas.total_moles]" /obj/machinery/pipeline/process() /* @@ -81,7 +81,7 @@ var/linenums = 0 // var/dbg = (suffix == "d") && Debug - //if(dbg) world.log << "PLP1 [gas.total_moles()] ~ [ngas.total_moles()]" + //if(dbg) world.log << "PLP1 [gas.total_moles] ~ [ngas.total_moles()]" if(!numnodes) return //dividing by zero is bad okay?