mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-16 21:17:39 +03:00
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> (cherry picked from commit b7aa97e2030c0b01d07a76b4ee291fe2c8be95fa)
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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -330,7 +330,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -401,7 +401,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);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,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,
|
||||
@@ -128,8 +129,8 @@ public sealed class PullController : VirtualController
|
||||
var range = pullerComp.MaxPushRange;
|
||||
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
|
||||
{
|
||||
|
||||
@@ -654,7 +654,7 @@ public abstract class SharedActionsSystem : EntitySystem
|
||||
if (range <= 0)
|
||||
return true;
|
||||
|
||||
return coords.InRange(EntityManager, _transformSystem, Transform(user).Coordinates, range);
|
||||
return _transformSystem.InRange(coords, Transform(user).Coordinates, range);
|
||||
}
|
||||
|
||||
return _interactionSystem.InRangeUnobstructed(user, coords, range: range);
|
||||
|
||||
@@ -176,7 +176,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