Skip to content

Commit

Permalink
Fix and Improve Steam Boiler (GregTechCEu#2636)
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit authored Oct 11, 2024
1 parent 2ad39ab commit 805b20c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private void updateCurrentTemperature() {
if (fuelBurnTimeLeft % 2 == 0 && currentTemperature < getMaxTemperate())
currentTemperature++;
fuelBurnTimeLeft -= isHighPressure ? 2 : 1;
if (fuelBurnTimeLeft == 0) {
if (fuelBurnTimeLeft <= 0) {
this.fuelMaxBurnTime = 0;
this.timeBeforeCoolingDown = getCooldownInterval();
// boiler has no fuel now, so queue burning state update
Expand Down Expand Up @@ -306,6 +306,10 @@ public double getTemperaturePercent() {
return currentTemperature / (getMaxTemperate() * 1.0);
}

public int getCurrentTemperature() {
return currentTemperature;
}

public double getFuelLeftPercent() {
return fuelMaxBurnTime == 0 ? 0.0 : fuelBurnTimeLeft / (fuelMaxBurnTime * 1.0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer play
if (te instanceof IGregTechTileEntity igtte) {
MetaTileEntity mte = igtte.getMetaTileEntity();
if (mte instanceof SteamBoiler boiler) {
if (boiler.isBurning()) {
// Boiler is active
int steamOutput = boiler.getTotalSteamOutput();

int steamOutput = boiler.getTotalSteamOutput();
// If we are producing steam, or we have fuel
if (steamOutput > 0 || boiler.isBurning()) {
// Creating steam
if (steamOutput > 0 && boiler.hasWater()) {
probeInfo.text(TextStyleClass.INFO + "{*gregtech.top.energy_production*} " +
Expand All @@ -42,10 +41,18 @@ public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer play
Materials.Steam.getUnlocalizedName() + "*}");
}

// Cooling Down
if (!boiler.isBurning()) {
probeInfo.text(TextStyleClass.INFO.toString() + TextFormatting.RED +
"{*gregtech.top.steam_cooling_down*}");
}

// Initial heat-up
if (steamOutput <= 0) {
if (steamOutput <= 0 && boiler.getCurrentTemperature() > 0) {
// Current Temperature = the % until the boiler reaches 100
probeInfo.text(TextStyleClass.INFO.toString() + TextFormatting.RED +
"{*gregtech.top.steam_heating_up*}");
"{*gregtech.top.steam_heating_up*} " +
TextFormattingUtil.formatNumbers(boiler.getCurrentTemperature()) + "%");
}

// No water
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/assets/gregtech/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ gregtech.top.transform_up=Step Up
gregtech.top.transform_down=Step Down
gregtech.top.transform_input=Input:
gregtech.top.transform_output=Output:
gregtech.top.steam_heating_up=Heating up
gregtech.top.steam_heating_up=Heating Up:
gregtech.top.steam_cooling_down=Cooling Down
gregtech.top.steam_no_water=No Water

gregtech.top.convert_eu=Converting §eEU§r -> §cFE§r
Expand Down

0 comments on commit 805b20c

Please sign in to comment.