Code: Select all
for i, forces in pairs(game.forces) do
stuff
end
loop but I'm getting "attempt to index global "game" (a nil value)"
The same loop works fine in migrations. What am I missing?
Code: Select all
for i, forces in pairs(game.forces) do
stuff
end
Alright, maybe you can help me with this then.DaveMcW wrote:You can only access game through events (and not on_load either).
The game doesn't work in any way that that's supported. Loading a game is never meant to change the game state unless there's some special condition: loading with different mod versions, loading a different map version and so on.Glockshna wrote:Alright, maybe you can help me with this then.DaveMcW wrote:You can only access game through events (and not on_load either).
I'm trying to make my mod modular such that one can change config options to enable and disable certain parts of the mod. That being said, I don't want to have to put in 700 different researches, I'd like some parts of the mod to share a research. But if a player starts a map with a module disabled and then after researching something that unlocks an item in that module decides to enable the module, I'd like the game to register the research entries and enable the appropriate recipes for the newly enabled module. You can see why a migration file wouldn't work for this. I wanted to just run a check each time the game is loaded to make sure everything is enabled that should be but now I'm stuck as to how I'd accomplish this.
Any insight would be appreciated...
Aw, well alright. Should I post a request to make this possible or is it just not going to happen?Rseding91 wrote:The game doesn't work in any way that that's supported. Loading a game is never meant to change the game state unless there's some special condition: loading with different mod versions, loading a different map version and so on.Glockshna wrote:Alright, maybe you can help me with this then.DaveMcW wrote:You can only access game through events (and not on_load either).
I'm trying to make my mod modular such that one can change config options to enable and disable certain parts of the mod. That being said, I don't want to have to put in 700 different researches, I'd like some parts of the mod to share a research. But if a player starts a map with a module disabled and then after researching something that unlocks an item in that module decides to enable the module, I'd like the game to register the research entries and enable the appropriate recipes for the newly enabled module. You can see why a migration file wouldn't work for this. I wanted to just run a check each time the game is loaded to make sure everything is enabled that should be but now I'm stuck as to how I'd accomplish this.
Any insight would be appreciated...
Currently Factorio doesn't support a "config" for mods and as such you're not going to be able to do what you're looking to do.
Add your request here: viewtopic.php?f=28&t=26166Glockshna wrote:Aw, well alright. Should I post a request to make this possible or is it just not going to happen?