Hey there! I am recently getting into modding and I don't quite understand how to add energy consumption to an entity.
In my mod, I want certain rails to use energy. I've copied the straight and curved rails from the base mod and added in the energy consumption and energy source attributes.
This doesn't work however, what else should I do?
Electricity help
-
- Manual Inserter
- Posts: 1
- Joined: Sun Apr 24, 2016 8:43 am
- Contact:
Re: Electricity help
try adding the following to all of your rails in prototypes
and then adding the following to your recipes
EDIT:
You will probably have to create a categories.lua and add this if you don't already have one
Kinda removes it's ability to be used as a rail, I'd say you'd probably have to create some sort of accumulator that works with the rail and when the accumulator is not full the rail slows down the locomotive? The biggest problem is that if the type of the rails isn't straight-rail or curved-rail it doesn't register as a track, but in order for it to consume energy it needs to be an different entity type.
Code: Select all
type = "assembling-machine",
crafting_categories = {"no-recipe-category"},
fixed_recipe = "no-recipe",
ingredient_count = 0,
Code: Select all
{
type = "recipe",
name = "no-recipe",
enabled = true,
hidden = true,
category = "no-recipe-category",
energy_required = 1,
ingredients = {},
results={{type="item", name="iron-plate", amount=1, probability=0},},
},
You will probably have to create a categories.lua and add this if you don't already have one
Code: Select all
data:extend({
{
type = "recipe-category",
name = "no-recipe-category"
}
})