Page 1 of 1

Recipes: name, type, amount for all recipes

Posted: Mon Aug 28, 2017 7:41 pm
by darkfrei
Hi all!

A lot of ingredients have this type of ingredients properties:

Code: Select all

data.raw.recipe.fast-underground-belt.ingredients[1][1] = "iron-gear-wheel"
data.raw.recipe["fast-underground-belt"].ingredients[1][2] = 40
data.raw.recipe["fast-underground-belt"].ingredients[2][1] = "underground-belt"
data.raw.recipe["fast-underground-belt"].ingredients[2][2] = 2
Why it can't be everywhere exact defined properties like this?

Code: Select all

data.raw.recipe["fast-underground-belt"].ingredients[1].type = "item"
data.raw.recipe["fast-underground-belt"].ingredients[1].name = "iron-gear-wheel"
data.raw.recipe["fast-underground-belt"].ingredients[1].amount = 40
data.raw.recipe["fast-underground-belt"].ingredients[2].type = "item"
data.raw.recipe["fast-underground-belt"].ingredients[2].name = "underground-belt"
data.raw.recipe["fast-underground-belt"].ingredients[2].amount = 2

Re: Recipes: name, type, amount for all recipes

Posted: Mon Aug 28, 2017 8:29 pm
by prg
My guess would be historical reasons, from when fluids didn't exist yet and type = "item" was implicit. Updating things would be work, so it stays like it is.

Re: Recipes: name, type, amount for all recipes

Posted: Mon Aug 28, 2017 8:51 pm
by darkfrei
prg wrote:My guess would be historical reasons, from when fluids didn't exist yet and type = "item" was implicit. Updating things would be work, so it stays like it is.
I'm making some mode, where must be nice procedural reading of existing recipes: For example, how much amounts of ingredients was used in vanilla? By [1] and [2] it can't be read as ["amount"], but amounts can't be read as [2].

If it was updated by the script, you can very easy iterate it and say:
amounts items in recipes

Re: Recipes: name, type, amount for all recipes

Posted: Tue Aug 29, 2017 12:35 pm
by bobingabout
my library accounts for both. it only write in the type, name, amount format though.
feel free to look through It for ideas.

Re: Recipes: name, type, amount for all recipes

Posted: Tue Aug 29, 2017 12:57 pm
by darkfrei
bobingabout wrote:my library accounts for both. it only write in the type, name, amount format though.
feel free to look through It for ideas.
I think this script makes the same. Takes all vanilla recipes and convert to full description format.

Re: Recipes: name, type, amount for all recipes

Posted: Tue Aug 29, 2017 3:50 pm
by darkfrei
Script was updated: Now all ingredients and results will be complete defined.

Code: Select all

data.raw.recipe["stone-furnace"].type = "recipe"
data.raw.recipe["stone-furnace"].name = "stone-furnace"
data.raw.recipe["stone-furnace"].ingredients[1].type = "item"
data.raw.recipe["stone-furnace"].ingredients[1].name = "stone"
data.raw.recipe["stone-furnace"].ingredients[1].amount = 5
data.raw.recipe["stone-furnace"].results[1].type = "item"
data.raw.recipe["stone-furnace"].results[1].name = "stone-furnace"
data.raw.recipe["stone-furnace"].results[1].amount = 1