Replace obsolete EntityCoordiates.InRange() with TransformSystem.InRange() (#29993)
* Replace EntityCoordiates.InRange() with TransformSystem.InRange() * nullspace * I figured it out * man I have no clue how client side sutff works * please have mercy * remove RadiationPulseOverlay changes * nullspace --------- Co-authored-by: plykiya <plykiya@protonmail.com>
This commit is contained in:
@@ -75,7 +75,7 @@ public sealed class AlignRCDConstruction : PlacementMode
|
||||
if (!_entityManager.TryGetComponent<TransformComponent>(player, out var xform))
|
||||
return false;
|
||||
|
||||
if (!xform.Coordinates.InRange(_entityManager, _transformSystem, position, SharedInteractionSystem.InteractionRange))
|
||||
if (!_transformSystem.InRange(xform.Coordinates, position, SharedInteractionSystem.InteractionRange))
|
||||
{
|
||||
InvalidPlaceColor = InvalidPlaceColor.WithAlpha(0);
|
||||
return false;
|
||||
|
||||
@@ -142,8 +142,8 @@ public sealed class StorageSystem : SharedStorageSystem
|
||||
{
|
||||
if (!_timing.IsFirstTimePredicted)
|
||||
return;
|
||||
|
||||
if (finalCoords.InRange(EntityManager, TransformSystem, initialCoords, 0.1f) ||
|
||||
|
||||
if (TransformSystem.InRange(finalCoords, initialCoords, 0.1f) ||
|
||||
!Exists(initialCoords.EntityId) || !Exists(finalCoords.EntityId))
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
if (component.LastPosition.HasValue)
|
||||
{
|
||||
// Check if position is out of range => don't update and disable
|
||||
if (!component.LastPosition.Value.InRange(EntityManager, _transform, userPos, SharedInteractionSystem.InteractionRange))
|
||||
if (!_transform.InRange(component.LastPosition.Value, userPos, SharedInteractionSystem.InteractionRange))
|
||||
{
|
||||
if (component.User is { } userId && component.Enabled)
|
||||
_popup.PopupEntity(Loc.GetString("gas-analyzer-shutoff"), userId, userId);
|
||||
|
||||
@@ -146,7 +146,7 @@ public sealed partial class DragonSystem : EntitySystem
|
||||
// cant stack rifts near eachother
|
||||
foreach (var (_, riftXform) in EntityQuery<DragonRiftComponent, TransformComponent>(true))
|
||||
{
|
||||
if (riftXform.Coordinates.InRange(EntityManager, _transform, xform.Coordinates, RiftRange))
|
||||
if (_transform.InRange(riftXform.Coordinates, xform.Coordinates, RiftRange))
|
||||
{
|
||||
_popup.PopupEntity(Loc.GetString("carp-rift-proximity", ("proximity", RiftRange)), uid, uid);
|
||||
return;
|
||||
|
||||
@@ -325,7 +325,7 @@ namespace Content.Server.Guardian
|
||||
if (!guardianComponent.GuardianLoose)
|
||||
return;
|
||||
|
||||
if (!guardianXform.Coordinates.InRange(EntityManager, _transform, hostXform.Coordinates, guardianComponent.DistanceAllowed))
|
||||
if (!_transform.InRange(guardianXform.Coordinates, hostXform.Coordinates, guardianComponent.DistanceAllowed))
|
||||
RetractGuardian(hostUid, hostComponent, guardianUid, guardianComponent);
|
||||
}
|
||||
|
||||
|
||||
@@ -402,7 +402,8 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
|
||||
|
||||
var trans = transformQuery.GetComponent(uid);
|
||||
var masterTrans = transformQuery.GetComponent(master);
|
||||
if (!masterTrans.Coordinates.InRange(EntityManager, _transform, trans.Coordinates, 10f))
|
||||
if (!_transform.InRange(masterTrans.Coordinates, trans.Coordinates, 10f)
|
||||
)
|
||||
{
|
||||
Clean(uid, instrument);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public sealed class HealthAnalyzerSystem : EntitySystem
|
||||
|
||||
//Get distance between health analyzer and the scanned entity
|
||||
var patientCoordinates = Transform(patient).Coordinates;
|
||||
if (!patientCoordinates.InRange(EntityManager, _transformSystem, transform.Coordinates, component.MaxScanRange))
|
||||
if (!_transformSystem.InRange(patientCoordinates, transform.Coordinates, component.MaxScanRange))
|
||||
{
|
||||
//Range too far, disable updates
|
||||
StopAnalyzingEntity((uid, component), patient);
|
||||
|
||||
@@ -58,6 +58,7 @@ public sealed class PullController : VirtualController
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly SharedGravitySystem _gravity = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||
|
||||
/// <summary>
|
||||
/// If distance between puller and pulled entity lower that this threshold,
|
||||
@@ -133,8 +134,8 @@ public sealed class PullController : VirtualController
|
||||
var range = 2f;
|
||||
var fromUserCoords = coords.WithEntityId(player, EntityManager);
|
||||
var userCoords = new EntityCoordinates(player, Vector2.Zero);
|
||||
|
||||
if (!coords.InRange(EntityManager, TransformSystem, userCoords, range))
|
||||
|
||||
if (!_transformSystem.InRange(coords, userCoords, range))
|
||||
{
|
||||
var direction = fromUserCoords.Position - userCoords.Position;
|
||||
|
||||
|
||||
@@ -8,12 +8,19 @@ namespace Content.Server.NPC.HTN.Preconditions;
|
||||
public sealed partial class CoordinatesInRangePrecondition : HTNPrecondition
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
private SharedTransformSystem _transformSystem = default!;
|
||||
|
||||
[DataField("targetKey", required: true)] public string TargetKey = default!;
|
||||
|
||||
[DataField("rangeKey", required: true)]
|
||||
public string RangeKey = default!;
|
||||
|
||||
public override void Initialize(IEntitySystemManager sysManager)
|
||||
{
|
||||
base.Initialize(sysManager);
|
||||
_transformSystem = sysManager.GetEntitySystem<SharedTransformSystem>();
|
||||
}
|
||||
|
||||
public override bool IsMet(NPCBlackboard blackboard)
|
||||
{
|
||||
if (!blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates, _entManager))
|
||||
@@ -22,6 +29,6 @@ public sealed partial class CoordinatesInRangePrecondition : HTNPrecondition
|
||||
if (!blackboard.TryGetValue<EntityCoordinates>(TargetKey, out var target, _entManager))
|
||||
return false;
|
||||
|
||||
return coordinates.InRange(_entManager, _entManager.System<SharedTransformSystem>(), target, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
|
||||
return _transformSystem.InRange(coordinates, target, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,19 @@ namespace Content.Server.NPC.HTN.Preconditions;
|
||||
public sealed partial class CoordinatesNotInRangePrecondition : HTNPrecondition
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
private SharedTransformSystem _transformSystem = default!;
|
||||
|
||||
[DataField("targetKey", required: true)] public string TargetKey = default!;
|
||||
|
||||
[DataField("rangeKey", required: true)]
|
||||
public string RangeKey = default!;
|
||||
|
||||
public override void Initialize(IEntitySystemManager sysManager)
|
||||
{
|
||||
base.Initialize(sysManager);
|
||||
_transformSystem = sysManager.GetEntitySystem<SharedTransformSystem>();
|
||||
}
|
||||
|
||||
public override bool IsMet(NPCBlackboard blackboard)
|
||||
{
|
||||
if (!blackboard.TryGetValue<EntityCoordinates>(NPCBlackboard.OwnerCoordinates, out var coordinates, _entManager))
|
||||
@@ -22,7 +29,7 @@ public sealed partial class CoordinatesNotInRangePrecondition : HTNPrecondition
|
||||
if (!blackboard.TryGetValue<EntityCoordinates>(TargetKey, out var target, _entManager))
|
||||
return false;
|
||||
|
||||
return !coordinates.InRange(_entManager, _entManager.System<SharedTransformSystem>(), target, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
|
||||
return !_transformSystem.InRange(coordinates, target, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,17 @@ namespace Content.Server.NPC.HTN.Preconditions;
|
||||
public sealed partial class TargetInRangePrecondition : HTNPrecondition
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
private SharedTransformSystem _transformSystem = default!;
|
||||
|
||||
[DataField("targetKey", required: true)] public string TargetKey = default!;
|
||||
|
||||
[DataField("rangeKey", required: true)]
|
||||
public string RangeKey = default!;
|
||||
public override void Initialize(IEntitySystemManager sysManager)
|
||||
{
|
||||
base.Initialize(sysManager);
|
||||
_transformSystem = sysManager.GetEntitySystem<SharedTransformSystem>();
|
||||
}
|
||||
|
||||
public override bool IsMet(NPCBlackboard blackboard)
|
||||
{
|
||||
@@ -23,6 +29,7 @@ public sealed partial class TargetInRangePrecondition : HTNPrecondition
|
||||
!_entManager.TryGetComponent<TransformComponent>(target, out var targetXform))
|
||||
return false;
|
||||
|
||||
return coordinates.InRange(_entManager, _entManager.System<SharedTransformSystem>(), targetXform.Coordinates, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
|
||||
var transformSystem = _entManager.System<SharedTransformSystem>;
|
||||
return _transformSystem.InRange(coordinates, targetXform.Coordinates, blackboard.GetValueOrDefault<float>(RangeKey, _entManager));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Content.Server.Pointing.EntitySystems
|
||||
{
|
||||
if (HasComp<GhostComponent>(pointer))
|
||||
{
|
||||
return Transform(pointer).Coordinates.InRange(EntityManager, _transform, coordinates, 15);
|
||||
return _transform.InRange(Transform(pointer).Coordinates, coordinates, 15);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -533,7 +533,7 @@ public abstract class SharedActionsSystem : EntitySystem
|
||||
if (action.Range <= 0)
|
||||
return true;
|
||||
|
||||
return coords.InRange(EntityManager, _transformSystem, Transform(user).Coordinates, action.Range);
|
||||
return _transformSystem.InRange(coords, Transform(user).Coordinates, action.Range);
|
||||
}
|
||||
|
||||
return _interactionSystem.InRangeUnobstructed(user, coords, range: action.Range);
|
||||
|
||||
@@ -170,7 +170,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
|
||||
if (args.BreakOnMove && !(!args.BreakOnWeightlessMove && _gravity.IsWeightless(args.User, xform: userXform)))
|
||||
{
|
||||
// Whether the user has moved too much from their original position.
|
||||
if (!userXform.Coordinates.InRange(EntityManager, _transform, doAfter.UserPosition, args.MovementThreshold))
|
||||
if (!_transform.InRange(userXform.Coordinates, doAfter.UserPosition, args.MovementThreshold))
|
||||
return true;
|
||||
|
||||
// Whether the distance between the user and target(if any) has changed too much.
|
||||
|
||||
Reference in New Issue
Block a user