How to make a leaky accumulator

Place to get help with not working mods / modding interface.
Andrey135296
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sun Dec 29, 2024 9:46 pm
Contact:

How to make a leaky accumulator

Post 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 119 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})
computeraddict
Filter Inserter
Filter Inserter
Posts: 409
Joined: Sat Oct 07, 2023 6:44 am
Contact:

Re: How to make a leaky accumulator

Post by computeraddict »

I am speaking from almost no Factorio modding experience, but could you just have a composited entity with a tiny drain?
Andrey135296
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sun Dec 29, 2024 9:46 pm
Contact:

Re: How to make a leaky accumulator

Post 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
eugenekay
Filter Inserter
Filter Inserter
Posts: 848
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: How to make a leaky accumulator

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

Return to “Modding help”