Repository navigation
fix: rivers inside a lure's province no longer count as leaving it - #19
Conversation
Rivers and lakes are SimpleFactions provinces of their own, so a committed player wading across a river that cuts through the lure's province took deserter damage, and lure mobs spawned on the far bank could not be reached. A committed player in a WATER province now counts as inside while the lure province's land is within river-reach blocks (default 16). Bystander checks stay strict. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Configure and calculate river reach src/main/java/net/tfminecraft/infestations/cache/Cache.java, src/main/java/net/tfminecraft/infestations/loader/ConfigLoader.java, src/main/java/net/tfminecraft/infestations/utils/Provinces.java, src/main/resources/config.yml, src/test/java/net/tfminecraft/infestations/InfestationsServicesTest.java, src/test/java/net/tfminecraft/infestations/loader/LoadersTest.java, README.md |
Adds the river-reach setting, defaults it to 16, and clamps configured values to 0–64. Provinces.within checks the player’s province and, for water provinces, nearby land within the configured reach. Tests cover reach limits, terrain, and unavailable grid context. The README describes the river and lake rule. |
Apply reach to lure checks src/main/java/net/tfminecraft/infestations/infestation/InfestationManager.java, src/test/java/net/tfminecraft/infestations/infestation/InfestationManagerTest.java |
Lure participation, departure, failure, victory, and province-leave checks use Provinces.within. Tests cover committed players on a matching river bank, players in another province, and an uncommitted bystander. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant Player
participant InfestationManager
participant Provinces
participant ProvinceGrid
InfestationManager->>Provinces: Check within(player, provinceId)
Provinces->>ProvinceGrid: Check province and nearby land within riverReach
ProvinceGrid-->>Provinces: Return province lookup results
Provinces-->>InfestationManager: Return inside or outside
InfestationManager->>Player: Send lure message or warning based on result
Suggested reviewers: ryanbarlow97
Merge Risk: 
Minimal · up to 8b173
-
The river-reach change is mergeable after normal checks.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
The river check scans a circle of river-reach blocks, so its cost grows with the square of the setting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@coderabbitai review |
✅ Action performed
|
Problem
A player reported that during a lure, crossing a river inside the lure's province hurts as if they had left it. Lure mobs spawn on the far bank, players can't reach them without taking damage, and the lure fails.
SimpleFactions stores every river and lake as its own
WATERprovince, so a block of river has the river's province ID, not the ID of the land around it. On Main, province 429 (bog,swamp_mobs) is cut into two pieces (about 18.5k and 7.6k blocks) by river 779. Infested provinces 465, 471, 480, 483 and 489 have small cut-off pieces too, and 30 land provinces are split across the whole map.Change
Provinces.within(player, provinceId): true on the province's own land, or in aWATERprovince (river or lake) while that province's land is withinriver-reachblocks.SEAstill counts as outside.config.ymlkeyriver-reach(default 16, capped at 64 so a typo can't stall the tick; 0 = old behaviour). Rivers that split provinces on Main are at most 14 blocks wide (half-width 7 or less), so 16 covers them. A long river can't be used to walk away from the province.within: deserter damage (tickOutsideCommitted), the leave-province chat warning, and the fail and victory messages (plus the/lure leavefail message that has to match them).Existing servers have no
river-reachkey, so they use the default 16 without a config edit.Tests
mvn clean verify: 184 tests pass, 100% line coverage. New tests coverProvinces.within(on the land, null player, land province,WATERwith no grid, land outside the circle, reach 0 and 1,SEA), the manager (committed wader safe; far river hurts; bystander in the river not hurt; no leave warning in the river) and the config default and both clamps.river-reach16river-reach0 (control = old behaviour)/lure leavethen failed the lure as before. No Infestations errors in Dev's log.🤖 Generated with Claude Code