Can we also get storage containers able to report some more useful statistics? I have a few cargo station designs that I would like to be able to more generically simplify by having the buffer storage report some extra statistics for me, notably:
- Container fill level (given as a number in the range [0,100] indicating a percentage of how many slots have stuff in them, ignoring whether the slots contain full stacks
- Container size in slots
- Number of empty slots in the container
As for the container fill level, that one easily makes use of the two API methods as follows:
Code: Select all
(ContainerPrototype.inventory_size - LuaInventory.count_empty_stacks())*100/ContainerPrototype.inventory_size
Fluid tanks have slightly different available methods already in the LUA API. Notably: LuaFluidBox.get_capacity() and (I don't think this is the right method, but...) LuaFluidBox.get_fluid_system_contents() but I'm not 100% confident on this second one. Fluid container statistics may have to be an exercise left to the developers to know which API methods to hook into for that!