Revert "Fix chat bubbles (#25643)" (#25645)

* Revert "Fix chat bubbles (#25643)"

This reverts commit 23d2c4d924.

* Revert "Fixes obsolete Transform warnings in Content. (#25256)"

This reverts commit f284b43ff6.
This commit is contained in:
metalgearsloth
2024-02-28 00:51:20 +11:00
committed by GitHub
parent d204896bf5
commit a9502be29e
154 changed files with 435 additions and 611 deletions

View File

@@ -451,7 +451,7 @@ public abstract partial class SharedBuckleSystem
_transform.SetWorldRotation(buckleXform, oldBuckledToWorldRot);
if (strapComp.UnbuckleOffset != Vector2.Zero)
_transform.SetCoordinates((buckleUid, buckleXform, MetaData(buckleUid)), oldBuckledXform.Coordinates.Offset(strapComp.UnbuckleOffset));
buckleXform.Coordinates = oldBuckledXform.Coordinates.Offset(strapComp.UnbuckleOffset);
}
if (TryComp(buckleUid, out AppearanceComponent? appearance))

View File

@@ -17,16 +17,15 @@ namespace Content.Shared.Construction.Conditions
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
{
var entManager = IoCManager.Resolve<IEntityManager>();
var xfmSystem = entManager.System<SharedTransformSystem>();
// get blueprint and user position
var userWorldPosition = xfmSystem.GetWorldPosition(user);
var userWorldPosition = entManager.GetComponent<TransformComponent>(user).WorldPosition;
var objWorldPosition = location.ToMap(entManager).Position;
// find direction from user to blueprint
var userToObject = (objWorldPosition - userWorldPosition);
// get direction of the grid being placed on as an offset.
var gridRotation = xfmSystem.GetWorldRotation(location.EntityId);
var gridRotation = entManager.GetComponent<TransformComponent>(location.EntityId).WorldRotation;
var directionWithOffset = gridRotation.RotateVec(direction.ToVec());
// dot product will be positive if user direction and blueprint are co-directed

View File

@@ -127,7 +127,7 @@ public sealed partial class AnchorableSystem : EntitySystem
// Snap rotation to cardinal (multiple of 90)
var rot = xform.LocalRotation;
_transformSystem.SetLocalRotation(uid, Math.Round(rot / (Math.PI / 2)) * (Math.PI / 2), xform);
xform.LocalRotation = Math.Round(rot / (Math.PI / 2)) * (Math.PI / 2);
if (TryComp<SharedPullableComponent>(uid, out var pullable) && pullable.Puller != null)
{

View File

@@ -7,7 +7,6 @@ namespace Content.Shared.Containers;
public sealed class ContainerFillSystem : EntitySystem
{
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
public override void Initialize()
{
@@ -37,7 +36,7 @@ public sealed class ContainerFillSystem : EntitySystem
if (!_containerSystem.Insert(ent, container, containerXform: xform))
{
Log.Error($"Entity {ToPrettyString(uid)} with a {nameof(ContainerFillComponent)} failed to insert an entity: {ToPrettyString(ent)}.");
_xformSystem.AttachToGridOrMap(ent);
Transform(ent).AttachToGridOrMap();
break;
}
}

View File

@@ -13,8 +13,6 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
private ISawmill _sawmill = default!;
public const string InvokedPort = "link_port";
@@ -533,7 +531,7 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
private bool InRange(EntityUid sourceUid, EntityUid sinkUid, float range)
{
// TODO: This should be using an existing method and also coordinates inrange instead.
return _xformSystem.GetMapCoordinates(sourceUid).InRange(_xformSystem.GetMapCoordinates(sinkUid), range);
return Transform(sourceUid).MapPosition.InRange(Transform(sinkUid).MapPosition, range);
}
private void SendNewLinkEvent(EntityUid? user, EntityUid sourceUid, string source, EntityUid sinkUid, string sink)

View File

@@ -20,7 +20,6 @@ namespace Content.Shared.Examine
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
[Dependency] protected readonly MobStateSystem MobStateSystem = default!;
public const float MaxRaycastRange = 100;
@@ -187,7 +186,6 @@ namespace Content.Shared.Examine
if (!ignoreInsideBlocker) return false;
var xfmSys = entMan.System<SharedTransformSystem>();
foreach (var result in rayResults)
{
if (!entMan.TryGetComponent(result.HitEntity, out OccluderComponent? o))
@@ -196,7 +194,7 @@ namespace Content.Shared.Examine
}
var bBox = o.BoundingBox;
bBox = bBox.Translated(xfmSys.GetWorldPosition(result.HitEntity));
bBox = bBox.Translated(entMan.GetComponent<TransformComponent>(result.HitEntity).WorldPosition);
if (bBox.Contains(origin.Position) || bBox.Contains(other.Position))
{
@@ -212,10 +210,8 @@ namespace Content.Shared.Examine
public static bool InRangeUnOccluded(EntityUid origin, EntityUid other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
{
var entMan = IoCManager.Resolve<IEntityManager>();
var xfmSys = entMan.System<SharedTransformSystem>();
var originPos = xfmSys.GetMapCoordinates(origin);
var otherPos = xfmSys.GetMapCoordinates(other);
var originPos = entMan.GetComponent<TransformComponent>(origin).MapPosition;
var otherPos = entMan.GetComponent<TransformComponent>(other).MapPosition;
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
}
@@ -223,10 +219,8 @@ namespace Content.Shared.Examine
public static bool InRangeUnOccluded(EntityUid origin, EntityCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
{
var entMan = IoCManager.Resolve<IEntityManager>();
var xfmSys = entMan.System<SharedTransformSystem>();
var originPos = xfmSys.GetMapCoordinates(origin);
var otherPos = other.ToMap(entMan, xfmSys);
var originPos = entMan.GetComponent<TransformComponent>(origin).MapPosition;
var otherPos = other.ToMap(entMan);
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
}
@@ -234,9 +228,7 @@ namespace Content.Shared.Examine
public static bool InRangeUnOccluded(EntityUid origin, MapCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true)
{
var entMan = IoCManager.Resolve<IEntityManager>();
var xfmSys = entMan.System<SharedTransformSystem>();
var originPos = xfmSys.GetMapCoordinates(origin);
var originPos = entMan.GetComponent<TransformComponent>(origin).MapPosition;
return InRangeUnOccluded(originPos, other, range, predicate, ignoreInsideBlocker);
}

View File

@@ -135,7 +135,7 @@ public abstract partial class SharedHandsSystem
}
var target = targetDropLocation.Value.ToMap(EntityManager, TransformSystem);
TransformSystem.SetWorldPosition(itemXform, GetFinalDropCoordinates(uid, TransformSystem.GetMapCoordinates((uid, userXform)), target));
TransformSystem.SetWorldPosition(itemXform, GetFinalDropCoordinates(uid, userXform.MapPosition, target));
return true;
}

View File

@@ -108,10 +108,10 @@ public abstract partial class SharedHandsSystem : EntitySystem
var xform = Transform(uid);
var coordinateEntity = xform.ParentUid.IsValid() ? xform.ParentUid : uid;
var itemXform = Transform(entity);
var itemPos = TransformSystem.GetMapCoordinates((entity, itemXform));
var itemPos = itemXform.MapPosition;
if (itemPos.MapId == xform.MapID
&& (itemPos.Position - TransformSystem.GetMapCoordinates((uid, xform)).Position).Length() <= MaxAnimationRange
&& (itemPos.Position - xform.MapPosition.Position).Length() <= MaxAnimationRange
&& MetaData(entity).VisibilityMask == MetaData(uid).VisibilityMask) // Don't animate aghost pickups.
{
var initialPosition = EntityCoordinates.FromMap(coordinateEntity, itemPos, EntityManager);

View File

@@ -70,7 +70,7 @@ namespace Content.Shared.Interaction
if (!Resolve(user, ref xform))
return false;
var diff = coordinates - _transform.GetMapCoordinates((user, xform)).Position;
var diff = coordinates - xform.MapPosition.Position;
if (diff.LengthSquared() <= 0.01f)
return true;

View File

@@ -630,7 +630,7 @@ namespace Content.Shared.Interaction
fixtureB.FixtureCount > 0 &&
TryComp<TransformComponent>(origin, out var xformA))
{
var (worldPosA, worldRotA) = _transform.GetWorldPositionRotation(xformA);
var (worldPosA, worldRotA) = xformA.GetWorldPositionRotation();
var xfA = new Transform(worldPosA, worldRotA);
var parentRotB = _transform.GetWorldRotation(otherCoordinates.EntityId);
var xfB = new Transform(targetPos.Position, parentRotB + otherAngle);
@@ -660,14 +660,14 @@ namespace Content.Shared.Interaction
else
{
// We'll still do the raycast from the centres but we'll bump the range as we know they're in range.
originPos = _transform.GetMapCoordinates(xformA);
originPos = xformA.MapPosition;
range = (originPos.Position - targetPos.Position).Length();
}
}
// No fixtures, e.g. wallmounts.
else
{
originPos = _transform.GetMapCoordinates(origin);
originPos = Transform(origin).MapPosition;
var otherParent = Transform(other).ParentUid;
targetRot = otherParent.IsValid() ? Transform(otherParent).LocalRotation + otherAngle : otherAngle;
}
@@ -696,7 +696,7 @@ namespace Content.Shared.Interaction
Ignored? predicate = null)
{
var transform = Transform(target);
var (position, rotation) = _transform.GetWorldPositionRotation(transform);
var (position, rotation) = transform.GetWorldPositionRotation();
var mapPos = new MapCoordinates(position, transform.MapID);
var combinedPredicate = GetPredicate(origin, target, mapPos, rotation, collisionMask, predicate);
@@ -821,7 +821,7 @@ namespace Content.Shared.Interaction
bool popup = false)
{
Ignored combinedPredicate = e => e == origin || (predicate?.Invoke(e) ?? false);
var originPosition = _transform.GetMapCoordinates(origin);
var originPosition = Transform(origin).MapPosition;
var inRange = InRangeUnobstructed(originPosition, other, range, collisionMask, combinedPredicate, ShouldCheckAccess(origin));
if (!inRange && popup && _gameTiming.IsFirstTimePredicted)
@@ -1057,7 +1057,7 @@ namespace Content.Shared.Interaction
rotation = mover.TargetRelativeRotation;
}
_transform.SetLocalRotation(item, rotation);
Transform(item).LocalRotation = rotation;
}
#endregion

View File

@@ -20,7 +20,6 @@ public sealed class TileSystem : EntitySystem
[Dependency] private readonly SharedDecalSystem _decal = default!;
[Dependency] private readonly SharedMapSystem _maps = default!;
[Dependency] private readonly TurfSystem _turf = default!;
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
/// <summary>
/// Returns a weighted pick of a tile variant.
@@ -155,7 +154,7 @@ public sealed class TileSystem : EntitySystem
//Actually spawn the relevant tile item at the right position and give it some random offset.
var tileItem = Spawn(tileDef.ItemDropPrototypeName, coordinates);
_xformSystem.SetLocalRotation(tileItem, _robustRandom.NextDouble() * Math.Tau);
Transform(tileItem).LocalRotation = _robustRandom.NextDouble() * Math.Tau;
// Destroy any decals on the tile
var decals = _decal.GetDecalsInRange(gridUid, coordinates.SnapToGrid(EntityManager, _mapManager).Position, 0.5f);

View File

@@ -144,12 +144,11 @@ namespace Content.Shared.Maps
private static bool GetWorldTileBox(TileRef turf, out Box2Rotated res)
{
var entManager = IoCManager.Resolve<IEntityManager>();
var xfmSystem = entManager.System<SharedTransformSystem>();
var map = IoCManager.Resolve<IMapManager>();
if (map.TryGetGrid(turf.GridUid, out var tileGrid))
{
var gridRot = xfmSystem.GetWorldRotation(turf.GridUid);
var gridRot = entManager.GetComponent<TransformComponent>(turf.GridUid).WorldRotation;
// This is scaled to 90 % so it doesn't encompass walls on other tiles.
var tileBox = Box2.UnitCentered.Scale(0.9f);

View File

@@ -248,7 +248,7 @@ namespace Content.Shared.Movement.Systems
// TODO apparently this results in a duplicate move event because "This should have its event run during
// island solver"??. So maybe SetRotation needs an argument to avoid raising an event?
var worldRot = _transform.GetWorldRotation(xform);
_transform.SetLocalRotation(physicsUid, xform.LocalRotation + worldTotal.ToWorldAngle() - worldRot, xform);
_transform.SetLocalRotation(xform, xform.LocalRotation + worldTotal.ToWorldAngle() - worldRot);
}
if (!weightless && MobMoverQuery.TryGetComponent(uid, out var mobMover) &&

View File

@@ -80,7 +80,7 @@ public sealed class DashAbilitySystem : EntitySystem
return;
}
var origin = _transform.GetMapCoordinates(user);
var origin = Transform(user).MapPosition;
var target = args.Target.ToMap(EntityManager, _transform);
// prevent collision with the user duh
if (!_interaction.InRangeUnobstructed(origin, target, 0f, CollisionGroup.Opaque, uid => uid == user))

View File

@@ -97,7 +97,7 @@ public abstract class SharedConveyorController : VirtualController
var itemRelative = conveyorPos - localPos;
localPos += Convey(direction, speed, frameTime, itemRelative);
TransformSystem.SetLocalPosition(entity, localPos, transform);
transform.LocalPosition = localPos;
// Force it awake for collisionwake reasons.
Physics.SetAwake(entity, body, true);

View File

@@ -8,7 +8,6 @@ namespace Content.Shared.Placeable
public sealed class PlaceableSurfaceSystem : EntitySystem
{
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
public override void Initialize()
{
@@ -61,11 +60,9 @@ namespace Content.Shared.Placeable
return;
if (surface.PlaceCentered)
{
_xformSystem.SetLocalPosition(args.Used, Transform(uid).LocalPosition + surface.PositionOffset);
}
Transform(args.Used).LocalPosition = Transform(uid).LocalPosition + surface.PositionOffset;
else
_xformSystem.SetCoordinates(args.Used, args.ClickLocation);
Transform(args.Used).Coordinates = args.ClickLocation;
args.Handled = true;
}

View File

@@ -38,7 +38,6 @@ public sealed class RCDSystem : EntitySystem
[Dependency] private readonly TagSystem _tag = default!;
[Dependency] private readonly TurfSystem _turf = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
private readonly int RcdModeCount = Enum.GetValues(typeof(RcdMode)).Length;
@@ -199,7 +198,7 @@ public sealed class RCDSystem : EntitySystem
if (_net.IsServer)
{
var ent = Spawn("WallSolid", mapGrid.GridTileToLocal(snapPos));
_xformSystem.SetLocalRotation(ent, Angle.Zero); // Walls always need to point south.
Transform(ent).LocalRotation = Angle.Zero; // Walls always need to point south.
_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(ent)} at {snapPos} on grid {tile.GridUid}");
}
break;
@@ -208,7 +207,7 @@ public sealed class RCDSystem : EntitySystem
if (_net.IsServer)
{
var airlock = Spawn("Airlock", mapGrid.GridTileToLocal(snapPos));
_xformSystem.SetLocalRotation(airlock, Transform(uid).LocalRotation); //Now apply icon smoothing.
Transform(airlock).LocalRotation = Transform(uid).LocalRotation; //Now apply icon smoothing.
_adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(airlock)} at {snapPos} on grid {tile.GridUid}");
}
break;

View File

@@ -20,7 +20,7 @@ public sealed class RandomHelperSystem : EntitySystem
var offset = new Vector2(randomX, randomY);
var xform = Transform(entity);
_transform.SetLocalPosition(entity, xform.LocalPosition + offset, xform);
_transform.SetLocalPosition(xform, xform.LocalPosition + offset);
}
public void RandomOffset(EntityUid entity, float min, float max)

View File

@@ -113,7 +113,7 @@ public abstract class SharedStealthSystem : EntitySystem
private void OnMove(EntityUid uid, StealthOnMoveComponent component, ref MoveEvent args)
{
if (_timing.ApplyingState)
if (args.FromStateHandling)
return;
if (args.NewPosition.EntityId != args.OldPosition.EntityId)

View File

@@ -77,7 +77,7 @@ public sealed class MagnetPickupSystem : EntitySystem
// the problem is that stack pickups delete the original entity, which is fine, but due to
// game state handling we can't show a lerp animation for it.
var nearXform = Transform(near);
var nearMap = _transform.GetMapCoordinates(nearXform);
var nearMap = nearXform.MapPosition;
var nearCoords = EntityCoordinates.FromMap(moverCoords.EntityId, nearMap, _transform, EntityManager);
if (!_storage.Insert(uid, near, out var stacked, storageComp: storage, playSound: !playedSound))

View File

@@ -14,9 +14,9 @@ namespace Content.Shared.Tabletop
public abstract class SharedTabletopSystem : EntitySystem
{
[Dependency] protected readonly ActionBlockerSystem ActionBlockerSystem = default!;
[Dependency] protected readonly SharedTransformSystem Transforms = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedTransformSystem _transforms = default!;
[Dependency] private readonly IMapManager _mapMan = default!;
public override void Initialize()
@@ -41,8 +41,8 @@ namespace Content.Shared.Tabletop
// Move the entity and dirty it (we use the map ID from the entity so noone can try to be funny and move the item to another map)
var transform = EntityManager.GetComponent<TransformComponent>(moved);
var coordinates = new EntityCoordinates(_mapMan.GetMapEntityId(transform.MapID), msg.Coordinates.Position);
Transforms.SetCoordinates(moved, transform, coordinates);
_transforms.SetParent(moved, transform, _mapMan.GetMapEntityId(transform.MapID));
_transforms.SetLocalPositionNoLerp(transform, msg.Coordinates.Position);
}
private void OnDraggingPlayerChanged(TabletopDraggingPlayerChangedEvent msg, EntitySessionEventArgs args)

View File

@@ -44,7 +44,7 @@ public sealed class ThrowingSystem : EntitySystem
float pushbackRatio = PushbackDefault,
bool playSound = true)
{
var thrownPos = _transform.GetMapCoordinates(uid);
var thrownPos = Transform(uid).MapPosition;
var mapPos = coordinates.ToMap(EntityManager, _transform);
if (mapPos.MapId != thrownPos.MapId)

View File

@@ -220,7 +220,7 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
_blocker.UpdateCanMove(target);
// Invisible tether entity
var tether = Spawn("TetherEntity", TransformSystem.GetMapCoordinates(target));
var tether = Spawn("TetherEntity", Transform(target).MapPosition);
var tetherPhysics = Comp<PhysicsComponent>(tether);
component.TetherEntity = tether;
_physics.WakeBody(tether);

View File

@@ -35,7 +35,7 @@ public abstract partial class SharedGunSystem
if (args.Handled)
return;
ManualCycle(uid, component, TransformSystem.GetMapCoordinates(uid), args.User);
ManualCycle(uid, component, Transform(uid).MapPosition, args.User);
args.Handled = true;
}
@@ -162,7 +162,7 @@ public abstract partial class SharedGunSystem
{
Text = Loc.GetString("gun-ballistic-cycle"),
Disabled = GetBallisticShots(component) == 0,
Act = () => ManualCycle(uid, component, TransformSystem.GetMapCoordinates(uid), args.User),
Act = () => ManualCycle(uid, component, Transform(uid).MapPosition, args.User),
});
}

View File

@@ -431,7 +431,8 @@ public abstract partial class SharedGunSystem : EntitySystem
var coordinates = xform.Coordinates;
coordinates = coordinates.Offset(offsetPos);
TransformSystem.SetCoordinates(entity, xform, coordinates, Random.NextAngle());
TransformSystem.SetLocalRotation(xform, Random.NextAngle());
TransformSystem.SetCoordinates(entity, xform, coordinates);
// decides direction the casing ejects and only when not cycling
if (angle != null)