2024-05-08 19:18:03 +10:00
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Math;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-06-02 03:46:35 +10:00
|
|
|
/// Set <see cref="SetBoolOperator.Value"/> to bool value for the
|
|
|
|
|
/// specified <see cref="SetFloatOperator.TargetKey"/> in the <see cref="NPCBlackboard"/>.
|
2024-05-08 19:18:03 +10:00
|
|
|
/// </summary>
|
|
|
|
|
public sealed partial class SetBoolOperator : HTNOperator
|
|
|
|
|
{
|
2024-06-02 03:46:35 +10:00
|
|
|
[DataField(required: true), ViewVariables]
|
2024-05-08 19:18:03 +10:00
|
|
|
public string TargetKey = string.Empty;
|
|
|
|
|
|
|
|
|
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
public bool Value;
|
|
|
|
|
|
|
|
|
|
public override async Task<(bool Valid, Dictionary<string, object>? Effects)> Plan(NPCBlackboard blackboard,
|
|
|
|
|
CancellationToken cancelToken)
|
|
|
|
|
{
|
|
|
|
|
return (
|
|
|
|
|
true,
|
|
|
|
|
new Dictionary<string, object>
|
|
|
|
|
{
|
|
|
|
|
{ TargetKey, Value }
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|