Page 1 of 1

Order string doesn't work

Posted: Sat Jan 16, 2016 11:24 am
by Natha
Hi,

for my mod I want to reorder all oil-recipes (oil-processing, cracking, solid fuel). But the order string doesn't work (for another subgroup with only one base-recipe (the others are mod-own recipes), it does work).

That doesn't work:

Code: Select all

recipe = function(name, subgroup, order)
	data.raw.recipe[name].subgroup = subgroup
	data.raw.recipe[name].order = order
end

recipe("basic-oil-processing", "oil-processing", "a-a")
recipe("advanced-oil-processing", "oil-processing", "a-b")

recipe("heavy-oil-cracking", "oil-processing", "b-a")
recipe("light-oil-cracking", "oil-processing", "b-b")

recipe("solid-fuel-from-heavy-oil", "oil-processing", "c-a")
recipe("solid-fuel-from-light-oil", "oil-processing", "c-b")
recipe("solid-fuel-from-petroleum-gas", "oil-processing", "c-c")
In game I get this order:
- basic oil processing
- Heavy oil cracking
- Light oil cracking
- Advanced oil cracking
- Petroleum solid fuel
- heavy oil solid fuel
- Light oil solid fuel

If I write this with []-brackets, I get another order (but not the desired).

Can someone help me?

Re: Order string doesn't work

Posted: Tue Jan 19, 2016 7:17 pm
by Rseding91
Which version of the game are you using?

Re: Order string doesn't work

Posted: Tue Jan 19, 2016 8:05 pm
by Natha
Rseding91 wrote:Which version of the game are you using?
0.12.21

Re: Order string doesn't work

Posted: Sat Jan 23, 2016 4:38 am
by malcmiller
I don't think that tables in lua code are actually ever kept in order. maybe you can use table_sort() on their order part of the recipe prototypes.