mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-25 04:57:12 +01:00
Replaces The SM Crush Bonus With a New Mechanic: Gas Coefficient (#27168)
* Changes crush to per gas bonuses depending on amount in the chamber * Undef the defines * oops * Make anomaly spawn threshold depend on power + bonus rather than power or crunch threshold. * moves the crunch bonus outside the if scope * Makes mole_crunch_bonus a variable of the SM * adds mole_crunch_bonus to power on the top if of the arcs and anomaly section * Adds mole count and the gas coefficient of the mix to the SM monitoring console * Removes a redundant rounding * Rebuild TGUI * rebuild tgui * Update tgui.bundle.js * Update tgui.bundle.js * Changes the variable name to gas coefficient * oops * Makes the uses of gas_coefficient a bit tidier * Update tgui.bundle.js * Update tgui.bundle.js * Tgui rebuild * Makes scaling below the old crush threshold quadratic, and makes GC scale with the square root of total moles above it. * Uses linear scaling for the moles progress bar * Corrects using the log scaled value of the moles for the bar --------- Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
co-authored by
Burzah
parent
92c663e1ff
commit
55ff05d57b
@@ -54,23 +54,25 @@
|
||||
data["SM_power"] = active.power
|
||||
data["SM_ambienttemp"] = air.temperature()
|
||||
data["SM_ambientpressure"] = air.return_pressure()
|
||||
data["SM_moles"] = air.total_moles()
|
||||
data["SM_gas_coefficient"] = active.gas_coefficient
|
||||
//data["SM_EPR"] = round((air.total_moles / air.group_multiplier) / 23.1, 0.01)
|
||||
var/list/gasdata = list()
|
||||
var/TM = air.total_moles()
|
||||
if(TM)
|
||||
gasdata.Add(list(list("name"= "Oxygen", "amount" = round(100 * air.oxygen() / TM, 0.01))))
|
||||
gasdata.Add(list(list("name"= "Carbon Dioxide", "amount" = round(100 * air.carbon_dioxide() / TM, 0.01))))
|
||||
gasdata.Add(list(list("name"= "Nitrogen", "amount" = round(100 * air.nitrogen() / TM, 0.01))))
|
||||
gasdata.Add(list(list("name"= "Plasma", "amount" = round(100 * air.toxins() / TM, 0.01))))
|
||||
gasdata.Add(list(list("name"= "Nitrous Oxide", "amount" = round(100 * air.sleeping_agent() / TM, 0.01))))
|
||||
gasdata.Add(list(list("name"= "Agent B", "amount" = round(100 * air.agent_b() / TM, 0.01))))
|
||||
gasdata.Add(list(list("name"= "Oxygen", "amount" = air.oxygen(), "portion" = round(100 * air.oxygen() / TM, 0.01))))
|
||||
gasdata.Add(list(list("name"= "Carbon Dioxide", "amount" = air.carbon_dioxide(), "portion" = round(100 * air.carbon_dioxide() / TM, 0.01))))
|
||||
gasdata.Add(list(list("name"= "Nitrogen", "amount" = air.nitrogen(), "portion" = round(100 * air.nitrogen() / TM, 0.01))))
|
||||
gasdata.Add(list(list("name"= "Plasma", "amount" = air.toxins(), "portion" = round(100 * air.toxins() / TM, 0.01))))
|
||||
gasdata.Add(list(list("name"= "Nitrous Oxide", "amount" = air.sleeping_agent(), "portion" = round(100 * air.sleeping_agent() / TM, 0.01))))
|
||||
gasdata.Add(list(list("name"= "Agent B", "amount" = air.agent_b(), "portion" = round(100 * air.agent_b() / TM, 0.01))))
|
||||
else
|
||||
gasdata.Add(list(list("name"= "Oxygen", "amount" = 0)))
|
||||
gasdata.Add(list(list("name"= "Carbon Dioxide", "amount" = 0)))
|
||||
gasdata.Add(list(list("name"= "Nitrogen", "amount" = 0)))
|
||||
gasdata.Add(list(list("name"= "Plasma", "amount" = 0)))
|
||||
gasdata.Add(list(list("name"= "Nitrous Oxide", "amount" = 0)))
|
||||
gasdata.Add(list(list("name"= "Agent B", "amount" = 0)))
|
||||
gasdata.Add(list(list("name"= "Oxygen", "amount" = 0, "portion" = 0)))
|
||||
gasdata.Add(list(list("name"= "Carbon Dioxide", "amount" = 0,"portion" = 0)))
|
||||
gasdata.Add(list(list("name"= "Nitrogen", "amount" = 0,"portion" = 0)))
|
||||
gasdata.Add(list(list("name"= "Plasma", "amount" = 0,"portion" = 0)))
|
||||
gasdata.Add(list(list("name"= "Nitrous Oxide", "amount" = 0,"portion" = 0)))
|
||||
gasdata.Add(list(list("name"= "Agent B", "amount" = 0,"portion" = 0)))
|
||||
data["gases"] = gasdata
|
||||
else
|
||||
var/list/SMS = list()
|
||||
|
||||
@@ -25,6 +25,12 @@
|
||||
#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
|
||||
#define POWERLOSS_INHIBITION_MOLE_BOOST_THRESHOLD 500 //bonus powerloss inhibition boost if this amount of moles is reached
|
||||
|
||||
#define O2_CRUNCH 1.5
|
||||
#define CO2_CRUNCH 1
|
||||
#define N2_CRUNCH 0.55
|
||||
#define N2O_CRUNCH 0.55
|
||||
#define PLASMA_CRUNCH 4
|
||||
|
||||
#define MOLE_CRUNCH_THRESHOLD 1700 //Above this value we can get lord singulo and
|
||||
#define MOLE_PENALTY_THRESHOLD 1800 //Above this value we can get lord singulo and independent mol damage, below it we can heal damage
|
||||
#define MOLE_HEAT_PENALTY 350 //Heat damage scales around this. Too hot setups with this amount of moles do regular damage, anything above and below is scaled
|
||||
@@ -134,8 +140,10 @@
|
||||
var/explosion_power = 35
|
||||
///Time in 1/10th of seconds since the last sent warning
|
||||
var/lastwarning = 0
|
||||
///Refered to as eer on the moniter. This value effects gas output, heat, damage, and radiation.
|
||||
/// Refered to as eer on the moniter. This value effects gas output, heat, damage, and radiation.
|
||||
var/power = 0
|
||||
/// A bonus to rad production equal to EER multiplied by the bonus given by each gas. The bonus gets higher the more gas there is in the chamber.
|
||||
var/gas_coefficient
|
||||
///Determines the rate of positve change in gas comp values
|
||||
var/gas_change_rate = 0.05
|
||||
|
||||
@@ -549,13 +557,11 @@
|
||||
if(power_changes)
|
||||
power = max((removed.temperature() * temp_factor / T0C) * gasmix_power_ratio + power, 0)
|
||||
|
||||
var/crush_ratio = combined_gas / MOLE_CRUNCH_THRESHOLD
|
||||
|
||||
gas_coefficient = 1 + (crush_ratio ** 2 * (crush_ratio <= 1) + (crush_ratio > 1) * crush_ratio ** 0.5) * (plasmacomp * PLASMA_CRUNCH + o2comp * O2_CRUNCH + co2comp * CO2_CRUNCH + n2comp * N2_CRUNCH + n2ocomp * N2O_CRUNCH)
|
||||
if(prob(50))
|
||||
var/mole_crunch_bonus = 0
|
||||
if(combined_gas > MOLE_CRUNCH_THRESHOLD)
|
||||
mole_crunch_bonus = 7000 //This adds 7000 EER worth of power to the SM. This should make mole crunch potentially worthy as a SM setup, if not risky. More stable than the anomalies, but very easy to push over the edge. Don't forget, a high EER setup can harvest power through zaps
|
||||
if(!has_been_powered) // Nice try, no free no risk power
|
||||
enable_for_the_first_time()
|
||||
radiation_pulse(src, power * max(0, (1 + (power_transmission_bonus / 10))) + mole_crunch_bonus)
|
||||
radiation_pulse(src, power * (gas_coefficient + max(0, ((power_transmission_bonus / 10)))))
|
||||
|
||||
//Power * 0.55 * a value between 1 and 0.8
|
||||
var/device_energy = power * REACTION_POWER_MODIFIER
|
||||
@@ -598,7 +604,7 @@
|
||||
//After this point power is lowered
|
||||
//This wraps around to the begining of the function
|
||||
//Handle high power zaps/anomaly generation
|
||||
if(power > POWER_PENALTY_THRESHOLD || damage > damage_penalty_point || combined_gas > MOLE_CRUNCH_THRESHOLD) //If the power is above 5000, if the damage is above 550, or mole crushing
|
||||
if((power * gas_coefficient) > POWER_PENALTY_THRESHOLD || damage > damage_penalty_point) //If the power is above 5000, if the damage is above 550, or mole crushing
|
||||
var/range = 4
|
||||
zap_cutoff = 1500
|
||||
if(removed && removed.return_pressure() > 0 && removed.temperature() > 0)
|
||||
@@ -637,9 +643,9 @@
|
||||
|
||||
if(prob(5))
|
||||
supermatter_anomaly_gen(src, FLUX_ANOMALY, rand(5, 10))
|
||||
if(power > SEVERE_POWER_PENALTY_THRESHOLD && prob(5) || prob(1) || combined_gas > MOLE_CRUNCH_THRESHOLD && prob(5))
|
||||
if((power * gas_coefficient) > SEVERE_POWER_PENALTY_THRESHOLD && prob(5) || prob(1))
|
||||
supermatter_anomaly_gen(src, GRAVITATIONAL_ANOMALY, rand(5, 10))
|
||||
if((power > SEVERE_POWER_PENALTY_THRESHOLD && prob(2)) || (prob(0.3) && power > POWER_PENALTY_THRESHOLD) || combined_gas > MOLE_CRUNCH_THRESHOLD && prob(2))
|
||||
if(((power * gas_coefficient) > SEVERE_POWER_PENALTY_THRESHOLD && prob(2)) || (prob(0.3) && (power * gas_coefficient) > POWER_PENALTY_THRESHOLD))
|
||||
supermatter_anomaly_gen(src, BLUESPACE_ANOMALY, rand(5, 10))
|
||||
|
||||
if(prob(15))
|
||||
@@ -1308,3 +1314,8 @@
|
||||
#undef SUPERMATTER_TESLA_COLOUR
|
||||
#undef SUPERMATTER_SINGULARITY_RAYS_COLOUR
|
||||
#undef SUPERMATTER_SINGULARITY_LIGHT_COLOUR
|
||||
#undef O2_CRUNCH
|
||||
#undef CO2_CRUNCH
|
||||
#undef N2_CRUNCH
|
||||
#undef N2O_CRUNCH
|
||||
#undef PLASMA_CRUNCH
|
||||
|
||||
@@ -22,7 +22,7 @@ const SupermatterMonitorListView = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const { supermatters = [] } = data;
|
||||
return (
|
||||
<Window width={450} height={185}>
|
||||
<Window width={450} height={250}>
|
||||
<Window.Content scrollable>
|
||||
<Section
|
||||
fill
|
||||
@@ -67,13 +67,13 @@ const SupermatterMonitorListView = (props, context) => {
|
||||
|
||||
const SupermatterMonitorDataView = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const { active, SM_integrity, SM_power, SM_ambienttemp, SM_ambientpressure } = data;
|
||||
const { active, SM_integrity, SM_power, SM_ambienttemp, SM_ambientpressure, SM_moles, SM_gas_coefficient } = data;
|
||||
const gases = flow([(gases) => gases.filter((gas) => gas.amount >= 0.01), sortBy((gas) => -gas.amount)])(
|
||||
data.gases || []
|
||||
);
|
||||
const gasMaxAmount = Math.max(1, ...gases.map((gas) => gas.amount));
|
||||
const gasMaxAmount = Math.max(1, ...gases.map((gas) => gas.portion));
|
||||
return (
|
||||
<Window width={550} height={185}>
|
||||
<Window width={550} height={250}>
|
||||
<Window.Content>
|
||||
<Stack fill>
|
||||
<Stack.Item width="270px">
|
||||
@@ -103,6 +103,20 @@ const SupermatterMonitorDataView = (props, context) => {
|
||||
{toFixed(SM_power) + ' MeV/cm3'}
|
||||
</ProgressBar>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Gas Coefficient">
|
||||
<ProgressBar
|
||||
value={SM_gas_coefficient}
|
||||
minValue={1}
|
||||
maxValue={5.25}
|
||||
ranges={{
|
||||
bad: [1, 1.55],
|
||||
average: [1.55, 5.25],
|
||||
good: [5.25, Infinity],
|
||||
}}
|
||||
>
|
||||
{SM_gas_coefficient.toFixed(2)}
|
||||
</ProgressBar>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Temperature">
|
||||
<ProgressBar
|
||||
value={logScale(SM_ambienttemp)}
|
||||
@@ -118,6 +132,21 @@ const SupermatterMonitorDataView = (props, context) => {
|
||||
{toFixed(SM_ambienttemp) + ' K'}
|
||||
</ProgressBar>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Mole Per Tile">
|
||||
<ProgressBar
|
||||
value={SM_moles}
|
||||
minValue={0}
|
||||
maxValue={12000}
|
||||
ranges={{
|
||||
teal: [-Infinity, 100],
|
||||
average: [100, 11333],
|
||||
good: [11333, 12000],
|
||||
bad: [12000, Infinity],
|
||||
}}
|
||||
>
|
||||
{toFixed(SM_moles) + ' mol'}
|
||||
</ProgressBar>
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Pressure">
|
||||
<ProgressBar
|
||||
value={logScale(SM_ambientpressure)}
|
||||
@@ -145,8 +174,8 @@ const SupermatterMonitorDataView = (props, context) => {
|
||||
<LabeledList>
|
||||
{gases.map((gas) => (
|
||||
<LabeledList.Item key={gas.name} label={getGasLabel(gas.name)}>
|
||||
<ProgressBar color={getGasColor(gas.name)} value={gas.amount} minValue={0} maxValue={gasMaxAmount}>
|
||||
{toFixed(gas.amount, 2) + '%'}
|
||||
<ProgressBar color={getGasColor(gas.name)} value={gas.portion} minValue={0} maxValue={gasMaxAmount}>
|
||||
{toFixed(gas.amount) + ' mol (' + gas.portion + '%)'}
|
||||
</ProgressBar>
|
||||
</LabeledList.Item>
|
||||
))}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user