Even if it only allowed GUI styles or technologies and disallowed entities, having data.lua functional in scenarios would be quite useful in some cases. Maybe you want to restrict this to mods only, but it seems to me like adding limitations is usually not a good thing. Maybe there's a reason due to the way scenarios are loaded, in which case i understand if it is too complex or bad for performance to change the behaviour.
Thank you
Data.lua in scenarios
Moderator: ickputzdirwech
Re: Data.lua in scenarios
Hm. I think you need to understand, that this is not possible yet.
The right way to do this is to define as many different GUI's as you need and exchange them "on the fly".
The right way to do this is to define as many different GUI's as you need and exchange them "on the fly".
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Re: Data.lua in scenarios
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
Re: Data.lua in scenarios
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
If you want to get ahold of me I'm almost always on Discord.
Re: Data.lua in scenarios
I think I get it, a mod's data.lua is run when the game is restarted?
Re: Data.lua in scenarios
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?
See also this: https://wiki.factorio.com/index.php?tit ... Flifetimes
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.
Re: Data.lua in scenarios
It's a repeated wish, that modders don't need to restart the whole game, if they just change small graphics.
Added to viewtopic.php?f=80&t=27805 Suggestion around Game-Internal Mods-Handling/Mods-Management
Added to viewtopic.php?f=80&t=27805 Suggestion around Game-Internal Mods-Handling/Mods-Management
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...