Support filters for inventories created with LuaGameScript::create_inventory

Things that we aren't going to implement
Xorimuth
Filter Inserter
Filter Inserter
Posts: 695
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Support filters for inventories created with LuaGameScript::create_inventory

Post 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
My mods
Content: Lunar Landings | Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Rseding91
Factorio Staff
Factorio Staff
Posts: 14269
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post 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.
If you want to get ahold of me I'm almost always on Discord.
Xorimuth
Filter Inserter
Filter Inserter
Posts: 695
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

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

Post 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:
My mods
Content: Lunar Landings | Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Post Reply

Return to “Won't implement”