Filtering on_player_selected_area and friends

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1652
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Filtering on_player_selected_area and friends

Post by Pi-C »

What?
I'd like to be able to filter the following events: Why?
There are several selection-tool prototypes created by different mods. I've made one myself now for one of my mods, and I only care about events triggered when a player used my tool to select an area. While it's trivial to have something like

Code: Select all

script.on_event(defines.events.on_player_selected_area, function(event)
	if event.item ~= "my_tool_name" then return end
	do stuff end
end)
it would be more elegant (and more efficient, as filtering would happen outside of Lua) if these events could be filtered by item name:

Code: Select all

script.on_event(defines.events.on_player_selected_area, function(event)
	do stuff end
end, {filter = "item", item = "my_tool_name"})
Would you consider adding this filter, please?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Modding interface requests”