Auto Deconstruct

by mindmix

This mod marks drills that have no more resources to mine for deconstruction.

Utilities
2 months ago
0.13 - 2.0
321K
Mining

i [Implemented] Automatically detect which pipe should be used

2 years ago

Would be nice if when deconstructing, the mod could check the type of pipe connected to the miner and use the same type as a replacement.

For example, the mod could check whether a Krastorio steel pipe is connected (or a steel underground pipe) and in that case place steel pipes instead.

2 years ago

This would be rather annoying to implement, because it would have to search the entire line of miners to find one with a pipe connected. What should it do if the same row of miners has more that one type of pipe already? If anything, I would have it search the nearest logistic network to see what kind of pipe is available there. But that still seems like it would be unpredictable and annoying to the player. Is the global mod setting to set the type of pipe to use so inconvenient? You can always change the ghost types with an upgrade planner to match what you have available.

(Before changing the pipe selection behavior, I have to fix the fact that it won't build pipes to other ghost pipes if they haven't been placed yet.)

2 years ago

Is the global mod setting to set the type of pipe to use so inconvenient?

Well, I have a case while playing Space Exploration + Crastorio where some of my outposts only have regular pipes in the inventory and other outposts have only steel pipes 😅 So basically my patches break on the newer outposts after automatic deconstruction.

What should it do if the same row of miners has more that one type of pipe already?

Just grab the first one you find. If there are multiple types on the patch, most likely both are available for placement.

If anything, I would have it search the nearest logistic network to see what kind of pipe is available there.

This sounds like a nice solution. Miners usually don't require a lot of fluid throughput unless they are heavily modded. If you want to step it up a notch, you can calculate the throughput needed for the miners and then select the pipe of the lowest quality that can support that throughput and is available in the network 😂 Sounds tricky though.

2 years ago

I think I will not touch this feature for the foreseeable future. If you would like to try writing it yourself and make a pull request, I'll be happy to take a look. (This mod is a team effort at this point!) You can also disable the removal of fluid miners entirely, so that your mining patches are not interrupted by unavailable ghost pipes.

3 months ago

Well folks, it happened! Version 1.0.4 includes automatic pipe type selection. With 2.0 adding connection category masks for different types of pipes, automatically selecting a compatible pipe is a lot more necessary now. The new algorithm should take care of every case:
1. Checks collision masks of tiles
2. Checks connection categories of all connecting pipes/buildings
3. Checks contents of the fixed logistic network (not player/spider networks).
4. Selects whichever type of pipe (including quality) is both valid and most numerous in the network
5. If no pipe is found in the network, makes ghosts according to the pipe type setting. It selects the first one in the list that satisfies items 1 and 2.

Please let me know if you experience any crashes or compatibility problems!

3 months ago
(updated 3 months ago)

Other caveats: It only searches a logistic network if it is the same force as the drill and completely covers the drill with construction area.

If none of the pipes in the default setting list fit, then it picks one that works arbitrarily.

If no valid pipe prototypes are found for the given situation, then the drill is left in place.

New response