Remove 700 usages of Component.Owner (#21100)

This commit is contained in:
DrSmugleaf
2023-10-19 12:34:31 -07:00
committed by GitHub
parent 5825ffb95c
commit f560f88eb5
261 changed files with 2291 additions and 2036 deletions

View File

@@ -73,7 +73,7 @@ public abstract class AlertsSystem : EntitySystem
/// be erased if there is currently a cooldown for the alert)</param>
public void ShowAlert(EntityUid euid, AlertType alertType, short? severity = null, (TimeSpan, TimeSpan)? cooldown = null)
{
if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
if (!TryComp(euid, out AlertsComponent? alertsComponent))
return;
if (TryGet(alertType, out var alert))
@@ -94,9 +94,9 @@ public abstract class AlertsSystem : EntitySystem
alertsComponent.Alerts[alert.AlertKey] = new AlertState
{ Cooldown = cooldown, Severity = severity, Type = alertType };
AfterShowAlert(alertsComponent);
AfterShowAlert((euid, alertsComponent));
Dirty(alertsComponent);
Dirty(euid, alertsComponent);
}
else
{
@@ -111,7 +111,7 @@ public abstract class AlertsSystem : EntitySystem
/// </summary>
public void ClearAlertCategory(EntityUid euid, AlertCategory category)
{
if(!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
if(!TryComp(euid, out AlertsComponent? alertsComponent))
return;
var key = AlertKey.ForCategory(category);
@@ -120,9 +120,9 @@ public abstract class AlertsSystem : EntitySystem
return;
}
AfterClearAlert(alertsComponent);
AfterClearAlert((euid, alertsComponent));
Dirty(alertsComponent);
Dirty(euid, alertsComponent);
}
/// <summary>
@@ -140,9 +140,9 @@ public abstract class AlertsSystem : EntitySystem
return;
}
AfterClearAlert(alertsComponent);
AfterClearAlert((euid, alertsComponent));
Dirty(alertsComponent);
Dirty(euid, alertsComponent);
}
else
{
@@ -153,14 +153,12 @@ public abstract class AlertsSystem : EntitySystem
/// <summary>
/// Invoked after showing an alert prior to dirtying the component
/// </summary>
/// <param name="alertsComponent"></param>
protected virtual void AfterShowAlert(AlertsComponent alertsComponent) { }
protected virtual void AfterShowAlert(Entity<AlertsComponent> alerts) { }
/// <summary>
/// Invoked after clearing an alert prior to dirtying the component
/// </summary>
/// <param name="alertsComponent"></param>
protected virtual void AfterClearAlert(AlertsComponent alertsComponent) { }
protected virtual void AfterClearAlert(Entity<AlertsComponent> alerts) { }
public override void Initialize()
{