diff --git a/src/main/java/net/torocraft/flighthud/AutoFlightManager.java b/src/main/java/net/torocraft/flighthud/AutoFlightManager.java index f1b6c268..f184aa95 100644 --- a/src/main/java/net/torocraft/flighthud/AutoFlightManager.java +++ b/src/main/java/net/torocraft/flighthud/AutoFlightManager.java @@ -10,6 +10,7 @@ import static net.torocraft.flighthud.FlightSafetyMonitor.lastFireworkActivationTimeMs; import static net.torocraft.flighthud.FlightSafetyMonitor.maximumSafePitch; import static net.torocraft.flighthud.FlightSafetyMonitor.secondsUntilTerrainImpact; +import static net.torocraft.flighthud.FlightSafetyMonitor.thrustLocked; import static net.torocraft.flighthud.FlightSafetyMonitor.thrustSet; import static net.torocraft.flighthud.FlightSafetyMonitor.usableFireworkHand; import static net.torocraft.flighthud.HudComponent.CONFIG; @@ -48,8 +49,8 @@ public static void update(MinecraftClient mc, FlightComputer computer) { boolean approachingDestination = distanceToTarget != null && distanceToTarget < Math.max(40, computer.velocityPerSecond.horizontalLength()); if (computer.speed > 30) thrustSet = true; - if (autoThrustEnabled && usableFireworkHand != null) { - if (gpwsLampColor == CONFIG.color && computer.velocityPerSecond.horizontalLength() > 0.01 && computer.pitch > (autoPilotEnabled ? 0 : 10) && !approachingDestination) { + else if (autoThrustEnabled && usableFireworkHand != null) { + if (!thrustLocked && gpwsLampColor == CONFIG.color && computer.velocityPerSecond.horizontalLength() > 0.01 && computer.pitch > (autoPilotEnabled ? 0 : 10) && !approachingDestination) { if (thrustSet && (computer.speed < 28 || computer.velocityPerSecond.y < -8)) { mc.interactionManager.interactItem(mc.player, usableFireworkHand); lastFireworkActivationTimeMs = lastUpdateTimeMs; @@ -91,7 +92,7 @@ public static void update(MinecraftClient mc, FlightComputer computer) { changeLookDirection(mc.player, targetPitch != null ? (targetPitch + computer.pitch) * deltaTime : 0.0f, deltaHeading * deltaTime * 1.25f); - statusString += "".equals(statusString) ? "AP" : " | AP"; + statusString += "".equals(statusString) ? "A/P" : " | A/P"; } } diff --git a/src/main/java/net/torocraft/flighthud/alerts/AutoThrustLimitedAlert.java b/src/main/java/net/torocraft/flighthud/alerts/AutoThrustLimitedAlert.java index 200fffd7..a3b50331 100644 --- a/src/main/java/net/torocraft/flighthud/alerts/AutoThrustLimitedAlert.java +++ b/src/main/java/net/torocraft/flighthud/alerts/AutoThrustLimitedAlert.java @@ -16,7 +16,7 @@ public boolean shouldActivate() { @Override public int drawText(MinecraftClient mc, DrawContext context, float x, float y, boolean highlight) { - int i = drawCaution(mc, context, x, y, highlight, "AUTO FLT A/THR LIMITED"); + int i = drawCaution(mc, context, x, y, highlight, "AUTO THRUST LIMITED"); if (FlightSafetyMonitor.fireworkCount > 0) i += HudComponent.drawFont(mc, context, " -FRWKS: SELECT", x, y + 9, CONFIG.adviceColor); return i; diff --git a/src/main/java/net/torocraft/flighthud/alerts/FireworkActivationFailureAlert.java b/src/main/java/net/torocraft/flighthud/alerts/FireworkActivationFailureAlert.java index 765a8307..a2406a0b 100644 --- a/src/main/java/net/torocraft/flighthud/alerts/FireworkActivationFailureAlert.java +++ b/src/main/java/net/torocraft/flighthud/alerts/FireworkActivationFailureAlert.java @@ -18,11 +18,15 @@ public boolean shouldActivate() { @Override public int drawText(MinecraftClient mc, DrawContext context, float x, float y, boolean highlight) { int i = drawWarning(mc, context, x, y, highlight, "FRWK ACTIVATION FAIL"); - if (AutoFlightManager.autoPilotEnabled || AutoFlightManager.flightDirectorsEnabled) - i += HudComponent.drawFont(mc, context, " -AP+FD: OFF", x, y += 9, CONFIG.adviceColor); + if (AutoFlightManager.flightDirectorsEnabled) + i += HudComponent.drawFont(mc, context, " -FD: OFF", x, y += 9, CONFIG.adviceColor); if (AutoFlightManager.autoThrustEnabled) - i += HudComponent.drawFont(mc, context, " -ATHR: OFF", x, y += 9, CONFIG.adviceColor); - i += HudComponent.drawFont(mc, context, " SPD MAY BE UNREL", x, y + 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, " -A/THR: OFF", x, y += 9, CONFIG.adviceColor); + if (AutoFlightManager.autoPilotEnabled) + i += HudComponent.drawFont(mc, context, " -A/P: OFF", x, y += 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, " -PITCH: MAX SAFE UP", x, y += 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, " -FRWKS: DO NOT USE", x, y += 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, " SPD MAY BE UNRELIABLE", x, y + 9, CONFIG.adviceColor); return i; } } diff --git a/src/main/java/net/torocraft/flighthud/alerts/FlightProtectionsOffAlert.java b/src/main/java/net/torocraft/flighthud/alerts/FlightProtectionsOffAlert.java index f99038e7..5960f932 100644 --- a/src/main/java/net/torocraft/flighthud/alerts/FlightProtectionsOffAlert.java +++ b/src/main/java/net/torocraft/flighthud/alerts/FlightProtectionsOffAlert.java @@ -3,6 +3,9 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.torocraft.flighthud.FlightSafetyMonitor; +import net.torocraft.flighthud.HudComponent; + +import static net.torocraft.flighthud.HudComponent.CONFIG; public class FlightProtectionsOffAlert extends Alert { @Override @@ -12,6 +15,11 @@ public boolean shouldActivate() { @Override public int drawText(MinecraftClient mc, DrawContext context, float x, float y, boolean highlight) { - return drawCaution(mc, context, x, y, highlight, "FLIGHT PROT OFF"); + int i = drawCaution(mc, context, x, y, highlight, "FLIGHT PROTECTIONS OFF"); + i += HudComponent.drawFont(mc, context, " MAX PITCH: 40* UP", x, y += 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, " MIN V/S: -8 BPS", x, y += 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, " -FRWKS: CONFIRM SAFE", x, y += 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, " MANEUVER WITH CARE", x, y + 9, CONFIG.adviceColor); + return i; } } diff --git a/src/main/java/net/torocraft/flighthud/alerts/GPWSOffAlert.java b/src/main/java/net/torocraft/flighthud/alerts/GPWSOffAlert.java index 433bd55f..d2cc3c58 100644 --- a/src/main/java/net/torocraft/flighthud/alerts/GPWSOffAlert.java +++ b/src/main/java/net/torocraft/flighthud/alerts/GPWSOffAlert.java @@ -2,8 +2,10 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; +import net.torocraft.flighthud.HudComponent; import static net.torocraft.flighthud.FlightHud.CONFIG_SETTINGS; +import static net.torocraft.flighthud.HudComponent.CONFIG; public class GPWSOffAlert extends Alert { @Override @@ -13,6 +15,11 @@ public boolean shouldActivate() { @Override public int drawText(MinecraftClient mc, DrawContext context, float x, float y, boolean highlight) { - return drawCaution(mc, context, x, y, highlight, "GPWS OFF"); + int i = drawCaution(mc, context, x, y, highlight, "GPWS OFF"); + i += HudComponent.drawFont(mc, context, " BELOW 320M", x, y += 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, " -A/P: DO NOT USE", x, y += 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, " BELOW 320M", x, y += 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, " -A/THR: DO NOT USE", x, y + 9, CONFIG.adviceColor); + return i; } } diff --git a/src/main/java/net/torocraft/flighthud/alerts/LowFireworksAlert.java b/src/main/java/net/torocraft/flighthud/alerts/LowFireworksAlert.java index b7f2ba3d..c50c665c 100644 --- a/src/main/java/net/torocraft/flighthud/alerts/LowFireworksAlert.java +++ b/src/main/java/net/torocraft/flighthud/alerts/LowFireworksAlert.java @@ -2,7 +2,11 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; +import net.torocraft.flighthud.AutoFlightManager; import net.torocraft.flighthud.FlightSafetyMonitor; +import net.torocraft.flighthud.HudComponent; + +import static net.torocraft.flighthud.HudComponent.CONFIG; public class LowFireworksAlert extends Alert { @Override @@ -12,6 +16,10 @@ public boolean shouldActivate() { @Override public int drawText(MinecraftClient mc, DrawContext context, float x, float y, boolean highlight) { - return drawCaution(mc, context, x, y, highlight, "FWOB BELOW 24"); + int i = drawCaution(mc, context, x, y, highlight, "FRWK CNT BELOW 24"); + if (AutoFlightManager.autoThrustEnabled) + i += HudComponent.drawFont(mc, context, " -A/THR: OFF", x, y += 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, " -CLIMB: INITIATE", x, y + 9, CONFIG.adviceColor); + return i; } } diff --git a/src/main/java/net/torocraft/flighthud/alerts/NoFireworksAlert.java b/src/main/java/net/torocraft/flighthud/alerts/NoFireworksAlert.java index e094ee92..e0e81e99 100644 --- a/src/main/java/net/torocraft/flighthud/alerts/NoFireworksAlert.java +++ b/src/main/java/net/torocraft/flighthud/alerts/NoFireworksAlert.java @@ -16,10 +16,13 @@ public boolean shouldActivate() { @Override public int drawText(MinecraftClient mc, DrawContext context, float x, float y, boolean highlight) { - int i = drawWarning(mc, context, x, y, highlight, "NO FRWKS ON BOARD"); + int i = drawWarning(mc, context, x, y, highlight, "FRWK CNT ZERO"); + if (AutoFlightManager.autoThrustEnabled) + i += HudComponent.drawFont(mc, context, " -A/THR: OFF", x, y += 9, CONFIG.adviceColor); if (AutoFlightManager.targetAltitude != null) - i += HudComponent.drawFont(mc, context, " -AP ALT: RESET", x, y += 9, CONFIG.adviceColor); - i += HudComponent.drawFont(mc, context, " GLDG DIST: 100 BLKS/10 GND ALT", x, y + 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, " -A/P ALT: RESET", x, y += 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, " GLDG DIST:", x, y += 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, " 100 BLKS/10 M", x, y + 9, CONFIG.adviceColor); return i; } } diff --git a/src/main/java/net/torocraft/flighthud/alerts/ThrustLockedAlert.java b/src/main/java/net/torocraft/flighthud/alerts/ThrustLockedAlert.java index f8c4ec25..ff68611e 100644 --- a/src/main/java/net/torocraft/flighthud/alerts/ThrustLockedAlert.java +++ b/src/main/java/net/torocraft/flighthud/alerts/ThrustLockedAlert.java @@ -18,13 +18,15 @@ public boolean shouldActivate() { @Override public int drawText(MinecraftClient mc, DrawContext context, float x, float y, boolean highlight) { int i = drawCaution(mc, context, x, y, highlight, "THRUST LOCKED"); - if (!CONFIG_SETTINGS.gpws || !AutoFlightManager.autoPilotEnabled) - i += HudComponent.drawFont(mc, context, "-GPWS+AP: ON", x, y += 9, CONFIG.adviceColor); + if (!CONFIG_SETTINGS.gpws) + i += HudComponent.drawFont(mc, context, "-GPWS: ON", x, y += 9, CONFIG.adviceColor); + if (!AutoFlightManager.autoPilotEnabled) + i += HudComponent.drawFont(mc, context, "-A/P: ON", x, y += 9, CONFIG.adviceColor); if (!AutoFlightManager.autoThrustEnabled) { - i += HudComponent.drawFont(mc, context, "-ATHR: ON THEN OFF", x, y + 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, "-A/THR: ON THEN OFF", x, y + 9, CONFIG.adviceColor); return i; } - i += HudComponent.drawFont(mc, context, "-ATHR: OFF", x, y + 9, CONFIG.adviceColor); + i += HudComponent.drawFont(mc, context, "-A/THR: OFF", x, y + 9, CONFIG.adviceColor); return i; } } diff --git a/src/main/java/net/torocraft/flighthud/components/FlightStatusIndicator.java b/src/main/java/net/torocraft/flighthud/components/FlightStatusIndicator.java index d3970363..65f7786e 100644 --- a/src/main/java/net/torocraft/flighthud/components/FlightStatusIndicator.java +++ b/src/main/java/net/torocraft/flighthud/components/FlightStatusIndicator.java @@ -86,6 +86,10 @@ public void render(DrawContext context, MinecraftClient mc) { y += 9 * alert.drawText(mc, context, x, y, highlight); } + int fwobLampColor = FlightSafetyMonitor.fireworkCount > 0 + ? (FlightSafetyMonitor.fireworkCount < 24 ? CONFIG.amberColor : CONFIG.color) + : CONFIG.alertColor; + drawRightAlignedFont(mc, context, "FRWK CNT: " + FlightSafetyMonitor.fireworkCount, xRight, yRight += 9, fwobLampColor); // Right-side ECAM if (AutoFlightManager.flightDirectorsEnabled) { drawRightAlignedFont(mc, context, "FD", xRight, yRight += 9, CONFIG.color); @@ -108,7 +112,7 @@ public void render(DrawContext context, MinecraftClient mc) { } } if (AutoFlightManager.distanceToTarget != null) { - drawRightAlignedFont(mc, context, String.format("DIST: %.1f", AutoFlightManager.distanceToTarget), xRight, yRight + 9, CONFIG.color); + drawRightAlignedFont(mc, context, String.format("DIST: %.0f", AutoFlightManager.distanceToTarget), xRight, yRight + 9, CONFIG.color); } drawCenteredFont(mc, context, AutoFlightManager.statusString, dim.wScreen, dim.tFrame + 15, CONFIG.color); @@ -120,7 +124,7 @@ public void render(DrawContext context, MinecraftClient mc) { lastAutopilotState = AutoFlightManager.autoPilotEnabled; if (FlightSafetyMonitor.isStalling && CONFIG_SETTINGS.stickShaker && computer.velocityPerSecond.y <= -10) { - playRepeating(mc, STICK_SHAKER, 0.75f); + playStickShaker(mc); drawCenteredWarning(mc, context, dim.wScreen, dim.hScreen / 2 + 10, highlight, "STALL"); } else stopEvent(mc, STICK_SHAKER); @@ -139,8 +143,8 @@ public void drawCenteredWarning(MinecraftClient mc, DrawContext context, float w float x = (width - mc.textRenderer.getWidth(text)) / 2; if (highlight) { HudComponent.drawUnbatched(drawContext -> { - HudComponent.drawTextHighlight(mc.textRenderer, context, x, y, text, CONFIG.alertColor); - HudComponent.drawCenteredFont(mc, context, text, width, y, CONFIG.white); + HudComponent.drawTextHighlight(mc.textRenderer, drawContext, x, y, text, CONFIG.alertColor); + HudComponent.drawCenteredFont(mc, drawContext, text, width, y, CONFIG.white); }, context); return; } @@ -164,10 +168,10 @@ private void playOnce(MinecraftClient mc, SoundEvent event, float volume, boolea } } - private void playRepeating(MinecraftClient mc, SoundEvent event, float volume) { - if (!activeEvents.contains(event)) { - mc.getSoundManager().play(new AlertSoundInstance(event, volume, mc.player, true)); - activeEvents.add(event); + private void playStickShaker(MinecraftClient mc) { + if (!activeEvents.contains(FlightStatusIndicator.STICK_SHAKER)) { + mc.getSoundManager().play(new AlertSoundInstance(FlightStatusIndicator.STICK_SHAKER, (float) 0.75, mc.player, true)); + activeEvents.add(FlightStatusIndicator.STICK_SHAKER); } }