[0.17.8] LuaInventory.set_filter sets the filter even if a different type of item is in that slot.

Bugs that are actually features.
User avatar
Gergely
Filter Inserter
Filter Inserter
Posts: 640
Joined: Sun Apr 10, 2016 8:31 pm
Contact:

[0.17.8] LuaInventory.set_filter sets the filter even if a different type of item is in that slot.

Post by Gergely »

Step 1: Start a vanilla freeplay. Or put an item other than copper plate into the first slot of your inventory.
Step 2: Run this command: /c game.player.print(game.player.character.get_inventory(defines.inventory.player_main).set_filter(1,"copper-plate"))

What I expected to happen: A printout "false" because the content of the first slot of the inventory collides with the filter it would set.

What happens: A filter is set under the item in the inventory. The next time I remove the item, I can't put it back because of the filter even though the hand still shows up.
User avatar
Gergely
Filter Inserter
Filter Inserter
Posts: 640
Joined: Sun Apr 10, 2016 8:31 pm
Contact:

Re: [0.17.8] LuaInventory.set_filter sets the filter even if a different type of item is in that slot.

Post by Gergely »

The same is the case with "can_set_filter".

Running...
/c game.player.print(game.player.character.get_inventory(defines.inventory.player_main).can_set_filter(1,"copper-plate"))
...still prints out true even if there is an item of a different type in that slot.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16101
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.8] LuaInventory.set_filter sets the filter even if a different type of item is in that slot.

Post by Rseding91 »

Thanks for the report however this is working correctly: the filter can be set regardless of what item is in the slot.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Gergely
Filter Inserter
Filter Inserter
Posts: 640
Joined: Sun Apr 10, 2016 8:31 pm
Contact:

Re: [0.17.8] LuaInventory.set_filter sets the filter even if a different type of item is in that slot.

Post by Gergely »

This used to work differently...

Under what conditions would the methods return false?

And what's the point of the item parameter in can_set_filter?
Rseding91
Factorio Staff
Factorio Staff
Posts: 16101
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.8] LuaInventory.set_filter sets the filter even if a different type of item is in that slot.

Post by Rseding91 »

Mainly for ammo/weapon inventories.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Not a bug”