feat: track death handicap per island instead of per world - #456
Merged
Conversation
Deaths were read from BentoBox's per-player, per-world counter at
calculation time, which caused several problems now that players can
have multiple islands and join teams while keeping their own islands:
- A player joining a team immediately raised the team island's death
handicap with deaths from their entire world history (core's
team-join-reset only fires when team members' own islands are
deleted on join).
- reset-on-new-island zeroed the whole world count, wiping deaths
that were effectively counting against the player's other islands.
- Deaths anywhere in the world counted, even while visiting someone
else's island.
Deaths are now recorded by Level itself, per island, in IslandLevels:
- A death only counts if it happens in the island space of an island
the player is a member of. Deaths elsewhere are ignored.
- Per-player counts are kept for the admin level report ("who died"),
capped at the game mode's deaths max setting.
- When a member leaves or is kicked, their balance is folded into an
anonymous per-island count, so an island's handicap never decreases
just because an often-dying member left. Island reset/deletion
clears everything, giving per-island reset-on-new-island semantics.
- Legacy per-world counts are migrated once per island on first touch:
the seed reproduces exactly what the old formula would compute now
(sum of member deaths if sumteamdeaths, else owner deaths) and is
stored as anonymous deaths, so levels do not change at upgrade.
- sumteamdeaths is deprecated; it is only read for the migration seed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NSvRYW3Rgh6Vgvx62QRYE1
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Problem
Level read death counts from BentoBox core's per-player, per-world counter (
Players.deaths) at calculation time. Now that players can have multiple islands and join teams while keeping their own islands, this caused:team-join-resetonly fires when the joiner's own islands are deleted on join, i.e. whendisallowTeamMemberIslandsis true).reset-on-new-islandzeroed the whole world count, wiping the deaths that were effectively counting against the player's other islands in that world.Reported on Discord by mrFloris/chunkblock.
Solution
Level now tracks deaths itself, per island, stored in
IslandLevels:deaths.countedanddeaths.maxgame mode settings are honoured.deaths.max.Migration
Legacy per-world counts are migrated once per island, on first touch (calculation, death, or member departure — whichever comes first). The seed reproduces exactly what the old formula would compute at that moment (sum of member deaths if
sumteamdeaths, else owner deaths) and is stored as anonymous deaths, so island levels do not change on upgrade.sumteamdeathsis deprecated and only read for the migration seed; the new model always counts all deaths that occurred on the island.Notes for admins
/[admin] deaths set|add|resetcommands and theteam-join-reset/reset-on-new-islandsettings no longer influence island levels (core's counter is untouched and still drives core placeholders).Tests
New coverage for: migration seeding in both
sumteamdeathsmodes (and no re-seed on second call), death cap anddeaths.max: 0, member/non-member/off-island/non-game-world deaths, leave/kick rollover preserving the island total, and the handicap reducing the level intidyUp(). Full suite: 256 tests, all passing.🤖 Generated with Claude Code
https://claude.ai/code/session_01NSvRYW3Rgh6Vgvx62QRYE1