Alerts for breathing plasma/tritium (#24484)

* Alert autoremove v0

* Code cleanup and timing

* comment

* Tritium, code compression

* not resolving manually

* reduced lookups, new comp

* fix-fix yes

* use RemCompDeferred, handle OnUnpaused

* missed a todo

* entitysystem resolve

* remove unnecessary component updates

* remove AlertState from comp, move EntityUnpausedEvent actions to AlertStateComponent's Timespan

* Code cleanup

* comments

* combines AutoRemove input into Clear

* minor logic adjustment that does not really change anything but is less ambiguous
This commit is contained in:
Errant
2024-03-02 15:07:05 +01:00
committed by GitHub
parent e7a806a443
commit ecd2d5a644
6 changed files with 165 additions and 31 deletions

View File

@@ -92,7 +92,8 @@ public sealed partial class AlertsUI : UIWidget
{
// key is the same, simply update the existing control severity / cooldown
existingAlertControl.SetSeverity(alertState.Severity);
existingAlertControl.Cooldown = alertState.Cooldown;
if (alertState.ShowCooldown)
existingAlertControl.Cooldown = alertState.Cooldown;
}
else
{
@@ -133,9 +134,13 @@ public sealed partial class AlertsUI : UIWidget
private AlertControl CreateAlertControl(AlertPrototype alert, AlertState alertState)
{
(TimeSpan, TimeSpan)? cooldown = null;
if (alertState.ShowCooldown)
cooldown = alertState.Cooldown;
var alertControl = new AlertControl(alert, alertState.Severity)
{
Cooldown = alertState.Cooldown
Cooldown = cooldown
};
alertControl.OnPressed += AlertControlPressed;
return alertControl;