Stop two co-op players from crafting with the same wood at the same moment
Both players press craft on the shared team stash, each sees five wood, each needs three. Both succeed and the stash goes to minus one, or one of them loses the ingredients and gets nothing. This entry reserves materials first and commits only when the work is done.
Why this works
When two people look at the same number, both think it is theirs. Setting aside what a job needs the moment it begins, and counting only what remains unclaimed, makes the shown number true for each player. The stock only changes when the work is really finished.
When not to use it
Skip reservations in a game with one player, or where the stash is so full that two crafts never compete. A plain check and spend is simpler. Also unnecessary when each player has their own bag.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- A diagram of every state
- 32 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Stop two co-op players from crafting with the same wood at the same moment" (read_entry shared-stash-reservation-for-two-crafters) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP