mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 11:34:19 +01:00
Gas Mixture Refactor (#13602)
* Gas Mixture Refactor * derp * defined turf types * fixes * cuts turf visuals cost in half * even better equalizing with planetary atmos * remove volatile fuel * comment and documentatino on turf gas vars
This commit is contained in:
@@ -15,9 +15,7 @@
|
||||
if(T.active_hotspot)
|
||||
burning = 1
|
||||
|
||||
to_chat(usr, "<span class='notice'>@[target.x],[target.y]: O:[GM.oxygen] T:[GM.toxins] N:[GM.nitrogen] C:[GM.carbon_dioxide] w [GM.temperature] Kelvin, [GM.return_pressure()] kPa [(burning)?("<span class='warning'>BURNING</span>"):(null)]</span>")
|
||||
for(var/datum/gas/trace_gas in GM.trace_gases)
|
||||
to_chat(usr, "[trace_gas.type]: [trace_gas.moles]")
|
||||
to_chat(usr, "<span class='notice'>@[target.x],[target.y]: O:[GM.oxygen] T:[GM.toxins] N:[GM.nitrogen] C:[GM.carbon_dioxide] N2O: [GM.sleeping_agent] Agent B: [GM.agent_b] w [GM.temperature] Kelvin, [GM.return_pressure()] kPa [(burning)?("<span class='warning'>BURNING</span>"):(null)]</span>")
|
||||
|
||||
message_admins("[key_name_admin(usr)] has checked the air status of [target]")
|
||||
log_admin("[key_name(usr)] has checked the air status of [target]")
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
var/plasma = 0
|
||||
var/cdiox = 0
|
||||
var/nitrox = 0
|
||||
var/agentbx = 0
|
||||
|
||||
|
||||
/datum/buildmode_mode/atmos/show_help(mob/user)
|
||||
@@ -29,6 +30,7 @@
|
||||
plasma = input(user, "Plasma ratio", "Input", 0) as num|null
|
||||
cdiox = input(user, "CO2 ratio", "Input", 0) as num|null
|
||||
nitrox = input(user, "N2O ratio", "Input", 0) as num|null
|
||||
agentbx = input(user, "Agent B ratio", "Input", 0) as num|null
|
||||
|
||||
/datum/buildmode_mode/atmos/proc/ppratio_to_moles(ppratio)
|
||||
// ideal gas equation: Pressure * Volume = Moles * r * Temperature
|
||||
@@ -52,11 +54,8 @@
|
||||
S.air.nitrogen = ppratio_to_moles(nitrogen)
|
||||
S.air.toxins = ppratio_to_moles(plasma)
|
||||
S.air.carbon_dioxide = ppratio_to_moles(cdiox)
|
||||
S.air.trace_gases.Cut()
|
||||
if(nitrox)
|
||||
var/datum/gas/TG = new /datum/gas/sleeping_agent
|
||||
TG.moles = ppratio_to_moles(nitrox)
|
||||
S.air.trace_gases += TG
|
||||
S.air.sleeping_agent = ppratio_to_moles(nitrox)
|
||||
S.air.agent_b = ppratio_to_moles(agentbx)
|
||||
S.update_visuals()
|
||||
S.air_update_turf()
|
||||
else if(ctrl_click) // overwrite "default" unsimulated air
|
||||
@@ -65,7 +64,8 @@
|
||||
T.nitrogen = ppratio_to_moles(nitrogen)
|
||||
T.toxins = ppratio_to_moles(plasma)
|
||||
T.carbon_dioxide = ppratio_to_moles(cdiox)
|
||||
// no interface for trace gases on unsim turfs
|
||||
T.sleeping_agent = ppratio_to_moles(nitrox)
|
||||
T.agent_b = ppratio_to_moles(agentbx)
|
||||
T.air_update_turf()
|
||||
|
||||
// admin log
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
var/O2_partialpressure = (breath.oxygen/breath.total_moles())*breath_pressure
|
||||
var/Toxins_partialpressure = (breath.toxins/breath.total_moles())*breath_pressure
|
||||
var/CO2_partialpressure = (breath.carbon_dioxide/breath.total_moles())*breath_pressure
|
||||
|
||||
var/SA_partialpressure = (breath.sleeping_agent/breath.total_moles())*breath_pressure
|
||||
|
||||
//OXYGEN
|
||||
if(O2_partialpressure < safe_oxy_min) //Not enough oxygen
|
||||
@@ -168,16 +168,14 @@
|
||||
clear_alert("too_much_tox")
|
||||
|
||||
//TRACE GASES
|
||||
if(breath.trace_gases.len)
|
||||
for(var/datum/gas/sleeping_agent/SA in breath.trace_gases)
|
||||
var/SA_partialpressure = (SA.moles/breath.total_moles())*breath_pressure
|
||||
if(SA_partialpressure > SA_para_min)
|
||||
Paralyse(3)
|
||||
if(SA_partialpressure > SA_sleep_min)
|
||||
AdjustSleeping(2, bound_lower = 0, bound_upper = 10)
|
||||
else if(SA_partialpressure > 0.01)
|
||||
if(prob(20))
|
||||
emote(pick("giggle","laugh"))
|
||||
if(breath.sleeping_agent)
|
||||
if(SA_partialpressure > SA_para_min)
|
||||
Paralyse(3)
|
||||
if(SA_partialpressure > SA_sleep_min)
|
||||
AdjustSleeping(2, bound_lower = 0, bound_upper = 10)
|
||||
else if(SA_partialpressure > 0.01)
|
||||
if(prob(20))
|
||||
emote(pick("giggle","laugh"))
|
||||
|
||||
//BREATH TEMPERATURE
|
||||
handle_breath_temperature(breath)
|
||||
|
||||
@@ -65,8 +65,8 @@
|
||||
t+= "<span class='notice'>Oxygen: [environment.oxygen] \n</span>"
|
||||
t+= "<span class='notice'>Plasma : [environment.toxins] \n</span>"
|
||||
t+= "<span class='notice'>Carbon Dioxide: [environment.carbon_dioxide] \n</span>"
|
||||
for(var/datum/gas/trace_gas in environment.trace_gases)
|
||||
to_chat(usr, "<span class='notice'>[trace_gas.type]: [trace_gas.moles] \n</span>")
|
||||
t+= "<span class='notice'>N2O: [environment.sleeping_agent] \n</span>"
|
||||
t+= "<span class='notice'>Agent B: [environment.agent_b] \n</span>"
|
||||
|
||||
usr.show_message(t, 1)
|
||||
|
||||
|
||||
@@ -84,9 +84,7 @@
|
||||
data["SM_ambienttemp"] = air.temperature
|
||||
data["SM_ambientpressure"] = air.return_pressure()
|
||||
//data["SM_EPR"] = round((air.total_moles / air.group_multiplier) / 23.1, 0.01)
|
||||
var/other_moles = 0.0
|
||||
for(var/datum/gas/G in air.trace_gases)
|
||||
other_moles+=G.moles
|
||||
var/other_moles = air.total_trace_moles()
|
||||
var/TM = air.total_moles()
|
||||
if(TM)
|
||||
data["SM_gas_O2"] = round(100*air.oxygen/TM,0.01)
|
||||
@@ -94,7 +92,7 @@
|
||||
data["SM_gas_N2"] = round(100*air.nitrogen/TM,0.01)
|
||||
data["SM_gas_PL"] = round(100*air.toxins/TM,0.01)
|
||||
if(other_moles)
|
||||
data["SM_gas_OTHER"] = round(100*other_moles/TM,0.01)
|
||||
data["SM_gas_OTHER"] = round(100 * other_moles / TM, 0.01)
|
||||
else
|
||||
data["SM_gas_OTHER"] = 0
|
||||
else
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
T.air.nitrogen = T.nitrogen
|
||||
T.air.carbon_dioxide = T.carbon_dioxide
|
||||
T.air.toxins = T.toxins
|
||||
T.air.sleeping_agent = T.sleeping_agent
|
||||
T.air.agent_b = T.agent_b
|
||||
T.air.temperature = T.temperature
|
||||
SSair.add_to_active(T)
|
||||
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
var/N2_pp = breath.get_breath_partial_pressure(breath.nitrogen)
|
||||
var/Toxins_pp = breath.get_breath_partial_pressure(breath.toxins)
|
||||
var/CO2_pp = breath.get_breath_partial_pressure(breath.carbon_dioxide)
|
||||
var/SA_pp = breath.get_breath_partial_pressure(breath.sleeping_agent)
|
||||
|
||||
|
||||
//-- OXY --//
|
||||
@@ -230,16 +231,14 @@
|
||||
|
||||
//-- TRACES --//
|
||||
|
||||
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 = breath.get_breath_partial_pressure(SA.moles)
|
||||
if(SA_pp > SA_para_min)
|
||||
H.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
|
||||
H.AdjustSleeping(8, bound_lower = 0, bound_upper = 10)
|
||||
else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning
|
||||
if(prob(20))
|
||||
H.emote(pick("giggle", "laugh"))
|
||||
if(breath.sleeping_agent) // If there's some other shit in the air lets deal with it here.
|
||||
if(SA_pp > SA_para_min)
|
||||
H.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
|
||||
H.AdjustSleeping(8, bound_lower = 0, bound_upper = 10)
|
||||
else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning
|
||||
if(prob(20))
|
||||
H.emote(pick("giggle", "laugh"))
|
||||
|
||||
handle_breath_temperature(breath, H)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user