Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
  • Loading branch information
Octol1ttle committed Nov 5, 2023
1 parent efd561c commit 944b12a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<p align=center>
<a href="https://modrinth.com/mod/flightassistant">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3.1.2/assets/cozy/available/modrinth_vector.svg"
alt="Available on Modrinth"></img></a>
alt="Available on Modrinth"></a>
<a href="https://modrinth.com/mod/fabric-api/">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/requires/fabric-api_vector.svg"
alt="Requires Fabric API"></img></a>
alt="Requires Fabric API"></a>
<!-- uncomment if Forge version is released (https://github.com/Octol1ttle/FlightAssistant/pull/2#discussion_r1370700775)
<a href="https://modrinth.com/mod/flightassistant/versions?l=forge">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3.1.2/assets/cozy/supported/forge_vector.svg"
Expand All @@ -26,7 +26,7 @@
- Flight HUD
- Stall protection<sup>1</sup>, warning and automatic recovery<sup>2</sup>
- Ground Proximity Warning System (GPWS):
- Sinkrate warning, protection<sup>1</sup> and automatic recovery<sup>2</sup>
- Sinkrate warning, protection<sup>1</sup> and automatic recovery
- Unsafe terrain clearance warning, protection<sup>1</sup> and automatic recovery<sup>2</sup>
- Autopilot systems:
- Flight Planner
Expand All @@ -42,13 +42,13 @@
- Passengers dismounted mid-flight

<sup>1</sup> Protection via blocked pitch changes<br>
<sup>2</sup> Automatic recovery via automatic pitch changes and firework usage (2.0 only, when applicable)
<sup>2</sup> Automatic recovery via automatic pitch changes and firework usage

## HUD Features

<details>
<summary>Diagram</summary>
<img src="images/diagram.png"></img>
<img src="images/diagram.png">
</details>

1. Heading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ExcessiveDescentAlert(FlightComputer computer) {

@Override
public boolean isTriggered() {
return computer.gpws.descentImpactTime >= 0.0f;
return computer.pitch < 0 && computer.gpws.descentImpactTime >= 0.0f;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public ElytraHealthLowAlert(FlightComputer computer) {

@Override
public boolean isTriggered() {
return computer.elytraHealth <= 5.0f;
return computer.elytraHealth != null && computer.elytraHealth <= 5.0f;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.client.sound.SoundManager;
import ru.octol1ttle.flightassistant.AlertSoundInstance;
import ru.octol1ttle.flightassistant.FlightAssistant;
import ru.octol1ttle.flightassistant.HudComponent;
import ru.octol1ttle.flightassistant.alerts.AbstractAlert;
import ru.octol1ttle.flightassistant.alerts.AlertSoundData;
import ru.octol1ttle.flightassistant.alerts.autoflight.ATHRNoFireworksInHotbarAlert;
Expand Down Expand Up @@ -48,6 +49,18 @@ public AlertController(FlightComputer computer, SoundManager manager) {
}

public void tick() {
if (HudComponent.CONFIG == null) { // HUD hidden
for (AbstractAlert alert : activeAlerts) {
alert.played = false;

if (alert.soundInstance != null) {
manager.stop(alert.soundInstance);
alert.soundInstance = null;
}
}
return;
}

for (AbstractAlert alert : allAlerts) {
try {
if (alert.isTriggered()) {
Expand Down Expand Up @@ -112,7 +125,7 @@ public void tick() {
}
}

if (interrupt || alert.played || alert.dismissed) {
if (interrupt || alert.played && !data.repeat() || alert.dismissed) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public void disallowUnsafeFireworks(PlayerEntity player, Hand hand, CallbackInfo
return;
}

computer.firework.unsafeFireworks = !computer.firework.isFireworkSafe(stack);

if (!computer.firework.isFireworkSafe(stack)) {
computer.firework.unsafeFireworks = true;
if (computer.firework.unsafeFireworks) {
cir.setReturnValue(ActionResult.FAIL);
}
}
Expand Down

0 comments on commit 944b12a

Please sign in to comment.