Add LuaEntity.drop_inventory [RW] and LuaEntity.pickup_inventory [RW]

Things that we aren't going to implement
LeonSkills
Inserter
Inserter
Posts: 26
Joined: Mon Feb 11, 2019 12:37 pm
Contact:

Add LuaEntity.drop_inventory [RW] and LuaEntity.pickup_inventory [RW]

Post by LeonSkills »

With 2.0.38 we got the proxy-container with `proxy_target_entity` and `proxy_target_inventory`
Which allowed me to create this mod (WIP), where you can insert/outsert from custom inventories.
factorio_EhdAJYrusv.gif
factorio_EhdAJYrusv.gif (4.21 MiB) Viewed 249 times
I currently implemented this by adding some invisible proxy-containers at the pickup/drop positions.
It would be neater without the containers if we can set the drop/pickup inventories directly with

Code: Select all

entity.drop_inventory = defines.inventory.assembling_machine_modules
entity.pickup_inventory = defines.inventory.assembling_machine_input
Instead of indirectly with `ProxyContainer.proxy_target_inventory`.

When `drop/pickup_inventory` is nil it should revert to the default behaviour.

This is for all entities that have a drop/pickup_target/position defined (inserters, loaders, mining-drills and crafting-machines, unless I'm missing any).

An alternative interface suggestion is to change drop/pickup_target to

Code: Select all

entity.drop_target = {
    position = {x=.., y=..},
    entity = entity_target,
    inventory = defines.inventory.assembling_machine_modules
}
Arguably neater, but requires deprecating the current interface.

Usecases:
  • Reinserting modules when they were automatically removed by a "set_recipe" recipe not allowing that type of module.
  • Inserting processing units/LDS/rocket fuel directly into the inventories of rocket silos.
  • Chaining crafting machines input/fuel like you can chain labs.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3757
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Add LuaEntity.drop_inventory [RW] and LuaEntity.pickup_inventory [RW]

Post by boskid »

Thanks for the suggestion but thats a Won't implement.

proxy-container was specifically implemented to work with specific inventory using similar access methods as scripts interact with entities, however standard input/output inventory interactions are far from being as simple as you imagine them to be. In general, the input is not implemented as inserting into a specific inventory, entity has freedom of deciding to which inventory the item will go, that includes fuel going to burner energy source, modules going to modules inventory (in case of a beacon), items going to ingredients inventory etc. Output is also not as simple, entities may advertise up to 4 output inventories and entities taking out of a machine (loaders, inserters) will look into all of those inventories for suitable items. There are no restrictions for entities having hidden inventories and moving items into them or advertising output inventory to be one of those not accessible through LuaEntity(LuaControl)::get_inventory.
curiosity
Filter Inserter
Filter Inserter
Posts: 607
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Add LuaEntity.drop_inventory [RW] and LuaEntity.pickup_inventory [RW]

Post by curiosity »

boskid wrote: Wed Mar 05, 2025 5:53 pm There are no restrictions for entities having hidden inventories and moving items into them or advertising output inventory to be one of those not accessible through LuaEntity(LuaControl)::get_inventory.
Right, that's called a missing API.
Post Reply

Return to “Won't implement”