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

@@ -29,13 +29,13 @@ namespace Content.Server.Atmos.EntitySystems
{
if (airtight.FixAirBlockedDirectionInitialize)
{
var rotateEvent = new RotateEvent(airtight.Owner, Angle.Zero, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).WorldRotation);
var rotateEvent = new RotateEvent(airtight.Owner, Angle.Zero, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner).WorldRotation);
OnAirtightRotated(uid, airtight, ref rotateEvent);
}
// Adding this component will immediately anchor the entity, because the atmos system
// requires airtight entities to be anchored for performance.
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).Anchored = true;
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner).Anchored = true;
UpdatePosition(airtight);
}
@@ -54,8 +54,8 @@ namespace Content.Server.Atmos.EntitySystems
private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent airtight, ref AnchorStateChangedEvent args)
{
var gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).GridID;
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).Coordinates;
var gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner).GridID;
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner).Coordinates;
var grid = _mapManager.GetGrid(gridId);
var tilePos = grid.TileIndicesFor(coords);
@@ -84,11 +84,11 @@ namespace Content.Server.Atmos.EntitySystems
public void UpdatePosition(AirtightComponent airtight)
{
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).Anchored || !IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).GridID.IsValid())
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner).Anchored || !IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner).GridID.IsValid())
return;
var grid = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).GridID);
airtight.LastPosition = (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).GridID, grid.TileIndicesFor(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner.Uid).Coordinates));
var grid = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner).GridID);
airtight.LastPosition = (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner).GridID, grid.TileIndicesFor(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(airtight.Owner).Coordinates));
InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2, airtight.FixVacuum && !airtight.AirBlocked);
}

View File

@@ -136,16 +136,16 @@ namespace Content.Server.Atmos.EntitySystems
var entity = session.AttachedEntity;
var worldBounds = Box2.CenteredAround(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).WorldPosition,
var worldBounds = Box2.CenteredAround(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).WorldPosition,
new Vector2(LocalViewRange, LocalViewRange));
foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).MapID, worldBounds))
foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).MapID, worldBounds))
{
if (!EntityManager.TryGetEntity(grid.GridEntityId, out var gridEnt)) continue;
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<GridAtmosphereComponent?>(gridEnt.Uid, out var gam)) continue;
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<GridAtmosphereComponent?>(gridEnt, out var gam)) continue;
var entityTile = grid.GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates).GridIndices;
var entityTile = grid.GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates).GridIndices;
var baseTile = new Vector2i(entityTile.X - (LocalViewRange / 2), entityTile.Y - (LocalViewRange / 2));
var debugOverlayContent = new AtmosDebugOverlayData[LocalViewRange * LocalViewRange];

View File

@@ -1315,7 +1315,7 @@ namespace Content.Server.Atmos.EntitySystems
public bool AddAtmosDevice(AtmosDeviceComponent atmosDevice)
{
var grid = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(atmosDevice.Owner.Uid).GridID;
var grid = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(atmosDevice.Owner).GridID;
if (!_mapManager.TryGetGrid(grid, out var mapGrid))
return false;
@@ -1526,7 +1526,7 @@ namespace Content.Server.Atmos.EntitySystems
public bool TryGetMapGrid(GridAtmosphereComponent gridAtmosphere, [NotNullWhen(true)] out IMapGrid? mapGrid)
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(gridAtmosphere.Owner.Uid, out IMapGridComponent? mapGridComponent))
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(gridAtmosphere.Owner, out IMapGridComponent? mapGridComponent))
{
mapGrid = mapGridComponent.Grid;
return true;

View File

@@ -34,7 +34,7 @@ namespace Content.Server.Atmos.EntitySystems
foreach (var entity in _gridtileLookupSystem.GetEntitiesIntersecting(tile.GridIndex, tile.GridIndices))
{
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Uid, out IPhysBody? physics)
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out IPhysBody? physics)
|| !entity.IsMovedByPressure(out var pressure)
|| entity.IsInContainer())
continue;

View File

@@ -2,6 +2,7 @@ using Content.Server.Atmos.Components;
using Content.Server.Atmos.Reactions;
using Content.Shared.Atmos;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.Atmos.EntitySystems
@@ -143,7 +144,7 @@ namespace Content.Server.Atmos.EntitySystems
foreach (var entity in _gridtileLookupSystem.GetEntitiesIntersecting(tile.GridIndex, tile.GridIndices))
{
RaiseLocalEvent(entity.Uid, fireEvent, false);
RaiseLocalEvent(entity, fireEvent, false);
}
}
}

View File

