Page 1 of 1

Allow LightningAttractorPrototype to support negative efficiency

Posted: Thu Aug 21, 2025 6:38 pm
by Arcus
Would it be possible to add support for negative values to the efficiency of lightning rods? The idea is to allow you to have lightning strikes that require excess power to protect against instead of generating power, as a modded environmental hazard.

Re: Allow LightningAttractorPrototype to support negative efficiency

Posted: Thu Aug 21, 2025 6:47 pm
by MrSmoothieHuman
+1, seems like a cool idea - even if it was a separate parameter and not directly “negative efficiency”

Re: Allow LightningAttractorPrototype to support negative efficiency

Posted: Thu Aug 21, 2025 7:26 pm
by protocol_1903
+1

Re: Allow LightningAttractorPrototype to support negative efficiency

Posted: Thu Sep 04, 2025 3:00 pm
by Bilka
What happens if there is no more energy left in the energy source?

Re: Allow LightningAttractorPrototype to support negative efficiency

Posted: Sun Sep 07, 2025 8:30 pm
by MrSmoothieHuman
Bilka wrote: Thu Sep 04, 2025 3:00 pm What happens if there is no more energy left in the energy source?
Presumably it'd just stop working? thats the only way I can see it working personally (presuming you mean "the electric network" in this context :lol: )

Re: Allow LightningAttractorPrototype to support negative efficiency

Posted: Mon Sep 08, 2025 6:40 am
by Bilka
no, I mean when lightning strikes an empty collector. should it damage the collector or do nothing? should the collector stop protecting the area?

Re: Allow LightningAttractorPrototype to support negative efficiency

Posted: Mon Sep 08, 2025 7:55 pm
by Quorken
+1

Damaging/destroying the collector seems reasonable - if the collector is destroyed, it would then stop protecting the area it's supposed, as a natural consequence. So protecting the area would consume energy, or entity health if there is no energy.

Damage could just be whatever the lightning would normally do to an entity.

To protect against people spamming unpowered collectors (if this is a problem), modders could use a dying_trigger_effect to zap nearby collectors, or a (damaging) explosion upon destruction.

Re: Allow LightningAttractorPrototype to support negative efficiency

Posted: Tue Sep 09, 2025 9:31 am
by Bilka
To make sure my reply doesn't give a wrong impression: I am not working on this currently, it seems like too risky of a change with not clearly specified behaviour.

Re: Allow LightningAttractorPrototype to support negative efficiency

Posted: Tue Sep 09, 2025 1:46 pm
by pastelstoic
Throwing my two cents in for a more concrete implementation idea:

If efficiency is negative, strikes will drain from the buffer instead of filling it.

A new field, minimum_buffer_content (value: float), is mandatory if efficiency is < 0. At runtime, if the current buffer energy is below this percentage, the attractor does not function. Value must be > 0 (a value of zero would act the same as efficiency == 0) and <= 1.

energy_source is now mandatory if efficiency ~= 0.

Re: Allow LightningAttractorPrototype to support negative efficiency

Posted: Tue Sep 09, 2025 4:15 pm
by protocol_1903
I'd say if it doesn't have enough energy available in the buffer, then the entity should explode. That, or some trigger event should be triggered, so that any number of effects can be defined (like how nuclear reactors explode, but burners dont).