changing vanilla recipes

Place to get help with not working mods / modding interface.
Post Reply
slijfergast
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Nov 04, 2019 9:29 pm
Contact:

changing vanilla recipes

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

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: changing vanilla recipes

Post by DaveMcW »

Code: Select all

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

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

Re: changing vanilla recipes

Post 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

Pi-C
Smart Inserter
Smart Inserter
Posts: 1651
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: changing vanilla recipes

Post 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}
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

slijfergast
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Nov 04, 2019 9:29 pm
Contact:

Re: changing vanilla recipes

Post by slijfergast »

I was able to figure it out thanks to the help of you all.
Thank you very much.

Post Reply

Return to “Modding help”