Page 3 of 4
Re: Mod changes in 0.13
Posted: Sat Jun 11, 2016 4:20 pm
by DedlySpyder
Adil wrote:I can't comprehend these:
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.
Weren't game.entity_prototypes and such already indexable by []?
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"]).
Re: Mod changes in 0.13
Posted: Sat Jun 11, 2016 5:02 pm
by sparr
Adil wrote:Weren't game.entity_prototypes and such already indexable by []?
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.
details:
http://lua-api.factorio.com/0.13.0-prev ... Table.html
Re: Mod changes in 0.13
Posted: Sat Jun 11, 2016 7:01 pm
by Adil
So what old code will break due to this?
I don't recall seeing ipairs used on any of the
game.players, game.surfaces, game.entity_prototypes, game.item_prototypes, game.fluid_prototypes, force.recipes, force,technologies
ever.
Re: Mod changes in 0.13
Posted: Sat Jun 11, 2016 7:36 pm
by sparr
Adil wrote:
I don't recall seeing ipairs used on any of the
game.players, game.surfaces, game.entity_prototypes, game.item_prototypes, game.fluid_prototypes, force.recipes, force,technologies
ever.
https://www.google.com/search?q=site:gi ... +%22ipairs(game%22
Adil wrote:So what old code will break due to this?
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
Posted: Sat Jun 11, 2016 8:02 pm
by Choumiko
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 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?
Re: Mod changes in 0.13
Posted: Sat Jun 11, 2016 9:39 pm
by Rseding91
Choumiko wrote: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 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?
Correct.
Re: Mod changes in 0.13
Posted: Sun Jun 12, 2016 4:10 pm
by Adil
Rseding91 wrote:Unified prototype names to be consistant with ingame names.
Will the same named technologies be renamed as well?
For example: basic-laser-defense-equipment and basic-exoskeleton-equipment?
Re: Mod changes in 0.13
Posted: Wed Jun 15, 2016 9:39 am
by binbinhfr
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 ?
Re: Mod changes in 0.13
Posted: Mon Jun 27, 2016 7:22 pm
by bobingabout
Question:
what is the correct way to access the new version of game.daytime?
Re: Mod changes in 0.13
Posted: Mon Jun 27, 2016 7:49 pm
by orzelek
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.
Re: Mod changes in 0.13
Posted: Mon Jun 27, 2016 8:09 pm
by orzelek
bobingabout wrote:Question:
what is the correct way to access the new version of game.daytime?
You need to have access to surface and find it there:
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
Posted: Mon Jun 27, 2016 8:30 pm
by Schorty
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
Posted: Mon Jun 27, 2016 8:55 pm
by Rseding91
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?
Add the tag to the info.json: "factorio_version":"0.13" indicating the mod works with that version.
Re: Mod changes in 0.13
Posted: Mon Jun 27, 2016 9:06 pm
by orzelek
Rseding91 wrote: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?
Add the tag to the info.json: "factorio_version":"0.13" indicating the mod works with that version.
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
Posted: Mon Jun 27, 2016 9:20 pm
by Schorty
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.
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?

Re: Mod changes in 0.13
Posted: Mon Jun 27, 2016 9:45 pm
by orzelek
Schorty wrote: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.
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?

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.
Re: Mod changes in 0.13
Posted: Mon Jun 27, 2016 9:54 pm
by DRY411S
orzelek wrote:Schorty wrote: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.
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?

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.
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")
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.
Re: Mod changes in 0.13
Posted: Tue Jun 28, 2016 12:49 am
by BloodForce
how now turn on/off peaceful mode?
Re: Mod changes in 0.13
Posted: Tue Jun 28, 2016 1:36 am
by Rseding91
BloodForce wrote:how now turn on/off peaceful mode?
/c game.player.surface.peaceful_mode = true/false
Re: Mod changes in 0.13
Posted: Tue Jun 28, 2016 7:15 pm
by leffe108
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.
- 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.