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

@@ -1,4 +1,5 @@
using Content.Server.GameTicking;
using Content.Server.AI.EntitySystems;
using Content.Server.GameTicking;
using Content.Shared.Movement.Components;
using Content.Shared.Roles;
using Robust.Shared.GameObjects;
@@ -19,6 +20,29 @@ namespace Content.Server.AI.Components
public override string Name => "AiController";
// TODO: Need to ECS a lot more of the AI first before we can ECS this
/// <summary>
/// Whether the AI is actively iterated.
/// </summary>
public bool Awake
{
get => _awake;
set
{
if (_awake == value) return;
_awake = value;
if (_awake)
EntitySystem.Get<NPCSystem>().WakeNPC(this);
else
EntitySystem.Get<NPCSystem>().SleepNPC(this);
}
}
[DataField("awake")]
private bool _awake = true;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("startingGear")]
public string? StartingGearPrototype { get; set; }