Replace all ITransformComponent by TransformComponent

This commit is contained in:
Vera Aguilera Puerto
2021-11-08 12:37:32 +01:00
parent 789ae63301
commit e6e15b3728
36 changed files with 53 additions and 53 deletions

View File

@@ -24,8 +24,8 @@ namespace Content.Client.Animations
{
new AnimationTrackComponentProperty
{
ComponentType = typeof(ITransformComponent),
Property = nameof(ITransformComponent.LocalRotation),
ComponentType = typeof(TransformComponent),
Property = nameof(TransformComponent.LocalRotation),
InterpolationMode = AnimationInterpolationMode.Linear,
KeyFrames =
{

View File

@@ -36,8 +36,8 @@ namespace Content.Client.Animations
{
new AnimationTrackComponentProperty
{
ComponentType = typeof(ITransformComponent),
Property = nameof(ITransformComponent.LocalPosition),
ComponentType = typeof(TransformComponent),
Property = nameof(TransformComponent.LocalPosition),
InterpolationMode = AnimationInterpolationMode.Linear,
KeyFrames =
{

View File

@@ -61,7 +61,7 @@ namespace Content.Client.Atmos.Visualizers
{
base.OnChangeData(component);
if (!component.Owner.TryGetComponent<ITransformComponent>(out var xform))
if (!component.Owner.TryGetComponent<TransformComponent>(out var xform))
return;
if (!component.Owner.TryGetComponent<ISpriteComponent>(out var sprite))

View File

@@ -48,7 +48,7 @@ namespace Content.Client.Popups
if (!EntityManager.EntityExists(uid))
return;
var transform = EntityManager.GetComponent<ITransformComponent>(uid);
var transform = EntityManager.GetComponent<TransformComponent>(uid);
PopupMessage(message, _eyeManager.CoordinatesToScreen(transform.Coordinates));
}

View File

@@ -28,8 +28,8 @@ namespace Content.IntegrationTests.Tests.Disposal
SubscribeLocalEvent<DoInsertDisposalUnitEvent>(ev =>
{
var (_, toInsert, unit) = ev;
var insertTransform = EntityManager.GetComponent<ITransformComponent>(toInsert);
var unitTransform = EntityManager.GetComponent<ITransformComponent>(unit);
var insertTransform = EntityManager.GetComponent<TransformComponent>(toInsert);
var unitTransform = EntityManager.GetComponent<TransformComponent>(unit);
// Not in a tube yet
Assert.That(insertTransform.Parent, Is.EqualTo(unitTransform));
}, after: new[] {typeof(SharedDisposalUnitSystem)});

View File

@@ -31,7 +31,7 @@ namespace Content.Server.Administration.Commands
var entityManager = IoCManager.Resolve<IEntityManager>();
if (!entityManager.TryGetComponent<ITransformComponent>(entityUid, out var transform)) return;
if (!entityManager.TryGetComponent<TransformComponent>(entityUid, out var transform)) return;
var parent = transform.ParentUid;

View File

@@ -32,7 +32,7 @@ namespace Content.Server.Administration.Commands
var entityManager = IoCManager.Resolve<IEntityManager>();
if (!entityManager.TryGetComponent<ITransformComponent>(entityUid, out var transform)) return;
if (!entityManager.TryGetComponent<TransformComponent>(entityUid, out var transform)) return;
var parent = transform.ParentUid;

View File

@@ -32,7 +32,7 @@ namespace Content.Server.Administration.Commands
var entityManager = IoCManager.Resolve<IEntityManager>();
if (!entityManager.TryGetComponent<ITransformComponent>(entityUid, out var transform)) return;
if (!entityManager.TryGetComponent<TransformComponent>(entityUid, out var transform)) return;
var parent = transform.ParentUid;

View File

@@ -70,7 +70,7 @@ namespace Content.Server.Atmos.EntitySystems
_timer -= UpdateTimer;
foreach (var (barotrauma, damageable, transform) in EntityManager.EntityQuery<BarotraumaComponent, DamageableComponent, ITransformComponent>(false))
foreach (var (barotrauma, damageable, transform) in EntityManager.EntityQuery<BarotraumaComponent, DamageableComponent, TransformComponent>(false))
{
var totalDamage = FixedPoint2.Zero;
foreach (var (barotraumaDamageType, _) in barotrauma.Damage.DamageDict)

View File

@@ -187,7 +187,7 @@ namespace Content.Server.Atmos.EntitySystems
_timer -= UpdateTime;
// TODO: This needs cleanup to take off the crust from TemperatureComponent and shit.
foreach (var (flammable, physics, transform) in EntityManager.EntityQuery<FlammableComponent, IPhysBody, ITransformComponent>())
foreach (var (flammable, physics, transform) in EntityManager.EntityQuery<FlammableComponent, IPhysBody, TransformComponent>())
{
var uid = flammable.Owner.Uid;

View File

@@ -51,7 +51,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
/// <summary>
/// Completely dumps the content of the canister into the world.
/// </summary>
public void PurgeContents(EntityUid uid, GasCanisterComponent? canister = null, ITransformComponent? transform = null)
public void PurgeContents(EntityUid uid, GasCanisterComponent? canister = null, TransformComponent? transform = null)
{
if (!Resolve(uid, ref canister, ref transform)) return;

View File

@@ -29,7 +29,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
private void OnPortableAnchorAttempt(EntityUid uid, GasPortableComponent component, AnchorAttemptEvent args)
{
if (!EntityManager.TryGetComponent(uid, out ITransformComponent? transform))
if (!EntityManager.TryGetComponent(uid, out TransformComponent? transform))
return;
// If we can't find any ports, cancel the anchoring.

View File

@@ -48,7 +48,7 @@ namespace Content.Server.Construction.Completions
container.Remove(board);
var transform = entityManager.GetComponent<ITransformComponent>(uid);
var transform = entityManager.GetComponent<TransformComponent>(uid);
var computer = entityManager.SpawnEntity(boardComponent.Prototype, transform.Coordinates);
computer.Transform.LocalRotation = transform.LocalRotation;

View File

@@ -61,7 +61,7 @@ namespace Content.Server.Construction.Completions
entBoardContainer.Remove(board);
var transform = entityManager.GetComponent<ITransformComponent>(uid);
var transform = entityManager.GetComponent<TransformComponent>(uid);
var machine = entityManager.SpawnEntity(boardComponent.Prototype, transform.Coordinates);
machine.Transform.LocalRotation = transform.LocalRotation;

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Construction.Completions
if (!entityManager.TryGetComponent(uid, out ContainerManagerComponent? containerManager))
return;
var transform = entityManager.GetComponent<ITransformComponent>(uid);
var transform = entityManager.GetComponent<TransformComponent>(uid);
foreach (var container in containerManager.GetAllContainers())
{
container.EmptyContainer(true, transform.Coordinates);

View File

@@ -21,7 +21,7 @@ namespace Content.Server.Construction.Completions
!containerManager.TryGetContainer(Container, out var container)) return;
// TODO: Use container system methods.
var transform = entityManager.GetComponent<ITransformComponent>(uid);
var transform = entityManager.GetComponent<TransformComponent>(uid);
foreach (var contained in container.ContainedEntities.ToArray())
{
container.ForceRemove(contained);

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Construction.Completions
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{
var transform = entityManager.GetComponent<ITransformComponent>(uid);
var transform = entityManager.GetComponent<TransformComponent>(uid);
transform.Anchored = Value;
}
}

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Construction.Completions
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{
var transform = entityManager.GetComponent<ITransformComponent>(uid);
var transform = entityManager.GetComponent<TransformComponent>(uid);
transform.Coordinates = transform.Coordinates.SnapToGrid(entityManager);
if (SouthRotation)

View File

@@ -21,7 +21,7 @@ namespace Content.Server.Construction.Completions
if (string.IsNullOrEmpty(Prototype))
return;
var coordinates = entityManager.GetComponent<ITransformComponent>(uid).Coordinates;
var coordinates = entityManager.GetComponent<TransformComponent>(uid).Coordinates;
if (EntityPrototypeHelpers.HasComponent<StackComponent>(Prototype))
{

View File

@@ -24,7 +24,7 @@ namespace Content.Server.Construction.Completions
var containerSystem = entityManager.EntitySysManager.GetEntitySystem<ContainerSystem>();
var container = containerSystem.EnsureContainer<Container>(uid, Container);
var coordinates = entityManager.GetComponent<ITransformComponent>(uid).Coordinates;
var coordinates = entityManager.GetComponent<TransformComponent>(uid).Coordinates;
for (var i = 0; i < Amount; i++)
{
container.Insert(entityManager.SpawnEntity(Prototype, coordinates));

View File

@@ -50,7 +50,7 @@ namespace Content.Server.Construction.Conditions
var type = IoCManager.Resolve<IComponentFactory>().GetRegistration(Component).Type;
var transform = entityManager.GetComponent<ITransformComponent>(uid);
var transform = entityManager.GetComponent<TransformComponent>(uid);
var indices = transform.Coordinates.ToVector2i(entityManager, IoCManager.Resolve<IMapManager>());
var entities = indices.GetEntitiesInTile(transform.GridID, LookupFlags.Approximate | LookupFlags.IncludeAnchored, IoCManager.Resolve<IEntityLookup>());

View File

@@ -19,7 +19,7 @@ namespace Content.Server.Construction.Conditions
public bool Condition(EntityUid uid, IEntityManager entityManager)
{
var transform = entityManager.GetComponent<ITransformComponent>(uid);
var transform = entityManager.GetComponent<TransformComponent>(uid);
return transform.Anchored && Anchored || !transform.Anchored && !Anchored;
}

View File

@@ -153,7 +153,7 @@ namespace Content.Server.Construction
private EntityUid? ChangeEntity(EntityUid uid, EntityUid? userUid, string newEntity,
ConstructionComponent? construction = null,
MetaDataComponent? metaData = null,
ITransformComponent? transform = null,
TransformComponent? transform = null,
ContainerManagerComponent? containerManager = null)
{
if (!Resolve(uid, ref construction, ref metaData, ref transform))
@@ -187,7 +187,7 @@ namespace Content.Server.Construction
}
// Transform transferring.
var newTransform = EntityManager.GetComponent<ITransformComponent>(newUid);
var newTransform = EntityManager.GetComponent<TransformComponent>(newUid);
newTransform.LocalRotation = transform.LocalRotation;
newTransform.Anchored = transform.Anchored;

View File

@@ -42,13 +42,13 @@ namespace Content.Server.DoAfter
if (eventArgs.BreakOnUserMove)
{
UserGrid = entityManager.GetComponent<ITransformComponent>(eventArgs.User).Coordinates;
UserGrid = entityManager.GetComponent<TransformComponent>(eventArgs.User).Coordinates;
}
if (eventArgs.BreakOnTargetMove)
{
// Target should never be null if the bool is set.
TargetGrid = entityManager.GetComponent<ITransformComponent>(eventArgs.Target!.Value).Coordinates;
TargetGrid = entityManager.GetComponent<TransformComponent>(eventArgs.Target!.Value).Coordinates;
}
// For this we need to stay on the same hand slot and need the same item in that hand slot
@@ -113,13 +113,13 @@ namespace Content.Server.DoAfter
}
// TODO :Handle inertia in space.
if (EventArgs.BreakOnUserMove && !entityManager.GetComponent<ITransformComponent>(EventArgs.User).Coordinates.InRange(
if (EventArgs.BreakOnUserMove && !entityManager.GetComponent<TransformComponent>(EventArgs.User).Coordinates.InRange(
entityManager, UserGrid, EventArgs.MovementThreshold))
{
return true;
}
if (EventArgs.BreakOnTargetMove && !entityManager.GetComponent<ITransformComponent>(EventArgs.Target!.Value).Coordinates.InRange(
if (EventArgs.BreakOnTargetMove && !entityManager.GetComponent<TransformComponent>(EventArgs.Target!.Value).Coordinates.InRange(
entityManager, TargetGrid, EventArgs.MovementThreshold))
{
return true;

View File

@@ -139,7 +139,7 @@ namespace Content.Server.Electrocution
public bool TryDoElectrifiedAct(EntityUid uid, EntityUid targetUid,
ElectrifiedComponent? electrified = null,
NodeContainerComponent? nodeContainer = null,
ITransformComponent? transform = null)
TransformComponent? transform = null)
{
if (!Resolve(uid, ref electrified, ref transform, false))
return false;
@@ -253,7 +253,7 @@ namespace Content.Server.Electrocution
float siemensCoefficient = 1f,
StatusEffectsComponent? statusEffects = null,
SharedAlertsComponent? alerts = null,
ITransformComponent? sourceTransform = null)
TransformComponent? sourceTransform = null)
{
if (!DoCommonElectrocutionAttempt(uid, sourceUid, ref siemensCoefficient))
return false;

View File

@@ -151,7 +151,7 @@ namespace Content.Server.Flash
public void FlashArea(EntityUid source, EntityUid? user, float range, float duration, float slowTo = 0f, bool displayPopup = false, SoundSpecifier? sound = null)
{
var transform = EntityManager.GetComponent<ITransformComponent>(source);
var transform = EntityManager.GetComponent<TransformComponent>(source);
foreach (var entity in _entityLookup.GetEntitiesInRange(transform.Coordinates, range))
{

View File

@@ -64,7 +64,7 @@ namespace Content.Server.GameTicking
throw new InvalidOperationException($"No grid found for map {map}");
}
var stationXform = EntityManager.GetComponent<ITransformComponent>(grid.GridEntityId);
var stationXform = EntityManager.GetComponent<TransformComponent>(grid.GridEntityId);
if (StationOffset)
{

View File

@@ -256,7 +256,7 @@ namespace Content.Server.GameTicking
_possiblePositions.Clear();
foreach (var (point, transform) in EntityManager.EntityQuery<SpawnPointComponent, ITransformComponent>())
foreach (var (point, transform) in EntityManager.EntityQuery<SpawnPointComponent, TransformComponent>())
{
if (point.SpawnType == SpawnPointType.Job && point.Job?.ID == jobId)
_possiblePositions.Add(transform.Coordinates);
@@ -274,7 +274,7 @@ namespace Content.Server.GameTicking
_possiblePositions.Clear();
foreach (var (point, transform) in EntityManager.EntityQuery<SpawnPointComponent, ITransformComponent>())
foreach (var (point, transform) in EntityManager.EntityQuery<SpawnPointComponent, TransformComponent>())
{
if (point.SpawnType == SpawnPointType.LateJoin) _possiblePositions.Add(transform.Coordinates);
}
@@ -292,7 +292,7 @@ namespace Content.Server.GameTicking
_possiblePositions.Clear();
foreach (var (point, transform) in EntityManager.EntityQuery<SpawnPointComponent, ITransformComponent>())
foreach (var (point, transform) in EntityManager.EntityQuery<SpawnPointComponent, TransformComponent>())
{
if (point.SpawnType == SpawnPointType.Observer)
_possiblePositions.Add(transform.Coordinates);

View File

@@ -48,7 +48,7 @@ namespace Content.Server.Pinpointer
/// Will return null if can't find anything
/// </summary>
private EntityUid? FindTargetFromWhitelist(EntityUid uid, EntityWhitelist whitelist,
ITransformComponent? transform = null)
TransformComponent? transform = null)
{
if (!Resolve(uid, ref transform))
return null;
@@ -125,9 +125,9 @@ namespace Content.Server.Pinpointer
private Vector2? CalculateDirection(EntityUid pinUid, EntityUid trgUid)
{
// check if entities have transform component
if (!EntityManager.TryGetComponent(pinUid, out ITransformComponent? pin))
if (!EntityManager.TryGetComponent(pinUid, out TransformComponent? pin))
return null;
if (!EntityManager.TryGetComponent(trgUid, out ITransformComponent? trg))
if (!EntityManager.TryGetComponent(trgUid, out TransformComponent? trg))
return null;
// check if they are on same map

View File

@@ -37,7 +37,7 @@ namespace Content.Server.Pointing.EntitySystems
}
}
private IEntity? RandomNearbyPlayer(EntityUid uid, RoguePointingArrowComponent? component = null, ITransformComponent? transform = null)
private IEntity? RandomNearbyPlayer(EntityUid uid, RoguePointingArrowComponent? component = null, TransformComponent? transform = null)
{
if (!Resolve(uid, ref component, ref transform))
return null;
@@ -55,7 +55,7 @@ namespace Content.Server.Pointing.EntitySystems
return _random.Pick(players).AttachedEntity;
}
private void UpdateAppearance(EntityUid uid, RoguePointingArrowComponent? component = null, ITransformComponent? transform = null, AppearanceComponent? appearance = null)
private void UpdateAppearance(EntityUid uid, RoguePointingArrowComponent? component = null, TransformComponent? transform = null, AppearanceComponent? appearance = null)
{
if (!Resolve(uid, ref component, ref transform, ref appearance) || component.Chasing == null)
return;
@@ -65,7 +65,7 @@ namespace Content.Server.Pointing.EntitySystems
public override void Update(float frameTime)
{
foreach (var (component, transform) in EntityManager.EntityQuery<RoguePointingArrowComponent, ITransformComponent>())
foreach (var (component, transform) in EntityManager.EntityQuery<RoguePointingArrowComponent, TransformComponent>())
{
var uid = component.Owner.Uid;
component.Chasing ??= RandomNearbyPlayer(uid, component, transform);

View File

@@ -49,7 +49,7 @@ namespace Content.Server.Power.EntitySystems
var mask = WireVisDirFlags.None;
var transform = EntityManager.GetComponent<ITransformComponent>(uid);
var transform = EntityManager.GetComponent<TransformComponent>(uid);
// Only valid grids allowed.
if(!transform.GridID.IsValid())

View File

@@ -52,7 +52,7 @@ namespace Content.Server.Tabletop
// TODO: some permission system, disallow movement if you're not permitted to move the item
// 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<ITransformComponent>(movedEntity.Uid);
var transform = EntityManager.GetComponent<TransformComponent>(movedEntity.Uid);
var entityCoordinates = new EntityCoordinates(_mapManager.GetMapEntityId(transform.MapID), msg.Coordinates.Position);
transform.Coordinates = entityCoordinates;
}

View File

@@ -113,7 +113,7 @@ namespace Content.Server.Tools
SoundSystem.Play(Filter.Pvs(uid), welder.WelderOnSounds.GetSound(), uid, AudioHelpers.WithVariation(0.125f).WithVolume(-5f));
// TODO: Use ITransformComponent directly.
// TODO: Use TransformComponent directly.
_atmosphereSystem.HotspotExpose(welder.Owner.Transform.Coordinates, 700, 50, true);
welder.Dirty();
@@ -316,7 +316,7 @@ namespace Content.Server.Tools
if (!_solutionContainerSystem.TryGetSolution(tool, welder.FuelSolution, out var solution, solutionContainer))
continue;
// TODO: Use ITransformComponent directly.
// TODO: Use TransformComponent directly.
_atmosphereSystem.HotspotExpose(welder.Owner.Transform.Coordinates, 700, 50, true);
solution.RemoveReagent(welder.FuelReagent, welder.FuelConsumption * _welderTimer);

View File

@@ -169,7 +169,7 @@ namespace Content.Shared.Movement
/// <summary>
/// Used for weightlessness to determine if we are near a wall.
/// </summary>
public static bool IsAroundCollider(SharedPhysicsSystem broadPhaseSystem, ITransformComponent transform, IMobMoverComponent mover, IPhysBody collider)
public static bool IsAroundCollider(SharedPhysicsSystem broadPhaseSystem, TransformComponent transform, IMobMoverComponent mover, IPhysBody collider)
{
var enlargedAABB = collider.GetWorldAABB().Enlarged(mover.GrabRange);

View File

@@ -142,7 +142,7 @@ namespace Content.Shared.SubFloor
private void UpdateEntity(EntityUid uid)
{
var transform = EntityManager.GetComponent<ITransformComponent>(uid);
var transform = EntityManager.GetComponent<TransformComponent>(uid);
if (!_mapManager.TryGetGrid(transform.GridID, out var grid))
{
@@ -175,7 +175,7 @@ namespace Content.Shared.SubFloor
subFloor = true;
}
// We only need to query the TransformComp if the SubfloorHide is enabled and requires anchoring.
else if (subFloorHideComponent.RequireAnchored && EntityManager.TryGetComponent(uid, out ITransformComponent? transformComponent))
else if (subFloorHideComponent.RequireAnchored && EntityManager.TryGetComponent(uid, out TransformComponent? transformComponent))
{
// If we require the entity to be anchored but it's not, this will set subfloor to true, unhiding it.
subFloor = !transformComponent.Anchored;

View File

@@ -4,7 +4,7 @@ namespace Content.Shared.Transform
{
public static class TransformExtensions
{
public static void AttachToGrandparent(this ITransformComponent transform)
public static void AttachToGrandparent(this TransformComponent transform)
{
var grandParent = transform.Parent?.Parent;