Skip to content

Commit

Permalink
feat: add "Show flight phase" config option
Browse files Browse the repository at this point in the history
Closes #16
  • Loading branch information
Octol1ttle committed Apr 26, 2024
1 parent 158620b commit 2cedd89
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ private ConfigCategory indicators(Text name, IndicatorConfigStorage.IndicatorCon
.binding(defaults.showDistanceToWaypoint, () -> config.showDistanceToWaypoint, o -> config.showDistanceToWaypoint = o)
.controller(TickBoxControllerBuilder::create)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("config.flightassistant.indicators.info.flight_phase"))
.binding(defaults.showFlightPhase, () -> config.showFlightPhase, o -> config.showFlightPhase = o)
.controller(TickBoxControllerBuilder::create)
.build())

.option(LabelOption.create(Text.translatable("config.flightassistant.indicators.misc")))
.option(Option.<Boolean>createBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public static class IndicatorConfig {
public boolean showFireworkCount = true;
@SerialEntry
public boolean showDistanceToWaypoint = true;
@SerialEntry
public boolean showFlightPhase = true;

@SerialEntry
public boolean showAttitudeIndicator = true;
Expand Down Expand Up @@ -119,6 +121,7 @@ IndicatorConfig disableAll() {
this.showAutomationStatus = false;
this.showFireworkCount = false;
this.showDistanceToWaypoint = false;
this.showFlightPhase = false;

return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void render(DrawContext context, TextRenderer textRenderer) {
}
}

if (phase.phase != FlightPhaseComputer.FlightPhase.UNKNOWN) {
if (FAConfig.indicator().showFlightPhase && phase.phase != FlightPhaseComputer.FlightPhase.UNKNOWN) {
DrawHelper.drawRightAlignedText(textRenderer, context, phase.phase.text, x, y + 10, FAConfig.indicator().statusColor);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/flightassistant/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"config.flightassistant.indicators.info.alerts": "Show alerts",
"config.flightassistant.indicators.info.firework_count": "Show firework count",
"config.flightassistant.indicators.info.waypoint_distance": "Show distance to waypoint",
"config.flightassistant.indicators.info.flight_phase": "Show flight phase",
"config.flightassistant.indicators.misc": "Miscellaneous",
"config.flightassistant.indicators.misc.attitude": "Show attitude",
"config.flightassistant.indicators.misc.flight_path": "Show flight path vector icon",
Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/assets/flightassistant/lang/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"config.flightassistant.indicators.info.alerts": "Показывать предупреждения",
"config.flightassistant.indicators.info.firework_count": "Показывать счётчик фейерверков",
"config.flightassistant.indicators.info.waypoint_distance": "Показывать расстояние до точки назначения",
"config.flightassistant.indicators.info.flight_phase": "Показывать фазу полёта",
"config.flightassistant.indicators.misc": "Прочее",
"config.flightassistant.indicators.misc.attitude": "Показывать индикатор ориентации",
"config.flightassistant.indicators.misc.flight_path": "Показывать иконку пути полёта",
Expand Down Expand Up @@ -158,6 +159,14 @@

"status.flightassistant.firework_count": "КОЛ-ВО ФРВКОВ: %s",
"status.flightassistant.waypoint_distance": "РАССТ: %s",
"status.flightassistant.phase.on_ground": "НА ЗЕМЛЕ",
"status.flightassistant.phase.takeoff": "ВЗЛЕТ",
"status.flightassistant.phase.climb": "НАБОР",
"status.flightassistant.phase.cruise": "КРЕЙСЕР",
"status.flightassistant.phase.descent": "СНИЖЕНИЕ",
"status.flightassistant.phase.approach": "ПОДХОД",
"status.flightassistant.phase.land": "ПОСАДКА",
"status.flightassistant.phase.go_around": "ВТОРОЙ КРУГ",

"mode.flightassistant.minimums.absolute": "МИНИМ %s",
"mode.flightassistant.minimums.relative": "МИНИМ +%s",
Expand Down

0 comments on commit 2cedd89

Please sign in to comment.