Page 1 of 1

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

Posted: Wed Apr 01, 2020 1:45 am
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.

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

Posted: Wed Apr 01, 2020 5:30 pm
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.

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

Posted: Wed Apr 01, 2020 5:36 pm
by DedlySpyder
OK awesome, I assumed I would have to listen at both join and changed. Thanks