Page 1 of 1

Inserter Hand

Posted: Sat Jan 20, 2018 2:32 pm
by Templarfreak
Is an Inserter's hand considered an Inventory, and thus can be messed with like a Player's or Chest's inventory? If so, would putting an item into an Inserter's hand manually make it still operate? And what would be the best way to ensure an Inserter has come to it's resting position before messing with its inventory?

The basic idea I want to try and do here is make it so Burner Inserters can daisy chain together.

Re: Inserter Hand

Posted: Sat Jan 20, 2018 2:42 pm
by darkfrei

Re: Inserter Hand

Posted: Sun Jan 28, 2018 1:41 am
by Oktokolo
Templarfreak wrote:Is an Inserter's hand considered an Inventory, and thus can be messed with like a Player's or Chest's inventory? If so, would putting an item into an Inserter's hand manually make it still operate? And what would be the best way to ensure an Inserter has come to it's resting position before messing with its inventory?

The basic idea I want to try and do here is make it so Burner Inserters can daisy chain together.
That's funny, as i am almost done forking BurnerLeech to add support for electric inserters and making it honor capacity bonuses, filters, hand position and power state so it will work with every inserter (even modded burners with filters). Will probably realease the mod on monday...

Inserters hold a single stack for their hand (inserterentity.held_stack), not a complete inventory. The inserter seems to be totally fine with a script adding, removing or changing items to/from/in the held stack. If it holds anything, it will try to deliver it, as if it has normally picked it up. If the hand is moving back to pickup position and you set some item to be in the held stack, it will instantly change direction and tryto deliver that. If you empty the held stack, it will instantly try to pickup something else.
It does, what you likely would expect it to do. ;)

Inserters also know their pickup and hand position (inserterentity.pickup_position and inserterentity.held_stack_position). The two never seem to exactly match but they come reasonably close so i just check, whether x and y coordinates exhibit less than 0.01 difference. Didn't see item teleporting in game using that heuristic. And it is pretty cheap CPU-wise.

Developers seem to have dumped all the stuff they ever needed into the LuaEntity class instead of making specialized classes - making that beast look like a real mess. But if you search it carefully, you will probably find everything, that item and entity prototypes won't give you.

Re: Inserter Hand

Posted: Tue Jan 30, 2018 6:37 pm
by Oktokolo
Released the mod.