Expose entity-ghost Inventory Filters to Lua
Posted: Fri Sep 09, 2022 1:15 am
Still working on Redo, and I'm running into the problem where I can't access the LuaInventory of a ghost container. Obviously it wouldn't be a good idea to expose the entire LuaInventory, you wouldn't want people inserting items in and out of them, but some parts of it (like `get_filter()` and more importantly set_filter()) would be really nice to have, if it's not too much trouble.
Example code works on normal entities but not ghost entities, data is the serialized entity properties.
Example code works on normal entities but not ghost entities, data is the serialized entity properties.
Code: Select all
local inventory = entity.get_inventory(defines.inventory.chest)
for index, filter in pairs(data.inventory_filters) do
inventory.set_filter(index, filter)
end