Hi,
I'm working on an electric interface for my turret energy shields and I want them to loose their energy more quickly, when there is no energy available on the network.
It seems like there is no api to see how much energy the entity actually drains.
When I use is_connected_to_electric_network(), it always returns true as long as there are any power-producers in the network, even if they output nothing, even if they are just empty accumulators.
My request would be to make the function return false if the energy is 0 or very low, or to add a lightweight api call to check how much the entity actually draws from the electric network.
edit: i found a workaround (by caching the stored energy) but still think this should be implemented
api call to get power drawed from electric network
api call to get power drawed from electric network
creator of 55 mods
My api requests/suggestions: ui relative for overlay||Grenade arc||Player Modifiers||textbox::selection||Singleplayer RCON||disable car's ground sounds
My api requests/suggestions: ui relative for overlay||Grenade arc||Player Modifiers||textbox::selection||Singleplayer RCON||disable car's ground sounds
Re: api call to get power drawed from electric network
How much energy an entity draws from the electric network depends on what it's doing that tick. If a crafting machine is running it takes some energy based off beacon effects. If it finished crafting that tick it will take 0 next tick unless it resumes crafting.
You can simply read entity.energy > 0 to see if it has energy.
You can simply read entity.energy > 0 to see if it has energy.
If you want to get ahold of me I'm almost always on Discord.
Re: api call to get power drawed from electric network
i know, that's why i said i was calculating the energy from tick to tick.
but i assume that since the energy consumption changes every tick, it might be a bit harder to implement that feature.
but you should totally fix that there is no simple way to see if the entity is in a dead electricity network
but i assume that since the energy consumption changes every tick, it might be a bit harder to implement that feature.
but you should totally fix that there is no simple way to see if the entity is in a dead electricity network
creator of 55 mods
My api requests/suggestions: ui relative for overlay||Grenade arc||Player Modifiers||textbox::selection||Singleplayer RCON||disable car's ground sounds
My api requests/suggestions: ui relative for overlay||Grenade arc||Player Modifiers||textbox::selection||Singleplayer RCON||disable car's ground sounds
Re: api call to get power drawed from electric network
Eh? There is a way:ownlyme wrote:but you should totally fix that there is no simple way to see if the entity is in a dead electricity network
Though it will not take into account the priority.Rseding91 wrote:You can simply read entity.energy > 0 to see if it has energy.