Files
Delta-v/Content.Server/NPC/HTN/PrimitiveTasks/Operators/Math/SetFloatOperator.cs
T
Tornado Tech 094ea59b95 Added new HTN operations and preconditions (#27486)
* Added new HTN operations & preconditions

* Ok I forgot about partial

* Namespace pierce the skies

* Some fixes, debug and new operators

* Bruh git eat my files
2024-05-18 13:32:55 +02:00

29 lines
727 B
C#

using System.Threading;
using System.Threading.Tasks;
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Math;
/// <summary>
/// Just sets a blackboard key to a float
/// </summary>
public sealed partial class SetFloatOperator : HTNOperator
{
[DataField(required: true)]
public string TargetKey = string.Empty;
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float Amount;
public override async Task<(bool Valid, Dictionary<string, object>? Effects)> Plan(NPCBlackboard blackboard,
CancellationToken cancelToken)
{
return (
true,
new Dictionary<string, object>
{
{ TargetKey, Amount }
}
);
}
}