[0.18.17][Modding][Multiplayer] Runtime-per-user Settings Lagging Behind

Bugs that are actually features.
Post Reply
User avatar
DedlySpyder
Filter Inserter
Filter Inserter
Posts: 253
Joined: Fri Jun 20, 2014 11:42 am
Contact:

[0.18.17][Modding][Multiplayer] Runtime-per-user Settings Lagging Behind

Post by DedlySpyder »

I have a runtime-per-user setting that I want to read right when a player connects to a game. The scenario I'm at right now is when the host has the setting to false and the joining player has it set to true with the "Use different mod settings per save" turned off, so their setting will be preserved and it will be true.

If I check the setting of that new user in the on_player_joined_game event, it is resolving to false. But if I delay the check by 60 ticks (only a handful doesn't work) it will correctly resolve to true. I can also see it as true on that user's settings when looking it up in game.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.18.17][Modding][Multiplayer] Runtime-per-user Settings Lagging Behind

Post by Rseding91 »

You should be using the https://lua-api.factorio.com/latest/eve ... ng_changed event to listen for the value changing. The setting gets sent as a player action after the player has joined and also the player can change the setting runtime so you need to listen to that event anyway.
If you want to get ahold of me I'm almost always on Discord.

User avatar
DedlySpyder
Filter Inserter
Filter Inserter
Posts: 253
Joined: Fri Jun 20, 2014 11:42 am
Contact:

Re: [0.18.17][Modding][Multiplayer] Runtime-per-user Settings Lagging Behind

Post by DedlySpyder »

OK awesome, I assumed I would have to listen at both join and changed. Thanks

Post Reply

Return to “Not a bug”