[2.1.7 / 2.0.77] What inventory does a loader interact with

Place to get help with not working mods / modding interface.
User avatar
hgschmie
Fast Inserter
Fast Inserter
Posts: 216
Joined: Tue Feb 06, 2024 5:18 am
Contact:

[2.1.7 / 2.0.77] What inventory does a loader interact with

Post by hgschmie »

The LuaEntity attribute `loader_container` says: "The container entity this loader is pointing at/pulling from depending on the LuaEntity::loader_type, if any.". However, a loader can interact with entities that have more than one inventory (e.g. a assembly machine or a furnace). How can I find out what inventory the loader interacts with?

Alternative: Can we add a read-only "loader_inventory" attribute on LuaEntity that holds the `defines.inventory.<x>` value for the inventory that the loader interacts with?

Special bonus points for making that attribute writeable to allow inventory selection. :-)
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4728
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.1.7 / 2.0.77] What inventory does a loader interact with

Post by boskid »

Loader taking items out of entity may take from multiple inventories, which ones is decided by the entity itself as it has to declare which inventories are "output" inventories. You can access those through https://lua-api.factorio.com/latest/cla ... _inventory. As for insertion, this is not even required to go into any inventory (entity can select target inventory based on item being inserted [look at rocket silo] and in theory could instantly remove item as part of its insert logic).
User avatar
hgschmie
Fast Inserter
Fast Inserter
Posts: 216
Joined: Tue Feb 06, 2024 5:18 am
Contact:

Re: [2.1.7 / 2.0.77] What inventory does a loader interact with

Post by hgschmie »

Thanks for the explanation.
Post Reply

Return to “Modding help”