@@ -314,7 +314,7 @@ namespace Content.Server.Atmos.EntitySystems
var number = 0;
while (atmosphere.CurrentRunAtmosDevices.TryDequeue(out var device))
{
RaiseLocalEvent(device.Owner.Uid, _updateEvent, false);
RaiseLocalEvent(device.Owner, _updateEvent, false);
device.LastProcess = time;
if (number++ < LagCheckIterations) continue;

View File

@@ -75,10 +75,10 @@ namespace Content.Server.Atmos.EntitySystems
{
foreach (var exposed in EntityManager.EntityQuery<AtmosExposedComponent>())
{
var tile = GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(exposed.Owner.Uid).Coordinates);
var tile = GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(exposed.Owner).Coordinates);
if (tile == null) continue;
var updateEvent = new AtmosExposedUpdateEvent(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(exposed.Owner.Uid).Coordinates, tile);
RaiseLocalEvent(exposed.Owner.Uid, ref updateEvent);
var updateEvent = new AtmosExposedUpdateEvent(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(exposed.Owner).Coordinates, tile);
RaiseLocalEvent(exposed.Owner, ref updateEvent);
}
_exposedTimer -= ExposedUpdateDelay;

View File

@@ -86,9 +86,9 @@ namespace Content.Server.Atmos.EntitySystems
if (totalDamage >= barotrauma.MaxDamage)
continue;
var uid = barotrauma.Owner.Uid;
var uid = (EntityUid) barotrauma.Owner;
var status = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ServerAlertsComponent>(barotrauma.Owner.Uid);
var status = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ServerAlertsComponent>(barotrauma.Owner);
var pressure = 1f;

View File

@@ -58,7 +58,7 @@ namespace Content.Server.Atmos.EntitySystems
return;
var isHotEvent = new IsHotEvent();
RaiseLocalEvent(args.Used.Uid, isHotEvent, false);
RaiseLocalEvent(args.Used, isHotEvent, false);
if (!isHotEvent.IsHot)
return;
@@ -69,7 +69,7 @@ namespace Content.Server.Atmos.EntitySystems
private void OnCollideEvent(EntityUid uid, FlammableComponent flammable, StartCollideEvent args)
{
var otherUid = args.OtherFixture.Body.Owner.Uid;
var otherUid = (EntityUid) args.OtherFixture.Body.Owner;
if (!EntityManager.TryGetComponent(otherUid, out FlammableComponent? otherFlammable))
return;
@@ -174,7 +174,7 @@ namespace Content.Server.Atmos.EntitySystems
if (!Resolve(uid, ref flammable, ref alerts))
return;
if (!flammable.OnFire || !_actionBlockerSystem.CanInteract(flammable.Owner.Uid) || flammable.Resisting)
if (!flammable.OnFire || !_actionBlockerSystem.CanInteract(flammable.Owner) || flammable.Resisting)
return;
flammable.Resisting = true;
@@ -217,7 +217,7 @@ namespace Content.Server.Atmos.EntitySystems
// TODO: This needs cleanup to take off the crust from TemperatureComponent and shit.
foreach (var (flammable, physics, transform) in EntityManager.EntityQuery<FlammableComponent, IPhysBody, TransformComponent>())
{
var uid = flammable.Owner.Uid;
var uid = (EntityUid) flammable.Owner;
// Slowly dry ourselves off if wet.
if (flammable.FireStacks < 0)
@@ -225,7 +225,7 @@ namespace Content.Server.Atmos.EntitySystems
flammable.FireStacks = MathF.Min(0, flammable.FireStacks + 1);
}
IoCManager.Resolve<IEntityManager>().TryGetComponent(flammable.Owner.Uid, out ServerAlertsComponent? status);
IoCManager.Resolve<IEntityManager>().TryGetComponent(flammable.Owner, out ServerAlertsComponent? status);
if (!flammable.OnFire)
{

View File

@@ -24,7 +24,7 @@ namespace Content.Server.Atmos.EntitySystems
private void AddOpenUIVerb(EntityUid uid, GasTankComponent component, GetActivationVerbsEvent args)
{
if (!args.CanAccess || !IoCManager.Resolve<IEntityManager>().TryGetComponent<ActorComponent?>(args.User.Uid, out var actor))
if (!args.CanAccess || !IoCManager.Resolve<IEntityManager>().TryGetComponent<ActorComponent?>(args.User, out var actor))
return;
Verb verb = new();

View File

@@ -197,17 +197,17 @@ namespace Content.Server.Atmos.EntitySystems
// This is the max in any direction that we can get a chunk (e.g. max 2 chunks away of data).
var (maxXDiff, maxYDiff) = ((int) (_updateRange / ChunkSize) + 1, (int) (_updateRange / ChunkSize) + 1);
var worldBounds = Box2.CenteredAround(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).WorldPosition,
var worldBounds = Box2.CenteredAround(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).WorldPosition,
new Vector2(_updateRange, _updateRange));
foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).MapID, worldBounds))
foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).MapID, worldBounds))
{
if (!_overlay.TryGetValue(grid.Index, out var chunks))
{
continue;
}
var entityTile = grid.GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity.Uid).Coordinates).GridIndices;
var entityTile = grid.GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates).GridIndices;
for (var x = -maxXDiff; x <= maxXDiff; x++)
{