They were indexed by a number (so [1], etc), but now, from what I understand, they are indexed by something else (so ["name-or-something"]).Adil wrote:I can't comprehend these:Weren't game.entity_prototypes and such already indexable by []?Rseding91 wrote: - Changed game.players, game.surfaces, game.entity_prototypes, game.item_prototypes, game.fluid_prototypes, force.recipes, force,technologies
to use custom access + iterator objects for improved performance.
Mod changes in 0.13
- DedlySpyder
- Filter Inserter
- Posts: 253
- Joined: Fri Jun 20, 2014 11:42 am
- Contact:
Re: Mod changes in 0.13
Re: Mod changes in 0.13
Previously, when you asked for game.entity_prototypes["foo"], the API would produce the entire entity_prototypes table for you to index, which is a huge waste of time and memory if you just want one index from it. Now it works like a generator, and only the indices you request will be instanciated. There are some new limitations on how you access them other than [], such as not supporting ipairs(), and you can't simply save a copy of this object in your global (although a shallow or deep copy is still possible), but the limitations will be well worth the performance increases.Adil wrote:Weren't game.entity_prototypes and such already indexable by []?
details: http://lua-api.factorio.com/0.13.0-prev ... Table.html
Re: Mod changes in 0.13
So what old code will break due to this?
I don't recall seeing ipairs used on any of the
I don't recall seeing ipairs used on any of the
ever.game.players, game.surfaces, game.entity_prototypes, game.item_prototypes, game.fluid_prototypes, force.recipes, force,technologies
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
I also update mods, some of them even work.
Recently I did a mod tutorial.
Re: Mod changes in 0.13
https://www.google.com/search?q=site:gi ... +%22ipairs(game%22Adil wrote: I don't recall seeing ipairs used on any of theever.game.players, game.surfaces, game.entity_prototypes, game.item_prototypes, game.fluid_prototypes, force.recipes, force,technologies
In addition to the above... any attempts to leave a reference to one of those tables in your global table (the one that gets saved in the game state) will result in an error and/or mp desync. You'll have to deep copy the parts of the table you want to keep.Adil wrote:So what old code will break due to this?
Re: Mod changes in 0.13
If i understand the change correctly it should only be an issue if you did something like global.players = game.players. Stuff like global.first_player = game.players[1] should still be fine?sparr wrote:In addition to the above... any attempts to leave a reference to one of those tables in your global table (the one that gets saved in the game state) will result in an error and/or mp desync. You'll have to deep copy the parts of the table you want to keep.
Re: Mod changes in 0.13
Correct.Choumiko wrote:If i understand the change correctly it should only be an issue if you did something like global.players = game.players. Stuff like global.first_player = game.players[1] should still be fine?sparr wrote:In addition to the above... any attempts to leave a reference to one of those tables in your global table (the one that gets saved in the game state) will result in an error and/or mp desync. You'll have to deep copy the parts of the table you want to keep.
If you want to get ahold of me I'm almost always on Discord.
Re: Mod changes in 0.13
Will the same named technologies be renamed as well?Rseding91 wrote:Unified prototype names to be consistant with ingame names.
For example: basic-laser-defense-equipment and basic-exoskeleton-equipment?
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
I also update mods, some of them even work.
Recently I did a mod tutorial.
Re: Mod changes in 0.13
About on_player_joined_game event :
at the first player creation, we already have event on_player_created.
Will the creation also trigger on_player_joined_game once ?
If yes, I suppose that it will be after the creation event ?
at the first player creation, we already have event on_player_created.
Will the creation also trigger on_player_joined_game once ?
If yes, I suppose that it will be after the creation event ?
My mods on the Factorio Mod Portal
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Mod changes in 0.13
Question:
what is the correct way to access the new version of game.daytime?
what is the correct way to access the new version of game.daytime?
Re: Mod changes in 0.13
Another question:
Any idea why game is playing silly with me and writes that my mod is meant for factorio 12?
It shows below it that dependency is set for base > 0.13.0. And it loads the control.lua part but data.lua or data-updates.lua will not be read (no log entry for them, checksum of mod says 0). Running mod as directory.
Solution:
There is a new required value factorio_version to make the mod work.
Any idea why game is playing silly with me and writes that my mod is meant for factorio 12?
It shows below it that dependency is set for base > 0.13.0. And it loads the control.lua part but data.lua or data-updates.lua will not be read (no log entry for them, checksum of mod says 0). Running mod as directory.
Solution:
There is a new required value factorio_version to make the mod work.
Re: Mod changes in 0.13
You need to have access to surface and find it there:bobingabout wrote:Question:
what is the correct way to access the new version of game.daytime?
http://lua-api.factorio.com/0.13.0/LuaS ... ce.daytime
You can grab default surface like this:
Code: Select all
local surface = game.surfaces['nauvis']
Re: Mod changes in 0.13
Why are my Mods saying, that they are for Version 0.12 and therefor not compatible with the current version of the game? I get this message in the mods menu ingame. What do I have to do, to change this?
Tired of not being able to reduce the pollution? Try the Air-Filter-Mod
With this, you are able to use the pollution levels in your circuit network: Pollution detector
With this, you are able to use the pollution levels in your circuit network: Pollution detector
Re: Mod changes in 0.13
Add the tag to the info.json: "factorio_version":"0.13" indicating the mod works with that version.Schorty wrote:Why are my Mods saying, that they are for Version 0.12 and therefor not compatible with the current version of the game? I get this message in the mods menu ingame. What do I have to do, to change this?
If you want to get ahold of me I'm almost always on Discord.
Re: Mod changes in 0.13
And be careful - mods disabled in this way that fullfill the base requirement are still running their control.lua - lots of fun to be had there.Rseding91 wrote:Add the tag to the info.json: "factorio_version":"0.13" indicating the mod works with that version.Schorty wrote:Why are my Mods saying, that they are for Version 0.12 and therefor not compatible with the current version of the game? I get this message in the mods menu ingame. What do I have to do, to change this?
Re: Mod changes in 0.13
Why shouldn't they? Did I miss something important? I read, that the 'require "defines"' is not longer needed, but other than that? Could you explain this a bit further, please?orzelek wrote:And be careful - mods disabled in this way that fullfill the base requirement are still running their control.lua - lots of fun to be had there.
Tired of not being able to reduce the pollution? Try the Air-Filter-Mod
With this, you are able to use the pollution levels in your circuit network: Pollution detector
With this, you are able to use the pollution levels in your circuit network: Pollution detector
Re: Mod changes in 0.13
I was updating RSO, fixed control file and only then realized that mod is disabled. So control.lua of mod was loaded for disabled mod.Schorty wrote:Why shouldn't they? Did I miss something important? I read, that the 'require "defines"' is not longer needed, but other than that? Could you explain this a bit further, please?orzelek wrote:And be careful - mods disabled in this way that fullfill the base requirement are still running their control.lua - lots of fun to be had there.
Re: Mod changes in 0.13
Confirmed. Same for me and Recycling Machines. I have the Test Mode and EvoGUI mods installed too. All failing with control.lua errors because of the use of require("defines")orzelek wrote:I was updating RSO, fixed control file and only then realized that mod is disabled. So control.lua of mod was loaded for disabled mod.Schorty wrote:Why shouldn't they? Did I miss something important? I read, that the 'require "defines"' is not longer needed, but other than that? Could you explain this a bit further, please?orzelek wrote:And be careful - mods disabled in this way that fullfill the base requirement are still running their control.lua - lots of fun to be had there.
Strictly though they weren't disabled (i.e. not grey). They were red, i.e. enabled but Factorio was saying they weren't compatible. But on that basis, Factorio shouldn't have let control.luas run. Disabling them (by toggling to make them grey) stopped control.lua.
-
- Manual Inserter
- Posts: 1
- Joined: Tue Jun 28, 2016 12:47 am
- Contact:
Re: Mod changes in 0.13
how now turn on/off peaceful mode?
Re: Mod changes in 0.13
/c game.player.surface.peaceful_mode = true/falseBloodForce wrote:how now turn on/off peaceful mode?
If you want to get ahold of me I'm almost always on Discord.
Re: Mod changes in 0.13
You can find a list of some name changes in
C:\Program Files\Factorio\data\base\migrations\*.json
It may still be the same as in the original post, but in (in my opinion) more readable format. And you can grep through it easily.
Still, there are some changes that I cannot find. It may be because they are older than 0.12 => 0.13 because I try to update an old mod I didn't write. It would be welcome if 0.11 mod API could be available or older migration logs to look through for this purpose. Maybe those are archived at some other place than lua-apis.factorio.com? I'm very new to the Factorio specific part of modding for Factorio.
I'll just drop a list here of some changes I couldn't find in the migrations that could be older changes. Feel free to point me to the docs where my answers can be found if you don't like to do my homework.
C:\Program Files\Factorio\data\base\migrations\*.json
It may still be the same as in the original post, but in (in my opinion) more readable format. And you can grep through it easily.
Still, there are some changes that I cannot find. It may be because they are older than 0.12 => 0.13 because I try to update an old mod I didn't write. It would be welcome if 0.11 mod API could be available or older migration logs to look through for this purpose. Maybe those are archived at some other place than lua-apis.factorio.com? I'm very new to the Factorio specific part of modding for Factorio.
I'll just drop a list here of some changes I couldn't find in the migrations that could be older changes. Feel free to point me to the docs where my answers can be found if you don't like to do my homework.
- AutoplaceSpecification::peaks::noise_persistence => noisePersistence (this doesn't even confirm with the naming standard of all other attributes)
- AutoplaceSpecification::peaks::starting_area_weight_optimal is missing and I cannot see what it has been renamed to.
- AutoplaceSpecification::peaks::starting_area_weight_range is missing and I cannot see what it has been renamed to.
- AutoplaceSpecification::peaks::starting_area_weight_max_rang is missing and I cannot see what it has been renamed to.