Page 1 of 1

Support filters for inventories created with LuaGameScript::create_inventory

Posted: Mon Sep 21, 2020 5:25 pm
by Xorimuth
I'm using LuaGameScript::create_inventory to temporarily store an entity's inventory before copying it back at a later time. Unfortunately I can't easily copy across filters because inventory.supports_filters() is false for an inventory created with LuaGameScript.create_inventory().

I'm going to use a workaround that stores the filters in a separate table, but it is quite inconvenient :)

Thanks

Re: Support filters for inventories created with LuaGameScript::create_inventory

Posted: Mon Sep 21, 2020 8:34 pm
by Rseding91
I'd rather not; filters in an inventory more than doubles the amount of CPU time it takes to do any operation with the inventory; even when not used. There's a reason most inventories in the game are not filtered.

Re: Support filters for inventories created with LuaGameScript::create_inventory

Posted: Mon Sep 21, 2020 10:44 pm
by Xorimuth
Rseding91 wrote:
Mon Sep 21, 2020 8:34 pm
I'd rather not; filters in an inventory more than doubles the amount of CPU time it takes to do any operation with the inventory; even when not used. There's a reason most inventories in the game are not filtered.
That makes sense, thanks for the quick reply.
I suppose you could do LuaGameScript::create_filtered_inventory that creates a completely different kind of inventory with filters, but that would presumably be a lot more work, and would make the api more cluttered for little gain. Obviously I'd appreciate it though :lol: