Skip to content

Reward islands for closing a whole ring of chunks - #22

Merged
tastybento merged 3 commits into
developfrom
feat/ring-milestones
Aug 9, 2026
Merged

Reward islands for closing a whole ring of chunks#22
tastybento merged 3 commits into
developfrom
feat/ring-milestones

Conversation

@tastybento

Copy link
Copy Markdown
Member

Closes the first half of #3 — ring-completion milestones.

Claiming has only ever paid out per chunk. Closing a complete square around the centre is the milestone that keeps players expanding evenly instead of running one arm of chunks out to the border, so it now earns something.

What's in it

Geometry ChunkManager.isRingComplete(island, ring) and completedRings(island). completedRings counts outward and stops at the first hole, so a chunk claimed two rings out earns nothing while ring 1 is still gappy. Rings that do not fit inside the protection range never count.
API RingCompleteEvent — island, ring, chunk count. Cancellable, unlike its two siblings: cancelling suppresses the addon's messages, commands and celebration, but the ring stays complete.
Persistence highestRingRewarded on OneBlockIslands. Earned once, stays earned — re-locking a ring on level loss and claiming it straight back pays nothing. Only island create/reset clears it.
Rewards Console commands under chunkblock.rings, empty by default.
Display The whole ring sparkles, not just the closing chunk; /ch chunks gains a rings line; new island_rings_complete placeholder.

⚙️ New config

chunkblock:
  rings:
    broadcast: false        # announce milestones server-wide
    commands: []            # once per ring — [ring] [chunks] [owner]
    player-commands: []     # once per island member — [player] [ring] [chunks]

Both lists default empty, so nothing changes for an existing server until an admin fills them in. The config comment warns against paying island levels as a ring reward: levels buy chunks, so that makes each ring buy the next one — a compounding loop rather than a milestone.

🔡 New locale keys

chunkblock.chunks.ring-complete, .ring-broadcast and .rings in en-US.yml. Other locales lag as usual.

Deliberately not in scope

Trophies, island titles and the secret phase branches also asked for in #3 are the reward layer — the event and the command hooks are precisely what lets that live outside the gamemode. #3 should stay open, or be closed with a note about what shipped.

Tests

642 green (was 632). Five in ChunkManagerTest — ring closure, missing corner, outer ring while an inner one has a hole, ring beyond the protection range. Five in LevelListenerTest — fires once, a partial ring fires nothing, no repeat after relock and re-claim, cancellation suppresses the reward, island reset clears the milestones.

🤖 Generated with Claude Code

https://claude.ai/code/session_017EZEwab2kL4i1FNnBYvSmp

tastybento and others added 3 commits August 9, 2026 12:27
Claiming has only ever paid out per chunk. Closing a complete square around
the centre is the milestone that keeps players expanding evenly rather than
running one arm of chunks out to the border, so it now earns something.

ChunkManager gains isRingComplete() and completedRings(); the latter counts
outward from the centre and stops at the first hole, so a chunk claimed two
rings out earns nothing while ring 1 is still gappy.

RingCompleteEvent fires once per ring. Unlike ChunkUnlockEvent it is
cancellable, so a reward plugin can take the milestone over completely; the
ring stays complete either way.

Rings are earned once and stay earned — highestRingRewarded is persisted on
the island data, so losing levels and re-claiming the same chunks pays
nothing. Only island create or reset clears it. Rewards are console commands
under chunkblock.rings (once per ring, and once per member), deliberately
empty by default; the config comment warns against paying island levels,
since levels buy chunks and that makes each ring buy the next one.

Trophies, titles and secret phase branches from the issue are left out on
purpose: the event and command hooks are what lets that layer live outside
the gamemode.

Part of #3

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017EZEwab2kL4i1FNnBYvSmp
[chunks] is the island's total chunk count, not the ring's, so an island
holding chunks outside the closed ring was told it was "a perfect square of
16 chunks" — a number that is not a square at all. Say what is actually true:
the ring is closed, and here is the total.
The center chunk drew as an ordinary owned chunk, so a grid of identical
squares had nothing to orient by — reading it meant counting rows in from
an edge. It now gets its own glyph, and a second one for when the player is
standing on it, since that is where the magic block is and where players
spend most of their time. The legend gains both.

Adds IslandChunksCommandTest, which the map had gone without.
@sonarqubecloud

sonarqubecloud Bot commented Aug 9, 2026

Copy link
Copy Markdown

@tastybento
tastybento merged commit 8e0563b into develop Aug 9, 2026
3 checks passed
@tastybento
tastybento deleted the feat/ring-milestones branch August 9, 2026 23:24
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.

1 participant