Inserter Hand

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Templarfreak
Burner Inserter
Burner Inserter
Posts: 15
Joined: Thu Oct 05, 2017 2:21 pm
Contact:

Inserter Hand

Post 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.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Inserter Hand

Post by darkfrei »


User avatar
Oktokolo
Filter Inserter
Filter Inserter
Posts: 883
Joined: Wed Jul 12, 2017 5:45 pm
Contact:

Re: Inserter Hand

Post 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.

User avatar
Oktokolo
Filter Inserter
Filter Inserter
Posts: 883
Joined: Wed Jul 12, 2017 5:45 pm
Contact:

Re: Inserter Hand

Post by Oktokolo »

Released the mod.

Post Reply

Return to “Modding help”