mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
This reverts commit 69a9eb0. About The Pull Request Fixes the sm producing fusion. dynamic_heat_modifier and power_transmission_bonus never got a clean reset, and because they are global vars, kept gaining value. I've fixed this and tweaked 1 comment about max heat output. This was a result of misunderstanding from both ghil and ninja, and is now thankfully fixed. Why It's Good For The Game This shit is neat, should actually be in the game rather then in my fixing pile. Changelog 🆑 add: The h2o interactions have been polished and readded. Fucking global variables. /🆑
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#define CO2_HEAT_PENALTY 0.1
|
||||
#define NITROGEN_HEAT_PENALTY -1.5
|
||||
#define BZ_HEAT_PENALTY 5
|
||||
#define H2O_HEAT_PENALTY 8 //still under testing, but should be enough to make a lot of heat
|
||||
#define FREON_HEAT_PENALTY -10 //very good heat absorbtion and less plasma and o2 generation
|
||||
|
||||
|
||||
@@ -29,11 +30,13 @@
|
||||
#define BZ_TRANSMIT_MODIFIER -2
|
||||
#define TRITIUM_TRANSMIT_MODIFIER 30 //We divide by 10, so this works out to 3
|
||||
#define PLUOXIUM_TRANSMIT_MODIFIER -5 //Should halve the power output
|
||||
#define H2O_TRANSMIT_MODIFIER -9
|
||||
|
||||
#define BZ_RADIOACTIVITY_MODIFIER 5 //Improves the effect of transmit modifiers
|
||||
|
||||
#define N2O_HEAT_RESISTANCE 6 //Higher == Gas makes the crystal more resistant against heat damage.
|
||||
#define PLUOXIUM_HEAT_RESISTANCE 3
|
||||
#define H2O_HEAT_RESISTANCE 10
|
||||
|
||||
#define POWERLOSS_INHIBITION_GAS_THRESHOLD 0.20 //Higher == Higher percentage of inhibitor gas needed before the charge inertia chain reaction effect starts.
|
||||
#define POWERLOSS_INHIBITION_MOLE_THRESHOLD 20 //Higher == More moles of the gas are needed before the charge inertia chain reaction effect starts. //Scales powerloss inhibition down until this amount of moles is reached
|
||||
@@ -107,7 +110,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
critical_machine = TRUE
|
||||
|
||||
//If we ever start to care about all gasses, make this based on type and apply it as a for loop
|
||||
var/list/gas_trans = list("PL" = PLASMA_TRANSMIT_MODIFIER, "O2" = OXYGEN_TRANSMIT_MODIFIER, "TRIT" = TRITIUM_TRANSMIT_MODIFIER, "PLX" = PLUOXIUM_TRANSMIT_MODIFIER, "BZ" = BZ_TRANSMIT_MODIFIER)
|
||||
var/list/gas_trans = list("PL" = PLASMA_TRANSMIT_MODIFIER, "WV" = H2O_TRANSMIT_MODIFIER, "O2" = OXYGEN_TRANSMIT_MODIFIER, "TRIT" = TRITIUM_TRANSMIT_MODIFIER, "PLX" = PLUOXIUM_TRANSMIT_MODIFIER, "BZ" = BZ_TRANSMIT_MODIFIER)
|
||||
var/gasefficency = 0.15
|
||||
|
||||
var/base_icon_state = "darkmatter"
|
||||
@@ -131,8 +134,9 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
|
||||
var/lastwarning = 0 // Time in 1/10th of seconds since the last sent warning
|
||||
var/power = 0
|
||||
|
||||
///Determines the rate of positve change in gas comp values
|
||||
var/gas_change_rate = 0.05
|
||||
///Ranging from 0 to 1, this is used to judge gas composition. It doesn't perfectly match the air around the sm, instead moving up at a rate determined by gas_change_rate per call
|
||||
var/n2comp = 0 // raw composition of each gas in the chamber, ranges from 0 to 1
|
||||
var/plasmacomp = 0
|
||||
var/o2comp = 0
|
||||
@@ -141,11 +145,20 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
var/tritiumcomp = 0
|
||||
var/bzcomp = 0
|
||||
var/pluoxiumcomp = 0
|
||||
var/h2ocomp = 0
|
||||
var/freoncomp = 0
|
||||
|
||||
var/pluoxiumbonus = 0
|
||||
var/freonbonus = 1 //it allows us to remove the power generation while freon is inside the chamber
|
||||
///used when calculating if the heat resitance from h2o is applied
|
||||
var/h2obonus = 0
|
||||
///it allows us to remove the power generation while freon is inside the chamber
|
||||
var/freonbonus = 1
|
||||
///used when calculating if the h2o "malus" is applied, the malus is an increase in power, waste gases and heat (wich is bad if not ready) also now used when calculating amount of radiations
|
||||
var/h2omalus = 1
|
||||
///fix for the heat penalty, making it work differently at different %
|
||||
var/h2ofixed = 0.5
|
||||
|
||||
///The last air sample's total molar count, will always be above or equal to 0
|
||||
var/combined_gas = 0
|
||||
var/gasmix_power_ratio = 0
|
||||
var/dynamic_heat_modifier = 1
|
||||
@@ -413,7 +426,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
//This means we can only deal 1.8 damage per function call
|
||||
damage = min(damage_archived + (DAMAGE_HARDCAP * explosion_point),damage)
|
||||
|
||||
removed.assert_gases(/datum/gas/oxygen, /datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/nitrogen, /datum/gas/pluoxium, /datum/gas/tritium, /datum/gas/bz, /datum/gas/freon)
|
||||
removed.assert_gases(/datum/gas/oxygen, /datum/gas/water_vapor, /datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/nitrogen, /datum/gas/pluoxium, /datum/gas/tritium, /datum/gas/bz, /datum/gas/freon)
|
||||
//calculating gas related values
|
||||
//Wanna know a secret? See that max() to zero? it's used for error checking. If we get a mol count in the negative, we'll get a divide by zero error
|
||||
combined_gas = max(removed.total_moles(), 0)
|
||||
@@ -433,6 +446,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
bzcomp += clamp(max(removed.gases[/datum/gas/bz][MOLES]/combined_gas, 0) - bzcomp, -1, gas_change_rate)
|
||||
n2ocomp += clamp(max(removed.gases[/datum/gas/nitrous_oxide][MOLES]/combined_gas, 0) - n2ocomp, -1, gas_change_rate)
|
||||
n2comp += clamp(max(removed.gases[/datum/gas/nitrogen][MOLES]/combined_gas, 0) - n2comp, -1, gas_change_rate)
|
||||
h2ocomp += clamp(max(removed.gases[/datum/gas/water_vapor][MOLES]/combined_gas, 0) - h2ocomp, -1, gas_change_rate)
|
||||
freoncomp += clamp(max(removed.gases[/datum/gas/freon][MOLES]/combined_gas, 0) - freoncomp, -1, gas_change_rate)
|
||||
|
||||
//We're concerned about pluoxium being too easy to abuse at low percents, so we make sure there's a substantial amount.
|
||||
@@ -441,31 +455,56 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
else
|
||||
pluoxiumbonus = 0
|
||||
|
||||
if (h2ocomp >= 0.35 && h2ocomp <= 0.45) //heat protection from h2o only works when it's between 35 and 45%
|
||||
h2obonus = 1
|
||||
else
|
||||
h2obonus = 0
|
||||
|
||||
if(freoncomp <= 0.03)
|
||||
freonbonus = 1
|
||||
else
|
||||
freonbonus = 0 //stop any power generation by removing radiation output
|
||||
|
||||
switch(h2ocomp)
|
||||
if (-INFINITY to 0.05) //non h2o delamination fix
|
||||
h2omalus = 1
|
||||
if(0.05 to 0.45) //the engine will stop producing power from 5% to 45% h2o (slow down the o2 and plasma generation too)
|
||||
h2omalus = 0.05
|
||||
if (0.45 to INFINITY)
|
||||
h2omalus = 2 //when gas comp is above 0.45 the engine will start to freak out
|
||||
|
||||
switch(h2ocomp) //variability in the h2o penalty calculation depending on the %
|
||||
if(-INFINITY to 0.30)
|
||||
h2ofixed = 1
|
||||
if(0.30 to 0.50)
|
||||
h2ofixed = 0.5
|
||||
if(0.5 to INFINITY)
|
||||
h2ofixed = 2
|
||||
|
||||
//No less then zero, and no greater then one, we use this to do explosions and heat to power transfer
|
||||
gasmix_power_ratio = min(max(plasmacomp + o2comp + co2comp + tritiumcomp + bzcomp - pluoxiumcomp - n2comp - freoncomp, 0), 1)
|
||||
//Minimum value of 1.5, maximum value of 15
|
||||
gasmix_power_ratio = min(max(((plasmacomp + o2comp + co2comp + h2ocomp + tritiumcomp + bzcomp - pluoxiumcomp - n2comp - freoncomp) * h2omalus), 0), 1)
|
||||
//Minimum value of 1.5, maximum value of 23
|
||||
dynamic_heat_modifier = plasmacomp * PLASMA_HEAT_PENALTY
|
||||
dynamic_heat_modifier += o2comp * OXYGEN_HEAT_PENALTY
|
||||
dynamic_heat_modifier += co2comp * CO2_HEAT_PENALTY
|
||||
dynamic_heat_modifier += tritiumcomp * TRITIUM_HEAT_PENALTY
|
||||
dynamic_heat_modifier += (pluoxiumcomp * PLUOXIUM_HEAT_PENALTY) * pluoxiumbonus
|
||||
dynamic_heat_modifier += pluoxiumcomp * PLUOXIUM_HEAT_PENALTY * pluoxiumbonus
|
||||
dynamic_heat_modifier += n2comp * NITROGEN_HEAT_PENALTY
|
||||
dynamic_heat_modifier += bzcomp * BZ_HEAT_PENALTY
|
||||
dynamic_heat_modifier += freoncomp * FREON_HEAT_PENALTY
|
||||
dynamic_heat_modifier *= h2omalus
|
||||
dynamic_heat_modifier += h2ocomp * H2O_HEAT_PENALTY * h2ofixed
|
||||
dynamic_heat_modifier = max(dynamic_heat_modifier, 0.5)
|
||||
//Value between 6 and 1
|
||||
dynamic_heat_resistance = max((n2ocomp * N2O_HEAT_RESISTANCE) + ((pluoxiumcomp * PLUOXIUM_HEAT_RESISTANCE) * pluoxiumbonus), 1)
|
||||
//Value between 30 and -5, used to determine radiation output as it concerns things like collecters
|
||||
//Value between 1 and 10
|
||||
dynamic_heat_resistance = max((n2ocomp * N2O_HEAT_RESISTANCE) + ((h2ocomp * H2O_HEAT_RESISTANCE) * h2obonus) + ((pluoxiumcomp * PLUOXIUM_HEAT_RESISTANCE) * pluoxiumbonus), 1)
|
||||
//Value between 30 and -5, used to determine radiation output as it concerns things like collectors
|
||||
power_transmission_bonus = plasmacomp * gas_trans["PL"]
|
||||
power_transmission_bonus += o2comp * gas_trans["O2"]
|
||||
power_transmission_bonus += (h2ocomp * gas_trans["WV"])*h2obonus
|
||||
power_transmission_bonus += bzcomp * gas_trans["BZ"]
|
||||
power_transmission_bonus += tritiumcomp * gas_trans["TRIT"]
|
||||
power_transmission_bonus += (pluoxiumcomp * gas_trans["PLX"]) * pluoxiumbonus
|
||||
power_transmission_bonus *= h2omalus
|
||||
|
||||
//more moles of gases are harder to heat than fewer, so let's scale heat damage around them
|
||||
mole_heat_penalty = max(combined_gas / MOLE_HEAT_PENALTY, 0.25)
|
||||
@@ -519,9 +558,9 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
|
||||
//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.
|
||||
//Power * 0.55 * (some value between 1.5 and 15) / 5
|
||||
//Power * 0.55 * (some value between 1.5 and 23) / 5
|
||||
removed.temperature += ((device_energy * dynamic_heat_modifier) / THERMAL_RELEASE_MODIFIER)
|
||||
//We can only emit so much heat, that being 37500
|
||||
//We can only emit so much heat, that being 57500
|
||||
removed.temperature = max(0, min(removed.temperature, 2500 * dynamic_heat_modifier))
|
||||
|
||||
//Calculate how much gas to release
|
||||
|
||||
Reference in New Issue
Block a user