Copy and modify a recipe into a new one
Posted: Fri Dec 18, 2020 8:24 pm
Hello everyone,
I just started looking into modding factorio.
I'm trying to do a simple thing:
The recipe doesn't show up, I expected it to be next to assembly machine 3.
Any help would be appreciated.
Thanks
I just started looking into modding factorio.
I'm trying to do a simple thing:
Code: Select all
local myAssemblyMachine = util.table.deepcopy(data.raw["assembling-machine"]["assembling-machine-3"])
myAssemblyMachine["name"] = "assembling-machine-test"
myAssemblyMachine["crafting_speed"] = 5
myAssemblyMachine["localised_name"] = "Assembling Machine 4"
myAssemblyMachine["module_specification"] =
{
module_slots = 6
}
-- recipe
local recipe = util.table.deepcopy(data.raw["recipe"]["assembling-machine-3"])
recipe.enabled = true
recipe.name = "assembling-machine-test"
recipe.localised_name = "Assembling Machine 4"
recipe.ingredients = {{"copper-plate",50},{"steel-plate",250}}
recipe.result = "assembling-machine-test"
-- item
local myitem = util.table.deepcopy(data.raw["item"]["assembling-machine-3"])
myitem.name = "assembling-machine-test"
myitem.localised_name = "Assembling Machine 4"
data:extend({myitem, myAssemblyMachine, recipe})
Any help would be appreciated.
Thanks