Skip to content

Add guild branches that improve supply hubs - #92

Merged
Drefvelin merged 1 commit into
mainfrom
feat/hub-branches
Oct 1, 2026
Merged

Drefvelin merged 1 commit into
mainfrom
feat/hub-branches

Conversation

@Drefvelin

Copy link
Copy Markdown
Contributor

Two new guild branches for supply hubs, open to guilds and realms.

Branch Per level
Supply Lines one more hub every 2 levels; hubs pass on 3% more of each mode's trade share
Freight Yards hubs pass on 8% more of each mode's production share

Both also add a little trade upkeep and prestige, like the existing branches.

How it works

  • Three new guild modifiers: HUB_LIMIT, HUB_TRADE, HUB_PRODUCTION.
  • A guild's hub limit is supply-hubs.base-limit plus the whole part of HUB_LIMIT.
  • The bonus multiplies a mode's share (rail 0.70 with +30% is 0.91), capped at 0.95 before distance loss.
  • The bonus is applied where a link is used in the province recalculation, read through GuildModifierOverride, so the branch upgrade income preview shows a level's effect without rebuilding the hub network. Cached links stay unboosted.
  • A guild over its limit keeps its hubs; the newest beyond the limit are dormant, still cost upkeep and still hold their slot.
  • /guild hub list shows hubs used / limit and the boosted shares.
  • The branches use new groups 3 and 4, so they are independent tracks. Guilds saved before this get them at level 0.

Testing

mvn verify: 2464 tests, 0 failures. New tests cover the modifier maths and cap, the limit, over-limit dormancy, the recalculation with a boosted share, the branch preview and branch loading for both guild types.

🤖 Generated with Claude Code

Supply Lines gives a guild one more hub every two levels and makes its
hubs pass on 3% more trade power per level. Freight Yards makes them
pass on 8% more production per level. Both are open to guilds and
realms. Shares stay capped at 95%.

A guild with more hubs than its limit keeps them, but the newest ones
beyond the limit are dormant. The branch upgrade preview shows what a
level would add before it is bought.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 2ffe513e-eba1-449c-820f-3e38488f1f6c

📥 Commits

Reviewing files that changed from the base of the PR and between 7dc5eb2 and 5820b04.

📒 Files selected for processing (12)
  • src/main/java/net/tfminecraft/simplefactions/enums/GuildModifier.java
  • src/main/java/net/tfminecraft/simplefactions/guild/hub/HubNetwork.java
  • src/main/java/net/tfminecraft/simplefactions/guild/hub/HubTransport.java
  • src/main/java/net/tfminecraft/simplefactions/guild/hub/SupplyHubCommands.java
  • src/main/java/net/tfminecraft/simplefactions/guild/hub/SupplyHubService.java
  • src/main/java/net/tfminecraft/simplefactions/managers/ProvinceManager.java
  • src/main/resources/Guilds/branches.yml
  • src/test/java/net/tfminecraft/simplefactions/guild/hub/HubTransportTest.java
  • src/test/java/net/tfminecraft/simplefactions/guild/hub/SupplyHubServiceTest.java
  • src/test/java/net/tfminecraft/simplefactions/guild/income/BranchIncomePreviewTest.java
  • src/test/java/net/tfminecraft/simplefactions/loaders/SupplyHubBranchesTest.java
  • src/test/java/net/tfminecraft/simplefactions/managers/ProvinceManagerHubTransportTest.java

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Summary

Summary by CodeRabbit

  • New Features
    • Added guild development branches that improve supply hub capacity, trade contributions and production.
    • Guild modifiers now boost hub trade and production, subject to existing share limits and distance effects.
  • Improvements
    • Guilds can have different supply hub limits. Hubs above the limit are marked dormant and excluded from active networks.
    • Hub listings show the guild’s limit, and connection details reflect applicable trade and production boosts.

Walkthrough

The change adds guild modifiers for supply hub limits, trade transfer and production transfer. It applies guild-specific limits to hub availability and uses boosted link factors in trade and production delivery.

