Skip to content

Commit 1c8fb2b

Browse files
committed
Fix crash if player dies while lava is waiting (caused by Restart Speed Berry)
1 parent 2568663 commit 1c8fb2b

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

Entities/SidewaysLava.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -280,24 +280,24 @@ public override void Update() {
280280
if (waiting) {
281281
loopSfx.Param("rising", 0f);
282282

283-
// the sandwich lava fade in animation is not handled here.
284-
if (lavaMode != LavaMode.Sandwich) {
285-
float target;
286-
if (lavaMode == LavaMode.LeftToRight) {
287-
// stop 32px to the left of the player.
288-
target = player.X - 32f;
289-
} else {
290-
// stop 32px to the right of the player. since lava is offset by 320px, that gives 320 - 32 = 288px.
291-
target = player.X - 288f;
292-
}
293-
294-
if (!intro && player != null && player.JustRespawned) {
295-
X = Calc.Approach(X, target, 32f * speedMultiplier * Engine.DeltaTime);
296-
}
297-
}
298-
299283
if (player == null || !player.JustRespawned) {
300284
waiting = false;
285+
} else {
286+
// the sandwich lava fade in animation is not handled here.
287+
if (lavaMode != LavaMode.Sandwich) {
288+
float target;
289+
if (lavaMode == LavaMode.LeftToRight) {
290+
// stop 32px to the left of the player.
291+
target = player.X - 32f;
292+
} else {
293+
// stop 32px to the right of the player. since lava is offset by 320px, that gives 320 - 32 = 288px.
294+
target = player.X - 288f;
295+
}
296+
297+
if (!intro && player != null && player.JustRespawned) {
298+
X = Calc.Approach(X, target, 32f * speedMultiplier * Engine.DeltaTime);
299+
}
300+
}
301301
}
302302
} else {
303303
if (lavaMode != LavaMode.Sandwich) {

0 commit comments

Comments
 (0)