i try to make an entity to consume energy from the electric network which by default doesn't. In theory it should be achievable by using a hidden-electric-energy-interface which is spawn in addition to the main object.
And using that snippet of code spawns an the entiy i wish for in addition a electric interface which is shown properly in the electric network overview.
Code: Select all
local function on_built( entity )
local gen = entity.surface.create_entity{name="heei_object", position=entity.position, direction=entity.direction,force=entity.force}
gen.destructible = true
gen.minable = false
return true
end
Code: Select all
{
type = "electric-energy-interface",
name = "heei_object",
icon = "__ArchdruidsChests__/graphics/object.png",
icon_size = 32,
flags = {},
max_health = 350,
collision_box = {{0, 0}, {0, 0}},
selection_box = {{-0, -0}, {0, 0}},
selectable_in_game = false,
localised_name = {"item-name.object"},
energy_source =
{
type = "electric",
buffer_capacity = "5MJ",
usage_priority = "primary-input",
input_flow_limit = "5MW",
output_flow_limit = "0KW",
drain = "0KW"
},
energy_production = "0KW",
energy_usage = "5MW",
picture =
{
filename = "__core__/graphics/empty.png",
priority = "extra-high",
width = 1,
height = 1
},
order = "h-e-e-i"
}
Any hint how to achieve it ? Additional calculations every x seconds/ticks …. or is that thing just deprecated portion of code and no longer valid to use ?! couldn't find any clue in documentation or web...
so i am looking forward to your ideas.
thanks and regards


