mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-28 14:37:04 +01:00
Improves how gas mixture datums are handled, reduces proc calls, commenting. Removed ghost-heating from cryo and "oxygen_agent_b" gas type.
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -282,7 +282,7 @@ datum
|
||||
|
||||
var/hotspot = (locate(/obj/effect/hotspot) in T)
|
||||
if(hotspot && !istype(T, /turf/space))
|
||||
var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() )
|
||||
var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles )
|
||||
lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0)
|
||||
lowertemp.react()
|
||||
T.assume_air(lowertemp)
|
||||
@@ -293,7 +293,7 @@ datum
|
||||
var/turf/T = get_turf(O)
|
||||
var/hotspot = (locate(/obj/effect/hotspot) in T)
|
||||
if(hotspot && !istype(T, /turf/space))
|
||||
var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() )
|
||||
var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles )
|
||||
lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0)
|
||||
lowertemp.react()
|
||||
T.assume_air(lowertemp)
|
||||
@@ -543,12 +543,14 @@ datum
|
||||
var/datum/gas_mixture/napalm = new
|
||||
napalm.oxygen = volume*10
|
||||
napalm.temperature = T0C
|
||||
napalm.update_values()
|
||||
the_turf.assume_air(napalm)
|
||||
reaction_turf(var/turf/T, var/volume)
|
||||
src = null
|
||||
var/datum/gas_mixture/napalm = new
|
||||
napalm.oxygen = volume*10
|
||||
napalm.temperature = T0C
|
||||
napalm.update_values()
|
||||
T.assume_air(napalm)
|
||||
return
|
||||
|
||||
@@ -571,12 +573,14 @@ datum
|
||||
var/datum/gas_mixture/napalm = new
|
||||
napalm.nitrogen = volume*10
|
||||
napalm.temperature = T0C
|
||||
napalm.update_values()
|
||||
the_turf.assume_air(napalm)
|
||||
reaction_turf(var/turf/T, var/volume)
|
||||
src = null
|
||||
var/datum/gas_mixture/napalm = new
|
||||
napalm.nitrogen = volume*10
|
||||
napalm.temperature = T0C
|
||||
napalm.update_values()
|
||||
T.assume_air(napalm)
|
||||
return
|
||||
|
||||
@@ -1051,12 +1055,14 @@ datum
|
||||
var/datum/gas_mixture/napalm = new
|
||||
napalm.toxins = volume*10
|
||||
napalm.temperature = T0C
|
||||
napalm.update_values()
|
||||
the_turf.assume_air(napalm)
|
||||
reaction_turf(var/turf/T, var/volume)
|
||||
src = null
|
||||
var/datum/gas_mixture/napalm = new
|
||||
napalm.toxins = volume*10
|
||||
napalm.temperature = T0C
|
||||
napalm.update_values()
|
||||
T.assume_air(napalm)
|
||||
return
|
||||
on_mob_life(var/mob/living/M as mob)
|
||||
@@ -1168,6 +1174,7 @@ datum
|
||||
var/datum/gas/volatile_fuel/fuel = new
|
||||
fuel.moles = 5
|
||||
napalm.trace_gases += fuel
|
||||
napalm.update_values()
|
||||
the_turf.assume_air(napalm)
|
||||
reaction_turf(var/turf/T, var/volume)
|
||||
src = null
|
||||
@@ -1175,6 +1182,7 @@ datum
|
||||
var/datum/gas/volatile_fuel/fuel = new
|
||||
fuel.moles = 5
|
||||
napalm.trace_gases += fuel
|
||||
napalm.update_values()
|
||||
T.assume_air(napalm)
|
||||
return
|
||||
|
||||
@@ -2154,7 +2162,7 @@ datum
|
||||
T.wet_overlay = null
|
||||
var/hotspot = (locate(/obj/effect/hotspot) in T)
|
||||
if(hotspot)
|
||||
var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() )
|
||||
var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles )
|
||||
lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0)
|
||||
lowertemp.react()
|
||||
T.assume_air(lowertemp)
|
||||
|
||||
@@ -357,6 +357,7 @@ datum
|
||||
|
||||
napalm.toxins = created_volume*10
|
||||
napalm.temperature = 400+T0C
|
||||
napalm.update_values()
|
||||
|
||||
target_tile.assume_air(napalm)
|
||||
spawn (0) target_tile.hotspot_expose(700, 400)
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
|
||||
else*/
|
||||
// Not enough air around, take a percentage of what's there to model this properly
|
||||
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
|
||||
breath_moles = environment.total_moles*BREATH_PERCENTAGE
|
||||
|
||||
breath = loc.remove_air(breath_moles)
|
||||
|
||||
@@ -259,15 +259,15 @@
|
||||
if(src.nodamage)
|
||||
return
|
||||
|
||||
if(!breath || (breath.total_moles() == 0))
|
||||
if(!breath || (breath.total_moles == 0))
|
||||
//Aliens breathe in vaccuum
|
||||
return 0
|
||||
|
||||
var/toxins_used = 0
|
||||
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
|
||||
var/breath_pressure = (breath.total_moles*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
|
||||
|
||||
//Partial pressure of the toxins in our breath
|
||||
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
|
||||
var/Toxins_pp = (breath.toxins/breath.total_moles)*breath_pressure
|
||||
|
||||
if(Toxins_pp) // Detect toxins in air
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
|
||||
else*/
|
||||
// Not enough air around, take a percentage of what's there to model this properly
|
||||
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
|
||||
breath_moles = environment.total_moles*BREATH_PERCENTAGE
|
||||
|
||||
breath = loc.remove_air(breath_moles)
|
||||
|
||||
@@ -234,15 +234,15 @@
|
||||
if(nodamage)
|
||||
return
|
||||
|
||||
if(!breath || (breath.total_moles() == 0))
|
||||
if(!breath || (breath.total_moles == 0))
|
||||
//Aliens breathe in vaccuum
|
||||
return 0
|
||||
|
||||
var/toxins_used = 0
|
||||
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
|
||||
var/breath_pressure = (breath.total_moles*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
|
||||
|
||||
//Partial pressure of the toxins in our breath
|
||||
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
|
||||
var/Toxins_pp = (breath.toxins/breath.total_moles)*breath_pressure
|
||||
|
||||
if(Toxins_pp) // Detect toxins in air
|
||||
|
||||
|
||||
@@ -409,7 +409,7 @@
|
||||
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
|
||||
else*/
|
||||
// Not enough air around, take a percentage of what's there to model this properly
|
||||
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
|
||||
breath_moles = environment.total_moles*BREATH_PERCENTAGE
|
||||
|
||||
breath = loc.remove_air(breath_moles)
|
||||
|
||||
@@ -473,7 +473,7 @@
|
||||
if(nodamage || (mutations & mNobreath))
|
||||
return
|
||||
|
||||
if(!breath || (breath.total_moles() == 0))
|
||||
if(!breath || (breath.total_moles == 0))
|
||||
if(reagents.has_reagent("inaprovaline"))
|
||||
return
|
||||
adjustOxyLoss(HUMAN_MAX_OXYLOSS)
|
||||
@@ -491,15 +491,15 @@
|
||||
var/SA_para_min = 1
|
||||
var/SA_sleep_min = 5
|
||||
var/oxygen_used = 0
|
||||
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
|
||||
var/breath_pressure = (breath.total_moles*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
|
||||
|
||||
//Partial pressure of the O2 in our breath
|
||||
var/O2_pp = (breath.oxygen/breath.total_moles())*breath_pressure
|
||||
var/O2_pp = (breath.oxygen/breath.total_moles)*breath_pressure
|
||||
// Same, but for the toxins
|
||||
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
|
||||
var/Toxins_pp = (breath.toxins/breath.total_moles)*breath_pressure
|
||||
// And CO2, lets say a PP of more than 10 will be bad (It's a little less really, but eh, being passed out all round aint no fun)
|
||||
var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*breath_pressure // Tweaking to fit the hacky bullshit I've done with atmo -- TLE
|
||||
//var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*0.5 // The default pressure value
|
||||
var/CO2_pp = (breath.carbon_dioxide/breath.total_moles)*breath_pressure // Tweaking to fit the hacky bullshit I've done with atmo -- TLE
|
||||
//var/CO2_pp = (breath.carbon_dioxide/breath.total_moles)*0.5 // The default pressure value
|
||||
|
||||
if(O2_pp < safe_oxygen_min) // Too little oxygen
|
||||
if(prob(20) && isbreathing)
|
||||
@@ -548,7 +548,7 @@
|
||||
|
||||
if(breath.trace_gases.len) // If there's some other shit in the air lets deal with it here.
|
||||
for(var/datum/gas/sleeping_agent/SA in breath.trace_gases)
|
||||
var/SA_pp = (SA.moles/breath.total_moles())*breath_pressure
|
||||
var/SA_pp = (SA.moles/breath.total_moles)*breath_pressure
|
||||
if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit
|
||||
Paralyse(3) // 3 gives them one second to wake up and run away a bit!
|
||||
if(SA_pp > SA_sleep_min) // Enough to make us sleep as well
|
||||
@@ -1532,5 +1532,5 @@ snippets
|
||||
src << "\red You collapse from heat exaustion!"
|
||||
plcheck = t_plasma
|
||||
oxcheck = t_oxygen
|
||||
G.turf_add(T, G.total_moles())
|
||||
G.turf_add(T, G.total_moles)
|
||||
*/
|
||||
@@ -206,7 +206,7 @@
|
||||
var/obj/location_as_object = loc
|
||||
breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME)
|
||||
else if(istype(loc, /turf/))
|
||||
var/breath_moles = environment.total_moles()*BREATH_PERCENTAGE
|
||||
var/breath_moles = environment.total_moles*BREATH_PERCENTAGE
|
||||
breath = loc.remove_air(breath_moles)
|
||||
|
||||
// Handle chem smoke effect -- Doohl
|
||||
@@ -260,7 +260,7 @@
|
||||
if(src.nodamage)
|
||||
return
|
||||
|
||||
if(!breath || (breath.total_moles() == 0))
|
||||
if(!breath || (breath.total_moles == 0))
|
||||
adjustOxyLoss(7)
|
||||
|
||||
oxygen_alert = max(oxygen_alert, 1)
|
||||
@@ -274,14 +274,14 @@
|
||||
var/SA_para_min = 0.5
|
||||
var/SA_sleep_min = 5
|
||||
var/oxygen_used = 0
|
||||
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
|
||||
var/breath_pressure = (breath.total_moles*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
|
||||
|
||||
//Partial pressure of the O2 in our breath
|
||||
var/O2_pp = (breath.oxygen/breath.total_moles())*breath_pressure
|
||||
var/O2_pp = (breath.oxygen/breath.total_moles)*breath_pressure
|
||||
// Same, but for the toxins
|
||||
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
|
||||
var/Toxins_pp = (breath.toxins/breath.total_moles)*breath_pressure
|
||||
// And CO2, lets say a PP of more than 10 will be bad (It's a little less really, but eh, being passed out all round aint no fun)
|
||||
var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*breath_pressure
|
||||
var/CO2_pp = (breath.carbon_dioxide/breath.total_moles)*breath_pressure
|
||||
|
||||
if(O2_pp < safe_oxygen_min) // Too little oxygen
|
||||
if(prob(20))
|
||||
@@ -329,7 +329,7 @@
|
||||
|
||||
if(breath.trace_gases.len) // If there's some other shit in the air lets deal with it here.
|
||||
for(var/datum/gas/sleeping_agent/SA in breath.trace_gases)
|
||||
var/SA_pp = (SA.moles/breath.total_moles())*breath_pressure
|
||||
var/SA_pp = (SA.moles/breath.total_moles)*breath_pressure
|
||||
if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit
|
||||
Paralyse(3) // 3 gives them one second to wake up and run away a bit!
|
||||
if(SA_pp > SA_sleep_min) // Enough to make us sleep as well
|
||||
|
||||
@@ -508,7 +508,7 @@
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
|
||||
var/pressure = environment.return_pressure()
|
||||
var/total_moles = environment.total_moles()
|
||||
var/total_moles = environment.total_moles
|
||||
|
||||
dat += "Air Pressure: [round(pressure,0.1)] kPa<br>"
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user