Electricity help

Place to get help with not working mods / modding interface.
Herobrainss
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Apr 24, 2016 8:43 am
Contact:

Electricity help

Post 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?
Simcra
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Wed Apr 06, 2016 6:05 am
Contact:

Re: Electricity help

Post 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.
Post Reply

Return to “Modding help”