Clean up new HTNs tasks (#28469)

* Clean up new HTNs tasks

* Added docs to math operations
This commit is contained in:
Tornado Tech
2024-06-02 03:46:35 +10:00
committed by GitHub
parent 81a328c543
commit a29b6a6894
12 changed files with 58 additions and 25 deletions

View File

@@ -4,13 +4,14 @@ using System.Threading.Tasks;
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Math;
/// <summary>
/// Gets the key, and adds the value to that float
/// Added <see cref="AddFloatOperator.Amount"/> to float value for the
/// specified <see cref="AddFloatOperator.TargetKey"/> in the <see cref="NPCBlackboard"/>.
/// </summary>
public sealed partial class AddFloatOperator : HTNOperator
{
[Dependency] private readonly IEntityManager _entManager = default!;
[DataField(required: true)]
[DataField(required: true), ViewVariables]
public string TargetKey = string.Empty;
[DataField, ViewVariables(VVAccess.ReadWrite)]

View File

@@ -4,11 +4,12 @@ using System.Threading.Tasks;
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Math;
/// <summary>
/// Just sets a blackboard key to a bool
/// Set <see cref="SetBoolOperator.Value"/> to bool value for the
/// specified <see cref="SetFloatOperator.TargetKey"/> in the <see cref="NPCBlackboard"/>.
/// </summary>
public sealed partial class SetBoolOperator : HTNOperator
{
[DataField(required: true)]
[DataField(required: true), ViewVariables]
public string TargetKey = string.Empty;
[DataField, ViewVariables(VVAccess.ReadWrite)]

View File

@@ -4,11 +4,12 @@ using System.Threading.Tasks;
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Math;
/// <summary>
/// Just sets a blackboard key to a float
/// Set <see cref="SetFloatOperator.Amount"/> to float value for the
/// specified <see cref="SetFloatOperator.TargetKey"/> in the <see cref="NPCBlackboard"/>.
/// </summary>
public sealed partial class SetFloatOperator : HTNOperator
{
[DataField(required: true)]
[DataField(required: true), ViewVariables]
public string TargetKey = string.Empty;
[DataField, ViewVariables(VVAccess.ReadWrite)]

View File

@@ -5,20 +5,22 @@ using Robust.Shared.Random;
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Math;
/// <summary>
/// Sets a random float from MinAmount to MaxAmount to blackboard
/// Set random float value between <see cref="SetRandomFloatOperator.MinAmount"/> and
/// <see cref="SetRandomFloatOperator.MaxAmount"/> specified <see cref="SetRandomFloatOperator.TargetKey"/>
/// in the <see cref="NPCBlackboard"/>.
/// </summary>
public sealed partial class SetRandomFloatOperator : HTNOperator
{
[Dependency] private readonly IRobustRandom _random = default!;
[DataField(required: true)]
[DataField(required: true), ViewVariables]
public string TargetKey = string.Empty;
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float MaxAmount = 1f;
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float MinAmount = 0f;
public float MinAmount;
public override async Task<(bool Valid, Dictionary<string, object>? Effects)> Plan(NPCBlackboard blackboard,
CancellationToken cancelToken)