Fixes obsolete Transform warnings in Content. (#25256)
* Fix TransformComponent.MapPosition warnings in Content.Client * Fix TransformComponent.MapPosition warnings in Content.IntegrationTests * Fix TransformComponent.MapPosition warnings in Content.Shared * Fix TransformComponent.MapPosition warnings in Content.Server * Fix TransformComponent.WorldPosition warnings in Content.Shared * Fix TransformComponent.WorldPosition warnings in Content.Client Excepts ClickableComponent b/c that needs to be ECS'd entirely later * Fix TransformComponent.WorldPosition warnings in Content.Server * Fix TransformComponent.WorldRotation warnings in Content.* * Fix TransformComponent.MapPosition warnings I missed * Fix TransformComponent.WorldMatrix warnings in Content.* * Fix TransformComponent.InvWorldMatrix warnings in Content.* * Fix TransformComponent.GetWorldPositionRotationMatrixWithInv warnings in Content.* * Fix TransformComponent.GetWorldPositionRotationMatrix warnings in Content.* * Fix TransformComponent.GetWorldPositionRotation warnings in Content.* * Fix TransformComponent.Anchored.set warnings in Content.* * Fix TransformComponent.Coordinates.set warnings in Content.* * Fix TransformComponent.LocalPosition.set warnings in Content.* * Fix TransformComponent.AttachToGridOrMap warnings in Content.* * Fix TransformComponent.AttachParent warnings in Content.* * Preempt TransformComponent.LocalRotation.set warnings in Content.Shared * Preempt TransformComponent.LocalRotation.set warnings in Content.Client * Preempt TransformComponent.LocalRotation.set warnings in Content.IntegrationTests * Preempt TransformComponent.LocalRotation.set warnings in Content.Server * Fix/Preempt the remaining obsolete TransformComponent properties/methods in Content.* * ECS ClickableComponent * Fix obsolete SharedTransformSystem methods in Content.* * Fix ExplosionOverlay `SharedTransformSystem` dependency * Maybe fix null eye position breaking tests * MGS requested changes
This commit is contained in:
@@ -63,6 +63,7 @@ namespace Content.Server.Construction.Commands
|
||||
|
||||
var changed = 0;
|
||||
var tagSystem = _entManager.EntitySysManager.GetEntitySystem<TagSystem>();
|
||||
var xformSystem = _entManager.System<SharedTransformSystem>();
|
||||
|
||||
|
||||
var enumerator = xformQuery.GetComponent(gridId.Value).ChildEnumerator;
|
||||
@@ -97,7 +98,7 @@ namespace Content.Server.Construction.Commands
|
||||
|
||||
if (childXform.LocalRotation != Angle.Zero)
|
||||
{
|
||||
childXform.LocalRotation = Angle.Zero;
|
||||
xformSystem.SetLocalRotation(child, Angle.Zero, childXform);
|
||||
changed++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,14 @@ namespace Content.Server.Construction.Completions
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
{
|
||||
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
||||
transform.Anchored = Value;
|
||||
if (Value == transform.Anchored)
|
||||
return;
|
||||
|
||||
var xformSystem = entityManager.System<SharedTransformSystem>();
|
||||
if (Value)
|
||||
xformSystem.AnchorEntity((uid, transform));
|
||||
else
|
||||
xformSystem.Unanchor(uid, transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,12 @@ namespace Content.Server.Construction.Completions
|
||||
{
|
||||
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
||||
|
||||
var xformSystem = entityManager.System<SharedTransformSystem>();
|
||||
if (!transform.Anchored)
|
||||
transform.Coordinates = transform.Coordinates.SnapToGrid(entityManager);
|
||||
xformSystem.SetCoordinates((uid, transform, entityManager.GetComponent<MetaDataComponent>(uid)), transform.Coordinates.SnapToGrid(entityManager));
|
||||
|
||||
if (SouthRotation)
|
||||
{
|
||||
transform.LocalRotation = Angle.Zero;
|
||||
}
|
||||
xformSystem.SetLocalRotation(uid, Angle.Zero, transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,9 +362,12 @@ namespace Content.Server.Construction
|
||||
|
||||
// Transform transferring.
|
||||
var newTransform = Transform(newUid);
|
||||
newTransform.AttachToGridOrMap(); // in case in hands or a container
|
||||
newTransform.LocalRotation = transform.LocalRotation;
|
||||
newTransform.Anchored = transform.Anchored;
|
||||
_xformSystem.AttachToGridOrMap(newUid, newTransform); // in case in hands or a container
|
||||
_xformSystem.SetLocalRotation(newUid, transform.LocalRotation, newTransform);
|
||||
if (transform.Anchored)
|
||||
_xformSystem.AnchorEntity((newUid, newTransform));
|
||||
else
|
||||
_xformSystem.Unanchor(newUid, newTransform);
|
||||
|
||||
// Container transferring.
|
||||
if (containerManager != null)
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace Content.Server.Construction
|
||||
[Dependency] private readonly EntityLookupSystem _lookupSystem = default!;
|
||||
[Dependency] private readonly StorageSystem _storageSystem = default!;
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
// --- WARNING! LEGACY CODE AHEAD! ---
|
||||
// This entire file contains the legacy code for initial construction.
|
||||
@@ -82,7 +83,7 @@ namespace Content.Server.Construction
|
||||
}
|
||||
}
|
||||
|
||||
var pos = Transform(user).MapPosition;
|
||||
var pos = _xformSystem.GetMapCoordinates(user);
|
||||
|
||||
foreach (var near in _lookupSystem.GetEntitiesInRange(pos, 2f, LookupFlags.Contained | LookupFlags.Dynamic | LookupFlags.Sundries | LookupFlags.Approximate))
|
||||
{
|
||||
@@ -527,10 +528,12 @@ namespace Content.Server.Construction
|
||||
// ikr
|
||||
var xform = Transform(structure);
|
||||
var wasAnchored = xform.Anchored;
|
||||
xform.Anchored = false;
|
||||
xform.Coordinates = GetCoordinates(ev.Location);
|
||||
xform.LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.Zero;
|
||||
xform.Anchored = wasAnchored;
|
||||
if (wasAnchored)
|
||||
_xformSystem.Unanchor(structure, xform);
|
||||
_xformSystem.SetCoordinates((structure, xform, MetaData(structure)), GetCoordinates(ev.Location));
|
||||
_xformSystem.SetLocalRotation(structure, constructionPrototype.CanRotate ? ev.Angle : Angle.Zero, xform);
|
||||
if (wasAnchored)
|
||||
_xformSystem.AnchorEntity((structure, xform));
|
||||
|
||||
RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack, GetNetEntity(structure)));
|
||||
_adminLogger.Add(LogType.Construction, LogImpact.Low, $"{ToPrettyString(user):player} has turned a {ev.PrototypeName} construction ghost into {ToPrettyString(structure)} at {Transform(structure).Coordinates}");
|
||||
|
||||
Reference in New Issue
Block a user