Block 5 — Loot & Economy (2 days)
Goal: Loot payloads arrive at the Loot Sorting Station and the player processes them into resources. Full resource flow functional. Station storage system online.
Depends on: Block 4 (loot payloads), Block 1 (ResourceLedger, Station base).
Deliverables
UStationSubsystem — Storage Management (C++)
| Function | Signature | Purpose |
|---|---|---|
AssignRaccoon | bool (EStationType, FGuid) | Validate raccoon Idle → set bHasAssignment + AssignedStation on raccoon, set AssignedRaccoonId on station state. Status → Assigned. |
UnassignRaccoon | FGuid (EStationType) | Clear assignment both sides. Raccoon → Idle. Return raccoon Id. |
GetEffectiveStat | int32 (EStationType, EStatType) | 1 (baseline) + assigned raccoon’s effective stat for that type (via URaccoonSubsystem::GetEffectiveStats). Returns 1 if nobody assigned. C++ — cross-subsystem lookup. |
GetStorageCap | int32 (EStationType) | Base cap from UStationDataAsset + tier bonus (cap increase per tier from DataAsset cost array). |
GetCurrentStorage | int32 (EStationType) | Current fill level from FStationRuntimeState. |
CanAcceptStorage | bool (EStationType, int32 Amount) | CurrentStorage + Amount <= GetStorageCap. |
ModifyStorage | void (EStationType, int32 Delta) | Increment/decrement CurrentStorage. Clamp to [0, Cap]. |
UpgradeStation | bool (EStationType) | Validate next tier exists + UResourceSubsystem::CanAffordCost → SpendCost → increment CapTier. (Wired in Block 7, stubbed here.) |
Internal state (extends Block 1 stubs — StationStates and PendingPayloads declared there):
| Member | Type | Purpose |
|---|---|---|
OnStationChanged | FOnStationChanged (DYNAMIC_MULTICAST_DELEGATE_OneParam) | BlueprintAssignable. Param: EStationType. Broadcast on assignment, unassignment, storage change, or upgrade |
Loot Intake Functions (C++)
Loot intake can live on UStationSubsystem or a dedicated ULootIntakeHelper utility class. All BlueprintCallable:
| Function | Signature | Purpose |
|---|---|---|
DepositLootPayload | bool (FLootPayload) | Called by URaidSubsystem::CompleteRaid. Adds payload to pending loot queue. Returns false if Loot Sorting Station storage full. |
ClaimGlobalLoot | void (int32 PayloadIndex, EResourceType Type) | Add trash/currency/scrap from payload to UResourceSubsystem, remove from pending pile. |
RouteFood | bool (int32 PayloadIndex, int32 FoodIndex, EFoodDestination Dest) | Dest = Pantry or Sell. Check destination storage cap via CanAcceptStorage. Move food item → increment destination storage. |
AutoConvertValuable | void (int32 PayloadIndex, int32 ValuableIndex) | MVP: flat rate conversion. FValuableItem::BaseSellPrice → add to Currency via UResourceSubsystem::AddResource. Remove from payload. |
GetPendingPayloads | TArray<FLootPayload> () | Current pending loot pile for UI to display. |
GetPendingPayloadCount | int32 () | For cap checking and UI warnings. |
EFoodDestination enum: Pantry, Sell.
Resource Counter HUD (UTNTHUDWidget)
Persistent UMG widget added to viewport by ATNTPlayerController::BeginPlay:
- Text elements for Trash, Currency, Scrap, Food (Pantry stock)
- Binds to
UResourceSubsystem::OnResourceChangeddelegate for real-time updates - Interact prompt text (shown when near a station)
- Active raid timer display (from
URaidSubsystem::GetActiveRaids)
Widget: Content/TrashNTreasure/UI/WBP_HUD.uasset.
Loot Sorting Station UI (UTNTLootSortingUI)
UMG widget opened when interacting with Loot Sorting Station:
- List of pending loot payloads (stacked view)
- Per payload:
- Global counter stacks (trash, currency, scrap) — click stack →
ClaimGlobalLoot→ counter ticks up → stack disappears. Zero friction. - Food items — each shows two buttons: Pantry | Sell. Calls
RouteFood. - Valuables — click →
AutoConvertValuable→ currency increments. No routing decision in MVP.
- Global counter stacks (trash, currency, scrap) — click stack →
- Raid pile cap warning — text warning when pending count approaches cap (e.g., “Pile full! Process loot before next raid returns.“)
- Close button returns to hideout
Loot Sorting Station DataAsset
DA_LootSortingStation: EStationType::LootSortingStation, relevant stat Cunning, base storage cap 10 (max pending payloads), upgrade cost tiers. UIWidgetClass = UTNTLootSortingUI.
Online Sales Station (MVP Minimal)
Interacting opens UTNTOnlineSalesUI:
- Shows food items routed via “Sell”
- Auto-converts at flat rate: 1 food = $2 (tunable)
- No time delay, no listing mechanic
- Items convert on click (or auto-convert on route)
DataAsset: DA_OnlineSales, storage cap 10, relevant stat Cunning + Luck (post-MVP effect).
Pantry Station
Interacting opens UTNTPantryUI:
- Current food / cap (e.g., “8 / 20”)
- No upkeep display yet (Block 6 adds burn rate and days remaining)
DataAsset: DA_Pantry, base storage cap 20, relevant stat Speed (post-MVP tick efficiency).
Starting Resources
ATNTGameMode::BeginPlay (after creating starter raccoons):
UResourceSubsystem::AddResource(Trash, 200)UStationSubsystem::ModifyStorage(Pantry, 10)— 10 starting food
Values tunable. Enough for 2–3 raids and several days of upkeep.
Done When
- Completed raids deposit loot at Loot Sorting Station (capped queue)
- Globals click-to-claim correctly (trash/currency/scrap counters update in HUD)
- Food routes to Pantry or Sell — storage updates on destination station
- Valuables auto-convert to currency on click
- Resource counter HUD reflects all changes in real time via
OnResourceChanged - Full raid pile blocks new deliveries with text warning
- Starting resources granted at game start (200 trash, 10 food)
- Station assignment works (assign raccoon to any station, effective stat = 1 + raccoon stat)
- Online Sales converts routed food to currency at flat rate
- Pantry UI shows stock and cap
References
Loot Intake · Loot Sorting Station · Online Sales · Pantry · Economy · Resources