Skip to content

Commit

Permalink
Improve resource, pipe and chest logic (#16)
Browse files Browse the repository at this point in the history
* Added support for drills with multiple resource types

When checking a drill for remaining resources, check for resources matching any of that drill's compatible types.

* Remove empty fluid miners when setting changed

Re-scan for depleted miners when fluid miner setting is newly enabled.
Improve debug prints for resource types.

* Moved max_radius calculation to init_globals

* Calculate max_radius based on all prototypes in the game, rather than checking every single entity when it is built to see if it has a larger radius.
* Add filter to on_deconstruction_cancelled event.

* Moved max_radius calculation to init_globals

* Calculate max_radius based on all prototypes in the game, rather than checking every single entity when it is built to see if it has a larger radius.
* Add filter to on_deconstruction_cancelled event.

* Improved pipe rotation logic

Change pipe placement to utilize the direction-specific connection coordinates contained in the prototype data, rather than assuming symmetrical rotation.

* Update autodeconstruct.lua

* Removed unneeded validity checks for a fluidbox we know exists.
* Only build pipes if this miner has more than one connection.  (If a row depletes uniformly from the very end, no pipes are ever needed.)

* Fixed chests being deconstructed while still in use

* Fixed a logic error when checking if another miner is still using a chest.
* Simplified the search code to find entities targeting the chest.
* Fixed a crash if an inserter is nearby the chest but not targeting the chest.

* Add deconstructing inserters feeding fuel to burner miners

* For burner miners, checks for inserters targeting the miner and deconstructs them too.
Note: Only case not covered is if an inserter is *taking* fuel from this miner in a daisy chain, in which case you might not want it to be deconstructed at all.

* Added partial pipe construction

* Added logic so that pipes are only built to connections in use.  (This will fail if connected to a very rectangular entity or if there are more than one pipe connection on one side of the miner.)
* Added logic to not deconstruct a burner miner that is a source for an inserter moving fuel around.

* Update comment
  • Loading branch information
robot256 committed Nov 21, 2021
1 parent 3751c9b commit 3a900ed
Show file tree
Hide file tree
Showing 2 changed files with 201 additions and 99 deletions.
Loading

0 comments on commit 3a900ed

Please sign in to comment.