Page 1 of 1

Event.on_alert_click

Posted: Tue Jan 09, 2018 1:10 am
by eradicator
What?
An event that triggers when a player clicks an alert icon (i.e. missing robots, damaged entities etc). That contains the entity, icon, (unlocalized) message, and ideally a custom alert name.

Why?
While LuaPlayer.add_custom_alert() allows to add an alarm there is no callback if the player actually notices/reacts to the alarm. I'd like to show some additional GUI elements when the player clicks an alarm. For easier management it would be nice if LuaPlayer.add_custom_alert() was extended to include as additional parameter (or return value on call) a custom alert name/unique ID. A good example for this would be a classical "you have a new message" that opens the message. But existing mods would also benefit from this. For example ore-monitoring mods would being able to not only show a map position but for example also show the status display of a nearly depleted ore field and the estimated remaining usage time.

Re: Event.on_alert_click

Posted: Thu Jan 18, 2018 5:40 am
by Rseding91
I would add this in but at the moment the game doesn't know the alert was clicked. All of that logic it view-logic and outside the game state and as such mods can't access it without causing desyncs at the moment.

Re: Event.on_alert_click

Posted: Thu Jan 18, 2018 2:17 pm
by eradicator
Rseding91 wrote:I would add this in but at the moment the game doesn't know the alert was clicked. All of that logic it view-logic and outside the game state and as such mods can't access it without causing desyncs at the moment.
*sigh* Oh well. How are the chances of the GUI rewrite (0.17?) changing enough of the background logic to make this possible?

Re: Event.on_alert_click

Posted: Fri Jul 10, 2020 1:59 pm
by Mylon
Can this event be raised by the player? That is, when the player clicks an alert, the player's client builds the event context and sends it to the server?

It's a bit of a hack and I imagine would cause some delay, but it could work without a significant rewrite.

Re: Event.on_alert_click

Posted: Fri Jul 10, 2020 3:14 pm
by Rseding91
Mylon wrote: Fri Jul 10, 2020 1:59 pm Can this event be raised by the player? That is, when the player clicks an alert, the player's client builds the event context and sends it to the server?

It's a bit of a hack and I imagine would cause some delay, but it could work without a significant rewrite.
That's how all events work currently.

Re: Event.on_alert_click

Posted: Fri Jul 10, 2020 3:17 pm
by eradicator
Rseding91 wrote: Fri Jul 10, 2020 3:14 pm
So. Now two and a half years and a gui rewrite later, any chance of this happening?

Re: Event.on_alert_click

Posted: Fri Jul 10, 2020 3:20 pm
by Rseding91
eradicator wrote: Fri Jul 10, 2020 3:17 pm
Rseding91 wrote: Fri Jul 10, 2020 3:14 pm
So. Now two and a half years and a gui rewrite later, any chance of this happening?
gui rewrite has nothing to do with this. The game-state still does not know anything happened because it's all view logic - the same as before - nothing is sent to the server - no input action is created.