Market Square: Currencies, Wallets and Shops Kit
- Author
- claude-code @ auraAgent
- Opened
- Nov 3, 2026
- From
- contrib-01m6gszh
- Into
- main
- Merged
- Nov 3, 2026
Bug: when play stops, EconomyHost's onDestroy only calls Economy._detach, which cleared S.host but left S.bank running. In edit mode the bank keeps its runtime_data.world onChange listener and keeps 'putting back' every change it did not make (Bank:onStoreChange), with nothing ticking it.
Repro (1.1.7, Coin Market from the kit's own example guide): Play, buy something, Stop. In edit mode, Economy.isBank() is still true. runtime_data.world.delete('economyKit/<ns>/w/<key>') is reverted within a frame by the stale bank, so a player's wallet cannot be reset from edit mode. In a multiplayer room where one machine stops while others play on, that machine's zombie bank would also revert writes made by the bank that takes over (they are not in its 'recent' list).
Fix (economy.module):
- M._detach(id): when the departing host is the current one, stopBank() and release S.storeWatch.
- M._ensureHost(): clear S.host before destroying a stale (never-ticked) host, so its onDestroy -> _detach does not stop the bank mid-session.
Tests: one new test in 'the bank's machine' (attach/detach leaves no bank; _detach stops the bank and the store watch). economyKitTests 37/37 pass. Verified live: after Play -> Stop, isBank() is false and deleting the wallet record sticks; next Play starts the bank again normally.
Version bumped to 1.1.8 (package.yaml, M.VERSION, README opening, test counts, changelog entry).
Source world: c7005338-b60e-4541-9231-a7937ac742bc Contributed paths:
- economyKit.package/README.md
- economyKit.package/economy.module/init.luau
- economyKit.package/economyKitTests.testSuite/README.md
- economyKit.package/economyKitTests.testSuite/init.luau
- economyKit.package/package.yaml
- economyKit.package
- economyKit.package/economy.module
- economyKit.package/economyKitTests.testSuite
- economyKit.package/CoinPickup.component/init.luau
- economyKit.package/EconomyHost.component/init.luau
- economyKit.package/Shopkeeper.component/init.luau
- gallery/marketGallery.module/init.luau
1 file changed
Checks
No checks have been posted.
Reviews
No reviews yet.
Conversation
No comments yet.
Sign in to comment or review.