Skip to content

Commit

Permalink
feat: show AlertController failure on ECAM
Browse files Browse the repository at this point in the history
Signed-off-by: Octol1ttle <[email protected]>
  • Loading branch information
Octol1ttle committed Nov 24, 2023
1 parent 07a3e8c commit 1d90350
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public HudRenderer(MinecraftClient mc) {
new FlightPathIndicator(dim, host.data, host.gpws), new LocationIndicator(dim, host.data),
new HeadingIndicator(dim, host.data), new SpeedIndicator(dim, host.data),
new AltitudeIndicator(dim, host.data), new PitchIndicator(dim, host.data, host.stall, host.voidLevel),
new ElytraHealthIndicator(dim, host.data), new AlertIndicator(dim, host.alert, host.time),
new ElytraHealthIndicator(dim, host.data), new AlertIndicator(dim, host, host.alert, host.time),
new FlightModeIndicator(dim, host.firework, host.time, host.autoflight), new StatusIndicator(dim, host.firework)));
this.faulted = new ArrayList<>(components.size());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,29 @@
import ru.octol1ttle.flightassistant.Dimensions;
import ru.octol1ttle.flightassistant.HudComponent;
import ru.octol1ttle.flightassistant.alerts.AbstractAlert;
import ru.octol1ttle.flightassistant.computers.ComputerHost;
import ru.octol1ttle.flightassistant.computers.TimeComputer;
import ru.octol1ttle.flightassistant.computers.safety.AlertController;

public class AlertIndicator extends HudComponent {
private final Dimensions dim;
private final ComputerHost host;
private final AlertController alert;
private final TimeComputer time;

public AlertIndicator(Dimensions dim, AlertController alert, TimeComputer time) {
public AlertIndicator(Dimensions dim, ComputerHost host, AlertController alert, TimeComputer time) {
this.dim = dim;
this.host = host;
this.alert = alert;
this.time = time;
}

@Override
public void render(DrawContext context, TextRenderer textRenderer) {
if (host.faulted.contains(alert)) {
renderFaulted(context, textRenderer, Text.translatable("alerts.flightassistant.fault.computers.alert_mgr"));
return;
}
boolean renderedCentered = false;
float x = dim.lFrame + 5;
float y = dim.tFrame + 15;
Expand All @@ -40,7 +47,11 @@ public void render(DrawContext context, TextRenderer textRenderer) {

@Override
public void renderFaulted(DrawContext context, TextRenderer textRenderer) {
HudComponent.drawHighlightedFont(textRenderer, context, Text.translatable("alerts.flightassistant.fault.indicators.alert"), dim.lFrame + 5, dim.tFrame + 15,
renderFaulted(context, textRenderer, Text.translatable("alerts.flightassistant.fault.indicators.alert"));
}

private void renderFaulted(DrawContext context, TextRenderer textRenderer, Text text) {
HudComponent.drawHighlightedFont(textRenderer, context, text, dim.lFrame + 5, dim.tFrame + 15,
CONFIG.alertColor, time.highlight);
}

Expand Down

0 comments on commit 1d90350

Please sign in to comment.