[0.17] Delayed Regeneration

Topics and discussion about specific mods
Post Reply
Honktown
Smart Inserter
Smart Inserter
Posts: 1026
Joined: Thu Oct 03, 2019 7:10 am
Contact:

[0.17] Delayed Regeneration

Post by Honktown »

https://mods.factorio.com/mod/DelayedRegen

Tired of biters/nests healing faster than you do damage? TIRED OF BURNING SO MANY BULLETS? Delay regeneration until they're out of combat!

Tested for a few minutes in multiplayer with someone else. Seems save/load stable with no errors in log. I might be doing overkill on some safeties so if someone has a big biter map at the moment I'd appreciate you trying it out for safety and performance reasons.
I have mods! I guess!
Link

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2633
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [0.17] Delayed Regeneration

Post by steinio »

Honktown wrote:
Tue Dec 10, 2019 11:16 am
https://mods.factorio.com/mod/DelayedRegen

Tired of biters/nests healing faster than you do damage? TIRED OF BURNING SO MANY BULLETS? Delay regeneration until they're out of combat!

Tested for a few minutes in multiplayer with someone else. Seems save/load stable with no errors in log. I might be doing overkill on some safeties so if someone has a big biter map at the moment I'd appreciate you trying it out for safety and performance reasons.
Nice idea.

I would encourage the devs to try it out if this could be a vanilla play style to make combat great again.
If not - fine.
Image

Transport Belt Repair Man

View unread Posts

PyroFire
Filter Inserter
Filter Inserter
Posts: 356
Joined: Tue Mar 08, 2016 8:18 am
Contact:

Re: [0.17] Delayed Regeneration

Post by PyroFire »

Not bad for one of your first mods.

A lot of room for improvement - but don't worry, you'll always do it better the second time.

One area is where you're comparing strings in an on_tick function (heal_effect) and tick timers on all entries in a table.
You can save the expensive detour through on_tick by using on_nth_tick instead.
Don't forget that you need to have the data stored in global so you can recreate "future" on_nth_tick calls in on_load, as these are not stored between save/loads.

And something fun - your settings could be changed during runtime by using https://lua-api.factorio.com/latest/eve ... ng_changed

And yes it is usually better to setup your mods global table with on_init and on_configuration_changed.

on_load only has 4 specific uses, and on_nth_tick is one of them.

Honktown
Smart Inserter
Smart Inserter
Posts: 1026
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: [0.17] Delayed Regeneration

Post by Honktown »

PyroFire wrote:
Tue Dec 10, 2019 4:53 pm
Not bad for one of your first mods.

A lot of room for improvement - but don't worry, you'll always do it better the second time.

One area is where you're comparing strings in an on_tick function (heal_effect) and tick timers on all entries in a table.
You can save the expensive detour through on_tick by using on_nth_tick instead.
Don't forget that you need to have the data stored in global so you can recreate "future" on_nth_tick calls in on_load, as these are not stored between save/loads.

And something fun - your settings could be changed during runtime by using https://lua-api.factorio.com/latest/eve ... ng_changed

And yes it is usually better to setup your mods global table with on_init and on_configuration_changed.

on_load only has 4 specific uses, and on_nth_tick is one of them.
Originally I was planning to have every enemy heal separately, instead of on the same tick. I added comments about the conflicting time, since technically the heal amount is wrong on the first healing pass of an enemy. There's different ways of implementing when to heal - I could've used a delay multiple counter and decrement it every delay until it reaches 0, then start healing an enemy, or just record the delay and decrement ticks until 0.

I can also define the heal function based on setting, instead of doing a check at all in a single function. More of an object-oriented style. I shat this mod out in a few hours, and I wanted to be the first to do it. Since it worked well, I got it out before cleaning it up a lot.

If you want to see more of a god-awful mess, DeepPockets is so much worse on the backside.
I have mods! I guess!
Link

Honktown
Smart Inserter
Smart Inserter
Posts: 1026
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: [0.17] Delayed Regeneration

Post by Honktown »

steinio wrote:
Tue Dec 10, 2019 4:12 pm
Honktown wrote:
Tue Dec 10, 2019 11:16 am
https://mods.factorio.com/mod/DelayedRegen

Tired of biters/nests healing faster than you do damage? TIRED OF BURNING SO MANY BULLETS? Delay regeneration until they're out of combat!

Tested for a few minutes in multiplayer with someone else. Seems save/load stable with no errors in log. I might be doing overkill on some safeties so if someone has a big biter map at the moment I'd appreciate you trying it out for safety and performance reasons.
Nice idea.

I would encourage the devs to try it out if this could be a vanilla play style to make combat great again.
If not - fine.
We already discussed this with them, because a 50% bonus to 7.5 damage doesn't kill a biter in 2 hits - they heal like .1 health in the time it takes to fire. They said no.
I have mods! I guess!
Link

Post Reply

Return to “Mods”