From 22fae70132af943cb55c73fc17a712674a5855bd Mon Sep 17 00:00:00 2001 From: Putnam3145 Date: Sat, 14 Aug 2021 19:39:31 -0700 Subject: [PATCH] Supermatter surge rework --- code/modules/atmospherics/auxgm/gas_types.dm | 4 ++++ code/modules/events/supermatter_surge.dm | 22 +++++++++++++++---- code/modules/power/supermatter/supermatter.dm | 3 ++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/code/modules/atmospherics/auxgm/gas_types.dm b/code/modules/atmospherics/auxgm/gas_types.dm index 6d30d7ed92..6faa3d55d6 100644 --- a/code/modules/atmospherics/auxgm/gas_types.dm +++ b/code/modules/atmospherics/auxgm/gas_types.dm @@ -157,6 +157,8 @@ id = GAS_METHANE specific_heat = 30 name = "Methane" + powerloss_inhibition = 1 + heat_resistance = 3 breath_results = GAS_METHYL_BROMIDE fire_products = list(GAS_CO2 = 1, GAS_H2O = 2) fire_burn_rate = 0.5 @@ -177,6 +179,8 @@ id = GAS_METHYL_BROMIDE specific_heat = 42 name = "Methyl Bromide" + powermix = 1 + heat_penalty = -1 flags = GAS_FLAG_DANGEROUS breath_alert_info = list( not_enough_alert = list( diff --git a/code/modules/events/supermatter_surge.dm b/code/modules/events/supermatter_surge.dm index 6b0a093440..78b5c9e70c 100644 --- a/code/modules/events/supermatter_surge.dm +++ b/code/modules/events/supermatter_surge.dm @@ -27,13 +27,27 @@ if(prob(low_threat_perc)) severity = "low; the supermatter should return to normal operation shortly." else - severity = "medium; the supermatter should return to normal operation, but check NT CIMS to ensure this." + severity = "medium; the supermatter should return to normal operation, but regardless, check if the emitters may need to be turned off temporarily." else - severity = "high; if the supermatter's cooling is not fortified, coolant may need to be added." + severity = "high; the emitters likely need to be turned off, and if the supermatter's cooling loop is not fortified, pre-cooled gas may need to be added." if(100000 to INFINITY) - severity = "extreme; emergency action is likely to be required even if coolant loop is fine." + severity = "extreme; emergency action is likely to be required even if coolant loop is fine. Turn off the emitters and make sure the loop is properly cooling gases." if(power > 20000 || prob(round(power/200))) priority_announce("Supermatter surge detected. Estimated severity is [severity]", "Anomaly Alert") /datum/round_event/supermatter_surge/start() - GLOB.main_supermatter_engine.matter_power += power + var/obj/machinery/power/supermatter_crystal/supermatter = GLOB.main_supermatter_engine + var/power_proportion = supermatter.powerloss_inhibitor/2 // what % of the power goes into matter power, at most 50% + // we reduce the proportion that goes into actual matter power based on powerloss inhibitor + // primarily so the supermatter doesn't tesla the instant these happen + supermatter.matter_power += power * power_proportion + var/datum/gas_mixture/methane_puff = new + var/selected_gas = pick(4;GAS_CO2, 10;GAS_METHANE, 4;GAS_H2O, 1;GAS_BZ, 1;GAS_METHYL_BROMIDE) + methane_puff.set_moles(selected_gas, 500) + methane_puff.set_temperature(500) + var/energy_ratio = (power * 500 * (1-power_proportion)) / methane_puff.thermal_energy() + if(energy_ratio < 1) // energy output we want is lower than current energy, reduce the amount of gas we puff out + methane_puff.set_moles(GAS_METHANE, energy_ratio * 500) + else // energy output we want is higher than current energy, increase its actual heat + methane_puff.set_temperature(energy_ratio * 500) + supermatter.assume_air(methane_puff) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index b460cfea51..0bc2e9a548 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -500,7 +500,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) powerloss_dynamic_scaling = clamp(powerloss_dynamic_scaling + clamp(powerloss_inhibition_gas - powerloss_dynamic_scaling, -0.02, 0.02), 0, 1) else powerloss_dynamic_scaling = clamp(powerloss_dynamic_scaling - 0.05, 0, 1) - //Ranges from 0 to 1(1-(value between 0 and 1 * ranges from 1 to 1.5(mol / 500))) + //Ranges from 0 to 1 (1-(value between 0 and 1 * ranges from 1 to 1.5(mol / 500))) + //0 means full inhibition, 1 means no inhibition //We take the mol count, and scale it to be our inhibitor powerloss_inhibitor = clamp(1-(powerloss_dynamic_scaling * clamp(combined_gas/POWERLOSS_INHIBITION_MOLE_BOOST_THRESHOLD, 1, 1.5)), 0, 1)