* Revert "Fix chat bubbles (#25643)" This reverts commit23d2c4d924. * Revert "Fixes obsolete Transform warnings in Content. (#25256)" This reverts commitf284b43ff6.
This commit is contained in:
@@ -47,7 +47,7 @@ namespace Content.Server.Administration.Commands
|
||||
? _entities.GetComponent<TransformComponent>(player.AttachedEntity.Value).Coordinates
|
||||
: EntitySystem.Get<GameTicker>().GetObserverSpawnPoint();
|
||||
var ghost = _entities.SpawnEntity(GameTicker.AdminObserverPrototypeName, coordinates);
|
||||
_entities.System<SharedTransformSystem>().AttachToGridOrMap(ghost);
|
||||
_entities.GetComponent<TransformComponent>(ghost).AttachToGridOrMap();
|
||||
|
||||
if (canReturn)
|
||||
{
|
||||
|
||||
@@ -105,7 +105,7 @@ public sealed class ExplosionCommand : IConsoleCommand
|
||||
if (args.Length > 4)
|
||||
coords = new MapCoordinates(new Vector2(x, y), xform.MapID);
|
||||
else
|
||||
coords = entMan.System<SharedTransformSystem>().GetMapCoordinates(xform);
|
||||
coords = xform.MapPosition;
|
||||
}
|
||||
|
||||
ExplosionPrototype? type;
|
||||
|
||||
@@ -118,10 +118,8 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
|
||||
var xform = _entManager.GetComponent<TransformComponent>(playerEntity);
|
||||
var xformSystem = _entManager.System<SharedTransformSystem>();
|
||||
|
||||
xformSystem.SetCoordinates((playerEntity, xform, _entManager.GetComponent<MetaDataComponent>(playerEntity)), coords);
|
||||
xformSystem.AttachToGridOrMap(playerEntity, xform);
|
||||
xform.Coordinates = coords;
|
||||
xform.AttachToGridOrMap();
|
||||
if (_entManager.TryGetComponent(playerEntity, out PhysicsComponent? physics))
|
||||
{
|
||||
_entManager.System<SharedPhysicsSystem>().SetLinearVelocity(playerEntity, Vector2.Zero, body: physics);
|
||||
|
||||
@@ -103,7 +103,7 @@ public sealed partial class AdminVerbSystem
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/smite.svg.192dpi.png")),
|
||||
Act = () =>
|
||||
{
|
||||
var coords = _transformSystem.GetMapCoordinates(args.Target);
|
||||
var coords = Transform(args.Target).MapPosition;
|
||||
Timer.Spawn(_gameTiming.TickPeriod,
|
||||
() => _explosionSystem.QueueExplosion(coords, ExplosionSystem.DefaultExplosionPrototypeId,
|
||||
4, 1, 2, maxTileBreak: 0), // it gibs, damage doesn't need to be high.
|
||||
@@ -134,8 +134,8 @@ public sealed partial class AdminVerbSystem
|
||||
Filter.PvsExcept(args.Target), true, PopupType.MediumCaution);
|
||||
var board = Spawn("ChessBoard", xform.Coordinates);
|
||||
var session = _tabletopSystem.EnsureSession(Comp<TabletopGameComponent>(board));
|
||||
_transformSystem.SetCoordinates((args.Target, xform, MetaData(args.Target)), EntityCoordinates.FromMap(_mapManager, session.Position));
|
||||
_transformSystem.SetWorldRotation(xform, Angle.Zero);
|
||||
xform.Coordinates = EntityCoordinates.FromMap(_mapManager, session.Position);
|
||||
xform.WorldRotation = Angle.Zero;
|
||||
},
|
||||
Impact = LogImpact.Extreme,
|
||||
Message = Loc.GetString("admin-smite-chess-dimension-description")
|
||||
@@ -407,7 +407,7 @@ public sealed partial class AdminVerbSystem
|
||||
{
|
||||
var xform = Transform(args.Target);
|
||||
var fixtures = Comp<FixturesComponent>(args.Target);
|
||||
_xformSystem.Unanchor(args.Target, xform); // Just in case.
|
||||
xform.Anchored = false; // Just in case.
|
||||
_physics.SetBodyType(args.Target, BodyType.Dynamic, manager: fixtures, body: physics);
|
||||
_physics.SetBodyStatus(physics, BodyStatus.InAir);
|
||||
_physics.WakeBody(args.Target, manager: fixtures, body: physics);
|
||||
@@ -441,7 +441,7 @@ public sealed partial class AdminVerbSystem
|
||||
{
|
||||
var xform = Transform(args.Target);
|
||||
var fixtures = Comp<FixturesComponent>(args.Target);
|
||||
_xformSystem.Unanchor(args.Target, xform); // Just in case.
|
||||
xform.Anchored = false; // Just in case.
|
||||
|
||||
_physics.SetBodyType(args.Target, BodyType.Dynamic, body: physics);
|
||||
_physics.SetBodyStatus(physics, BodyStatus.InAir);
|
||||
|
||||
@@ -40,7 +40,7 @@ public sealed class BluespaceAnomalySystem : EntitySystem
|
||||
foreach (var ent in allEnts)
|
||||
{
|
||||
if (xformQuery.TryGetComponent(ent, out var xf))
|
||||
coords.Add(_xform.GetWorldPosition(xf));
|
||||
coords.Add(xf.MapPosition.Position);
|
||||
}
|
||||
|
||||
_random.Shuffle(coords);
|
||||
|
||||
@@ -61,7 +61,7 @@ public sealed class ElectricityAnomalySystem : EntitySystem
|
||||
var damage = (int) (elec.MaxElectrocuteDamage * anom.Severity);
|
||||
var duration = elec.MaxElectrocuteDuration * anom.Severity;
|
||||
|
||||
foreach (var (ent, comp) in _lookup.GetEntitiesInRange<StatusEffectsComponent>(_transform.GetMapCoordinates((uid, xform)), range))
|
||||
foreach (var (ent, comp) in _lookup.GetEntitiesInRange<StatusEffectsComponent>(xform.MapPosition, range))
|
||||
{
|
||||
_electrocution.TryDoElectrocution(ent, uid, damage, duration, true, statusEffects: comp, ignoreInsulation: true);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ public sealed class InjectionAnomalySystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
private EntityQuery<InjectableSolutionComponent> _injectableQuery;
|
||||
|
||||
@@ -46,7 +45,7 @@ public sealed class InjectionAnomalySystem : EntitySystem
|
||||
//We get all the entity in the radius into which the reagent will be injected.
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
var xform = xformQuery.GetComponent(entity);
|
||||
var allEnts = _lookup.GetEntitiesInRange<InjectableSolutionComponent>(_xformSystem.GetMapCoordinates((entity.Owner, xform)), injectRadius)
|
||||
var allEnts = _lookup.GetEntitiesInRange<InjectableSolutionComponent>(xform.MapPosition, injectRadius)
|
||||
.Select(x => x.Owner).ToList();
|
||||
|
||||
//for each matching entity found
|
||||
|
||||
@@ -66,7 +66,7 @@ public sealed class AirFilterSystem : EntitySystem
|
||||
var oxygen = air.GetMoles(filter.Oxygen) / air.TotalMoles;
|
||||
var gases = oxygen >= filter.TargetOxygen ? filter.Gases : filter.OverflowGases;
|
||||
|
||||
var coordinates = _transform.GetMapCoordinates(uid);
|
||||
var coordinates = Transform(uid).MapPosition;
|
||||
GasMixture? destination = null;
|
||||
if (_map.TryFindGridAt(coordinates, out _, out var grid))
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
if (airtight.Comp.FixAirBlockedDirectionInitialize)
|
||||
{
|
||||
var moveEvent = new MoveEvent((airtight, xform, MetaData(airtight)), default, default, Angle.Zero, xform.LocalRotation);
|
||||
var moveEvent = new MoveEvent(airtight, default, default, Angle.Zero, xform.LocalRotation, xform, false);
|
||||
if (AirtightMove(airtight, ref moveEvent))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
return;
|
||||
|
||||
// Used by ExperiencePressureDifference to correct push/throw directions from tile-relative to physics world.
|
||||
var gridWorldRotation = _transformSystem.GetWorldRotation(gridAtmosphere);
|
||||
var gridWorldRotation = xforms.GetComponent(gridAtmosphere).WorldRotation;
|
||||
|
||||
// If we're using monstermos, smooth out the yeet direction to follow the flow
|
||||
if (MonstermosEqualization)
|
||||
@@ -238,7 +238,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
// TODO: Technically these directions won't be correct but uhh I'm just here for optimisations buddy not to fix my old bugs.
|
||||
if (throwTarget != EntityCoordinates.Invalid)
|
||||
{
|
||||
var pos = ((throwTarget.ToMap(EntityManager).Position - _transformSystem.GetWorldPosition(xform)).Normalized() + dirVec).Normalized();
|
||||
var pos = ((throwTarget.ToMap(EntityManager).Position - xform.WorldPosition).Normalized() + dirVec).Normalized();
|
||||
_physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -19,7 +19,6 @@ public sealed class BeamSystem : SharedBeamSystem
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedBroadphaseSystem _broadphase = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -145,8 +144,8 @@ public sealed class BeamSystem : SharedBeamSystem
|
||||
if (Deleted(user) || Deleted(target))
|
||||
return;
|
||||
|
||||
var userMapPos = _xformSystem.GetMapCoordinates(user);
|
||||
var targetMapPos = _xformSystem.GetMapCoordinates(target);
|
||||
var userMapPos = Transform(user).MapPosition;
|
||||
var targetMapPos = Transform(target).MapPosition;
|
||||
|
||||
//The distance between the target and the user.
|
||||
var calculatedDistance = targetMapPos.Position - userMapPos.Position;
|
||||
|
||||
@@ -12,7 +12,6 @@ public sealed class LogSystem : EntitySystem
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly RandomHelperSystem _randomHelper = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -40,7 +39,7 @@ public sealed class LogSystem : EntitySystem
|
||||
{
|
||||
var xform = Transform(plank);
|
||||
_containerSystem.AttachParentToContainerOrGrid((plank, xform));
|
||||
_xformSystem.SetLocalRotation(plank, 0, xform);
|
||||
xform.LocalRotation = 0;
|
||||
_randomHelper.RandomOffset(plank, 0.25f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ public sealed class RehydratableSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedPopupSystem _popups = default!;
|
||||
[Dependency] private readonly SolutionContainerSystem _solutions = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -41,7 +40,7 @@ public sealed class RehydratableSystem : EntitySystem
|
||||
|
||||
var target = Spawn(randomMob, Transform(uid).Coordinates);
|
||||
|
||||
_xformSystem.AttachToGridOrMap(target);
|
||||
Transform(target).AttachToGridOrMap();
|
||||
var ev = new GotRehydratedEvent(target);
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
||||
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
||||
[Dependency] private readonly ReactiveSystem _reactive = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
private const float ReactTime = 0.125f;
|
||||
|
||||
@@ -72,7 +71,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
|
||||
_throwing.TryThrow(vapor, dir, speed, user: user);
|
||||
|
||||
var distance = (target.Position - _xformSystem.GetWorldPosition(vaporXform)).Length();
|
||||
var distance = (target.Position - vaporXform.WorldPosition).Length();
|
||||
var time = (distance / physics.LinearVelocity.Length());
|
||||
despawn.Lifetime = MathF.Min(aliveTime, time);
|
||||
}
|
||||
|
||||
@@ -57,18 +57,16 @@ namespace Content.Server.Chemistry.ReactionEffects
|
||||
var spreadAmount = (int) Math.Max(0, Math.Ceiling((args.Quantity / OverflowThreshold).Float()));
|
||||
var splitSolution = args.Source.SplitSolution(args.Source.Volume);
|
||||
var transform = args.EntityManager.GetComponent<TransformComponent>(args.SolutionEntity);
|
||||
var xformSystem = args.EntityManager.System<SharedTransformSystem>();
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
var mapCoordinates = xformSystem.GetMapCoordinates((args.SolutionEntity, transform));
|
||||
if (!mapManager.TryFindGridAt(mapCoordinates, out _, out var grid) ||
|
||||
if (!mapManager.TryFindGridAt(transform.MapPosition, out _, out var grid) ||
|
||||
!grid.TryGetTileRef(transform.Coordinates, out var tileRef) ||
|
||||
tileRef.Tile.IsSpace())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var coords = grid.MapToGrid(mapCoordinates);
|
||||
var coords = grid.MapToGrid(transform.MapPosition);
|
||||
var ent = args.EntityManager.SpawnEntity(_prototypeId, coords.SnapToGrid());
|
||||
|
||||
var smoke = args.EntityManager.System<SmokeSystem>();
|
||||
|
||||
@@ -34,7 +34,7 @@ public sealed partial class CreateEntityReactionEffect : ReagentEffect
|
||||
|
||||
for (var i = 0; i < quantity; i++)
|
||||
{
|
||||
var uid = args.EntityManager.SpawnEntity(Entity, transformSystem.GetMapCoordinates((args.SolutionEntity, transform)));
|
||||
var uid = args.EntityManager.SpawnEntity(Entity, transform.MapPosition);
|
||||
transformSystem.AttachToGridOrMap(uid);
|
||||
|
||||
// TODO figure out how to properly spawn inside of containers
|
||||
|
||||
@@ -41,7 +41,7 @@ public sealed partial class EmpReactionEffect : ReagentEffect
|
||||
var range = MathF.Min((float) (args.Quantity*EmpRangePerUnit), EmpMaxRange);
|
||||
|
||||
args.EntityManager.System<EmpSystem>().EmpPulse(
|
||||
args.EntityManager.System<SharedTransformSystem>().GetMapCoordinates((args.SolutionEntity, transform)),
|
||||
transform.MapPosition,
|
||||
range,
|
||||
EnergyConsumption,
|
||||
DisableDuration);
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace Content.Server.Cloning
|
||||
}
|
||||
// end of genetic damage checks
|
||||
|
||||
var mob = Spawn(speciesPrototype.Prototype, _transformSystem.GetMapCoordinates(uid));
|
||||
var mob = Spawn(speciesPrototype.Prototype, Transform(uid).MapPosition);
|
||||
_humanoidSystem.CloneAppearance(bodyToClone, mob);
|
||||
|
||||
var ev = new CloningEvent(bodyToClone, mob);
|
||||
|
||||
@@ -54,16 +54,18 @@ namespace Content.Server.Commands
|
||||
public static string SubstituteEntityDetails(IConsoleShell shell, EntityUid ent, string ruleString)
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var xfmSys = entMan.System<SharedTransformSystem>();
|
||||
var transform = entMan.GetComponent<TransformComponent>(ent);
|
||||
var worldPosition = xfmSys.GetWorldPosition(transform);
|
||||
|
||||
// gross, is there a better way to do this?
|
||||
ruleString = ruleString.Replace("$ID", ent.ToString());
|
||||
ruleString = ruleString.Replace("$WX", worldPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$WY", worldPosition.Y.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$LX", transform.LocalPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$LY", transform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$WX",
|
||||
transform.WorldPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$WY",
|
||||
transform.WorldPosition.Y.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$LX",
|
||||
transform.LocalPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$LY",
|
||||
transform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$NAME", entMan.GetComponent<MetaDataComponent>(ent).EntityName);
|
||||
|
||||
if (shell.Player is { } player)
|
||||
@@ -71,13 +73,16 @@ namespace Content.Server.Commands
|
||||
if (player.AttachedEntity is {Valid: true} p)
|
||||
{
|
||||
var pTransform = entMan.GetComponent<TransformComponent>(p);
|
||||
var pPosition = xfmSys.GetWorldPosition(pTransform);
|
||||
|
||||
ruleString = ruleString.Replace("$PID", ent.ToString());
|
||||
ruleString = ruleString.Replace("$PWX", pPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$PWY", pPosition.Y.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$PLX", pTransform.LocalPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$PLY", pTransform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$PWX",
|
||||
pTransform.WorldPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$PWY",
|
||||
pTransform.WorldPosition.Y.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$PLX",
|
||||
pTransform.LocalPosition.X.ToString(CultureInfo.InvariantCulture));
|
||||
ruleString = ruleString.Replace("$PLY",
|
||||
pTransform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
return ruleString;
|
||||
|
||||
@@ -63,7 +63,6 @@ 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;
|
||||
@@ -98,7 +97,7 @@ namespace Content.Server.Construction.Commands
|
||||
|
||||
if (childXform.LocalRotation != Angle.Zero)
|
||||
{
|
||||
xformSystem.SetLocalRotation(child, Angle.Zero, childXform);
|
||||
childXform.LocalRotation = Angle.Zero;
|
||||
changed++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,14 +12,7 @@ namespace Content.Server.Construction.Completions
|
||||
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
|
||||
{
|
||||
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
||||
if (Value == transform.Anchored)
|
||||
return;
|
||||
|
||||
var xformSystem = entityManager.System<SharedTransformSystem>();
|
||||
if (Value)
|
||||
xformSystem.AnchorEntity((uid, transform));
|
||||
else
|
||||
xformSystem.Unanchor(uid, transform);
|
||||
transform.Anchored = Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,12 +14,13 @@ namespace Content.Server.Construction.Completions
|
||||
{
|
||||
var transform = entityManager.GetComponent<TransformComponent>(uid);
|
||||
|
||||
var xformSystem = entityManager.System<SharedTransformSystem>();
|
||||
if (!transform.Anchored)
|
||||
xformSystem.SetCoordinates((uid, transform, entityManager.GetComponent<MetaDataComponent>(uid)), transform.Coordinates.SnapToGrid(entityManager));
|
||||
transform.Coordinates = transform.Coordinates.SnapToGrid(entityManager);
|
||||
|
||||
if (SouthRotation)
|
||||
xformSystem.SetLocalRotation(uid, Angle.Zero, transform);
|
||||
{
|
||||
transform.LocalRotation = Angle.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,12 +362,9 @@ namespace Content.Server.Construction
|
||||
|
||||
// Transform transferring.
|
||||
var newTransform = Transform(newUid);
|
||||
_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);
|
||||
newTransform.AttachToGridOrMap(); // in case in hands or a container
|
||||
newTransform.LocalRotation = transform.LocalRotation;
|
||||
newTransform.Anchored = transform.Anchored;
|
||||
|
||||
// Container transferring.
|
||||
if (containerManager != null)
|
||||
|
||||
@@ -32,7 +32,6 @@ 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.
|
||||
@@ -83,7 +82,7 @@ namespace Content.Server.Construction
|
||||
}
|
||||
}
|
||||
|
||||
var pos = _xformSystem.GetMapCoordinates(user);
|
||||
var pos = Transform(user).MapPosition;
|
||||
|
||||
foreach (var near in _lookupSystem.GetEntitiesInRange(pos, 2f, LookupFlags.Contained | LookupFlags.Dynamic | LookupFlags.Sundries | LookupFlags.Approximate))
|
||||
{
|
||||
@@ -528,12 +527,10 @@ namespace Content.Server.Construction
|
||||
// ikr
|
||||
var xform = Transform(structure);
|
||||
var wasAnchored = xform.Anchored;
|
||||
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));
|
||||
xform.Anchored = false;
|
||||
xform.Coordinates = GetCoordinates(ev.Location);
|
||||
xform.LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.Zero;
|
||||
xform.Anchored = wasAnchored;
|
||||
|
||||
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}");
|
||||
|
||||
@@ -42,7 +42,6 @@ namespace Content.Server.Destructible
|
||||
[Dependency] public readonly IPrototypeManager PrototypeManager = default!;
|
||||
[Dependency] public readonly IComponentFactory ComponentFactory = default!;
|
||||
[Dependency] public readonly IAdminLogManager _adminLogger = default!;
|
||||
[Dependency] public readonly SharedTransformSystem TransformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -44,14 +44,14 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
var spawned = system.EntityManager.SpawnEntity(entityId, xform.Coordinates.Offset(system.Random.NextVector2(-Offset, Offset)));
|
||||
system.StackSystem.SetCount(spawned, toSpawn);
|
||||
system.TransformSystem.SetLocalRotation(spawned, system.Random.NextAngle());
|
||||
system.EntityManager.GetComponent<TransformComponent>(spawned).LocalRotation = system.Random.NextAngle();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var i = 0; i < toSpawn; i++)
|
||||
{
|
||||
var spawned = system.EntityManager.SpawnEntity(entityId, xform.Coordinates.Offset(system.Random.NextVector2(-Offset, Offset)));
|
||||
system.TransformSystem.SetLocalRotation(spawned, system.Random.NextAngle());
|
||||
system.EntityManager.GetComponent<TransformComponent>(spawned).LocalRotation = system.Random.NextAngle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
||||
|
||||
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
|
||||
{
|
||||
var position = system.TransformSystem.GetMapCoordinates(owner);
|
||||
var position = system.EntityManager.GetComponent<TransformComponent>(owner).MapPosition;
|
||||
|
||||
var getRandomVector = () => new Vector2(system.Random.NextFloat(-Offset, Offset), system.Random.NextFloat(-Offset, Offset));
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ namespace Content.Server.DeviceNetwork.Systems
|
||||
[UsedImplicitly]
|
||||
public sealed class WirelessNetworkSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -27,7 +25,7 @@ namespace Content.Server.DeviceNetwork.Systems
|
||||
return;
|
||||
|
||||
if (xform.MapID != args.SenderTransform.MapID
|
||||
|| (ownPosition - _xformSystem.GetWorldPosition(xform)).Length() > sendingComponent.Range)
|
||||
|| (ownPosition - xform.WorldPosition).Length() > sendingComponent.Range)
|
||||
{
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
@@ -37,8 +37,6 @@ namespace Content.Server.Disposal.Tube
|
||||
[Dependency] private readonly DisposableSystem _disposableSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -432,7 +430,8 @@ namespace Content.Server.Disposal.Tube
|
||||
if (!Resolve(uid, ref entry))
|
||||
return false;
|
||||
|
||||
var holder = Spawn(DisposalEntryComponent.HolderPrototypeId, _xformSystem.GetMapCoordinates(uid));
|
||||
var xform = Transform(uid);
|
||||
var holder = Spawn(DisposalEntryComponent.HolderPrototypeId, xform.MapPosition);
|
||||
var holderComponent = Comp<DisposalHolderComponent>(holder);
|
||||
|
||||
foreach (var entity in from.Container.ContainedEntities.ToArray())
|
||||
|
||||
@@ -28,7 +28,6 @@ public sealed partial class DragonSystem : EntitySystem
|
||||
[Dependency] private readonly RoleSystem _role = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _actions = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
private EntityQuery<CarpRiftsConditionComponent> _objQuery;
|
||||
|
||||
@@ -155,7 +154,7 @@ public sealed partial class DragonSystem : EntitySystem
|
||||
}
|
||||
|
||||
// cant put a rift on solars
|
||||
foreach (var tile in grid.GetTilesIntersecting(new Circle(_xformSystem.GetWorldPosition(xform), RiftTileRadius), false))
|
||||
foreach (var tile in grid.GetTilesIntersecting(new Circle(xform.WorldPosition, RiftTileRadius), false))
|
||||
{
|
||||
if (!tile.IsSpace(_tileDef))
|
||||
continue;
|
||||
@@ -164,7 +163,7 @@ public sealed partial class DragonSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
var carpUid = Spawn(component.RiftPrototype, _xformSystem.GetMapCoordinates((uid, xform)));
|
||||
var carpUid = Spawn(component.RiftPrototype, xform.MapPosition);
|
||||
component.Rifts.Add(carpUid);
|
||||
Comp<DragonRiftComponent>(carpUid).Dragon = uid;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Content.Server.Emp;
|
||||
public sealed class EmpSystem : SharedEmpSystem
|
||||
{
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public const string EmpPulseEffectPrototype = "EffectEmpPulse";
|
||||
|
||||
@@ -103,7 +102,7 @@ public sealed class EmpSystem : SharedEmpSystem
|
||||
|
||||
private void HandleEmpTrigger(EntityUid uid, EmpOnTriggerComponent comp, TriggerEvent args)
|
||||
{
|
||||
EmpPulse(_xformSystem.GetMapCoordinates(uid), comp.Range, comp.EnergyConsumption, comp.DisableDuration);
|
||||
EmpPulse(Transform(uid).MapPosition, comp.Range, comp.EnergyConsumption, comp.DisableDuration);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,15 +69,13 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
|
||||
return;
|
||||
|
||||
_needToTransform = true;
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var xfmSys = entMan.System<SharedTransformSystem>();
|
||||
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Grid.Owner);
|
||||
var size = (float) Grid.TileSize;
|
||||
|
||||
_matrix.R0C2 = size / 2;
|
||||
_matrix.R1C2 = size / 2;
|
||||
_matrix *= xfmSys.GetWorldMatrix(transform) * Matrix3.Invert(spaceMatrix);
|
||||
var relativeAngle = xfmSys.GetWorldRotation(transform) - spaceAngle;
|
||||
_matrix *= transform.WorldMatrix * Matrix3.Invert(spaceMatrix);
|
||||
var relativeAngle = transform.WorldRotation - spaceAngle;
|
||||
_offset = relativeAngle.RotateVec(new Vector2(size / 4, size / 4));
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
{
|
||||
var targetGrid = Comp<MapGridComponent>(referenceGrid.Value);
|
||||
var xform = Transform(referenceGrid.Value);
|
||||
targetAngle = _transformSystem.GetWorldRotation(xform);
|
||||
targetMatrix = _transformSystem.GetInvWorldMatrix(xform);
|
||||
targetAngle = xform.WorldRotation;
|
||||
targetMatrix = xform.InvWorldMatrix;
|
||||
tileSize = targetGrid.TileSize;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
|
||||
var xforms = EntityManager.GetEntityQuery<TransformComponent>();
|
||||
var xform = xforms.GetComponent(gridToTransform);
|
||||
var (_, gridWorldRotation, gridWorldMatrix, invGridWorldMatrid) = _transformSystem.GetWorldPositionRotationMatrixWithInv(xform);
|
||||
var (_, gridWorldRotation, gridWorldMatrix, invGridWorldMatrid) = xform.GetWorldPositionRotationMatrixWithInv(xforms);
|
||||
|
||||
var localEpicentre = (Vector2i) invGridWorldMatrid.Transform(epicentre.Position);
|
||||
var matrix = offsetMatrix * gridWorldMatrix * targetMatrix;
|
||||
|
||||
@@ -88,8 +88,8 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
if (referenceGrid != null)
|
||||
{
|
||||
var xform = Transform(_mapManager.GetGrid(referenceGrid.Value).Owner);
|
||||
spaceMatrix = _transformSystem.GetWorldMatrix(xform);
|
||||
spaceAngle = _transformSystem.GetWorldRotation(xform);
|
||||
spaceMatrix = xform.WorldMatrix;
|
||||
spaceAngle = xform.WorldRotation;
|
||||
}
|
||||
|
||||
// is the explosion starting on a grid?
|
||||
|
||||
@@ -382,7 +382,7 @@ public sealed partial class ExplosionSystem : EntitySystem
|
||||
if (player.AttachedEntity is not EntityUid uid)
|
||||
continue;
|
||||
|
||||
var playerPos = _transformSystem.GetWorldPosition(player.AttachedEntity!.Value);
|
||||
var playerPos = Transform(player.AttachedEntity!.Value).WorldPosition;
|
||||
var delta = epicenter.Position - playerPos;
|
||||
|
||||
if (delta.EqualsApprox(Vector2.Zero))
|
||||
|
||||
@@ -15,7 +15,6 @@ public sealed class SmokeOnTriggerSystem : SharedSmokeOnTriggerSystem
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapMan = default!;
|
||||
[Dependency] private readonly SmokeSystem _smoke = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -27,15 +26,14 @@ public sealed class SmokeOnTriggerSystem : SharedSmokeOnTriggerSystem
|
||||
private void OnTrigger(EntityUid uid, SmokeOnTriggerComponent comp, TriggerEvent args)
|
||||
{
|
||||
var xform = Transform(uid);
|
||||
var mapCoords = _xformSystem.GetMapCoordinates((uid, xform));
|
||||
if (!_mapMan.TryFindGridAt(mapCoords, out _, out var grid) ||
|
||||
if (!_mapMan.TryFindGridAt(xform.MapPosition, out _, out var grid) ||
|
||||
!grid.TryGetTileRef(xform.Coordinates, out var tileRef) ||
|
||||
tileRef.Tile.IsSpace())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var coords = grid.MapToGrid(mapCoords);
|
||||
var coords = grid.MapToGrid(xform.MapPosition);
|
||||
var ent = Spawn(comp.SmokePrototype, coords.SnapToGrid());
|
||||
if (!TryComp<SmokeComponent>(ent, out var smoke))
|
||||
{
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
|
||||
// Gets location of the implant
|
||||
var ownerXform = Transform(uid);
|
||||
var pos = _transformSystem.GetMapCoordinates((uid, ownerXform));
|
||||
var pos = ownerXform.MapPosition;
|
||||
var x = (int) pos.X;
|
||||
var y = (int) pos.Y;
|
||||
var posText = $"({x}, {y})";
|
||||
|
||||
@@ -37,7 +37,6 @@ namespace Content.Server.Flash
|
||||
[Dependency] private readonly PopupSystem _popup = default!;
|
||||
[Dependency] private readonly StunSystem _stun = default!;
|
||||
[Dependency] private readonly TagSystem _tag = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -33,7 +33,6 @@ public sealed class DrainSystem : SharedDrainSystem
|
||||
[Dependency] private readonly PuddleSystem _puddleSystem = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -156,7 +155,7 @@ public sealed class DrainSystem : SharedDrainSystem
|
||||
|
||||
puddles.Clear();
|
||||
|
||||
foreach (var entity in _lookup.GetEntitiesInRange(_xformSystem.GetMapCoordinates((uid, xform)), drain.Range))
|
||||
foreach (var entity in _lookup.GetEntitiesInRange(xform.MapPosition, drain.Range))
|
||||
{
|
||||
// No InRangeUnobstructed because there's no collision group that fits right now
|
||||
// and these are placed by mappers and not buildable/movable so shouldnt really be a problem...
|
||||
|
||||
@@ -13,7 +13,6 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly PuddleSystem _puddle = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
private readonly HashSet<ICommonSession> _playerObservers = new();
|
||||
private List<Entity<MapGridComponent>> _grids = new();
|
||||
@@ -56,7 +55,7 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst
|
||||
|
||||
var transform = EntityManager.GetComponent<TransformComponent>(entity);
|
||||
|
||||
var worldBounds = Box2.CenteredAround(_xformSystem.GetWorldPosition(transform),
|
||||
var worldBounds = Box2.CenteredAround(transform.WorldPosition,
|
||||
new Vector2(LocalViewRange, LocalViewRange));
|
||||
|
||||
_grids.Clear();
|
||||
|
||||
@@ -392,7 +392,7 @@ namespace Content.Server.GameTicking
|
||||
var gridXform = Transform(gridUid);
|
||||
|
||||
return new EntityCoordinates(gridUid,
|
||||
_transform.GetInvWorldMatrix(gridXform).Transform(toMap.Position));
|
||||
gridXform.InvWorldMatrix.Transform(toMap.Position));
|
||||
}
|
||||
|
||||
return spawn;
|
||||
|
||||
@@ -24,7 +24,6 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem<DeathMatchRuleComponen
|
||||
[Dependency] private readonly RespawnRuleSystem _respawn = default!;
|
||||
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
|
||||
[Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -98,7 +97,7 @@ public sealed class DeathMatchRuleSystem : GameRuleSystem<DeathMatchRuleComponen
|
||||
_point.AdjustPointValue(assist.PlayerId, 1, uid, point);
|
||||
|
||||
var spawns = EntitySpawnCollection.GetSpawns(dm.RewardSpawns).Cast<string?>().ToList();
|
||||
EntityManager.SpawnEntities(_xformSystem.GetMapCoordinates(ev.Entity), spawns);
|
||||
EntityManager.SpawnEntities(Transform(ev.Entity).MapPosition, spawns);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,6 @@ public sealed class PiratesRuleSystem : GameRuleSystem<PiratesRuleComponent>
|
||||
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
|
||||
[ValidatePrototypeId<EntityPrototype>]
|
||||
private const string GameRuleId = "Pirates";
|
||||
@@ -182,7 +180,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem<PiratesRuleComponent>
|
||||
|
||||
var aabbs = EntityQuery<StationDataComponent>().SelectMany(x =>
|
||||
x.Grids.Select(x =>
|
||||
_xformSystem.GetWorldMatrix(x).TransformBox(_mapManager.GetGridComp(x).LocalAABB)))
|
||||
xformQuery.GetComponent(x).WorldMatrix.TransformBox(_mapManager.GetGridComp(x).LocalAABB)))
|
||||
.ToArray();
|
||||
|
||||
var aabb = aabbs[0];
|
||||
|
||||
@@ -19,8 +19,6 @@ public abstract class BaseEntityReplaceVariationPassSystem<TEntComp, TGameRuleCo
|
||||
where TEntComp: IComponent
|
||||
where TGameRuleComp: IComponent
|
||||
{
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Used so we don't modify while enumerating
|
||||
/// if the replaced entity also has <see cref="TEntComp"/>.
|
||||
@@ -57,7 +55,7 @@ public abstract class BaseEntityReplaceVariationPassSystem<TEntComp, TGameRuleCo
|
||||
{
|
||||
var (spawn, coords, rot) = tup;
|
||||
var newEnt = Spawn(spawn, coords);
|
||||
_xformSystem.SetLocalRotation(newEnt, rot);
|
||||
Transform(newEnt).LocalRotation = rot;
|
||||
}
|
||||
|
||||
Log.Debug($"Entity replacement took {stopwatch.Elapsed} with {Stations.GetTileCount(args.Station)} tiles");
|
||||
|
||||
@@ -18,7 +18,6 @@ public sealed partial class GatherableSystem : EntitySystem
|
||||
[Dependency] private readonly DestructibleSystem _destructible = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -62,7 +61,7 @@ public sealed partial class GatherableSystem : EntitySystem
|
||||
if (component.MappedLoot == null)
|
||||
return;
|
||||
|
||||
var pos = _xformSystem.GetMapCoordinates(gatheredUid);
|
||||
var pos = Transform(gatheredUid).MapPosition;
|
||||
|
||||
foreach (var (tag, table) in component.MappedLoot)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,6 @@ namespace Content.Server.Guardian
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly BodySystem _bodySystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -212,7 +211,7 @@ namespace Content.Server.Guardian
|
||||
var hostXform = Transform(args.Args.Target.Value);
|
||||
var host = EnsureComp<GuardianHostComponent>(args.Args.Target.Value);
|
||||
// Use map position so it's not inadvertantly parented to the host + if it's in a container it spawns outside I guess.
|
||||
var guardian = Spawn(component.GuardianProto, _xformSystem.GetMapCoordinates(hostXform));
|
||||
var guardian = Spawn(component.GuardianProto, hostXform.MapPosition);
|
||||
|
||||
_container.Insert(guardian, host.GuardianContainer);
|
||||
host.HostedGuardian = guardian;
|
||||
|
||||
@@ -38,7 +38,6 @@ namespace Content.Server.Hands.Systems
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly PullingSystem _pullingSystem = default!;
|
||||
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -199,7 +198,7 @@ namespace Content.Server.Hands.Systems
|
||||
throwEnt = splitStack.Value;
|
||||
}
|
||||
|
||||
var direction = coordinates.ToMapPos(EntityManager) - _xformSystem.GetWorldPosition(player);
|
||||
var direction = coordinates.ToMapPos(EntityManager) - Transform(player).WorldPosition;
|
||||
if (direction == Vector2.Zero)
|
||||
return true;
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ public sealed class ImmovableRodSystem : EntitySystem
|
||||
[Dependency] private readonly PopupSystem _popup = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
@@ -65,11 +64,11 @@ public sealed class ImmovableRodSystem : EntitySystem
|
||||
var vel = component.DirectionOverride.Degrees switch
|
||||
{
|
||||
0f => _random.NextVector2(component.MinSpeed, component.MaxSpeed),
|
||||
_ => _xformSystem.GetWorldRotation(xform).RotateVec(component.DirectionOverride.ToVec()) * _random.NextFloat(component.MinSpeed, component.MaxSpeed)
|
||||
_ => xform.WorldRotation.RotateVec(component.DirectionOverride.ToVec()) * _random.NextFloat(component.MinSpeed, component.MaxSpeed)
|
||||
};
|
||||
|
||||
_physics.ApplyLinearImpulse(uid, vel, body: phys);
|
||||
_xformSystem.SetLocalRotation(uid, (vel - _xformSystem.GetWorldPosition(xform)).ToWorldAngle() + MathHelper.PiOver2, xform);
|
||||
xform.LocalRotation = (vel - xform.WorldPosition).ToWorldAngle() + MathHelper.PiOver2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ public sealed class SharpSystem : EntitySystem
|
||||
[Dependency] private readonly ContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -98,7 +97,7 @@ public sealed class SharpSystem : EntitySystem
|
||||
}
|
||||
|
||||
var spawnEntities = EntitySpawnCollection.GetSpawns(butcher.SpawnedEntities, _robustRandom);
|
||||
var coords = _xformSystem.GetMapCoordinates(args.Args.Target.Value);
|
||||
var coords = Transform(args.Args.Target.Value).MapPosition;
|
||||
EntityUid popupEnt = default!;
|
||||
foreach (var proto in spawnEntities)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,6 @@ public sealed class LightningSystem : SharedLightningSystem
|
||||
[Dependency] private readonly BeamSystem _beam = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -75,7 +74,7 @@ public sealed class LightningSystem : SharedLightningSystem
|
||||
//To Do: This is still pretty bad for perf but better than before and at least it doesn't re-allocate
|
||||
// several hashsets every time
|
||||
|
||||
var targets = _lookup.GetComponentsInRange<LightningTargetComponent>(_xformSystem.GetMapCoordinates(user), range).ToList();
|
||||
var targets = _lookup.GetComponentsInRange<LightningTargetComponent>(Transform(user).MapPosition, range).ToList();
|
||||
_random.Shuffle(targets);
|
||||
targets.Sort((x, y) => y.Priority.CompareTo(x.Priority));
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ public sealed class LightningTargetSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||
[Dependency] private readonly ExplosionSystem _explosionSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -30,7 +29,7 @@ public sealed class LightningTargetSystem : EntitySystem
|
||||
if (uid.Comp.LightningExplode)
|
||||
{
|
||||
_explosionSystem.QueueExplosion(
|
||||
_xformSystem.GetMapCoordinates(uid),
|
||||
Transform(uid).MapPosition,
|
||||
uid.Comp.ExplosionPrototype,
|
||||
uid.Comp.TotalIntensity, uid.Comp.Dropoff,
|
||||
uid.Comp.MaxTileIntensity,
|
||||
|
||||
@@ -278,7 +278,7 @@ public sealed class MagicSystem : EntitySystem
|
||||
if (transform.MapID != args.Target.GetMapId(EntityManager)) return;
|
||||
|
||||
_transformSystem.SetCoordinates(args.Performer, args.Target);
|
||||
_transformSystem.AttachToGridOrMap(args.Performer, transform);
|
||||
transform.AttachToGridOrMap();
|
||||
_audio.PlayPvs(args.BlinkSound, args.Performer, AudioParams.Default.WithVolume(args.BlinkVolume));
|
||||
Speak(args);
|
||||
args.Handled = true;
|
||||
@@ -321,7 +321,7 @@ public sealed class MagicSystem : EntitySystem
|
||||
ev.Handled = true;
|
||||
Speak(ev);
|
||||
|
||||
var direction = _transformSystem.GetWorldPosition(ev.Target) - _transformSystem.GetWorldPosition(ev.Performer);
|
||||
var direction = Transform(ev.Target).MapPosition.Position - Transform(ev.Performer).MapPosition.Position;
|
||||
var impulseVector = direction * 10000;
|
||||
|
||||
_physics.ApplyLinearImpulse(ev.Target, impulseVector);
|
||||
|
||||
@@ -12,7 +12,6 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
||||
{
|
||||
[Dependency] private readonly IConGroupController _admin = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
private readonly HashSet<ICommonSession> _draggers = new();
|
||||
|
||||
@@ -79,6 +78,6 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
||||
|
||||
var gridXform = Transform(grid);
|
||||
|
||||
_xformSystem.SetWorldPosition(gridXform, msg.WorldPosition);
|
||||
gridXform.WorldPosition = msg.WorldPosition;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public sealed class MechGrabberSystem : EntitySystem
|
||||
var (mechPos, mechRot) = _transform.GetWorldPositionRotation(mechxform);
|
||||
|
||||
var offset = mechPos + mechRot.RotateVec(component.DepositOffset);
|
||||
_transform.SetWorldPositionRotation(toRemove, offset, Angle.Zero, xform);
|
||||
_transform.SetWorldPositionRotation(xform, offset, Angle.Zero);
|
||||
_mech.UpdateUserInterface(mech);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public sealed partial class PathfindingSystem
|
||||
return Vector2.Zero;
|
||||
}
|
||||
|
||||
endPos = _transform.GetInvWorldMatrix(startXform).Transform(_transform.GetWorldMatrix(endXform).Transform(endPos));
|
||||
endPos = startXform.InvWorldMatrix.Transform(endXform.WorldMatrix.Transform(endPos));
|
||||
}
|
||||
|
||||
// TODO: Numerics when we changeover.
|
||||
|
||||
@@ -405,7 +405,7 @@ namespace Content.Server.NPC.Pathfinding
|
||||
return null;
|
||||
}
|
||||
|
||||
var localPos = _transform.GetInvWorldMatrix(xform).Transform(coordinates.ToMapPos(EntityManager));
|
||||
var localPos = xform.InvWorldMatrix.Transform(coordinates.ToMapPos(EntityManager));
|
||||
var origin = GetOrigin(localPos);
|
||||
|
||||
if (!TryGetChunk(origin, comp, out var chunk))
|
||||
|
||||
@@ -462,7 +462,7 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
|
||||
}
|
||||
|
||||
var targetPos = steering.Coordinates.ToMap(EntityManager, _transform);
|
||||
var ourPos = _transform.GetMapCoordinates((uid, xform));
|
||||
var ourPos = xform.MapPosition;
|
||||
|
||||
PrunePath(uid, ourPos, targetPos.Position - ourPos.Position, result.Path);
|
||||
steering.CurrentPath = new Queue<PathPoly>(result.Path);
|
||||
|
||||
@@ -369,7 +369,7 @@ public sealed class NPCUtilitySystem : EntitySystem
|
||||
if (compQuery.Components.Count == 0)
|
||||
return;
|
||||
|
||||
var mapPos = _transform.GetMapCoordinates(owner);
|
||||
var mapPos = _xformQuery.GetComponent(owner).MapPosition;
|
||||
_compTypes.Clear();
|
||||
var i = -1;
|
||||
EntityPrototype.ComponentRegistryEntry compZero = default!;
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace Content.Server.NPC.Systems;
|
||||
public sealed partial class NpcFactionSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
[Dependency] private readonly IPrototypeManager _protoManager = default!;
|
||||
|
||||
private ISawmill _sawmill = default!;
|
||||
@@ -154,7 +153,7 @@ public sealed partial class NpcFactionSystem : EntitySystem
|
||||
if (!xformQuery.TryGetComponent(entity, out var entityXform))
|
||||
yield break;
|
||||
|
||||
foreach (var ent in _lookup.GetEntitiesInRange<NpcFactionMemberComponent>(_xformSystem.GetMapCoordinates((entity, entityXform)), range))
|
||||
foreach (var ent in _lookup.GetEntitiesInRange<NpcFactionMemberComponent>(entityXform.MapPosition, range))
|
||||
{
|
||||
if (ent.Owner == entity)
|
||||
continue;
|
||||
|
||||
@@ -452,7 +452,7 @@ public sealed class NukeSystem : EntitySystem
|
||||
if (stationUid != null)
|
||||
_alertLevel.SetLevel(stationUid.Value, component.AlertLevelOnActivate, true, true, true, true);
|
||||
|
||||
var pos = _transform.GetMapCoordinates(nukeXform);
|
||||
var pos = nukeXform.MapPosition;
|
||||
var x = (int) pos.X;
|
||||
var y = (int) pos.Y;
|
||||
var posText = $"({x}, {y})";
|
||||
|
||||
@@ -54,7 +54,6 @@ public sealed class FoodSystem : EntitySystem
|
||||
[Dependency] private readonly StackSystem _stack = default!;
|
||||
[Dependency] private readonly StomachSystem _stomach = default!;
|
||||
[Dependency] private readonly UtensilSystem _utensil = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public const float MaxFeedDistance = 1.0f;
|
||||
|
||||
@@ -150,7 +149,7 @@ public sealed class FoodSystem : EntitySystem
|
||||
return (false, true);
|
||||
|
||||
// TODO make do-afters account for fixtures in the range check.
|
||||
if (!_xformSystem.GetMapCoordinates(user).InRange(_xformSystem.GetMapCoordinates(target), MaxFeedDistance))
|
||||
if (!Transform(user).MapPosition.InRange(Transform(target).MapPosition, MaxFeedDistance))
|
||||
{
|
||||
var message = Loc.GetString("interaction-system-user-interaction-cannot-reach");
|
||||
_popup.PopupEntity(message, user, user);
|
||||
@@ -326,7 +325,7 @@ public sealed class FoodSystem : EntitySystem
|
||||
}
|
||||
|
||||
//We're empty. Become trash.
|
||||
var position = _xformSystem.GetMapCoordinates(food);
|
||||
var position = Transform(food).MapPosition;
|
||||
var finisher = Spawn(component.Trash, position);
|
||||
|
||||
// If the user is holding the item
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace Content.Server.PDA.Ringer
|
||||
[Dependency] private readonly UserInterfaceSystem _ui = default!;
|
||||
[Dependency] private readonly AudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
private readonly Dictionary<NetUserId, TimeSpan> _lastSetRingtoneAt = new();
|
||||
|
||||
@@ -210,7 +209,7 @@ namespace Content.Server.PDA.Ringer
|
||||
|
||||
_audio.PlayEntity(
|
||||
GetSound(ringer.Ringtone[ringer.NoteCount]),
|
||||
Filter.Empty().AddInRange(_xformSystem.GetMapCoordinates(ringerXform), ringer.Range),
|
||||
Filter.Empty().AddInRange(ringerXform.MapPosition, ringer.Range),
|
||||
uid,
|
||||
true,
|
||||
AudioParams.Default.WithMaxDistance(ringer.Range).WithVolume(ringer.Volume)
|
||||
|
||||
@@ -797,7 +797,7 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
|
||||
// At least for now unless we do lookups or smth, only work with anchoring.
|
||||
if (_xformQuery.TryGetComponent(ent, out var xform) && !xform.Anchored)
|
||||
{
|
||||
_transform.AnchorEntity((ent, xform), (gridUid, grid), indices);
|
||||
_transform.AnchorEntity(ent, xform, gridUid, grid, indices);
|
||||
}
|
||||
|
||||
loadedEntities.Add(ent, indices);
|
||||
|
||||
@@ -20,7 +20,6 @@ public sealed class PayloadSystem : EntitySystem
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly IComponentFactory _componentFactory = default!;
|
||||
[Dependency] private readonly ISerializationManager _serializationManager = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -159,7 +158,7 @@ public sealed class PayloadSystem : EntitySystem
|
||||
var solStringB = SolutionContainerSystem.ToPrettyString(solutionB);
|
||||
|
||||
_adminLogger.Add(LogType.ChemicalReaction,
|
||||
$"Chemical bomb payload {ToPrettyString(entity.Owner):payload} at {_xformSystem.GetMapCoordinates(entity.Owner):location} is combining two solutions: {solStringA:solutionA} and {solStringB:solutionB}");
|
||||
$"Chemical bomb payload {ToPrettyString(entity.Owner):payload} at {Transform(entity.Owner).MapPosition:location} is combining two solutions: {solStringA:solutionA} and {solStringB:solutionB}");
|
||||
|
||||
solutionA.MaxVolume += solutionB.MaxVolume;
|
||||
_solutionContainerSystem.TryAddSolution(solnA.Value, solutionB);
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Content.Server.Physics.Controllers
|
||||
var baseRotation = pulledData.WorldRotation - pulledXform.LocalRotation;
|
||||
var localRotation = newAngle - baseRotation;
|
||||
var localRotationSnapped = Angle.FromDegrees(Math.Floor((localRotation.Degrees / ThresholdRotAngle) + 0.5f) * ThresholdRotAngle);
|
||||
TransformSystem.SetLocalRotation(pulled, localRotationSnapped, pulledXform);
|
||||
TransformSystem.SetLocalRotation(pulledXform, localRotationSnapped);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ namespace Content.Server.Physics.Controllers
|
||||
|
||||
// Now that's over with...
|
||||
|
||||
var pullerPosition = TransformSystem.GetMapCoordinates((puller, pullerXform));
|
||||
var pullerPosition = pullerXform.MapPosition;
|
||||
var movingTo = pullable.MovingTo.Value.ToMap(EntityManager, _transform);
|
||||
if (movingTo.MapId != pullerPosition.MapId)
|
||||
{
|
||||
@@ -163,7 +163,7 @@ namespace Content.Server.Physics.Controllers
|
||||
}
|
||||
|
||||
var movingPosition = movingTo.Position;
|
||||
var ownerPosition = TransformSystem.GetWorldPosition(pullableXform);
|
||||
var ownerPosition = pullableXform.MapPosition.Position;
|
||||
|
||||
var diff = movingPosition - ownerPosition;
|
||||
var diffLength = diff.Length();
|
||||
|
||||
@@ -37,7 +37,6 @@ namespace Content.Server.Pointing.EntitySystems
|
||||
[Dependency] private readonly VisibilitySystem _visibilitySystem = default!;
|
||||
[Dependency] private readonly SharedMindSystem _minds = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
private static readonly TimeSpan PointDelay = TimeSpan.FromSeconds(0.5f);
|
||||
|
||||
@@ -182,7 +181,7 @@ namespace Content.Server.Pointing.EntitySystems
|
||||
(eyeComp.VisibilityMask & layer) == 0)
|
||||
return false;
|
||||
|
||||
return _xformSystem.GetMapCoordinates(ent).InRange(_xformSystem.GetMapCoordinates(player), PointingRange);
|
||||
return Transform(ent).MapPosition.InRange(Transform(player).MapPosition, PointingRange);
|
||||
}
|
||||
|
||||
var viewers = Filter.Empty()
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace Content.Server.Pointing.EntitySystems
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly ExplosionSystem _explosion = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
private EntityUid? RandomNearbyPlayer(EntityUid uid, RoguePointingArrowComponent? component = null, TransformComponent? transform = null)
|
||||
{
|
||||
@@ -70,25 +69,24 @@ namespace Content.Server.Pointing.EntitySystems
|
||||
|
||||
if (component.TurningDelay > 0)
|
||||
{
|
||||
var difference = _xformSystem.GetWorldPosition(chasing) - _xformSystem.GetWorldPosition(transform);
|
||||
var difference = Comp<TransformComponent>(chasing).WorldPosition - transform.WorldPosition;
|
||||
var angle = difference.ToAngle();
|
||||
var adjusted = angle.Degrees + 90;
|
||||
var newAngle = Angle.FromDegrees(adjusted);
|
||||
|
||||
_xformSystem.SetWorldRotation(transform, newAngle);
|
||||
transform.WorldRotation = newAngle;
|
||||
|
||||
UpdateAppearance(uid, component, transform);
|
||||
continue;
|
||||
}
|
||||
|
||||
_xformSystem.SetWorldRotation(transform, _xformSystem.GetWorldRotation(transform) + Angle.FromDegrees(20));
|
||||
transform.WorldRotation += Angle.FromDegrees(20);
|
||||
|
||||
UpdateAppearance(uid, component, transform);
|
||||
|
||||
var worldPosition = _xformSystem.GetWorldPosition(transform);
|
||||
var toChased = _xformSystem.GetWorldPosition(chasing) - worldPosition;
|
||||
var toChased = Comp<TransformComponent>(chasing).WorldPosition - transform.WorldPosition;
|
||||
|
||||
_xformSystem.SetWorldPosition(transform, worldPosition + toChased * frameTime * component.ChasingSpeed);
|
||||
transform.WorldPosition += toChased * frameTime * component.ChasingSpeed;
|
||||
|
||||
component.ChasingTime -= frameTime;
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ public sealed partial class DungeonSystem
|
||||
|
||||
// If the templated entity was anchored then anchor us too.
|
||||
if (anchored && !childXform.Anchored)
|
||||
_transform.AnchorEntity((ent, childXform), (gridUid, grid));
|
||||
_transform.AnchorEntity(ent, childXform, grid);
|
||||
else if (!anchored && childXform.Anchored)
|
||||
_transform.Unanchor(ent, childXform);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly TurfSystem _turf = default!;
|
||||
[Dependency] private readonly IChatManager _chat = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -95,7 +94,7 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem
|
||||
{
|
||||
var xform = Transform(entityGridUid.Value);
|
||||
var pos = xform.Coordinates;
|
||||
var mapPos = _xformSystem.GetMapCoordinates((entityGridUid.Value, xform));
|
||||
var mapPos = xform.MapPosition;
|
||||
var circle = new Circle(mapPos.Position, 2);
|
||||
|
||||
var found = false;
|
||||
@@ -157,7 +156,7 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem
|
||||
var tile = tileRef.GridIndices;
|
||||
|
||||
var found = false;
|
||||
var (gridPos, _, gridMatrix) = _xformSystem.GetWorldPositionRotationMatrix(xform);
|
||||
var (gridPos, _, gridMatrix) = xform.GetWorldPositionRotationMatrix();
|
||||
var gridBounds = gridMatrix.TransformBox(grid.LocalAABB);
|
||||
|
||||
//Obviously don't put anything ridiculous in here
|
||||
|
||||
@@ -41,7 +41,6 @@ public sealed partial class RevenantSystem
|
||||
[Dependency] private readonly MobThresholdSystem _mobThresholdSystem = default!;
|
||||
[Dependency] private readonly GhostSystem _ghost = default!;
|
||||
[Dependency] private readonly TileSystem _tile = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
private void InitializeAbilities()
|
||||
{
|
||||
@@ -216,7 +215,7 @@ public sealed partial class RevenantSystem
|
||||
var xform = Transform(uid);
|
||||
if (!_mapManager.TryGetGrid(xform.GridUid, out var map))
|
||||
return;
|
||||
var tiles = map.GetTilesIntersecting(Box2.CenteredAround(_xformSystem.GetWorldPosition(xform),
|
||||
var tiles = map.GetTilesIntersecting(Box2.CenteredAround(xform.WorldPosition,
|
||||
new Vector2(component.DefileRadius * 2, component.DefileRadius))).ToArray();
|
||||
|
||||
_random.Shuffle(tiles);
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace Content.Server.Rotatable
|
||||
public sealed class RotatableSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly PopupSystem _popup = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -55,7 +54,7 @@ namespace Content.Server.Rotatable
|
||||
Verb resetRotation = new ()
|
||||
{
|
||||
DoContactInteraction = true,
|
||||
Act = () => _xformSystem.SetLocalRotation(uid, Angle.Zero),
|
||||
Act = () => EntityManager.GetComponent<TransformComponent>(uid).LocalRotation = Angle.Zero,
|
||||
Category = VerbCategory.Rotate,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/refresh.svg.192dpi.png")),
|
||||
Text = "Reset",
|
||||
@@ -67,11 +66,7 @@ namespace Content.Server.Rotatable
|
||||
// rotate clockwise
|
||||
Verb rotateCW = new()
|
||||
{
|
||||
Act = () =>
|
||||
{
|
||||
var xform = Transform(uid);
|
||||
_xformSystem.SetLocalRotation(uid, xform.LocalRotation - component.Increment, xform);
|
||||
},
|
||||
Act = () => EntityManager.GetComponent<TransformComponent>(uid).LocalRotation -= component.Increment,
|
||||
Category = VerbCategory.Rotate,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/rotate_cw.svg.192dpi.png")),
|
||||
Priority = -1,
|
||||
@@ -82,11 +77,7 @@ namespace Content.Server.Rotatable
|
||||
// rotate counter-clockwise
|
||||
Verb rotateCCW = new()
|
||||
{
|
||||
Act = () =>
|
||||
{
|
||||
var xform = Transform(uid);
|
||||
_xformSystem.SetLocalRotation(uid, xform.LocalRotation + component.Increment, xform);
|
||||
},
|
||||
Act = () => EntityManager.GetComponent<TransformComponent>(uid).LocalRotation += component.Increment,
|
||||
Category = VerbCategory.Rotate,
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/rotate_ccw.svg.192dpi.png")),
|
||||
Priority = 0,
|
||||
@@ -110,8 +101,8 @@ namespace Content.Server.Rotatable
|
||||
var oldTransform = EntityManager.GetComponent<TransformComponent>(uid);
|
||||
var entity = EntityManager.SpawnEntity(component.MirrorEntity, oldTransform.Coordinates);
|
||||
var newTransform = EntityManager.GetComponent<TransformComponent>(entity);
|
||||
_xformSystem.SetLocalRotation(entity, oldTransform.LocalRotation, newTransform);
|
||||
_xformSystem.Unanchor(entity, newTransform);
|
||||
newTransform.LocalRotation = oldTransform.LocalRotation;
|
||||
newTransform.Anchored = false;
|
||||
EntityManager.DeleteEntity(uid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,9 +275,9 @@ public sealed partial class ShuttleSystem
|
||||
var fromRotation = _transform.GetWorldRotation(xform);
|
||||
|
||||
var width = Comp<MapGridComponent>(uid).LocalAABB.Width;
|
||||
_transform.SetCoordinates((uid, xform, MetaData(uid)), new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value),
|
||||
new Vector2(_index + width / 2f, 0f)));
|
||||
_transform.SetLocalRotation(uid, Angle.Zero, xform);
|
||||
xform.Coordinates = new EntityCoordinates(_mapManager.GetMapEntityId(_hyperSpaceMap!.Value),
|
||||
new Vector2(_index + width / 2f, 0f));
|
||||
xform.LocalRotation = Angle.Zero;
|
||||
_index += width + Buffer;
|
||||
comp.Accumulator += comp.TravelTime - DefaultArrivalTime;
|
||||
|
||||
@@ -372,7 +372,7 @@ public sealed partial class ShuttleSystem
|
||||
}
|
||||
else
|
||||
{
|
||||
_transform.SetCoordinates((uid, xform, MetaData(uid)), comp.TargetCoordinates);
|
||||
xform.Coordinates = comp.TargetCoordinates;
|
||||
mapId = comp.TargetCoordinates.GetMapId(EntityManager);
|
||||
}
|
||||
|
||||
@@ -574,7 +574,7 @@ public sealed partial class ShuttleSystem
|
||||
|
||||
if (config != null)
|
||||
{
|
||||
FTLDock((shuttleUid, shuttleXform), config);
|
||||
FTLDock(config, shuttleXform);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -585,11 +585,11 @@ public sealed partial class ShuttleSystem
|
||||
/// <summary>
|
||||
/// Forces an FTL dock.
|
||||
/// </summary>
|
||||
public void FTLDock(Entity<TransformComponent> shuttle, DockingConfig config)
|
||||
public void FTLDock(DockingConfig config, TransformComponent shuttleXform)
|
||||
{
|
||||
// Set position
|
||||
_transform.SetCoordinates((shuttle.Owner, shuttle.Comp, MetaData(shuttle)), config.Coordinates);
|
||||
_transform.SetWorldRotation(shuttle.Comp, config.Angle);
|
||||
shuttleXform.Coordinates = config.Coordinates;
|
||||
_transform.SetWorldRotation(shuttleXform, config.Angle);
|
||||
|
||||
// Connect everything
|
||||
foreach (var (dockAUid, dockBUid, dockA, dockB) in config.Docks)
|
||||
@@ -702,15 +702,15 @@ public sealed partial class ShuttleSystem
|
||||
spawnPos = _transform.GetWorldPosition(targetXform, xformQuery);
|
||||
}
|
||||
|
||||
_transform.SetCoordinates((shuttleUid, xform, MetaData(shuttleUid)), new EntityCoordinates(targetXform.MapUid.Value, spawnPos));
|
||||
xform.Coordinates = new EntityCoordinates(targetXform.MapUid.Value, spawnPos);
|
||||
|
||||
if (!HasComp<MapComponent>(targetXform.GridUid))
|
||||
{
|
||||
_transform.SetLocalRotation(shuttleUid, _random.NextAngle(), xform);
|
||||
_transform.SetLocalRotation(xform, _random.NextAngle());
|
||||
}
|
||||
else
|
||||
{
|
||||
_transform.SetLocalRotation(shuttleUid, Angle.Zero, xform);
|
||||
_transform.SetLocalRotation(xform, Angle.Zero);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -206,7 +206,7 @@ public sealed partial class ShuttleSystem
|
||||
|
||||
if (config != null)
|
||||
{
|
||||
FTLDock((ent[0], shuttleXform), config);
|
||||
FTLDock(config, shuttleXform);
|
||||
|
||||
if (TryComp<StationMemberComponent>(xform.GridUid, out var stationMember))
|
||||
{
|
||||
|
||||
@@ -38,8 +38,8 @@ public sealed partial class ShuttleSystem
|
||||
|
||||
var otherXform = Transform(args.OtherEntity);
|
||||
|
||||
var ourPoint = _transform.GetInvWorldMatrix(ourXform).Transform(args.WorldPoint);
|
||||
var otherPoint = _transform.GetInvWorldMatrix(otherXform).Transform(args.WorldPoint);
|
||||
var ourPoint = ourXform.InvWorldMatrix.Transform(args.WorldPoint);
|
||||
var otherPoint = otherXform.InvWorldMatrix.Transform(args.WorldPoint);
|
||||
|
||||
var ourVelocity = _physics.GetLinearVelocity(uid, ourPoint, ourBody, ourXform);
|
||||
var otherVelocity = _physics.GetLinearVelocity(args.OtherEntity, otherPoint, otherBody, otherXform);
|
||||
|
||||
@@ -23,7 +23,6 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly SharedPointLightSystem _light = default!;
|
||||
[Dependency] private readonly TagSystem _tags = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -234,7 +233,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
|
||||
if (!gen1XForm.Anchored)
|
||||
return false;
|
||||
|
||||
var genWorldPosRot = _xformSystem.GetWorldPositionRotation(gen1XForm);
|
||||
var genWorldPosRot = gen1XForm.GetWorldPositionRotation();
|
||||
var dirRad = dir.ToAngle() + genWorldPosRot.WorldRotation; //needs to be like this for the raycast to work properly
|
||||
|
||||
var ray = new CollisionRay(genWorldPosRot.WorldPosition, dirRad.ToVec(), component.CollisionMask);
|
||||
@@ -311,14 +310,14 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
|
||||
var newField = Spawn(firstGen.Comp.CreatedField, currentCoords);
|
||||
|
||||
var fieldXForm = Transform(newField);
|
||||
_xformSystem.SetParent(newField, fieldXForm, firstGen);
|
||||
fieldXForm.AttachParent(firstGen);
|
||||
if (dirVec.GetDir() == Direction.East || dirVec.GetDir() == Direction.West)
|
||||
{
|
||||
var angle = fieldXForm.LocalPosition.ToAngle();
|
||||
var rotateBy90 = angle.Degrees + 90;
|
||||
var rotatedAngle = Angle.FromDegrees(rotateBy90);
|
||||
|
||||
_xformSystem.SetLocalRotation(newField, rotatedAngle, fieldXForm);
|
||||
fieldXForm.LocalRotation = rotatedAngle;
|
||||
}
|
||||
|
||||
fieldList.Add(newField);
|
||||
|
||||
@@ -13,7 +13,6 @@ public sealed class ContainmentFieldSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -35,8 +34,8 @@ public sealed class ContainmentFieldSystem : EntitySystem
|
||||
|
||||
if (TryComp<PhysicsComponent>(otherBody, out var physics) && physics.Mass <= component.MaxMass && physics.Hard)
|
||||
{
|
||||
var fieldDir = _xformSystem.GetWorldPosition(uid);
|
||||
var playerDir = _xformSystem.GetWorldPosition(otherBody);
|
||||
var fieldDir = Transform(uid).WorldPosition;
|
||||
var playerDir = Transform(otherBody).WorldPosition;
|
||||
|
||||
_throwing.TryThrow(otherBody, playerDir-fieldDir, strength: component.ThrowForce);
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
|
||||
var range2 = range * range;
|
||||
var xformQuery = EntityManager.GetEntityQuery<TransformComponent>();
|
||||
var epicenter = _xformSystem.GetWorldPosition(xform, xformQuery);
|
||||
foreach (var entity in _lookup.GetEntitiesInRange(_xformSystem.GetMapCoordinates((uid, xform)), range, flags: LookupFlags.Uncontained))
|
||||
foreach (var entity in _lookup.GetEntitiesInRange(xform.MapPosition, range, flags: LookupFlags.Uncontained))
|
||||
{
|
||||
if (entity == uid)
|
||||
continue;
|
||||
@@ -295,7 +295,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
|
||||
if (!Resolve(uid, ref xform) || !Resolve(uid, ref eventHorizon))
|
||||
return;
|
||||
|
||||
var mapPos = _xformSystem.GetMapCoordinates((uid, xform));
|
||||
var mapPos = xform.MapPosition;
|
||||
var box = Box2.CenteredAround(mapPos.Position, new Vector2(range, range));
|
||||
var circle = new Circle(mapPos.Position, range);
|
||||
var grids = new List<Entity<MapGridComponent>>();
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace Content.Server.Solar.EntitySystems
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physicsSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum panel angular velocity range - used to stop people rotating panels fast enough that the lag prevention becomes noticable
|
||||
@@ -113,7 +112,7 @@ namespace Content.Server.Solar.EntitySystems
|
||||
while (query.MoveNext(out var uid, out var panel, out var xform))
|
||||
{
|
||||
TotalPanelPower += panel.MaxSupply * panel.Coverage;
|
||||
_xformSystem.SetWorldRotation(xform, TargetPanelRotation);
|
||||
xform.WorldRotation = TargetPanelRotation;
|
||||
_updateQueue.Enqueue((uid, panel));
|
||||
}
|
||||
}
|
||||
@@ -136,7 +135,7 @@ namespace Content.Server.Solar.EntitySystems
|
||||
// directly downwards (abs(theta) = pi) = coverage -1
|
||||
// as TowardsSun + = CCW,
|
||||
// panelRelativeToSun should - = CW
|
||||
var panelRelativeToSun = _xformSystem.GetWorldRotation(xform) - TowardsSun;
|
||||
var panelRelativeToSun = xform.WorldRotation - TowardsSun;
|
||||
// essentially, given cos = X & sin = Y & Y is 'downwards',
|
||||
// then for the first 90 degrees of rotation in either direction,
|
||||
// this plots the lower-right quadrant of a circle.
|
||||
@@ -154,7 +153,7 @@ namespace Content.Server.Solar.EntitySystems
|
||||
if (coverage > 0)
|
||||
{
|
||||
// Determine if the solar panel is occluded, and zero out coverage if so.
|
||||
var ray = new CollisionRay(_xformSystem.GetWorldPosition(xform), TowardsSun.ToWorldVec(), (int) CollisionGroup.Opaque);
|
||||
var ray = new CollisionRay(xform.WorldPosition, TowardsSun.ToWorldVec(), (int) CollisionGroup.Opaque);
|
||||
var rayCastResults = _physicsSystem.IntersectRayWithPredicate(
|
||||
xform.MapID,
|
||||
ray,
|
||||
|
||||
@@ -13,7 +13,6 @@ public sealed class StandingStateSystem : EntitySystem
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
private void FallOver(EntityUid uid, StandingStateComponent component, DropHandItemsEvent args)
|
||||
{
|
||||
@@ -26,7 +25,7 @@ public sealed class StandingStateSystem : EntitySystem
|
||||
if (!TryComp(uid, out HandsComponent? handsComp))
|
||||
return;
|
||||
|
||||
var worldRotation = _xformSystem.GetWorldRotation(uid).ToVec();
|
||||
var worldRotation = EntityManager.GetComponent<TransformComponent>(uid).WorldRotation.ToVec();
|
||||
foreach (var hand in handsComp.Hands.Values)
|
||||
{
|
||||
if (hand.HeldEntity is not EntityUid held)
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace Content.Server.Worldgen.Systems;
|
||||
public abstract class BaseWorldSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly WorldControllerSystem _worldController = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a chunk's coordinates in chunk space as an integer value.
|
||||
@@ -26,7 +25,7 @@ public abstract class BaseWorldSystem : EntitySystem
|
||||
if (!Resolve(ent, ref xform))
|
||||
throw new Exception("Failed to resolve transform, somehow.");
|
||||
|
||||
return WorldGen.WorldToChunkCoords(_xformSystem.GetWorldPosition(xform)).Floored();
|
||||
return WorldGen.WorldToChunkCoords(xform.WorldPosition).Floored();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -41,7 +40,7 @@ public abstract class BaseWorldSystem : EntitySystem
|
||||
if (!Resolve(ent, ref xform))
|
||||
throw new Exception("Failed to resolve transform, somehow.");
|
||||
|
||||
return WorldGen.WorldToChunkCoords(_xformSystem.GetWorldPosition(xform));
|
||||
return WorldGen.WorldToChunkCoords(xform.WorldPosition);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems;
|
||||
public sealed class EmpArtifactSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly EmpSystem _emp = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xform = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
@@ -17,6 +16,6 @@ public sealed class EmpArtifactSystem : EntitySystem
|
||||
|
||||
private void OnActivate(EntityUid uid, EmpArtifactComponent component, ArtifactActivatedEvent args)
|
||||
{
|
||||
_emp.EmpPulse(_xform.GetMapCoordinates(uid), component.Range, component.EnergyConsumption, component.DisableDuration);
|
||||
_emp.EmpPulse(Transform(uid).MapPosition, component.Range, component.EnergyConsumption, component.DisableDuration);
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public sealed class SpawnArtifactSystem : EntitySystem
|
||||
if (component.Spawns is not {} spawns)
|
||||
return;
|
||||
|
||||
var artifactCord = _transform.GetMapCoordinates(uid);
|
||||
var artifactCord = Transform(uid).MapPosition;
|
||||
foreach (var spawn in EntitySpawnCollection.GetSpawns(spawns, _random))
|
||||
{
|
||||
var dx = _random.NextFloat(-component.Range, component.Range);
|
||||
|
||||
@@ -19,7 +19,6 @@ public sealed class ThrowArtifactSystem : EntitySystem
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
||||
[Dependency] private readonly TileSystem _tile = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
@@ -33,7 +32,7 @@ public sealed class ThrowArtifactSystem : EntitySystem
|
||||
if (_map.TryGetGrid(xform.GridUid, out var grid))
|
||||
{
|
||||
var tiles = grid.GetTilesIntersecting(
|
||||
Box2.CenteredAround(_xformSystem.GetWorldPosition(xform), new Vector2(component.Range * 2, component.Range)));
|
||||
Box2.CenteredAround(xform.WorldPosition, new Vector2(component.Range * 2, component.Range)));
|
||||
|
||||
foreach (var tile in tiles)
|
||||
{
|
||||
@@ -52,7 +51,9 @@ public sealed class ThrowArtifactSystem : EntitySystem
|
||||
&& (phys.CollisionMask & (int) CollisionGroup.GhostImpassable) != 0)
|
||||
continue;
|
||||
|
||||
var foo = _xformSystem.GetWorldPosition(ent) - _xformSystem.GetWorldPosition(xform);
|
||||
var tempXform = Transform(ent);
|
||||
|
||||
var foo = tempXform.MapPosition.Position - xform.MapPosition.Position;
|
||||
_throwing.TryThrow(ent, foo*2, component.ThrowStrength, uid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user