After the huge clusterF* when the resource_autoplace system was introduced in the first place, part of the solution was to leave resource_autoplace in resources.lua as global INTENTIONALLY, to make it easier for mods to use it.
This was because when you reload it from a different mod, any locals set in the file are reset, so ore index numbers end up being re-used when they're not supposed to be.
In 1.1, it has been changed back to a local.
[1.1] resource_autoplace isn't global anymore
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
[1.1] resource_autoplace isn't global anymore
Last edited by bobingabout on Tue Nov 24, 2020 2:07 pm, edited 2 times in total.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: [1.1] resource_autoplace isn't global anymore
The change for me was to add one line:
Code: Select all
local resource_autoplace = require("resource-autoplace")
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: [1.1] resource_autoplace isn't global anymore
Deadlock989 wrote: Tue Nov 24, 2020 2:05 pm The change for me was to add one line:
Code: Select all
local resource_autoplace = require("resource-autoplace")
I'll give it a try include it again anyway and see if there are any issues with it. (i'm just going to include it as a global in my library, as I call it too many places to want to try and fix them all.)
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: [1.1] resource_autoplace isn't global anymore
Well, it does seem to work with just including it.
I'll be back if I find any issues related to the change.
I'll be back if I find any issues related to the change.
Re: [1.1] resource_autoplace isn't global anymore
Not a bug, change was mentioned in viewtopic.php?p=521904#p521904. If an problem crops up other than like the variables resetting as you mention, please let us know.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.