From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Date: Tue, 25 Apr 2023 12:33:13 +0000 (+1000)
Subject: Fix NPC awake assert (#15783)
X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=fda607b2f6eecf97d1298420988d9484c3acf951;p=space-station-14.git
Fix NPC awake assert (#15783)
---
diff --git a/Content.Server/NPC/Systems/NPCSystem.cs b/Content.Server/NPC/Systems/NPCSystem.cs
index 0689d5fdf4..fb45912482 100644
--- a/Content.Server/NPC/Systems/NPCSystem.cs
+++ b/Content.Server/NPC/Systems/NPCSystem.cs
@@ -53,7 +53,7 @@ namespace Content.Server.NPC.Systems
private void OnPlayerNPCDetach(EntityUid uid, NPCComponent component, PlayerDetachedEvent args)
{
- if (_mobState.IsIncapacitated(uid))
+ if (_mobState.IsIncapacitated(uid) || Deleted(uid))
return;
WakeNPC(uid, component);
@@ -83,9 +83,9 @@ namespace Content.Server.NPC.Systems
///
/// Is the NPC awake and updating?
///
- public bool IsAwake(NPCComponent component, ActiveNPCComponent? active = null)
+ public bool IsAwake(EntityUid uid, NPCComponent component, ActiveNPCComponent? active = null)
{
- return Resolve(component.Owner, ref active, false);
+ return Resolve(uid, ref active, false);
}
///
@@ -98,8 +98,8 @@ namespace Content.Server.NPC.Systems
return;
}
- _sawmill.Debug($"Waking {ToPrettyString(component.Owner)}");
- EnsureComp(component.Owner);
+ _sawmill.Debug($"Waking {ToPrettyString(uid)}");
+ EnsureComp(uid);
}
public void SleepNPC(EntityUid uid, NPCComponent? component = null)
@@ -109,8 +109,8 @@ namespace Content.Server.NPC.Systems
return;
}
- _sawmill.Debug($"Sleeping {ToPrettyString(component.Owner)}");
- RemComp(component.Owner);
+ _sawmill.Debug($"Sleeping {ToPrettyString(uid)}");
+ RemComp(uid);
}
///