Remove NPC IEntityManager resolves (#12648)
This commit is contained in:
@@ -16,12 +16,12 @@ public sealed class CoordinatesInRangePrecondition : HTNPrecondition
|
|||||||
|
|
||||||
public override bool IsMet(NPCBlackboard blackboard)
|
public override bool IsMet(NPCBlackboard blackboard)
|
||||||
{
|
{
|
||||||
if (!blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates))
|
if (!blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates, _entManager))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!blackboard.TryGetValue<EntityCoordinates>(TargetKey, out var target))
|
if (!blackboard.TryGetValue<EntityCoordinates>(TargetKey, out var target, _entManager))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return coordinates.InRange(_entManager, target, blackboard.GetValueOrDefault<float>(RangeKey));
|
return coordinates.InRange(_entManager, target, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ public sealed class CoordinatesNotInRangePrecondition : HTNPrecondition
|
|||||||
|
|
||||||
public override bool IsMet(NPCBlackboard blackboard)
|
public override bool IsMet(NPCBlackboard blackboard)
|
||||||
{
|
{
|
||||||
if (!blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates))
|
if (!blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates, _entManager))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!blackboard.TryGetValue<EntityCoordinates>(TargetKey, out var target))
|
if (!blackboard.TryGetValue<EntityCoordinates>(TargetKey, out var target, _entManager))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return !coordinates.InRange(_entManager, target, blackboard.GetValueOrDefault<float>(RangeKey));
|
return !coordinates.InRange(_entManager, target, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace Content.Server.NPC.HTN.Preconditions;
|
|||||||
|
|
||||||
public sealed class TargetInLOSPrecondition : HTNPrecondition
|
public sealed class TargetInLOSPrecondition : HTNPrecondition
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||||
private InteractionSystem _interaction = default!;
|
private InteractionSystem _interaction = default!;
|
||||||
|
|
||||||
[DataField("targetKey")]
|
[DataField("targetKey")]
|
||||||
@@ -22,10 +23,10 @@ public sealed class TargetInLOSPrecondition : HTNPrecondition
|
|||||||
{
|
{
|
||||||
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
||||||
|
|
||||||
if (!blackboard.TryGetValue<EntityUid>(TargetKey, out var target))
|
if (!blackboard.TryGetValue<EntityUid>(TargetKey, out var target, _entManager))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var range = blackboard.GetValueOrDefault<float>(RangeKey);
|
var range = blackboard.GetValueOrDefault<float>(RangeKey, _entManager);
|
||||||
|
|
||||||
return _interaction.InRangeUnobstructed(owner, target, range);
|
return _interaction.InRangeUnobstructed(owner, target, range);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ public sealed class TargetInRangePrecondition : HTNPrecondition
|
|||||||
|
|
||||||
public override bool IsMet(NPCBlackboard blackboard)
|
public override bool IsMet(NPCBlackboard blackboard)
|
||||||
{
|
{
|
||||||
if (!blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates))
|
if (!blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates, _entManager))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!blackboard.TryGetValue<EntityUid>(TargetKey, out var target) ||
|
if (!blackboard.TryGetValue<EntityUid>(TargetKey, out var target, _entManager) ||
|
||||||
!_entManager.TryGetComponent<TransformComponent>(target, out var targetXform))
|
!_entManager.TryGetComponent<TransformComponent>(target, out var targetXform))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return coordinates.InRange(_entManager, targetXform.Coordinates, blackboard.GetValueOrDefault<float>(RangeKey));
|
return coordinates.InRange(_entManager, targetXform.Coordinates, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public sealed class MeleeOperator : HTNOperator
|
|||||||
CancellationToken cancelToken)
|
CancellationToken cancelToken)
|
||||||
{
|
{
|
||||||
// Don't attack if they're already as wounded as we want them.
|
// Don't attack if they're already as wounded as we want them.
|
||||||
if (!blackboard.TryGetValue<EntityUid>(TargetKey, out var target))
|
if (!blackboard.TryGetValue<EntityUid>(TargetKey, out var target, _entManager))
|
||||||
{
|
{
|
||||||
return (false, null);
|
return (false, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public sealed class MoveToOperator : HTNOperator
|
|||||||
public override async Task<(bool Valid, Dictionary<string, object>? Effects)> Plan(NPCBlackboard blackboard,
|
public override async Task<(bool Valid, Dictionary<string, object>? Effects)> Plan(NPCBlackboard blackboard,
|
||||||
CancellationToken cancelToken)
|
CancellationToken cancelToken)
|
||||||
{
|
{
|
||||||
if (!blackboard.TryGetValue<EntityCoordinates>(TargetKey, out var targetCoordinates))
|
if (!blackboard.TryGetValue<EntityCoordinates>(TargetKey, out var targetCoordinates, _entManager))
|
||||||
{
|
{
|
||||||
return (false, null);
|
return (false, null);
|
||||||
}
|
}
|
||||||
@@ -77,14 +77,14 @@ public sealed class MoveToOperator : HTNOperator
|
|||||||
return (false, null);
|
return (false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
var range = blackboard.GetValueOrDefault<float>(RangeKey);
|
var range = blackboard.GetValueOrDefault<float>(RangeKey, _entManager);
|
||||||
|
|
||||||
if (xform.Coordinates.TryDistance(_entManager, targetCoordinates, out var distance) && distance <= range)
|
if (xform.Coordinates.TryDistance(_entManager, targetCoordinates, out var distance) && distance <= range)
|
||||||
{
|
{
|
||||||
// In range
|
// In range
|
||||||
return (true, new Dictionary<string, object>()
|
return (true, new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
{NPCBlackboard.OwnerCoordinates, blackboard.GetValueOrDefault<EntityCoordinates>(NPCBlackboard.OwnerCoordinates)}
|
{NPCBlackboard.OwnerCoordinates, blackboard.GetValueOrDefault<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, _entManager)}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,14 +130,14 @@ public sealed class MoveToOperator : HTNOperator
|
|||||||
// Re-use the path we may have if applicable.
|
// Re-use the path we may have if applicable.
|
||||||
var comp = _steering.Register(blackboard.GetValue<EntityUid>(NPCBlackboard.Owner), targetCoordinates);
|
var comp = _steering.Register(blackboard.GetValue<EntityUid>(NPCBlackboard.Owner), targetCoordinates);
|
||||||
|
|
||||||
if (blackboard.TryGetValue<float>(RangeKey, out var range))
|
if (blackboard.TryGetValue<float>(RangeKey, out var range, _entManager))
|
||||||
{
|
{
|
||||||
comp.Range = range;
|
comp.Range = range;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blackboard.TryGetValue<PathResultEvent>(PathfindKey, out var result))
|
if (blackboard.TryGetValue<PathResultEvent>(PathfindKey, out var result, _entManager))
|
||||||
{
|
{
|
||||||
if (blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates))
|
if (blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates, _entManager))
|
||||||
{
|
{
|
||||||
var mapCoords = coordinates.ToMap(_entManager);
|
var mapCoords = coordinates.ToMap(_entManager);
|
||||||
_steering.PrunePath(mapCoords, targetCoordinates.ToMapPos(_entManager) - mapCoords.Position, result.Path);
|
_steering.PrunePath(mapCoords, targetCoordinates.ToMapPos(_entManager) - mapCoords.Position, result.Path);
|
||||||
@@ -152,7 +152,7 @@ public sealed class MoveToOperator : HTNOperator
|
|||||||
base.Shutdown(blackboard, status);
|
base.Shutdown(blackboard, status);
|
||||||
|
|
||||||
// Cleanup the blackboard and remove steering.
|
// Cleanup the blackboard and remove steering.
|
||||||
if (blackboard.TryGetValue<CancellationTokenSource>(MovementCancelToken, out var cancelToken))
|
if (blackboard.TryGetValue<CancellationTokenSource>(MovementCancelToken, out var cancelToken, _entManager))
|
||||||
{
|
{
|
||||||
cancelToken.Cancel();
|
cancelToken.Cancel();
|
||||||
blackboard.Remove<CancellationTokenSource>(MovementCancelToken);
|
blackboard.Remove<CancellationTokenSource>(MovementCancelToken);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public abstract class NPCCombatOperator : HTNOperator
|
|||||||
var radius = blackboard.GetValueOrDefault<float>(NPCBlackboard.VisionRadius, EntManager);
|
var radius = blackboard.GetValueOrDefault<float>(NPCBlackboard.VisionRadius, EntManager);
|
||||||
var targets = new List<(EntityUid Entity, float Rating, float Distance)>();
|
var targets = new List<(EntityUid Entity, float Rating, float Distance)>();
|
||||||
|
|
||||||
blackboard.TryGetValue<EntityUid>(Key, out var existingTarget);
|
blackboard.TryGetValue<EntityUid>(Key, out var existingTarget, EntManager);
|
||||||
var xformQuery = EntManager.GetEntityQuery<TransformComponent>();
|
var xformQuery = EntManager.GetEntityQuery<TransformComponent>();
|
||||||
var mobQuery = EntManager.GetEntityQuery<MobStateComponent>();
|
var mobQuery = EntManager.GetEntityQuery<MobStateComponent>();
|
||||||
var canMove = blackboard.GetValueOrDefault<bool>(NPCBlackboard.CanMove, EntManager);
|
var canMove = blackboard.GetValueOrDefault<bool>(NPCBlackboard.CanMove, EntManager);
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ public sealed class PickAccessibleComponentOperator : HTNOperator
|
|||||||
return (false, null);
|
return (false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
var range = blackboard.GetValueOrDefault<float>(RangeKey);
|
var range = blackboard.GetValueOrDefault<float>(RangeKey, _entManager);
|
||||||
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
||||||
|
|
||||||
if (!blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates))
|
if (!blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates, _entManager))
|
||||||
{
|
{
|
||||||
return (false, null);
|
return (false, null);
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ public sealed class PickAccessibleComponentOperator : HTNOperator
|
|||||||
return (false, null);
|
return (false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
blackboard.TryGetValue<float>(RangeKey, out var maxRange);
|
blackboard.TryGetValue<float>(RangeKey, out var maxRange, _entManager);
|
||||||
|
|
||||||
if (maxRange == 0f)
|
if (maxRange == 0f)
|
||||||
maxRange = 7f;
|
maxRange = 7f;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class PickAccessibleOperator : HTNOperator
|
public sealed class PickAccessibleOperator : HTNOperator
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||||
private PathfindingSystem _pathfinding = default!;
|
private PathfindingSystem _pathfinding = default!;
|
||||||
|
|
||||||
[DataField("rangeKey", required: true)]
|
[DataField("rangeKey", required: true)]
|
||||||
@@ -37,7 +38,7 @@ public sealed class PickAccessibleOperator : HTNOperator
|
|||||||
// Very inefficient (should weight each region by its node count) but better than the old system
|
// Very inefficient (should weight each region by its node count) but better than the old system
|
||||||
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
||||||
|
|
||||||
blackboard.TryGetValue<float>(RangeKey, out var maxRange);
|
blackboard.TryGetValue<float>(RangeKey, out var maxRange, _entManager);
|
||||||
|
|
||||||
if (maxRange == 0f)
|
if (maxRange == 0f)
|
||||||
maxRange = 7f;
|
maxRange = 7f;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators;
|
|||||||
|
|
||||||
public sealed class RandomOperator : HTNOperator
|
public sealed class RandomOperator : HTNOperator
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -30,8 +31,8 @@ public sealed class RandomOperator : HTNOperator
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
TargetKey,
|
TargetKey,
|
||||||
_random.NextFloat(blackboard.GetValueOrDefault<float>(MinKey),
|
_random.NextFloat(blackboard.GetValueOrDefault<float>(MinKey, _entManager),
|
||||||
blackboard.GetValueOrDefault<float>(MaxKey))
|
blackboard.GetValueOrDefault<float>(MaxKey, _entManager))
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public sealed class RangedOperator : HTNOperator
|
|||||||
CancellationToken cancelToken)
|
CancellationToken cancelToken)
|
||||||
{
|
{
|
||||||
// Don't attack if they're already as wounded as we want them.
|
// Don't attack if they're already as wounded as we want them.
|
||||||
if (!blackboard.TryGetValue<EntityUid>(TargetKey, out var target))
|
if (!blackboard.TryGetValue<EntityUid>(TargetKey, out var target, _entManager))
|
||||||
{
|
{
|
||||||
return (false, null);
|
return (false, null);
|
||||||
}
|
}
|
||||||
@@ -50,12 +50,12 @@ public sealed class RangedOperator : HTNOperator
|
|||||||
var ranged = _entManager.EnsureComponent<NPCRangedCombatComponent>(blackboard.GetValue<EntityUid>(NPCBlackboard.Owner));
|
var ranged = _entManager.EnsureComponent<NPCRangedCombatComponent>(blackboard.GetValue<EntityUid>(NPCBlackboard.Owner));
|
||||||
ranged.Target = blackboard.GetValue<EntityUid>(TargetKey);
|
ranged.Target = blackboard.GetValue<EntityUid>(TargetKey);
|
||||||
|
|
||||||
if (blackboard.TryGetValue<float>(NPCBlackboard.RotateSpeed, out var rotSpeed))
|
if (blackboard.TryGetValue<float>(NPCBlackboard.RotateSpeed, out var rotSpeed, _entManager))
|
||||||
{
|
{
|
||||||
ranged.RotationSpeed = new Angle(rotSpeed);
|
ranged.RotationSpeed = new Angle(rotSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blackboard.TryGetValue<SoundSpecifier>("SoundTargetInLOS", out var losSound))
|
if (blackboard.TryGetValue<SoundSpecifier>("SoundTargetInLOS", out var losSound, _entManager))
|
||||||
{
|
{
|
||||||
ranged.SoundTargetInLOS = losSound;
|
ranged.SoundTargetInLOS = losSound;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public sealed class MedibotInjectOperator : HTNOperator
|
|||||||
// TODO: Wat
|
// TODO: Wat
|
||||||
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
||||||
|
|
||||||
if (!blackboard.TryGetValue<EntityUid>(TargetKey, out var target) || _entManager.Deleted(target))
|
if (!blackboard.TryGetValue<EntityUid>(TargetKey, out var target, _entManager) || _entManager.Deleted(target))
|
||||||
return HTNOperatorStatus.Failed;
|
return HTNOperatorStatus.Failed;
|
||||||
|
|
||||||
if (!_entManager.TryGetComponent<MedibotComponent>(owner, out var botComp))
|
if (!_entManager.TryGetComponent<MedibotComponent>(owner, out var botComp))
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public sealed class PickNearbyInjectableOperator : HTNOperator
|
|||||||
{
|
{
|
||||||
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
||||||
|
|
||||||
if (!blackboard.TryGetValue<float>(RangeKey, out var range))
|
if (!blackboard.TryGetValue<float>(RangeKey, out var range, _entManager))
|
||||||
return (false, null);
|
return (false, null);
|
||||||
|
|
||||||
var damageQuery = _entManager.GetEntityQuery<DamageableComponent>();
|
var damageQuery = _entManager.GetEntityQuery<DamageableComponent>();
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class WaitOperator : HTNOperator
|
public sealed class WaitOperator : HTNOperator
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Blackboard key for the time we'll wait for.
|
/// Blackboard key for the time we'll wait for.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -12,7 +14,7 @@ public sealed class WaitOperator : HTNOperator
|
|||||||
|
|
||||||
public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
|
public override HTNOperatorStatus Update(NPCBlackboard blackboard, float frameTime)
|
||||||
{
|
{
|
||||||
if (!blackboard.TryGetValue<float>(Key, out var timer))
|
if (!blackboard.TryGetValue<float>(Key, out var timer, _entManager))
|
||||||
{
|
{
|
||||||
return HTNOperatorStatus.Finished;
|
return HTNOperatorStatus.Finished;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public sealed class NPCBlackboard : IEnumerable<KeyValuePair<string, object>>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tries to get the blackboard data for a particular key. Returns default if not found
|
/// Tries to get the blackboard data for a particular key. Returns default if not found
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public T? GetValueOrDefault<T>(string key, IEntityManager? entManager = null)
|
public T? GetValueOrDefault<T>(string key, IEntityManager entManager)
|
||||||
{
|
{
|
||||||
if (_blackboard.TryGetValue(key, out var value))
|
if (_blackboard.TryGetValue(key, out var value))
|
||||||
{
|
{
|
||||||
@@ -90,7 +90,7 @@ public sealed class NPCBlackboard : IEnumerable<KeyValuePair<string, object>>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tries to get the blackboard data for a particular key.
|
/// Tries to get the blackboard data for a particular key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool TryGetValue<T>(string key, [NotNullWhen(true)] out T? value, IEntityManager? entManager = null)
|
public bool TryGetValue<T>(string key, [NotNullWhen(true)] out T? value, IEntityManager entManager)
|
||||||
{
|
{
|
||||||
if (_blackboard.TryGetValue(key, out var data))
|
if (_blackboard.TryGetValue(key, out var data))
|
||||||
{
|
{
|
||||||
@@ -130,17 +130,15 @@ public sealed class NPCBlackboard : IEnumerable<KeyValuePair<string, object>>
|
|||||||
DebugTools.Assert(false, $"Tried to write to an NPC blackboard that is readonly!");
|
DebugTools.Assert(false, $"Tried to write to an NPC blackboard that is readonly!");
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TryGetEntityDefault(string key, [NotNullWhen(true)] out object? value, IEntityManager? entManager = null)
|
private bool TryGetEntityDefault(string key, [NotNullWhen(true)] out object? value, IEntityManager entManager)
|
||||||
{
|
{
|
||||||
// TODO: Pass this in
|
|
||||||
IoCManager.Resolve(ref entManager);
|
|
||||||
value = default;
|
value = default;
|
||||||
EntityUid owner;
|
EntityUid owner;
|
||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case Access:
|
case Access:
|
||||||
if (!TryGetValue(Owner, out owner))
|
if (!TryGetValue(Owner, out owner, entManager))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -149,7 +147,7 @@ public sealed class NPCBlackboard : IEnumerable<KeyValuePair<string, object>>
|
|||||||
value = access.FindAccessTags(owner);
|
value = access.FindAccessTags(owner);
|
||||||
return true;
|
return true;
|
||||||
case CanMove:
|
case CanMove:
|
||||||
if (!TryGetValue(Owner, out owner))
|
if (!TryGetValue(Owner, out owner, entManager))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -158,7 +156,7 @@ public sealed class NPCBlackboard : IEnumerable<KeyValuePair<string, object>>
|
|||||||
value = blocker.CanMove(owner);
|
value = blocker.CanMove(owner);
|
||||||
return true;
|
return true;
|
||||||
case OwnerCoordinates:
|
case OwnerCoordinates:
|
||||||
if (!TryGetValue(Owner, out owner))
|
if (!TryGetValue(Owner, out owner, entManager))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ namespace Content.Server.NPC.Pathfinding
|
|||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case PathResult.Continuing:
|
case PathResult.Continuing:
|
||||||
DebugTools.Assert(path.Frontier.Count > 0);
|
|
||||||
break;
|
break;
|
||||||
case PathResult.PartialPath:
|
case PathResult.PartialPath:
|
||||||
case PathResult.Path:
|
case PathResult.Path:
|
||||||
@@ -409,17 +408,17 @@ namespace Content.Server.NPC.Pathfinding
|
|||||||
{
|
{
|
||||||
var flags = PathFlags.None;
|
var flags = PathFlags.None;
|
||||||
|
|
||||||
if (blackboard.TryGetValue<bool>(NPCBlackboard.NavPry, out var pry) && pry)
|
if (blackboard.TryGetValue<bool>(NPCBlackboard.NavPry, out var pry, EntityManager) && pry)
|
||||||
{
|
{
|
||||||
flags |= PathFlags.Prying;
|
flags |= PathFlags.Prying;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blackboard.TryGetValue<bool>(NPCBlackboard.NavSmash, out var smash) && smash)
|
if (blackboard.TryGetValue<bool>(NPCBlackboard.NavSmash, out var smash, EntityManager) && smash)
|
||||||
{
|
{
|
||||||
flags |= PathFlags.Smashing;
|
flags |= PathFlags.Smashing;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blackboard.TryGetValue<bool>(NPCBlackboard.NavInteract, out var interact) && interact)
|
if (blackboard.TryGetValue<bool>(NPCBlackboard.NavInteract, out var interact, EntityManager) && interact)
|
||||||
{
|
{
|
||||||
flags |= PathFlags.Interact;
|
flags |= PathFlags.Interact;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user