Stop a bag from being put inside itself, or into a bag it holds
Bags that hold bags are a lovely way to organise a hoard, until someone puts one into another that is already inside it. Both vanish from the world, still counted, still heavy. This entry stops that move before it happens and tells the player why, and also keeps nesting from running away.
Why this works
Containers only make sense when you can always get from the outside to the inside. A bag that sits inside itself, even through others, is cut off from the world, so the move is refused up front and the reason given.
When not to use it
Don't allow bags in bags at all in a small game with a few items, where the sorting only gets in the way, or on a phone, where opening layers is fiddly. A flat bag with tabs or filters is easier for the player.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 36 lines of example code with 3 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Stop a bag from being put inside itself, or into a bag it holds" (read_entry bag-inside-a-bag-cannot-end-up-inside-itself) 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