Making a mod that changes another mod's recipes

Place to get help with not working mods / modding interface.
Post Reply
khadgarion
Inserter
Inserter
Posts: 43
Joined: Sun Dec 25, 2016 3:34 am
Contact:

Making a mod that changes another mod's recipes

Post by khadgarion »

Hi folks,

I am trying to modify some recipes in a mod I am playing. I have successfully edited the mod's files and made some recipe changes, but I would like to keep my changes separate from the actual mod.

Essentially, I am making a new mod that has a dependency on the old mod.

I made my info.json file, and make the folder structure to match the original mod. I added the lines that I changed into the corresponding .lua files, and while my mod actually does load, no changes have been made to recipes. I feel like I am missing a step. I haven't been able to find much information on modding an existing mod; Does anyone have any suggestions on where I could look, or what I am missing / doing wrong?

edit: adding some more info

One of the files I have changed is the prototypes / recipe / part / assembly.lua file. My file contains this:

Code: Select all

data.raw.recipe["flying-robot-frame"].energy_required = 10
data.raw.recipe["flying-robot-frame"].ingredients = {{"battery-2", 1}, {"control-2", 1}, {"forging-aluminum", 1}, {"motor-2", 1}}
This is basically a copy of the original mod's lines pertaining to the flying robot frame, but with one of the ingredients changed.

Thank you.
Khad

khadgarion
Inserter
Inserter
Posts: 43
Joined: Sun Dec 25, 2016 3:34 am
Contact:

Re: Making a mod that changes another mod's recipes

Post by khadgarion »

I think I just answered my own question; I added a data.lua file and put in a require for the file I changed and it worked!

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

Re: Making a mod that changes another mod's recipes

Post by darkfrei »

You can also add require if some another mod is enabled.

Code: Select all

require ("main")

if mods['rso-mod'] then
  require ("mods/rso-mod")
end 

Post Reply

Return to “Modding help”