NPC wake / sleep cleanup (#5679)

This commit is contained in:
metalgearsloth
2021-12-05 14:08:35 +11:00
committed by GitHub
parent ae65418c52
commit 5d63411113
10 changed files with 175 additions and 217 deletions

View File

@@ -84,9 +84,9 @@ namespace Content.Server.AI.Utility
if (rebuild)
RebuildActions(npc);
if (npc.BehaviorSets.Count == 1 && !EntitySystem.Get<AiSystem>().IsAwake(npc))
if (npc.BehaviorSets.Count == 1 && !npc.Awake)
{
_entityManager.EventBus.RaiseEvent(EventSource.Local, new SleepAiMessage(npc, false));
EntitySystem.Get<NPCSystem>().WakeNPC(npc);
}
}
@@ -113,9 +113,9 @@ namespace Content.Server.AI.Utility
if (rebuild)
RebuildActions(npc);
if (npc.BehaviorSets.Count == 0 && EntitySystem.Get<AiSystem>().IsAwake(npc))
if (npc.BehaviorSets.Count == 0 && npc.Awake)
{
_entityManager.EventBus.RaiseEvent(EventSource.Local, new SleepAiMessage(npc, true));
EntitySystem.Get<NPCSystem>().SleepNPC(npc);
}
}