Item Filters

Place to get help with not working mods / modding interface.
rookhaven
Inserter
Inserter
Posts: 22
Joined: Sun May 07, 2017 9:21 pm
Contact:

Item Filters

Post by rookhaven »

Hi all,

Part 1: How can I give a tab focus and make its contents show up on start. I have three tabs and nothing shows up in the content till I click on them. Tried adding .focus() to various parts of the chain but so far hasn't worked. Thanks!

Part 2:
I've managed to be able to set the item filters of a storage unit in my control script - same as if you had middle-scroll-clicked them. So woot there.

Now I'm trying to set a filter on an item. I only want this item to be placeable in specific entity storages - hoping to keep players from hauling my peeps in cattle wagons etc. Looking at the item prototype, I tried this and I got no errors - it let me add the 'item-filter' line to the item definition, but it didn't prevent the item from being placed in any storage. I did see an ultra old post about this not being supported but the prototype makes it look like it should be possible?

Please help and thanks!

Code: Select all

  {
    type = "item",
    name = "k2cp-passenger",
    icon = "__CityPeeps__/graphics/icons/citypeep.png",
    icon_size = 48, 
    icon_mipmaps = 4,
    category = "k2cp-city-products",
    subgroup = "k2cp-citizens",
    order = "a",
    stackable = false,
    item_filter = {"k2cp-passenger-wagon","k2cp-depot"},
    stack_size = 1
  },
robot256
Filter Inserter
Filter Inserter
Posts: 934
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Item Filters

Post by robot256 »

https://wiki.factorio.com/Prototype/Ite ... ntory_size

The item_filters property only applies to the inventory contained inside an item-with-inventory. This is a type only used for things like blueprint books and "backpacks". It serves no other purpose, and has no relation to what containers the item may be placed in.

You might have to resort to using a script to detect events whenever items are inserted in any chest and check the item type, but that's going to be terrible for performance.
rookhaven
Inserter
Inserter
Posts: 22
Joined: Sun May 07, 2017 9:21 pm
Contact:

Re: Item Filters

Post by rookhaven »

Ok thanks. Yea, I definitely don't want to cycle through every item placed, so I'll just leave as is. I got half of it done, the rest isn't ultra critical.
Post Reply

Return to “Modding help”