Page 1 of 1

How to make a leaky accumulator

Posted: Sat Nov 08, 2025 3:45 pm
by Andrey135296
So, basically I want to make a "leaky" accumulator that gradually loses its stored power. The problem is, even though accumulator's prototype has "energy_source" field that can have a "drain" property, it seems to simply be ignored. (Runtime inspection shows it gets computed, but accumulator still doesn't drain).
To circumvent this issue i tried basing my leaky accumulator on lightning-attractor from space age, which worked, but required some redundant properties like efficiency that created interface clutter. And also, it didn't get displayed in charge statistics. And also also I don't want to require SA
I then tried basing on electric-energy-interface, which also works as intended but doesn't get properly displayed in statistics and on mouse-over shows charge in a very obtuse way. Image for electric-energy-interface option
11-08-2025, 20-38-34.png
11-08-2025, 20-38-34.png (9.63 KiB) Viewed 184 times

Any Ideas or recommendations on how to force accumulator to leak or force electric-energy-interface to display properly in statistics?


Also, code:
data.lua:
local lacc = table.deepcopy(data.raw["accumulator"]["accumulator"])
lacc.name = "lacc"
lacc.energy_source =
{
type = "electric",
usage_priority = "tertiary",
buffer_capacity = "800MJ",
input_flow_limit = "2MW",
output_flow_limit = "2MW",
drain = "80kW",
}
data:extend{lacc}

local lacc_eei = table.deepcopy(data.raw["accumulator"]["lacc"])
lacc_eei.name = "lacc_eei"
lacc_eei.type = "electric-energy-interface"
lacc_eei.picture = lacc_eei.chargable_graphics.picture
data:extend{lacc_eei}


and to spawn them in:
/c game.player.surface.create_entity({name="lacc", position={game.player.position.x-2, game.player.position.y+2}, force = game.player.force}); game.player.surface.create_entity({name="lacc_eei", position={game.player.position.x+2, game.player.position.y+2}, force = game.player.force})

Re: How to make a leaky accumulator

Posted: Sat Nov 08, 2025 8:18 pm
by computeraddict
I am speaking from almost no Factorio modding experience, but could you just have a composited entity with a tiny drain?

Re: How to make a leaky accumulator

Posted: Sat Nov 08, 2025 8:51 pm
by Andrey135296
computeraddict wrote: Sat Nov 08, 2025 8:18 pm I am speaking from almost no Factorio modding experience, but could you just have a composited entity with a tiny drain?
Huh, this could probably work. I don't actually know how to make composite entities, but it is a good avenue to explore

Re: How to make a leaky accumulator

Posted: Sat Nov 08, 2025 10:27 pm
by eugenekay
Lighted Electric Poles is a pretty good example of compound/composite entities. It creates a (hidden) Lamp underneath each Pole that is placed using an Event handler.

Good Luck!