Skip to content

Commit 62991af

Browse files
committed
display autoflight selections near the indications instead of on the FMA
Closes #67 Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
1 parent 668e6e6 commit 62991af

File tree

21 files changed

+126
-64
lines changed

21 files changed

+126
-64
lines changed

src/main/kotlin/ru/octol1ttle/flightassistant/api/util/extensions/GuiGraphicsExtensions.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ val primaryColor: Int
3737
val secondaryColor: Int
3838
get() = FAConfig.display.secondaryColor.rgb
3939

40-
val advisoryColor: Int
41-
get() = FAConfig.display.advisoryColor.rgb
40+
val primaryAdvisoryColor: Int
41+
get() = FAConfig.display.primaryAdvisoryColor.rgb
42+
43+
val secondaryAdvisoryColor: Int
44+
get() = FAConfig.display.secondaryAdvisoryColor.rgb
4245

4346
val cautionColor: Int
4447
get() = FAConfig.display.cautionColor.rgb

src/main/kotlin/ru/octol1ttle/flightassistant/config/FAConfigScreen.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,14 @@ import ru.octol1ttle.flightassistant.config.options.SafetyOptions
109109
binding(current::secondaryColor, defaults.secondaryColor)
110110
controller(colorPicker())
111111
}
112-
rootOptions.register("colors.advisory") {
112+
rootOptions.register("colors.advisory.primary") {
113113
setDisplayName()
114-
binding(current::advisoryColor, defaults.advisoryColor)
114+
binding(current::primaryAdvisoryColor, defaults.primaryAdvisoryColor)
115+
controller(colorPicker())
116+
}
117+
rootOptions.register("colors.advisory.secondary") {
118+
setDisplayName()
119+
binding(current::secondaryAdvisoryColor, defaults.secondaryAdvisoryColor)
115120
controller(colorPicker())
116121
}
117122
rootOptions.register("colors.caution") {

src/main/kotlin/ru/octol1ttle/flightassistant/config/options/DisplayOptions.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ class DisplayOptions {
1515
var primaryColor: Color = Color.GREEN
1616
@SerialEntry
1717
var secondaryColor: Color = Color.WHITE
18+
19+
@SerialEntry
20+
var primaryAdvisoryColor: Color = Color.CYAN
21+
1822
@SerialEntry
19-
var advisoryColor: Color = Color.CYAN
23+
var secondaryAdvisoryColor: Color = Color.MAGENTA
2024

2125
@SerialEntry
2226
var cautionColor: Color = Color.YELLOW

src/main/kotlin/ru/octol1ttle/flightassistant/impl/alert/autoflight/AutopilotOffAlert.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import ru.octol1ttle.flightassistant.api.alert.AlertData
77
import ru.octol1ttle.flightassistant.api.alert.ECAMAlert
88
import ru.octol1ttle.flightassistant.api.computer.ComputerView
99
import ru.octol1ttle.flightassistant.api.util.FATickCounter
10-
import ru.octol1ttle.flightassistant.api.util.extensions.advisoryColor
1110
import ru.octol1ttle.flightassistant.api.util.extensions.drawString
11+
import ru.octol1ttle.flightassistant.api.util.extensions.primaryAdvisoryColor
1212
import ru.octol1ttle.flightassistant.api.util.extensions.warningColor
1313

1414
class AutopilotOffAlert(computers: ComputerView) : Alert(computers), ECAMAlert {
@@ -42,7 +42,7 @@ class AutopilotOffAlert(computers: ComputerView) : Alert(computers), ECAMAlert {
4242
override fun render(guiGraphics: GuiGraphics, firstLineX: Int, otherLinesX: Int, firstLineY: Int): Int {
4343
var i: Int = guiGraphics.drawString(Component.translatable("alert.flightassistant.autoflight.autopilot_off"), firstLineX, firstLineY, warningColor)
4444
if (computers.autoflight.autopilotAlert) {
45-
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.autoflight.autopilot_off.push_to_silence"), otherLinesX, firstLineY + 11, advisoryColor)
45+
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.autoflight.autopilot_off.push_to_silence"), otherLinesX, firstLineY + 11, primaryAdvisoryColor)
4646
}
4747

4848
return i

src/main/kotlin/ru/octol1ttle/flightassistant/impl/alert/fault/DisplayFaultAlert.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import ru.octol1ttle.flightassistant.api.alert.Alert
77
import ru.octol1ttle.flightassistant.api.alert.AlertData
88
import ru.octol1ttle.flightassistant.api.alert.ECAMAlert
99
import ru.octol1ttle.flightassistant.api.computer.ComputerView
10-
import ru.octol1ttle.flightassistant.api.util.extensions.advisoryColor
1110
import ru.octol1ttle.flightassistant.api.util.extensions.cautionColor
1211
import ru.octol1ttle.flightassistant.api.util.extensions.drawString
12+
import ru.octol1ttle.flightassistant.api.util.extensions.primaryAdvisoryColor
1313
import ru.octol1ttle.flightassistant.impl.display.HudDisplayHost
1414

1515
class DisplayFaultAlert(computers: ComputerView, val identifier: ResourceLocation) : Alert(computers), ECAMAlert {
@@ -25,7 +25,7 @@ class DisplayFaultAlert(computers: ComputerView, val identifier: ResourceLocatio
2525
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.fault.hud.$identifier"), firstLineX, firstLineY, cautionColor)
2626
i +=
2727
if (HudDisplayHost.countFaults(identifier) == 1) {
28-
guiGraphics.drawString(Component.translatable("alert.flightassistant.fault.hud.reset"), otherLinesX, firstLineY + 11, advisoryColor)
28+
guiGraphics.drawString(Component.translatable("alert.flightassistant.fault.hud.reset"), otherLinesX, firstLineY + 11, primaryAdvisoryColor)
2929
} else {
3030
0
3131
}

src/main/kotlin/ru/octol1ttle/flightassistant/impl/alert/fault/computer/ComputerFaultAlert.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import ru.octol1ttle.flightassistant.api.alert.Alert
77
import ru.octol1ttle.flightassistant.api.alert.AlertData
88
import ru.octol1ttle.flightassistant.api.alert.ECAMAlert
99
import ru.octol1ttle.flightassistant.api.computer.ComputerView
10-
import ru.octol1ttle.flightassistant.api.util.extensions.advisoryColor
1110
import ru.octol1ttle.flightassistant.api.util.extensions.drawString
11+
import ru.octol1ttle.flightassistant.api.util.extensions.primaryAdvisoryColor
1212
import ru.octol1ttle.flightassistant.impl.computer.ComputerHost
1313

1414
class ComputerFaultAlert(computers: ComputerView,
@@ -31,14 +31,14 @@ class ComputerFaultAlert(computers: ComputerView,
3131

3232
if (extraTexts != null) {
3333
for (text in extraTexts) {
34-
i += guiGraphics.drawString(text, otherLinesX, y, advisoryColor)
34+
i += guiGraphics.drawString(text, otherLinesX, y, primaryAdvisoryColor)
3535
y += 10
3636
}
3737
}
3838

3939
i +=
4040
if (ComputerHost.getFaultCount(identifier) == 1) {
41-
guiGraphics.drawString(Component.translatable("alert.flightassistant.fault.computer.reset"), otherLinesX, y, advisoryColor)
41+
guiGraphics.drawString(Component.translatable("alert.flightassistant.fault.computer.reset"), otherLinesX, y, primaryAdvisoryColor)
4242
} else {
4343
0
4444
}

src/main/kotlin/ru/octol1ttle/flightassistant/impl/alert/flight_controls/ProtectionsLostAlert.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import ru.octol1ttle.flightassistant.api.alert.Alert
66
import ru.octol1ttle.flightassistant.api.alert.AlertData
77
import ru.octol1ttle.flightassistant.api.alert.ECAMAlert
88
import ru.octol1ttle.flightassistant.api.computer.ComputerView
9-
import ru.octol1ttle.flightassistant.api.util.extensions.advisoryColor
109
import ru.octol1ttle.flightassistant.api.util.extensions.cautionColor
1110
import ru.octol1ttle.flightassistant.api.util.extensions.drawString
11+
import ru.octol1ttle.flightassistant.api.util.extensions.primaryAdvisoryColor
1212

1313
class ProtectionsLostAlert(computers: ComputerView) : Alert(computers), ECAMAlert {
1414
override val priorityOffset: Int = 10
@@ -25,18 +25,18 @@ class ProtectionsLostAlert(computers: ComputerView) : Alert(computers), ECAMAler
2525
var y: Int = firstLineY + 1
2626
if (!computers.data.enabled && computers.data.faultCount <= 1) {
2727
y += 10
28-
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.flight_controls.protections_lost.enable_air_data"), otherLinesX, y, advisoryColor)
28+
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.flight_controls.protections_lost.enable_air_data"), otherLinesX, y, primaryAdvisoryColor)
2929
}
3030
if (!computers.pitch.enabled && computers.pitch.faultCount <= 1) {
3131
y += 10
32-
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.flight_controls.protections_lost.enable_pitch"), otherLinesX, y, advisoryColor)
32+
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.flight_controls.protections_lost.enable_pitch"), otherLinesX, y, primaryAdvisoryColor)
3333
}
3434
y += 10
35-
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.flight_controls.protections_lost.max_pitch"), otherLinesX, y, advisoryColor)
35+
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.flight_controls.protections_lost.max_pitch"), otherLinesX, y, primaryAdvisoryColor)
3636
y += 10
37-
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.flight_controls.protections_lost.min_pitch"), otherLinesX, y, advisoryColor)
37+
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.flight_controls.protections_lost.min_pitch"), otherLinesX, y, primaryAdvisoryColor)
3838
y += 10
39-
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.flight_controls.protections_lost.maneuver_with_care"), otherLinesX, y, advisoryColor)
39+
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.flight_controls.protections_lost.maneuver_with_care"), otherLinesX, y, primaryAdvisoryColor)
4040

4141
return i
4242
}

src/main/kotlin/ru/octol1ttle/flightassistant/impl/alert/thrust/ReverseThrustNotSupportedAlert.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import ru.octol1ttle.flightassistant.api.alert.Alert
66
import ru.octol1ttle.flightassistant.api.alert.AlertData
77
import ru.octol1ttle.flightassistant.api.alert.ECAMAlert
88
import ru.octol1ttle.flightassistant.api.computer.ComputerView
9-
import ru.octol1ttle.flightassistant.api.util.extensions.advisoryColor
109
import ru.octol1ttle.flightassistant.api.util.extensions.cautionColor
1110
import ru.octol1ttle.flightassistant.api.util.extensions.drawString
11+
import ru.octol1ttle.flightassistant.api.util.extensions.primaryAdvisoryColor
1212

1313
class ReverseThrustNotSupportedAlert(computers: ComputerView) : Alert(computers), ECAMAlert {
1414
override val priorityOffset: Int = 40
@@ -21,7 +21,7 @@ class ReverseThrustNotSupportedAlert(computers: ComputerView) : Alert(computers)
2121
override fun render(guiGraphics: GuiGraphics, firstLineX: Int, otherLinesX: Int, firstLineY: Int): Int {
2222
var i = 0
2323
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.thrust.reverse_not_supported"), firstLineX, firstLineY, cautionColor)
24-
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.thrust.reverse_not_supported.set_forward"), otherLinesX, firstLineY + 11, advisoryColor)
24+
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.thrust.reverse_not_supported.set_forward"), otherLinesX, firstLineY + 11, primaryAdvisoryColor)
2525
return i
2626
}
2727
}

src/main/kotlin/ru/octol1ttle/flightassistant/impl/alert/thrust/ThrustLockedAlert.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import ru.octol1ttle.flightassistant.api.alert.Alert
66
import ru.octol1ttle.flightassistant.api.alert.AlertData
77
import ru.octol1ttle.flightassistant.api.alert.ECAMAlert
88
import ru.octol1ttle.flightassistant.api.computer.ComputerView
9-
import ru.octol1ttle.flightassistant.api.util.extensions.advisoryColor
109
import ru.octol1ttle.flightassistant.api.util.extensions.cautionColor
1110
import ru.octol1ttle.flightassistant.api.util.extensions.drawString
11+
import ru.octol1ttle.flightassistant.api.util.extensions.primaryAdvisoryColor
1212

1313
class ThrustLockedAlert(computers: ComputerView) : Alert(computers), ECAMAlert {
1414
override val data: AlertData = AlertData.THRUST_LOCKED
@@ -20,7 +20,7 @@ class ThrustLockedAlert(computers: ComputerView) : Alert(computers), ECAMAlert {
2020
override fun render(guiGraphics: GuiGraphics, firstLineX: Int, otherLinesX: Int, firstLineY: Int): Int {
2121
var i = 0
2222
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.thrust.locked"), firstLineX, firstLineY, cautionColor)
23-
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.thrust.locked.use_keys"), otherLinesX, firstLineY + 11, advisoryColor)
23+
i += guiGraphics.drawString(Component.translatable("alert.flightassistant.thrust.locked.use_keys"), otherLinesX, firstLineY + 11, primaryAdvisoryColor)
2424
return i
2525
}
2626
}

src/main/kotlin/ru/octol1ttle/flightassistant/impl/computer/autoflight/base/ThrustComputer.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,6 @@ class ThrustComputer(computers: ComputerView) : Computer(computers) {
119119

120120
companion object {
121121
val ID: ResourceLocation = FlightAssistant.id("thrust")
122-
const val TOGA_THRESHOLD: Float = 0.99f
122+
const val TOGA_THRESHOLD: Float = 0.99f // TODO: just hardcode it to 1.0f bruh
123123
}
124124
}

0 commit comments

Comments
 (0)