Teardown

by Skrundz

Automate the removal of depleted miners

Tweaks
23 days ago
1.1 - 2.0
745

g Auto Deconstruct?

2 months ago
(updated 2 months ago)

Hmm, there is already a mod called "Auto Deconstruct" by mindmix That does this.

2 months ago

This is my attempt at similar mod with better performance characteristics. I am a big fan of AutoDeconstruct :)

2 months ago

This is my attempt at similar mod with better performance characteristics. I am a big fan of AutoDeconstruct :)

How exactly it differs from Auto Deconstruct though? Any tweaks, hacks, optimisations, etc?..

2 months ago

Not bad for a short and sweet mod. Great for those who don't want all the features in AutoDeconstruct (like settings to ignore fluid miners or replace them with pipes, setting to ignore miners with wires, options to remove chests, belts, and beacons). I didn't see anything in the event or tick based code that would be inherently more performant--resource depletion is a rare event after all.

2 months ago

The main difference (the motivation for attempting this mod) is when determining if the miner is ready to deconstruct or not (https://github.com/softmix/AutoDeconstruct/blob/master/autodeconstruct.lua#L205); in check_drill() AutoDeconstruct uses its own implementation of has_resources() to check if a miner is done or not which involves a NxN entity search (https://github.com/softmix/AutoDeconstruct/blob/master/autodeconstruct.lua#L24).

What I'm attempting to do instead is allow 2 ticks for the game (C++) to perform the search for me then query the miner's status (https://git.skrundz.dev/skrundztorio/Teardown/src/branch/master/teardown/on_tick.lua#L11). My idea is for this to be much more performant as it avoids an entity search and loop in Lua, however I have zero measurements to confirm this (yet). I suspect the difference is more pronounced with mods that add larger radius miners.

AutoDeconstruct is amazing and has many more features than I care to implement at the moment. I anticipate this mod will diverge from AutoDeconstruct with the expansion ;)

2 months ago

That's really smart! I haven't touched that part of AutoDeconstruct much so I didn't realize it was so different. Now that I've added a delay queue waiting for the last ore to be ejected, it would be easy to use your method to detect depletion too. I might give it a try. Thanks for sharing!

New response