Skip to content

Fix per-island health death loop on respawn (#56)#57

Merged
tastybento merged 1 commit into
developfrom
fix/56-per-island-health-death-loop
Jul 2, 2026
Merged

Fix per-island health death loop on respawn (#56)#57
tastybento merged 1 commit into
developfrom
fix/56-per-island-health-death-loop

Conversation

@tastybento

Copy link
Copy Markdown
Member

Fixes #56

Problem

With per-island health enabled and a player owning multiple islands, dying on an island softlocked the player: they respawned at their default island and every attempt to return produced another death screen because their health was stuck at 0.

Root cause

On death/respawn the player's state is captured mid-death (health 0) and saved to the death island's storage key. When the player later loads that island, Store.setHeath applied the stored 0 via player.setHealth(0), killing them instantly and re-triggering the death screen — an endless respawn/death loop.

A stored health of 0 is never a valid value to load into a live player; it can only ever arise from a mid-death capture.

Fix

Store.setHeath now restores full (max) health whenever the resolved value is <= 0, matching vanilla respawn behaviour, and still clamps against max health as before.

Testing

  • Added StoreTest#testGetInventoryNeverLoadsFatalHealth reproducing the fatal-health load.
  • Full suite: 125 tests pass.

🤖 Generated with Claude Code

With per-island health enabled and a player owning multiple islands, dying
on one island softlocked the player in an endless respawn/death loop.

Root cause: on death/respawn the player's state is captured mid-death with a
health of 0 and saved to the death island's key. When the player later loads
that island, Store.setHeath applied the stored 0 via player.setHealth(0),
killing them instantly and re-triggering the death screen.

Loading a stored health of 0 into a live player is never valid — it only ever
arises from a mid-death capture. setHeath now restores full health when the
resolved value is <= 0, matching vanilla respawn behaviour, and clamps against
max health as before.

Adds a regression test covering the fatal-health load case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011i5FDtwcFcJFhbUDSG1YzA
@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

@tastybento tastybento merged commit f0939fc into develop Jul 2, 2026
3 checks passed
@tastybento tastybento deleted the fix/56-per-island-health-death-loop branch July 2, 2026 04:10
@tastybento tastybento mentioned this pull request Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setting per island health to true softlocks the island on death

1 participant