Page 1 of 1
Electricity help
Posted: Sun Apr 24, 2016 8:47 am
by Herobrainss
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?
Re: Electricity help
Posted: Sun Apr 24, 2016 12:10 pm
by Simcra
try adding the following to all of your rails in prototypes
Code: Select all
type = "assembling-machine",
crafting_categories = {"no-recipe-category"},
fixed_recipe = "no-recipe",
ingredient_count = 0,
and then adding the following to your recipes
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},},
},
EDIT:
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"
}
})
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.