Skip to content

Fixed Coins leaking into SP - #26

Merged
Dream-Master merged 1 commit into
masterfrom
fix-sp-coins
Oct 14, 2025
Merged

Fixed Coins leaking into SP#26
Dream-Master merged 1 commit into
masterfrom
fix-sp-coins

Conversation

@cubefury

Copy link
Copy Markdown
Collaborator

Fixes #25.

There was an issue where the coins data was not reset upon loading up a world. This was causing the locally stored data from a server session to persist if a player played on a MP world, leaves, then opens up a SP world where there was no prior currency data (eg. creating a new world).

This PR centralizes the unloading of everything on server start and loading data from scratch.

The data leak technically still happens if a player hops from one MP server to another, but it does not affect gameplay nor spawns in items in this case. Since coins are server-side authoritative, there is no risk of the coins being transferred there. When a player opens a vending machine for the first time on another server, it would immediately sync and override the local coin data.

I acknowledge this fix is not very clean, but it will fix the issue for now. The immediate next steps I'm working on are to change the coin sync code to decouple it from tradestate as much as possible and just sync the coin display amount via MUI2 synchandlers instead of sending/updating the coin amounts to the client. When that happens, this leak will stop happening altogether.

Tested on 186 in both SP and local MP with multiple players, to ensure read/write and integrity of saved coin data (to prevent another coin disappearance incident).

@cubefury
cubefury requested review from a team and FrostyFire1 October 14, 2025 11:29

@FrostyFire1 FrostyFire1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty sound

@Dream-Master
Dream-Master merged commit 77b7e68 into master Oct 14, 2025
1 check passed
@Dream-Master
Dream-Master deleted the fix-sp-coins branch October 14, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix coin data overriding local stored file when connected to server in multiplayer

3 participants