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.
Event.on_alert_click
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Event.on_alert_click
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Event.on_alert_click
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.
If you want to get ahold of me I'm almost always on Discord.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Event.on_alert_click
*sigh* Oh well. How are the chances of the GUI rewrite (0.17?) changing enough of the background logic to make this possible?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.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Event.on_alert_click
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.
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
That's how all events work currently.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.
If you want to get ahold of me I'm almost always on Discord.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Event.on_alert_click
So. Now two and a half years and a gui rewrite later, any chance of this happening?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Event.on_alert_click
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.eradicator wrote: ↑Fri Jul 10, 2020 3:17 pmSo. Now two and a half years and a gui rewrite later, any chance of this happening?
If you want to get ahold of me I'm almost always on Discord.