ECSatize AlertsSystem (#5559)

This commit is contained in:
Acruid
2022-01-05 00:19:23 -08:00
committed by GitHub
parent 36d4de5e61
commit 5b1cd2dd96
59 changed files with 1069 additions and 1038 deletions

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using Content.Server.Administration.Logs;
using Content.Server.Alert;
using Content.Server.Atmos.Components;
using Content.Server.Stunnable;
using Content.Server.Temperature.Systems;
@@ -28,6 +27,7 @@ namespace Content.Server.Atmos.EntitySystems
[Dependency] private readonly StunSystem _stunSystem = default!;
[Dependency] private readonly TemperatureSystem _temperatureSystem = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!;
private const float MinimumFireStacks = -10f;
@@ -167,10 +167,9 @@ namespace Content.Server.Atmos.EntitySystems
}
public void Resist(EntityUid uid,
FlammableComponent? flammable = null,
ServerAlertsComponent? alerts = null)
FlammableComponent? flammable = null)
{
if (!Resolve(uid, ref flammable, ref alerts))
if (!Resolve(uid, ref flammable))
return;
if (!flammable.OnFire || !_actionBlockerSystem.CanInteract(flammable.Owner) || flammable.Resisting)
@@ -179,7 +178,7 @@ namespace Content.Server.Atmos.EntitySystems
flammable.Resisting = true;
flammable.Owner.PopupMessage(Loc.GetString("flammable-component-resist-message"));
_stunSystem.TryParalyze(uid, TimeSpan.FromSeconds(2f), true, alerts: alerts);
_stunSystem.TryParalyze(uid, TimeSpan.FromSeconds(2f), true);
// TODO FLAMMABLE: Make this not use TimerComponent...
flammable.Owner.SpawnTimer(2000, () =>
@@ -224,15 +223,13 @@ namespace Content.Server.Atmos.EntitySystems
flammable.FireStacks = MathF.Min(0, flammable.FireStacks + 1);
}
EntityManager.TryGetComponent(flammable.Owner, out ServerAlertsComponent? status);
if (!flammable.OnFire)
{
status?.ClearAlert(AlertType.Fire);
_alertsSystem.ClearAlert(uid, AlertType.Fire);
continue;
}
status?.ShowAlert(AlertType.Fire);
_alertsSystem.ShowAlert(uid, AlertType.Fire, null, null);
if (flammable.FireStacks > 0)
{