[2.0.23] entity.get_filter(1) on storage-chest gets prototype
Posted: Mon Dec 02, 2024 7:41 pm
I made a mod to expand filters and therefore add functionality to copy/paste. The code below is a MWE to reproduce the issue:
I think it is a bug, as it is inconsistent for the same function.
I would expect both cases to give the normal filter, not a prototype. If I see something wrong here please let me know as well as this is my first mod in the making.
Edit: it is specifically the name of the filter that is a prototype, I realized this was not clear in my original post.
Code: Select all
data:extend{{
type = "custom-input",
name = "FolterCopyExpansion_Copy",
key_sequence = "mouse-button-2 + SHIFT",
linked_game_control = "copy-entity-settings",
action = "lua",
include_selected_prototype=true,
}}
Code: Select all
local CopyFrom = player.selected
if CopyFrom then
if CopyFrom.name:lower() == "storage-chest" then
local Filter = CopyFrom.get_filter(1) -- gets prototype filter
elseif CopyFrom.type:lower():match("inserter") then
local Filter = CopyFrom.get_filter(1) -- gets a normal filter
end
end
I would expect both cases to give the normal filter, not a prototype. If I see something wrong here please let me know as well as this is my first mod in the making.
Edit: it is specifically the name of the filter that is a prototype, I realized this was not clear in my original post.