Inline UID

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 15:53:09 +01:00
parent 2654775bf0
commit 5cd42c9ad6
803 changed files with 3613 additions and 3577 deletions

View File

@@ -41,11 +41,11 @@ namespace Content.Server.Physics.Controllers
}
var direction = system.GetAngle(comp).ToVec();
var ownerPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner.Uid).WorldPosition;
var ownerPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner).WorldPosition;
foreach (var (entity, physics) in EntitySystem.Get<ConveyorSystem>().GetEntitiesToMove(comp))
{
var itemRelativeToConveyor = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).WorldPosition - ownerPos;
var itemRelativeToConveyor = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).WorldPosition - ownerPos;
physics.LinearVelocity += Convey(direction, comp.Speed, frameTime, itemRelativeToConveyor);
}
}

View File

@@ -53,7 +53,7 @@ namespace Content.Server.Physics.Controllers
foreach (var (mobMover, mover, physics) in EntityManager.EntityQuery<IMobMoverComponent, IMoverComponent, PhysicsComponent>())
{
_excludedMobs.Add(mover.Owner.Uid);
_excludedMobs.Add(mover.Owner);
HandleMobMovement(mover, physics, mobMover);
}
@@ -61,7 +61,7 @@ namespace Content.Server.Physics.Controllers
foreach (var (mover, physics) in EntityManager.EntityQuery<IMoverComponent, PhysicsComponent>(true))
{
if (_excludedMobs.Contains(mover.Owner.Uid)) continue;
if (_excludedMobs.Contains(mover.Owner)) continue;
HandleKinematicMovement(mover, physics);
}
@@ -75,7 +75,7 @@ namespace Content.Server.Physics.Controllers
foreach (var (pilot, mover, xform) in EntityManager.EntityQuery<PilotComponent, SharedPlayerInputMoverComponent, TransformComponent>())
{
if (pilot.Console == null) continue;
_excludedMobs.Add(mover.Owner.Uid);
_excludedMobs.Add(mover.Owner);
var gridId = xform.GridID;
@@ -271,7 +271,7 @@ namespace Content.Server.Physics.Controllers
{
if (!mover.Owner.HasTag("FootstepSound")) return;
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mover.Owner.Uid);
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mover.Owner);
var coordinates = transform.Coordinates;
var gridId = coordinates.GetGridId(EntityManager);
var distanceNeeded = mover.Sprinting ? StepSoundMoveDistanceRunning : StepSoundMoveDistanceWalking;
@@ -303,9 +303,9 @@ namespace Content.Server.Physics.Controllers
mobMover.StepSoundDistance -= distanceNeeded;
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<InventoryComponent?>(mover.Owner.Uid, out var inventory)
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<InventoryComponent?>(mover.Owner, out var inventory)
&& inventory.TryGetSlotItem<ItemComponent>(EquipmentSlotDefines.Slots.SHOES, out var item)
&& IoCManager.Resolve<IEntityManager>().TryGetComponent<FootstepModifierComponent?>(item.Owner.Uid, out var modifier))
&& IoCManager.Resolve<IEntityManager>().TryGetComponent<FootstepModifierComponent?>(item.Owner, out var modifier))
{
modifier.PlayFootstep();
}
@@ -352,7 +352,7 @@ namespace Content.Server.Physics.Controllers
SoundSystem.Play(
Filter.Pvs(coordinates),
soundToPlay,
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mover.Uid).Coordinates,
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mover).Coordinates,
sprinting ? AudioParams.Default.WithVolume(0.75f) : null);
}
}

View File

@@ -74,7 +74,7 @@ namespace Content.Server.Physics.Controllers
// Now that's over with...
var pullerPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(puller.Uid).MapPosition;
var pullerPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(puller).MapPosition;
var movingTo = pullable.MovingTo.Value.ToMap(IoCManager.Resolve<IEntityManager>());
if (movingTo.MapId != pullerPosition.MapId)
{
@@ -82,16 +82,16 @@ namespace Content.Server.Physics.Controllers
continue;
}
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<PhysicsComponent?>(pullable.Owner.Uid, out var physics) ||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<PhysicsComponent?>(pullable.Owner, out var physics) ||
physics.BodyType == BodyType.Static ||
movingTo.MapId != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pullable.Owner.Uid).MapID)
movingTo.MapId != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pullable.Owner).MapID)
{
_pullableSystem.StopMoveTo(pullable);
continue;
}
var movingPosition = movingTo.Position;
var ownerPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pullable.Owner.Uid).MapPosition.Position;
var ownerPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pullable.Owner).MapPosition.Position;
var diff = movingPosition - ownerPosition;
var diffLength = diff.Length;
@@ -119,7 +119,7 @@ namespace Content.Server.Physics.Controllers
var impulse = accel * physics.Mass * frameTime;
physics.ApplyLinearImpulse(impulse);
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<PhysicsComponent?>(puller.Uid, out var pullerPhysics))
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<PhysicsComponent?>(puller, out var pullerPhysics))
{
pullerPhysics.WakeBody();
pullerPhysics.ApplyLinearImpulse(-impulse);

View File

@@ -21,7 +21,7 @@ namespace Content.Server.Physics.Controllers
foreach (var (singularity, physics) in EntityManager.EntityQuery<ServerSingularityComponent, PhysicsComponent>())
{
if (IoCManager.Resolve<IEntityManager>().HasComponent<ActorComponent>(singularity.Owner.Uid) ||
if (IoCManager.Resolve<IEntityManager>().HasComponent<ActorComponent>(singularity.Owner) ||
singularity.BeingDeletedByAnotherSingularity) continue;
singularity.MoveAccumulator -= frameTime;