New event type: on_alert_added
Posted: Fri Apr 24, 2026 3:09 pm
I would like the game to have an event defines.events.on_alert_added that will fire when a new alert is added to LuaPlayer::get_alerts(). Or maybe on_alerts_changed for any changes in get_alerts(), but with the ability to distinguish if a new one was added or an existing expired.
I'm making Dynamic HUD mod. It hides "unnecessary" UI. The goal here is to hide the alerts panel using GameViewSettings::show_alert_gui if there were no recent enough changes in LuaPlayer::get_alerts().
Unfortunately I couldn't find a proper event for when to check get_alerts(). A workaround I plan to use for now is to use on_nth_tick to check alerts once in a few seconds + show/check alerts on on_entity_damaged.
The downside of the workaround is that only damage-related alerts will be shown "urgently". All other alerts will be presented to the player with a delay for up to a few seconds. Which is not ideal. Also up until now I was able to avoid adding a permanently running on_nth_tick task. Adding something that affects ups for a measly goal of UI hiding doesn't feel right.
I'm making Dynamic HUD mod. It hides "unnecessary" UI. The goal here is to hide the alerts panel using GameViewSettings::show_alert_gui if there were no recent enough changes in LuaPlayer::get_alerts().
Unfortunately I couldn't find a proper event for when to check get_alerts(). A workaround I plan to use for now is to use on_nth_tick to check alerts once in a few seconds + show/check alerts on on_entity_damaged.
The downside of the workaround is that only damage-related alerts will be shown "urgently". All other alerts will be presented to the player with a delay for up to a few seconds. Which is not ideal. Also up until now I was able to avoid adding a permanently running on_nth_tick task. Adding something that affects ups for a measly goal of UI hiding doesn't feel right.