Changes

Guild supply hub modifiers

Layer / File(s) Summary
Modifier and branch definitions
src/main/java/net/tfminecraft/simplefactions/enums/GuildModifier.java, src/main/resources/Guilds/branches.yml, src/test/java/net/tfminecraft/simplefactions/loaders/SupplyHubBranchesTest.java
GuildModifier adds three hub-related modifiers. The bundled configuration adds supply_lines and freight_yards for guilds and realms. The loader test checks branch resolution and selected modifier values.
Guild hub-limit enforcement
src/main/java/net/tfminecraft/simplefactions/guild/hub/SupplyHubService.java, src/main/java/net/tfminecraft/simplefactions/guild/hub/SupplyHubCommands.java, src/main/java/net/tfminecraft/simplefactions/guild/hub/HubNetwork.java, src/test/java/net/tfminecraft/simplefactions/guild/hub/SupplyHubServiceTest.java
SupplyHubService calculates the guild limit from the base limit and the floored modifier, then identifies hubs beyond that limit. Build validation, hub status, list output and active-site selection use the guild-specific limit.
Boosted hub transfer factors
src/main/java/net/tfminecraft/simplefactions/guild/hub/HubTransport.java, src/main/java/net/tfminecraft/simplefactions/guild/hub/HubNetwork.java, src/main/java/net/tfminecraft/simplefactions/managers/ProvinceManager.java, src/main/java/net/tfminecraft/simplefactions/guild/hub/SupplyHubCommands.java, src/test/java/net/tfminecraft/simplefactions/guild/hub/HubTransportTest.java, src/test/java/net/tfminecraft/simplefactions/guild/income/BranchIncomePreviewTest.java, src/test/java/net/tfminecraft/simplefactions/managers/ProvinceManagerHubTransportTest.java
HubTransport.Link applies non-negative bonuses before the share cap and distance loss. Hub trade and production delivery use boosted factors. Connection output displays boosted factors. Tests cover factor calculations, delivery and income previews.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ProvinceManager
  participant GuildModifierOverride
  participant HubTransportLink
  ProvinceManager->>GuildModifierOverride: Resolve HUB_TRADE bonus
  ProvinceManager->>HubTransportLink: Calculate boostedTradeFactor(bonus)
  HubTransportLink-->>ProvinceManager: Return distance-adjusted factor
  ProvinceManager->>ProvinceManager: Apply factor to hub trade delivery
Loading

Merge Risk: ⚪ Minimal · up to 5820b

The change adds two guild branches that raise hub limits and transfer shares. No concrete merge-blocking issue was found in the supplied changes.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 5820b

The changes affect which supply hubs operate and how much they transfer. Existing membership, leadership, and owner-permission checks remain in place, and transfer bonuses remain capped. No introduced security bypass was established, but hypothetical limit previews and complete recovery behavior remain incompletely verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The directly affected assets are guild-owned hub records, eligible installations, and province trade and production values within the game server. Placement can involve another faction's installation only through the existing ownership or explicit-permit control. No new cross-guild authority path was established in the inspected command and service flows.

Trust Boundaries and Controls

  • observed — Build and removal commands retain guild membership and leader checks. Build retains duplicate, guild-limit, installation-slot, loaded-hub, trade, and owner-permission prerequisites; the changed limit is passed through the existing service check. Listing remains restricted to the requesting member's guild collection.

Resilience and Maintainability Implications

  • observed — Network refresh constructs immutable link collections before publishing a replacement through a volatile map. Preview uses copied province data and clears its modifier override in finally, containing standalone hypothetical calculations across normal and exceptional completion. These controls do not establish complete live-recalculation failure recovery.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

@Drefvelin
Drefvelin merged commit d07a40a into main Oct 1, 2026
2 checks passed
@Drefvelin
Drefvelin deleted the feat/hub-branches branch October 1, 2026 12:56
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.

2 participants