[1.1] resource_autoplace isn't global anymore

Bugs that are actually features.
Post Reply
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

[1.1] resource_autoplace isn't global anymore

Post by bobingabout »

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.
Last edited by bobingabout on Tue Nov 24, 2020 2:07 pm, edited 2 times in total.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: [1.1] resource_autoplace isn't global anymore

Post by Deadlock989 »

The change for me was to add one line:

Code: Select all

local resource_autoplace = require("resource-autoplace")
Image

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: [1.1] resource_autoplace isn't global anymore

Post by bobingabout »

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.)
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: [1.1] resource_autoplace isn't global anymore

Post by bobingabout »

Well, it does seem to work with just including it.
I'll be back if I find any issues related to the change.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Bilka
Factorio Staff
Factorio Staff
Posts: 3133
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [1.1] resource_autoplace isn't global anymore

Post by Bilka »

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.

Post Reply

Return to “Not a bug”