Remove redundant read-only VV from datafields (#12626)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.MobState;
|
||||
using Content.Server.NPC.Components;
|
||||
using Content.Shared.MobState;
|
||||
using Content.Shared.MobState.Components;
|
||||
@@ -17,13 +16,13 @@ public sealed class MeleeOperator : HTNOperator
|
||||
/// <summary>
|
||||
/// Key that contains the target entity.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("targetKey", required: true)]
|
||||
[DataField("targetKey", required: true)]
|
||||
public string TargetKey = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum damage state that the target has to be in for us to consider attacking.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("targetState")]
|
||||
[DataField("targetState")]
|
||||
public DamageState TargetState = DamageState.Alive;
|
||||
|
||||
// Like movement we add a component and pass it off to the dedicated system.
|
||||
|
||||
@@ -3,10 +3,8 @@ using System.Threading.Tasks;
|
||||
using Content.Server.NPC.Components;
|
||||
using Content.Server.NPC.Pathfinding;
|
||||
using Content.Server.NPC.Systems;
|
||||
using Content.Shared.NPC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using YamlDotNet.Core.Tokens;
|
||||
|
||||
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators;
|
||||
|
||||
@@ -23,31 +21,31 @@ public sealed class MoveToOperator : HTNOperator
|
||||
/// <summary>
|
||||
/// Should we assume the MovementTarget is reachable during planning or should we pathfind to it?
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("pathfindInPlanning")]
|
||||
[DataField("pathfindInPlanning")]
|
||||
public bool PathfindInPlanning = true;
|
||||
|
||||
/// <summary>
|
||||
/// When we're finished moving to the target should we remove its key?
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("removeKeyOnFinish")]
|
||||
[DataField("removeKeyOnFinish")]
|
||||
public bool RemoveKeyOnFinish = true;
|
||||
|
||||
/// <summary>
|
||||
/// Target Coordinates to move to. This gets removed after execution.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("targetKey")]
|
||||
[DataField("targetKey")]
|
||||
public string TargetKey = "MovementTarget";
|
||||
|
||||
/// <summary>
|
||||
/// Where the pathfinding result will be stored (if applicable). This gets removed after execution.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("pathfindKey")]
|
||||
[DataField("pathfindKey")]
|
||||
public string PathfindKey = NPCBlackboard.PathfindKey;
|
||||
|
||||
/// <summary>
|
||||
/// How close we need to get before considering movement finished.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("rangeKey")]
|
||||
[DataField("rangeKey")]
|
||||
public string RangeKey = "MovementRange";
|
||||
|
||||
private const string MovementCancelToken = "MovementCancelToken";
|
||||
|
||||
@@ -18,12 +18,12 @@ public abstract class NPCCombatOperator : HTNOperator
|
||||
protected InteractionSystem Interaction = default!;
|
||||
private PathfindingSystem _pathfinding = default!;
|
||||
|
||||
[ViewVariables, DataField("key")] public string Key = "CombatTarget";
|
||||
[DataField("key")] public string Key = "CombatTarget";
|
||||
|
||||
/// <summary>
|
||||
/// The EntityCoordinates of the specified target.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("keyCoordinates")]
|
||||
[DataField("keyCoordinates")]
|
||||
public string KeyCoordinates = "CombatTargetCoordinates";
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.NPC.Pathfinding;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators;
|
||||
|
||||
@@ -20,16 +19,16 @@ public sealed class PickAccessibleComponentOperator : HTNOperator
|
||||
[DataField("rangeKey", required: true)]
|
||||
public string RangeKey = string.Empty;
|
||||
|
||||
[ViewVariables, DataField("targetKey", required: true)]
|
||||
[DataField("targetKey", required: true)]
|
||||
public string TargetKey = string.Empty;
|
||||
|
||||
[ViewVariables, DataField("component", required: true)]
|
||||
[DataField("component", required: true)]
|
||||
public string Component = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Where the pathfinding result will be stored (if applicable). This gets removed after execution.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("pathfindKey")]
|
||||
[DataField("pathfindKey")]
|
||||
public string PathfindKey = NPCBlackboard.PathfindKey;
|
||||
|
||||
public override void Initialize(IEntitySystemManager sysManager)
|
||||
|
||||
@@ -2,7 +2,6 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.NPC.Pathfinding;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators;
|
||||
|
||||
@@ -16,13 +15,13 @@ public sealed class PickAccessibleOperator : HTNOperator
|
||||
[DataField("rangeKey", required: true)]
|
||||
public string RangeKey = string.Empty;
|
||||
|
||||
[ViewVariables, DataField("targetKey", required: true)]
|
||||
[DataField("targetKey", required: true)]
|
||||
public string TargetKey = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Where the pathfinding result will be stored (if applicable). This gets removed after execution.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("pathfindKey")]
|
||||
[DataField("pathfindKey")]
|
||||
public string PathfindKey = NPCBlackboard.PathfindKey;
|
||||
|
||||
public override void Initialize(IEntitySystemManager sysManager)
|
||||
|
||||
@@ -8,7 +8,7 @@ public sealed class PickRandomRotationOperator : HTNOperator
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
[ViewVariables, DataField("targetKey")]
|
||||
[DataField("targetKey")]
|
||||
public string TargetKey = "RotateTarget";
|
||||
|
||||
public override async Task<(bool Valid, Dictionary<string, object>? Effects)> Plan(NPCBlackboard blackboard,
|
||||
|
||||
@@ -14,13 +14,13 @@ public sealed class RangedOperator : HTNOperator
|
||||
/// <summary>
|
||||
/// Key that contains the target entity.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("targetKey", required: true)]
|
||||
[DataField("targetKey", required: true)]
|
||||
public string TargetKey = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum damage state that the target has to be in for us to consider attacking.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("targetState")]
|
||||
[DataField("targetState")]
|
||||
public DamageState TargetState = DamageState.Alive;
|
||||
|
||||
// Like movement we add a component and pass it off to the dedicated system.
|
||||
|
||||
@@ -7,14 +7,14 @@ public sealed class RotateToTargetOperator : HTNOperator
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
private RotateToFaceSystem _rotate = default!;
|
||||
|
||||
[ViewVariables, DataField("targetKey")]
|
||||
[DataField("targetKey")]
|
||||
public string TargetKey = "RotateTarget";
|
||||
|
||||
[ViewVariables, DataField("rotateSpeedKey")]
|
||||
[DataField("rotateSpeedKey")]
|
||||
public string RotationSpeedKey = NPCBlackboard.RotateSpeed;
|
||||
|
||||
// Didn't use a key because it's likely the same between all NPCs
|
||||
[ViewVariables, DataField("tolerance")]
|
||||
[DataField("tolerance")]
|
||||
public Angle Tolerance = Angle.FromDegrees(1);
|
||||
|
||||
public override void Initialize(IEntitySystemManager sysManager)
|
||||
|
||||
@@ -6,7 +6,7 @@ public sealed class SpeakOperator : HTNOperator
|
||||
{
|
||||
private ChatSystem _chat = default!;
|
||||
|
||||
[ViewVariables, DataField("speech", required: true)]
|
||||
[DataField("speech", required: true)]
|
||||
public string Speech = string.Empty;
|
||||
|
||||
public override void Initialize(IEntitySystemManager sysManager)
|
||||
|
||||
@@ -21,7 +21,7 @@ public sealed class MedibotInjectOperator : HTNOperator
|
||||
/// <summary>
|
||||
/// Target entity to inject.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("targetKey", required: true)]
|
||||
[DataField("targetKey", required: true)]
|
||||
public string TargetKey = string.Empty;
|
||||
|
||||
public override void Initialize(IEntitySystemManager sysManager)
|
||||
|
||||
@@ -15,18 +15,18 @@ public sealed class PickNearbyInjectableOperator : HTNOperator
|
||||
private EntityLookupSystem _lookup = default!;
|
||||
private PathfindingSystem _pathfinding = default!;
|
||||
|
||||
[ViewVariables, DataField("rangeKey")] public string RangeKey = NPCBlackboard.MedibotInjectRange;
|
||||
[DataField("rangeKey")] public string RangeKey = NPCBlackboard.MedibotInjectRange;
|
||||
|
||||
/// <summary>
|
||||
/// Target entity to inject
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("targetKey", required: true)]
|
||||
[DataField("targetKey", required: true)]
|
||||
public string TargetKey = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Target entitycoordinates to move to.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("targetMoveKey", required: true)]
|
||||
[DataField("targetMoveKey", required: true)]
|
||||
public string TargetMoveKey = string.Empty;
|
||||
|
||||
public override void Initialize(IEntitySystemManager sysManager)
|
||||
|
||||
@@ -8,7 +8,7 @@ public sealed class WaitOperator : HTNOperator
|
||||
/// <summary>
|
||||
/// Blackboard key for the time we'll wait for.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("key", required: true)] public string Key = string.Empty;
|
||||
[DataField("key", required: true)] public string Key = string.Empty;
|
||||
|
||||
public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user