using Content.Shared.Emag.Systems;
namespace Content.Server.NPC.HTN.Preconditions;
///
/// A precondition which is met if the NPC is emagged with , as computed by
/// . This is useful for changing NPC behavior in the case that the NPC is emagged,
/// eg. like a helper NPC bot turning evil.
///
public sealed partial class IsEmaggedPrecondition : HTNPrecondition
{
private EmagSystem _emag;
///
/// The type of emagging to check for.
///
[DataField]
public EmagType EmagType = EmagType.Interaction;
public override void Initialize(IEntitySystemManager sysManager)
{
base.Initialize(sysManager);
_emag = sysManager.GetEntitySystem();
}
public override bool IsMet(NPCBlackboard blackboard)
{
var owner = blackboard.GetValue(NPCBlackboard.Owner);
return _emag.CheckFlag(owner, EmagType);
}
}