From 7235e215fb80c1f3b427f337fda02b8733e559f1 Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Tue, 20 Feb 2024 23:06:18 +0500 Subject: [PATCH] Do not flash FireworkUnsafeAlert on ground Signed-off-by: Octol1ttle --- .../alerts/firework/FireworkUnsafeAlert.java | 8 +++++--- .../flightassistant/computers/safety/AlertController.java | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/ru/octol1ttle/flightassistant/alerts/firework/FireworkUnsafeAlert.java b/src/main/java/ru/octol1ttle/flightassistant/alerts/firework/FireworkUnsafeAlert.java index ef97e04c..f9e7a653 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/alerts/firework/FireworkUnsafeAlert.java +++ b/src/main/java/ru/octol1ttle/flightassistant/alerts/firework/FireworkUnsafeAlert.java @@ -7,16 +7,18 @@ import ru.octol1ttle.flightassistant.HudComponent; import ru.octol1ttle.flightassistant.alerts.AbstractAlert; import ru.octol1ttle.flightassistant.alerts.AlertSoundData; +import ru.octol1ttle.flightassistant.computers.AirDataComputer; import ru.octol1ttle.flightassistant.computers.autoflight.FireworkController; import ru.octol1ttle.flightassistant.config.FAConfig; public class FireworkUnsafeAlert extends AbstractAlert { - + private final AirDataComputer data; private final FireworkController firework; - public FireworkUnsafeAlert(FireworkController firework) { + public FireworkUnsafeAlert(AirDataComputer data, FireworkController firework) { + this.data = data; this.firework = firework; } @@ -33,6 +35,6 @@ public boolean isTriggered() { @Override public int renderECAM(TextRenderer textRenderer, DrawContext context, float x, float y, boolean highlight) { return HudComponent.drawHighlightedText(textRenderer, context, Text.translatable("alerts.flightassistant.firework.unsafe"), x, y, - FAConfig.hud().warningColor, highlight); + FAConfig.hud().warningColor, highlight && data.isFlying); } } diff --git a/src/main/java/ru/octol1ttle/flightassistant/computers/safety/AlertController.java b/src/main/java/ru/octol1ttle/flightassistant/computers/safety/AlertController.java index 1d4d6012..f476f313 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/computers/safety/AlertController.java +++ b/src/main/java/ru/octol1ttle/flightassistant/computers/safety/AlertController.java @@ -38,7 +38,7 @@ public AlertController(ComputerHost host, SoundManager manager, HudRenderer rend new IndicatorFaultAlert(renderer), new ApproachingVoidDamageLevelAlert(host.voidLevel), new ElytraHealthLowAlert(host.data), - new FireworkUnsafeAlert(host.firework), + new FireworkUnsafeAlert(host.data, host.firework), new FireworkNoResponseAlert(host.firework) ); activeAlerts = new ArrayList<>(allAlerts.size());