private void OnPlayerNPCDetach(EntityUid uid, NPCComponent component, PlayerDetachedEvent args)
{
- if (_mobState.IsIncapacitated(uid))
+ if (_mobState.IsIncapacitated(uid) || Deleted(uid))
return;
WakeNPC(uid, component);
/// <summary>
/// Is the NPC awake and updating?
/// </summary>
- 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);
}
/// <summary>
return;
}
- _sawmill.Debug($"Waking {ToPrettyString(component.Owner)}");
- EnsureComp<ActiveNPCComponent>(component.Owner);
+ _sawmill.Debug($"Waking {ToPrettyString(uid)}");
+ EnsureComp<ActiveNPCComponent>(uid);
}
public void SleepNPC(EntityUid uid, NPCComponent? component = null)
return;
}
- _sawmill.Debug($"Sleeping {ToPrettyString(component.Owner)}");
- RemComp<ActiveNPCComponent>(component.Owner);
+ _sawmill.Debug($"Sleeping {ToPrettyString(uid)}");
+ RemComp<ActiveNPCComponent>(uid);
}
/// <inheritdoc />