Recipes: name, type, amount for all recipes

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Recipes: name, type, amount for all recipes

Post 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
Attachments
update_recipes.lua
version 03
for data-updates.lua
(1.91 KiB) Downloaded 126 times
Last edited by darkfrei on Tue Aug 29, 2017 4:35 pm, edited 4 times in total.

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

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

Post 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.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

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

Post 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

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

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

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

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

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

Post 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.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

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

Post 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

Post Reply

Return to “Modding discussion”