Load order mess stack sizes

Place to get help with not working mods / modding interface.
Anumiell
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Aug 16, 2016 8:49 am
Contact:

Load order mess stack sizes

Post by Anumiell »

I'm trying to create a recipe, which using current stack size of an item.

Code: Select all

local StackSize = data.raw.item[Material].stack_size
data:extend(
		{
			{
				type = "recipe",
				......
				result = Material,
				result_count = StackSize,
			}, 
		}
	)
The problem: my mod getting wrong stack sizes.
There are currently 2 mods, that modify them: bobplates and BigBags. So e.g Iron Plates have stack size of 100. bob increase them to 200. BigBags increase them to 400. And my mod, for some reason, want to think that stack size is still 100.
When i trying to(for test purposes), change item's stack size in my mod, game recognizes that my changes to it was done before bob's and BigBags'. (base>crates>bob>Bags)

The funny part is my info.json:

Code: Select all

  "dependencies": ["base >= 0.13.0", "? bobplates", "? BigBags"]
So my crates probably should load after this two guys.

Even more funny thing is that config.lua see proper values, so

Code: Select all

local StackSize = game.item_prototypes[Material].stack_size
Returns 400(in Iron Plates example), but i can't use this code in any data changes(i believe because of "game" is referencing to current game session, and cannot be called during initialization, right?)

So, comrades, what am i doing to my life? I mean, what's wrong with my code? Thanks. :)
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5411
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Load order mess stack sizes

Post by Klonan »

Put your code into data-final-fixes.lua and it will run after all other data and data-updates
Anumiell
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Aug 16, 2016 8:49 am
Contact:

Re: Load order mess stack sizes

Post by Anumiell »

Fast and furious, sir! Fast an furious. That solved my problem. [sarcasm] But it's too easy for me. I will go now, trying to overcomplicate whole thing, and then i will return! [/sarcasm]

Thank you very much, really.
Post Reply

Return to “Modding help”