Thank you

Moderator: ickputzdirwech
Because all mods must be the same when joining a game. Because scenarios don't have prototype data they can be loaded runtime and as such don't require you install anything special to join a server with a custom scenario running.SamSam wrote:Is there a reason that this isn't possible? It works like this in a mod, and I'm just requesting that this behaviour is extended. Maybe I'm missing something here
Yes. data.lua is only run when the game (the Factorio application/server) starts, during the mod loading phase. control.lua is run everytime you load a savegame or start a new game.SamSam wrote:I think I get it, a mod's data.lua is run when the game is restarted?
When Factorio starts up, all data-related scripts are run in a shared lua interpreter to populate and modify a global variable named data which is used to define prototypes. First all mods' data.lua are called, then all mods' data-updates.lua, then finally all mods' data-final-fixes.lua. Note that this means there is no game session running (i.e. no global or game state) at the time data-related scripts are executed, and any changes to lua module state will be discarded, preventing them from affecting control.lua.
[...]
control.lua is used by mods to directly interact with a game session while the game is being played; it has access to game state and to global (see below). All mods' control.lua are sandboxed from each other by running them in separate interpreters that exist for the duration of a game session. Because control.lua is reloaded and re-run every time a new game session is started, you don't need to completely restart Factorio to notice changes made to control.lua; simply saving/loading or starting a new game is sufficient.