Task #16: per-player pouch in co-op
Each scarecrow carries its own pouch (ResourceStore.pouches by avatar slot; slot 0 is the solo player / host, `pouch` stays slot 0's), with one shared pouch_capacity so a Bigger pouch grows both. The shed stays shared. - Gathering, the shed drop-off, repair, upgrade-in-place, patching, building and buying all act on the acting avatar's slot. The host pays the partner's "place" and "buy" requests from P2's pouch and the shed. - The partner's build mode, build hotbar, shop menus and materials HUD check affordability against P2's pouch (FarmSim.set_local). - Alien Goop goes to the killer's pouch: FarmSim sets EnemySystem.attacker around each avatar's combat step and shots carry their shooter's slot; bomb/turret kills go to the nearest scarecrow. The replica no longer rolls goop locally. - When the partner leaves, their pouch goes into the shed (and is named in the toast); a co-op save continued alone banks P2's pouch at morning. - FarmState.VERSION 7 (resources.partner_pouch) with a v6 migration; CoopSession.PROTOCOL 4. - Tests: per-slot store rules, v6 save migration, and test_coop cases for separate gathering, no cross-banking in the shed, own-pouch paying, shared capacity, goop credit and leaving. test_coop's crowd case now resets the loopback's drop counter so earlier traffic can't change which messages it loses. - Docs: COOP.md and RULES.md no longer say the pouch is shared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
26b735d3e6
commit
fa7f67fe04
23 changed files with 535 additions and 138 deletions
|
|
@ -281,9 +281,11 @@ Implemented in Step 5. The numbers are in `GameConfig`; the gather points are li
|
|||
|
||||
- **Three materials:** wood, scrap, and straw.
|
||||
- The supply shed's stock starts at 4 wood, 2 scrap, 4 straw.
|
||||
- The scarecrow's **pouch** holds **15 units** in total.
|
||||
- The scarecrow's **pouch** holds **15 units** in total. In co-op each scarecrow has its own
|
||||
pouch, of the same size (below).
|
||||
- Walking into the Supply Shed zone empties the pouch into the shed, in any phase.
|
||||
- **Paying:** costs come from the pouch first, then the shed, and are all-or-nothing.
|
||||
- **Paying:** costs come from the pouch first, then the shed, and are all-or-nothing. In co-op
|
||||
that's the payer's own pouch, never the other's.
|
||||
- **Patch:** 2 straw.
|
||||
- **Buildables:** fence 2 wood; gate 4 wood + 1 scrap; slowing trap 3 scrap + 1 wood; automated
|
||||
defense 6 scrap + 2 wood + 2 straw.
|
||||
|
|
@ -516,10 +518,18 @@ tip doesn't come back on a retry.
|
|||
|
||||
Two players, each with a scarecrow, keep one farm (Main menu → Play with a friend; the details are
|
||||
in `game/COOP.md`):
|
||||
- **What's shared:** the shed, the pouch, upgrades, and structures. Either player can gather,
|
||||
build, repair, buy upgrades, and start the day.
|
||||
- **What's shared:** the shed, upgrades, and structures. Either player can gather, build,
|
||||
repair, buy upgrades, and start the day.
|
||||
- **What's your own:** your scarecrow's health, and the weapon in your hands: a weapon bought
|
||||
is there for both, and each player picks their own main weapon. Upgrades to max health apply to both.
|
||||
- **Your pouch is your own** (the materials HUD shows yours):
|
||||
- You gather into it, and only you walking into the Supply Shed banks it.
|
||||
- You pay from it first, then from the shed.
|
||||
- An Alien's goop goes to its killer's pouch. A pumpkin bomb's or a turret's kill goes to the
|
||||
nearest scarecrow's.
|
||||
- Both pouches have the same capacity: one Bigger pouch grows both.
|
||||
- When player 2 leaves, their pouch goes into the shed. So does player 2's pouch in a co-op
|
||||
save continued alone.
|
||||
- **Falling:** a scarecrow at 0 HP is out until the morning, when it comes back at half health.
|
||||
**Game Over only when both are down at once.**
|
||||
- **Enemies** go for the nearer scarecrow.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue