Inline TryGetComponent completely, for real
This commit is contained in:
@@ -7,6 +7,7 @@ using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -142,7 +143,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
if (!EntityManager.TryGetEntity(grid.GridEntityId, out var gridEnt)) continue;
|
||||
|
||||
if (!gridEnt.TryGetComponent<GridAtmosphereComponent>(out var gam)) continue;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<GridAtmosphereComponent?>(gridEnt.Uid, out var gam)) continue;
|
||||
|
||||
var entityTile = grid.GetTileRef(entity.Transform.Coordinates).GridIndices;
|
||||
var baseTile = new Vector2i(entityTile.X - (LocalViewRange / 2), entityTile.Y - (LocalViewRange / 2));
|
||||
|
||||
@@ -1526,7 +1526,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
public bool TryGetMapGrid(GridAtmosphereComponent gridAtmosphere, [NotNullWhen(true)] out IMapGrid? mapGrid)
|
||||
{
|
||||
if (gridAtmosphere.Owner.TryGetComponent(out IMapGridComponent? mapGridComponent))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(gridAtmosphere.Owner.Uid, out IMapGridComponent? mapGridComponent))
|
||||
{
|
||||
mapGrid = mapGridComponent.Grid;
|
||||
return true;
|
||||
|
||||
@@ -5,6 +5,7 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
@@ -33,7 +34,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
foreach (var entity in _gridtileLookupSystem.GetEntitiesIntersecting(tile.GridIndex, tile.GridIndices))
|
||||
{
|
||||
if (!entity.TryGetComponent(out IPhysBody? physics)
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Uid, out IPhysBody? physics)
|
||||
|| !entity.IsMovedByPressure(out var pressure)
|
||||
|| entity.IsInContainer())
|
||||
continue;
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
flammable.FireStacks = MathF.Min(0, flammable.FireStacks + 1);
|
||||
}
|
||||
|
||||
flammable.Owner.TryGetComponent(out ServerAlertsComponent? status);
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(flammable.Owner.Uid, out ServerAlertsComponent? status);
|
||||
|
||||
if (!flammable.OnFire)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
private void AddOpenUIVerb(EntityUid uid, GasTankComponent component, GetActivationVerbsEvent args)
|
||||
{
|
||||
if (!args.CanAccess || !args.User.TryGetComponent<ActorComponent>(out var actor))
|
||||
if (!args.CanAccess || !IoCManager.Resolve<IEntityManager>().TryGetComponent<ActorComponent?>(args.User.Uid, out var actor))
|
||||
return;
|
||||
|
||||
Verb verb = new();
|
||||
|
||||
Reference in New Issue
Block a user