consider efficiency in reactor heat (#11322)

* whatever

* final touches maybe

* well forget that, I m stupid

* no
This commit is contained in:
EggleEgg 2025-10-30 05:43:15 +01:00 committed by GitHub
parent 6f1287e11f
commit 5ae6ffae8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -21,7 +21,6 @@ public class SaveIO{
public static final byte[] header = {'M', 'S', 'A', 'V'}; public static final byte[] header = {'M', 'S', 'A', 'V'};
public static final IntMap<SaveVersion> versions = new IntMap<>(); public static final IntMap<SaveVersion> versions = new IntMap<>();
public static final Seq<SaveVersion> versionArray = Seq.with(new Save1(), new Save2(), new Save3(), new Save4(), new Save5(), new Save6(), new Save7(), new Save8(), new Save9(), new Save10(), new Save11()); public static final Seq<SaveVersion> versionArray = Seq.with(new Save1(), new Save2(), new Save3(), new Save4(), new Save5(), new Save6(), new Save7(), new Save8(), new Save9(), new Save10(), new Save11());
static{ static{
for(SaveVersion version : versionArray){ for(SaveVersion version : versionArray){
versions.put(version.version, version); versions.put(version.version, version);

View file

@ -32,6 +32,8 @@ public class NuclearReactor extends PowerGenerator{
public float heating = 0.01f; public float heating = 0.01f;
/** max heat this block can output */ /** max heat this block can output */
public float heatOutput = 10f; public float heatOutput = 10f;
/** rate at which heat progress increases */
public float heatWarmupRate = 1f;
/** threshold at which block starts smoking */ /** threshold at which block starts smoking */
public float smokeThreshold = 0.3f; public float smokeThreshold = 0.3f;
/** heat threshold at which lights start flashing */ /** heat threshold at which lights start flashing */
@ -84,6 +86,7 @@ public class NuclearReactor extends PowerGenerator{
public class NuclearReactorBuild extends GeneratorBuild implements HeatBlock{ public class NuclearReactorBuild extends GeneratorBuild implements HeatBlock{
public float heat; public float heat;
public float heatProgress;
public float flash; public float flash;
public float smoothLight; public float smoothLight;
@ -118,6 +121,7 @@ public class NuclearReactor extends PowerGenerator{
} }
heat = Mathf.clamp(heat); heat = Mathf.clamp(heat);
heatProgress = heatOutput > 0f ? Mathf.approachDelta(heatProgress, heat * heatOutput * efficiency, heatWarmupRate * delta()) : 0f;
if(heat >= 0.999f){ if(heat >= 0.999f){
Events.fire(Trigger.thoriumReactorOverheat); Events.fire(Trigger.thoriumReactorOverheat);
@ -127,12 +131,12 @@ public class NuclearReactor extends PowerGenerator{
@Override @Override
public float heatFrac(){ public float heatFrac(){
return heatOutput > 0f ? heat : 0f; return heatProgress / heatOutput;
} }
@Override @Override
public float heat(){ public float heat(){
return heatOutput > 0f ? heat * heatOutput : 0f; return heatProgress;
} }
@Override @Override