Page 1 of 1
Event on_selection_changed request
Posted: Fri Sep 16, 2016 8:08 pm
by jonatkins
There's a "selected" property in LuaPlayer (actually LuaControl), but, as far as I can tell, no event fires when this changes.
Perhaps add an
on_selected_changed event, with event parameters specifying
- the player
- the newly selected item (or nil if deselecting)
- the previously selected item (or nil if not set)
Re: Event on_selection_changed request
Posted: Fri Sep 16, 2016 10:32 pm
by Supercheese
This event would fire a bazillion times per game, though, possibly leading to bloat due to needing to log every event...
Re: Event on_selection_changed request
Posted: Fri Sep 16, 2016 10:51 pm
by jonatkins
Logging every event? You mean with replays enabled?
Anyway, the data might already be recorded - to update the state of player.selected property.
For now, in my mod, I've added code to monitor for changes to player.selected in on_tick - so it's already possible, but a little ugly and inefficient compared to a dedicated event.
Re: Event on_selection_changed request
Posted: Fri Sep 16, 2016 11:40 pm
by aubergine18
The event could potentially be despammed - so that a selection must persist for 500ms or 750ms before the event is fired.
It will certainly be less crufty than having a bunch of mods checking the selection state of all players via on_tick handlers.
Re: Event on_selection_changed request
Posted: Sat Sep 17, 2016 2:46 am
by Rseding91
Added for 0.15.