KeyExistsPrecondition.cs 521 B

12345678910111213141516
  1. namespace Content.Server.NPC.HTN.Preconditions;
  2. /// <summary>
  3. /// Checks for the presence of the value by the specified <see cref="KeyExistsPrecondition.Key"/> in the <see cref="NPCBlackboard"/>.
  4. /// Returns true if there is a value.
  5. /// </summary>
  6. public sealed partial class KeyExistsPrecondition : HTNPrecondition
  7. {
  8. [DataField(required: true), ViewVariables]
  9. public string Key = string.Empty;
  10. public override bool IsMet(NPCBlackboard blackboard)
  11. {
  12. return blackboard.ContainsKey(Key);
  13. }
  14. }