Autobuild

by therax

Autobuild allows your character to automatically build, deconstruct, and upgrade nearby ghosts. A more efficient alternative to mods like Bluebuild.

Utilities
4 months ago
0.17 - 1.1
18.0K

i (fixed) Spilled My Lubricant

1 year, 3 months ago

I still use this mod through late game. I love it :) When I deconstruct something a little too large and I'm not paying attention to my inventory, the items spill onto the ground when my inventory fills, causing me to possibly loose items or have to drag another deconstruct box. I'm sure this is what it is supposed to do. My suggestion is to add an option to automatically turn off Autobuild when the inventory is nearly full (or maybe when the trash slots are full, whatever is easier to code). Then, turn itself back on once more room becomes available. So, the items do not spill over when I bite off more than I can chew :)

1 year, 3 months ago

Interesting Idea.
A slight problem could be, that the item gets deconstructed first and then it tries to fit the item into the player's inventory.
I could check, if there are any empty slots, before trying to deconstruct, but sometimes an item can be added to an existing stack, which is not full yet, even if there are no empty slots
Maybe, I can somehow simulate to add the item and only deconstruct, if successful
Need to think about it and check the API, what is possible

1 year, 3 months ago

OK, I have implemented, that it only deconstruct entities and tiles, if it fits into the players inventory. When the inventory has more space again, deconstruction continues.
Hopefully, it works good and doesn't create further problems.

1 year, 3 months ago
(updated 1 year, 3 months ago)

It does not seem to work. It seemed to handle single items just fine already. The problem is when it tried to deconstruct stackers, belts, or chests. For instance, if you try to pick up a belt that had items on it, that will take 2 inventory slots, one for the belt, and one for the items were on the belt. If you did not have inventory room what was on the belt, it would spill on the ground. You can recreate this by doing something like deconstruction planning a larger area of smelters when all the stackers and belts full. If you do a large enough area, Autobuild will deconstruct faster than the logistics robots can keep up with the trash. When your inventory finally fills, it will do weird stuff like pick what the stacker was holding but spill the stacker itself on the ground, or pick up the belt but spill the ore on the ground.

1 year, 3 months ago
(updated 1 year, 3 months ago)

Autobuild simulates that the entity gets mined by the character
I added a check, if that the entity after mining would fit by using player.can_insert. But, it assumable doesn't consider items inside the entity's inventories. I probably have to iterate over the inventories, but I'm bit worried about performance.

I need to check those cases of deconstructing big fields of smelting lines.

9 months ago

OK, this should now work.
There are some weird instances, where some items remain on the ground, but that's not avoidable, at least not to my knowledge.
Performance is hopefully not a big deal unless, you increase players reach too much and have lots of undeconstructable entities (due to full inventory) in reach.

New response