can't copy vanilla locomotive
Posted: Fri May 14, 2021 9:54 pm
Hello, I'm trying to make a little mod and i need to have a copy of the normal locomotive but a little bit more powerful and slower, so I wrote this code:
but the thing is that the game keeps crashing on startup with the error
I don't know what I'm doing wrong, I'm literally copying the vanilla locomotive how can it not exist?
Code: Select all
--data.lua
--====================================
-- defining shunter loco prototype
local shunterLoco = table.deepcopy(data.raw["locomotive"]["locomotive"]) -- copy the table that defines a loco
shunterLoco.name = "shunter-loco"
shunterLoco.max_speed = 60
shunterLoco.reversing_power_modifier = 1.00
--====================================
-- defining shunter recipe prototype
local shunterLocoRecipe = table.deepcopy(data.raw["recipe"]["locomotive"])
shunterLocoRecipe.name = "shunter-loco-recipe"
shunterLocoRecipe.enabled = true
shunterLocoRecipe.result = shunterLoco.name
--====================================
-- adding those prototypes to the game
data:extend({shunterLoco, shunterLocoRecipe})
Code: Select all
--language.cfg
[item-name]
shunter-loco=Shunter Locomotive
[item-description]
shunter-loco=A locomotive designated to move cars between rail yards.
[entity-name]
shunter-loco=Shunter Locomotive
[entity-description]
shunter-loco=A locomotive designated to move cars between rail yards.
Code: Select all
Item with name 'shunter-loco' does not exist