2022-09-30 14:39:48 +10:00
|
|
|
using System.Threading;
|
2022-09-06 00:28:23 +10:00
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2024-05-08 19:18:03 +10:00
|
|
|
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Math;
|
2022-09-06 00:28:23 +10:00
|
|
|
|
|
|
|
|
/// <summary>
|
2024-06-02 03:46:35 +10:00
|
|
|
/// Set <see cref="SetFloatOperator.Amount"/> to float value for the
|
|
|
|
|
/// specified <see cref="SetFloatOperator.TargetKey"/> in the <see cref="NPCBlackboard"/>.
|
2022-09-06 00:28:23 +10:00
|
|
|
/// </summary>
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class SetFloatOperator : HTNOperator
|
2022-09-06 00:28:23 +10:00
|
|
|
{
|
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;
|
2022-09-06 00:28:23 +10:00
|
|
|
|
2024-05-08 19:18:03 +10:00
|
|
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
2022-09-06 00:28:23 +10:00
|
|
|
public float Amount;
|
|
|
|
|
|
2022-09-30 14:39:48 +10:00
|
|
|
public override async Task<(bool Valid, Dictionary<string, object>? Effects)> Plan(NPCBlackboard blackboard,
|
|
|
|
|
CancellationToken cancelToken)
|
2022-09-06 00:28:23 +10:00
|
|
|
{
|
2024-05-08 19:18:03 +10:00
|
|
|
return (
|
|
|
|
|
true,
|
|
|
|
|
new Dictionary<string, object>
|
|
|
|
|
{
|
|
|
|
|
{ TargetKey, Amount }
|
|
|
|
|
}
|
|
|
|
|
);
|
2022-09-06 00:28:23 +10:00
|
|
|
}
|
|
|
|
|
}
|