Page 1 of 1

changing vanilla recipes

Posted: Mon Nov 04, 2019 9:35 pm
by slijfergast
Hi, I'm very new to modding and I'm trying to make a simple mod that makes wooden chests more difficult to make. However i've run into a problem. I want to change the recipe of the chest to instead of consisting of 2 wood be that of multiple nails and wooden planks. I figured everything out except how to change the vanilla recipe of a wooden chest.
If I made any mistakes please correct me, english is not my first language.

Re: changing vanilla recipes

Posted: Mon Nov 04, 2019 9:44 pm
by DaveMcW

Code: Select all

data.raw["recipe"]["wooden-chest"].ingredients = {
  {"wooden-plank", 6},
  {"nail", 12},
}

Re: changing vanilla recipes

Posted: Mon Nov 04, 2019 9:47 pm
by darkfrei
Take part of code from vanilla prototypes and place it into your mod folder into the data.lua.
You are need to define items: "nail", "wooden-plank" and icons for them.
After adding items you are need to add recipes for nails and planks, only then changing the recipe of wooden boxes.

See items and recipes here, but don't change they here:
Factorio\data\base\prototypes\item\demo-item.lua
Factorio\data\base\prototypes\item\item.lua

Factorio\data\base\prototypes\recipe\demo-recipe.lua
Factorio\data\base\prototypes\recipe\recipe.lua

Re: changing vanilla recipes

Posted: Mon Nov 04, 2019 9:54 pm
by Pi-C
Did you see this modding tutorial yet?
You should use something like

Code: Select all

local new_chest = table.deepcopy(data.raw.recipe["wooden-chest"])
new_chest.ingredients = {
	-- apply necessary changes to prototype
}
data:extend{new_chest}

Re: changing vanilla recipes

Posted: Tue Nov 05, 2019 9:14 am
by slijfergast
I was able to figure it out thanks to the help of you all.
Thank you very much.