Fix 3000 errors

This commit is contained in:
DrSmugleaf
2021-12-05 18:09:01 +01:00
parent 2bfec7ec62
commit 2a3b7d809d
569 changed files with 2979 additions and 3280 deletions

View File

@@ -11,6 +11,8 @@ namespace Content.Server.Atmos.Commands
[AdminCommand(AdminFlags.Debug)]
public class AddAtmosCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entities = default!;
public string Command => "addatmos";
public string Description => "Adds atmos support to a grid.";
public string Help => $"{Command} <GridId>";
@@ -39,21 +41,19 @@ namespace Content.Server.Atmos.Commands
return;
}
var entMan = IoCManager.Resolve<IEntityManager>();
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
if (!_entities.EntityExists(gridComp.GridEntityId))
{
shell.WriteLine("Failed to get grid entity.");
return;
}
if (IoCManager.Resolve<IEntityManager>().HasComponent<IAtmosphereComponent>(grid))
if (_entities.HasComponent<IAtmosphereComponent>(gridComp.GridEntityId))
{
shell.WriteLine("Grid already has an atmosphere.");
return;
}
IoCManager.Resolve<IEntityManager>().AddComponent<GridAtmosphereComponent>(grid);
_entities.AddComponent<GridAtmosphereComponent>(gridComp.GridEntityId);
shell.WriteLine($"Added atmosphere to grid {id}.");
}

View File

@@ -41,19 +41,19 @@ namespace Content.Server.Atmos.Commands
var entMan = IoCManager.Resolve<IEntityManager>();
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
if (!entMan.EntityExists(gridComp.GridEntityId))
{
shell.WriteLine("Failed to get grid entity.");
return;
}
if (IoCManager.Resolve<IEntityManager>().HasComponent<IAtmosphereComponent>(grid))
if (entMan.HasComponent<IAtmosphereComponent>(gridComp.GridEntityId))
{
shell.WriteLine("Grid already has an atmosphere.");
return;
}
IoCManager.Resolve<IEntityManager>().AddComponent<UnsimulatedGridAtmosphereComponent>(grid);
entMan.AddComponent<UnsimulatedGridAtmosphereComponent>(gridComp.GridEntityId);
shell.WriteLine($"Added unsimulated atmosphere to grid {id}.");
}

View File

@@ -27,19 +27,20 @@ namespace Content.Server.Atmos.Commands
switch (args.Length)
{
case 0:
{
if (player == null)
{
shell.WriteLine("A grid must be specified when the command isn't used by a player.");
return;
}
if (player.AttachedEntity == null)
if (player.AttachedEntity is not {Valid: true} playerEntity)
{
shell.WriteLine("You have no entity to get a grid from.");
return;
}
gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.AttachedEntity).GridID;
gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(playerEntity).GridID;
if (gridId == GridId.Invalid)
{
@@ -48,6 +49,7 @@ namespace Content.Server.Atmos.Commands
}
break;
}
case 1:
{
if (!int.TryParse(args[0], out var number))
@@ -59,13 +61,13 @@ namespace Content.Server.Atmos.Commands
return;
}
if (player.AttachedEntity == null)
if (player.AttachedEntity is not {Valid: true} playerEntity)
{
shell.WriteLine("You have no entity from which to get a grid id.");
return;
}
gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.AttachedEntity).GridID;
gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(playerEntity).GridID;
if (gridId == GridId.Invalid)
{

View File

@@ -12,6 +12,8 @@ namespace Content.Server.Atmos.Components
[RegisterComponent]
public class BreathToolComponent : Component, IEquipped, IUnequipped
{
[Dependency] private readonly IEntityManager _entities = default!;
/// <summary>
/// Tool is functional only in allowed slots
/// </summary>
@@ -20,7 +22,7 @@ namespace Content.Server.Atmos.Components
public override string Name => "BreathMask";
public bool IsFunctional { get; private set; }
public IEntity? ConnectedInternalsEntity { get; private set; }
public EntityUid ConnectedInternalsEntity { get; private set; }
protected override void Shutdown()
{
@@ -33,7 +35,7 @@ namespace Content.Server.Atmos.Components
if ((EquipmentSlotDefines.SlotMasks[eventArgs.Slot] & _allowedSlots) != _allowedSlots) return;
IsFunctional = true;
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out InternalsComponent? internals))
if (_entities.TryGetComponent(eventArgs.User, out InternalsComponent? internals))
{
ConnectedInternalsEntity = eventArgs.User;
internals.ConnectBreathTool(Owner);
@@ -48,9 +50,9 @@ namespace Content.Server.Atmos.Components
public void DisconnectInternals()
{
var old = ConnectedInternalsEntity;
ConnectedInternalsEntity = null;
ConnectedInternalsEntity = default;
if (old != null && IoCManager.Resolve<IEntityManager>().TryGetComponent<InternalsComponent?>(old, out var internalsComponent))
if (old != default && _entities.TryGetComponent<InternalsComponent?>(old, out var internalsComponent))
{
internalsComponent.DisconnectBreathTool();
}

View File

@@ -13,7 +13,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Players;
using Robust.Shared.ViewVariables;
namespace Content.Server.Atmos.Components
@@ -21,6 +20,8 @@ namespace Content.Server.Atmos.Components
[RegisterComponent]
public class GasAnalyzerComponent : SharedGasAnalyzerComponent, IAfterInteract, IDropped, IUse
{
[Dependency] private readonly IEntityManager _entities = default!;
private GasAnalyzerDanger _pressureDanger;
private float _timeSinceSync;
private const float TimeBetweenSyncs = 2f;
@@ -40,7 +41,7 @@ namespace Content.Server.Atmos.Components
UserInterface.OnClosed += UserInterfaceOnClose;
}
IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out _appearance);
_entities.TryGetComponent(Owner, out _appearance);
}
public override ComponentState GetComponentState()
@@ -123,7 +124,7 @@ namespace Content.Server.Atmos.Components
{
// Already get the pressure before Dirty(), because we can't get the EntitySystem in that thread or smth
var pressure = 0f;
var tile = EntitySystem.Get<AtmosphereSystem>().GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
var tile = EntitySystem.Get<AtmosphereSystem>().GetTileMixture(_entities.GetComponent<TransformComponent>(Owner).Coordinates);
if (tile != null)
{
pressure = tile.Pressure;
@@ -158,24 +159,24 @@ namespace Content.Server.Atmos.Components
// Check if the player is still holding the gas analyzer => if not, don't update
foreach (var session in UserInterface.SubscribedSessions)
{
if (session.AttachedEntity == null)
if (session.AttachedEntity is not {Valid: true} playerEntity)
return;
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(session.AttachedEntity, out HandsComponent? handsComponent))
if (!_entities.TryGetComponent(playerEntity, out HandsComponent? handsComponent))
return;
var activeHandEntity = handsComponent?.GetActiveHand?.Owner;
if (activeHandEntity == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(activeHandEntity, out GasAnalyzerComponent? gasAnalyzer))
if (handsComponent?.GetActiveHand?.Owner is not {Valid: true} activeHandEntity ||
!_entities.TryGetComponent(activeHandEntity, out GasAnalyzerComponent? gasAnalyzer))
{
return;
}
}
var pos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates;
var pos = _entities.GetComponent<TransformComponent>(Owner).Coordinates;
if (!_checkPlayer && _position.HasValue)
{
// Check if position is out of range => don't update
if (!_position.Value.InRange(IoCManager.Resolve<IEntityManager>(), pos, SharedInteractionSystem.InteractionRange))
if (!_position.Value.InRange(_entities, pos, SharedInteractionSystem.InteractionRange))
return;
pos = _position.Value;
@@ -220,20 +221,19 @@ namespace Content.Server.Atmos.Components
switch (message)
{
case GasAnalyzerRefreshMessage msg:
var player = serverMsg.Session.AttachedEntity;
if (player == null)
if (serverMsg.Session.AttachedEntity is not {Valid: true} player)
{
return;
}
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(player, out HandsComponent? handsComponent))
if (!_entities.TryGetComponent(player, out HandsComponent? handsComponent))
{
Owner.PopupMessage(player, Loc.GetString("gas-analyzer-component-player-has-no-hands-message"));
return;
}
var activeHandEntity = handsComponent.GetActiveHand?.Owner;
if (activeHandEntity == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(activeHandEntity, out GasAnalyzerComponent? gasAnalyzer))
if (handsComponent.GetActiveHand?.Owner is not {Valid: true} activeHandEntity ||
!_entities.TryGetComponent(activeHandEntity, out GasAnalyzerComponent? gasAnalyzer))
{
serverMsg.Session.AttachedEntity?.PopupMessage(Loc.GetString("gas-analyzer-component-need-gas-analyzer-in-hand-message"));
return;
@@ -253,7 +253,7 @@ namespace Content.Server.Atmos.Components
return true;
}
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
if (_entities.TryGetComponent(eventArgs.User, out ActorComponent? actor))
{
OpenInterface(actor.PlayerSession, eventArgs.ClickLocation);
}
@@ -265,7 +265,7 @@ namespace Content.Server.Atmos.Components
void IDropped.Dropped(DroppedEventArgs eventArgs)
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
if (_entities.TryGetComponent(eventArgs.User, out ActorComponent? actor))
{
CloseInterface(actor.PlayerSession);
}
@@ -273,7 +273,7 @@ namespace Content.Server.Atmos.Components
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
if (_entities.TryGetComponent(eventArgs.User, out ActorComponent? actor))
{
ToggleInterface(actor.PlayerSession);
return true;

View File

@@ -175,7 +175,7 @@ namespace Content.Server.Atmos.Components
UpdateUserInterface();
}
public void DisconnectFromInternals(IEntity? owner = null)
public void DisconnectFromInternals(EntityUid? owner = null)
{
if (!IsConnected) return;
IsConnected = false;
@@ -190,7 +190,7 @@ namespace Content.Server.Atmos.Components
new GasTankBoundUserInterfaceState
{
TankPressure = Air?.Pressure ?? 0,
OutputPressure = initialUpdate ? OutputPressure : (float?) null,
OutputPressure = initialUpdate ? OutputPressure : null,
InternalsConnected = IsConnected,
CanConnectInternals = IsFunctional && internals != null
});
@@ -216,7 +216,7 @@ namespace Content.Server.Atmos.Components
{
var user = GetInternalsComponent()?.Owner;
if (user == null || !EntitySystem.Get<ActionBlockerSystem>().CanUse(user))
if (user == null || !EntitySystem.Get<ActionBlockerSystem>().CanUse(user.Value))
return;
if (IsConnected)
@@ -228,10 +228,10 @@ namespace Content.Server.Atmos.Components
ConnectToInternals();
}
private InternalsComponent? GetInternalsComponent(IEntity? owner = null)
private InternalsComponent? GetInternalsComponent(EntityUid? owner = null)
{
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted) return null;
if (owner != null) return IoCManager.Resolve<IEntityManager>().GetComponentOrNull<InternalsComponent>(owner);
if (owner != null) return IoCManager.Resolve<IEntityManager>().GetComponentOrNull<InternalsComponent>(owner.Value);
return Owner.TryGetContainer(out var container)
? IoCManager.Resolve<IEntityManager>().GetComponentOrNull<InternalsComponent>(container.Owner)
: null;
@@ -271,7 +271,7 @@ namespace Content.Server.Atmos.Components
EntitySystem.Get<ExplosionSystem>().SpawnExplosion(((IComponent) this).Owner, (int) (range * 0.25f), (int) (range * 0.5f), (int) (range * 1.5f), 1);
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity((EntityUid) Owner);
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(Owner);
return;
}
@@ -285,7 +285,7 @@ namespace Content.Server.Atmos.Components
SoundSystem.Play(Filter.Pvs(Owner), _ruptureSound.GetSound(), IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates, AudioHelpers.WithVariation(0.125f));
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity((EntityUid) Owner);
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(Owner);
return;
}

View File

@@ -11,7 +11,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
namespace Content.Server.Atmos.EntitySystems
{
@@ -132,18 +131,18 @@ namespace Content.Server.Atmos.EntitySystems
// Afterwards we reset all the chunk data for the next time we tick.
foreach (var session in _playerObservers)
{
if (session.AttachedEntity == null) continue;
var entity = session.AttachedEntity;
if (session.AttachedEntity is not {Valid: true} entity)
continue;
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).MapID, worldBounds))
{
if (!EntityManager.TryGetEntity(grid.GridEntityId, out var gridEnt)) continue;
if (!EntityManager.EntityExists(grid.GridEntityId))
continue;
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<GridAtmosphereComponent?>(gridEnt, out var gam)) continue;
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<GridAtmosphereComponent?>(grid.GridEntityId, out var gam)) continue;
var entityTile = grid.GetTileRef(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates).GridIndices;
var baseTile = new Vector2i(entityTile.X - (LocalViewRange / 2), entityTile.Y - (LocalViewRange / 2));

View File

@@ -1,7 +1,6 @@
using Content.Server.Atmos.Components;
using Content.Shared.Atmos;
using Content.Shared.Audio;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
@@ -63,7 +62,7 @@ namespace Content.Server.Atmos.EntitySystems
if (difference > tile.PressureDifference)
{
tile.PressureDifference = difference;
tile.PressureDirection = ((Vector2i)(tile.GridIndices - other.GridIndices)).GetDir().ToAtmosDirection();
tile.PressureDirection = (tile.GridIndices - other.GridIndices).GetDir().ToAtmosDirection();
}
}
}

View File

@@ -1,9 +1,7 @@
using System;
using System.Data;
using Content.Server.Administration.Logs;
using Content.Server.Alert;
using Content.Server.Atmos.Components;
using Content.Shared.Administration.Logs;
using Content.Shared.Alert;
using Content.Shared.Atmos;
using Content.Shared.Damage;
@@ -86,7 +84,7 @@ namespace Content.Server.Atmos.EntitySystems
if (totalDamage >= barotrauma.MaxDamage)
continue;
var uid = (EntityUid) barotrauma.Owner;
var uid = barotrauma.Owner;
var status = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ServerAlertsComponent>(barotrauma.Owner);

View File

@@ -6,7 +6,6 @@ using Content.Server.Atmos.Components;
using Content.Server.Stunnable;
using Content.Server.Temperature.Systems;
using Content.Shared.ActionBlocker;
using Content.Shared.Administration.Logs;
using Content.Shared.Alert;
using Content.Shared.Atmos;
using Content.Shared.Damage;
@@ -69,7 +68,7 @@ namespace Content.Server.Atmos.EntitySystems
private void OnCollideEvent(EntityUid uid, FlammableComponent flammable, StartCollideEvent args)
{
var otherUid = (EntityUid) args.OtherFixture.Body.Owner;
var otherUid = args.OtherFixture.Body.Owner;
if (!EntityManager.TryGetComponent(otherUid, out FlammableComponent? otherFlammable))
return;
@@ -217,7 +216,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 = (EntityUid) flammable.Owner;
var uid = flammable.Owner;
// Slowly dry ourselves off if wet.
if (flammable.FireStacks < 0)

View File

@@ -19,17 +19,16 @@ using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
// ReSharper disable once RedundantUsingDirective
using Dependency = Robust.Shared.IoC.DependencyAttribute;
namespace Content.Server.Atmos.EntitySystems
{
[UsedImplicitly]
internal sealed class GasTileOverlaySystem : SharedGasTileOverlaySystem
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Robust.Shared.IoC.Dependency] private readonly IGameTiming _gameTiming = default!;
[Robust.Shared.IoC.Dependency] private readonly IPlayerManager _playerManager = default!;
[Robust.Shared.IoC.Dependency] private readonly IMapManager _mapManager = default!;
[Robust.Shared.IoC.Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
/// <summary>
/// The tiles that have had their atmos data updated since last tick
@@ -190,7 +189,7 @@ namespace Content.Server.Atmos.EntitySystems
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
private List<GasOverlayChunk> GetChunksInRange(IEntity entity)
private List<GasOverlayChunk> GetChunksInRange(EntityUid entity)
{
var inRange = new List<GasOverlayChunk>();
@@ -311,10 +310,10 @@ namespace Content.Server.Atmos.EntitySystems
// Afterwards we reset all the chunk data for the next time we tick.
foreach (var (session, overlay) in _knownPlayerChunks)
{
if (session.AttachedEntity == null) continue;
if (session.AttachedEntity is not {Valid: true} entity) continue;
// Get chunks in range and update if we've moved around or the chunks have new overlay data
var chunksInRange = GetChunksInRange(session.AttachedEntity);
var chunksInRange = GetChunksInRange(entity);
var knownChunks = overlay.GetKnownChunks();
var chunksToRemove = new List<GasOverlayChunk>();
var chunksToAdd = new List<GasOverlayChunk>();

View File

@@ -4,14 +4,11 @@ using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.Unary.Components;
using Content.Server.Destructible;
using Content.Server.Hands.Components;
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.NodeGroups;
using Content.Server.NodeContainer.Nodes;
using Content.Server.UserInterface;
using Content.Shared.ActionBlocker;
using Content.Shared.Administration.Logs;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping.Binary.Components;
using Content.Shared.Database;
@@ -19,7 +16,6 @@ using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
@@ -85,7 +81,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
private bool CheckInteract(ICommonSession session)
{
if (session.AttachedEntityUid is not {} uid
if (session.AttachedEntity is not {} uid
|| !_actionBlockerSystem.CanInteract(uid)
|| !_actionBlockerSystem.CanUse(uid))
return false;
@@ -110,14 +106,14 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (containerManager.TryGetContainer(canister.ContainerName, out var tankContainer)
&& tankContainer.ContainedEntities.Count > 0)
{
var tank = (EntityUid) tankContainer.ContainedEntities[0];
var tank = tankContainer.ContainedEntities[0];
var tankComponent = EntityManager.GetComponent<GasTankComponent>(tank);
tankLabel = EntityManager.GetComponent<MetaDataComponent>(tank).EntityName;
tankPressure = tankComponent.Air.Pressure;
}
_userInterfaceSystem.TrySetUiState(uid, GasCanisterUiKey.Key,
new GasCanisterBoundUserInterfaceState(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(canister.Owner).EntityName,
new GasCanisterBoundUserInterfaceState(EntityManager.GetComponent<MetaDataComponent>(canister.Owner).EntityName,
canister.Air.Pressure, portStatus, tankLabel, tankPressure, canister.ReleasePressure,
canister.ReleaseValve, canister.MinReleasePressure, canister.MaxReleasePressure));
}
@@ -205,13 +201,12 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (container.ContainedEntities.Count > 0)
{
IEntity tempQualifier = container.ContainedEntities[0];
var gasTank = IoCManager.Resolve<IEntityManager>().GetComponent<GasTankComponent>(tempQualifier);
var gasTank = EntityManager.GetComponent<GasTankComponent>(container.ContainedEntities[0]);
_atmosphereSystem.ReleaseGasTo(canister.Air, gasTank.Air, canister.ReleasePressure);
}
else
{
var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(canister.Owner).Coordinates, true);
var environment = _atmosphereSystem.GetTileMixture(EntityManager.GetComponent<TransformComponent>(canister.Owner).Coordinates, true);
_atmosphereSystem.ReleaseGasTo(canister.Air, environment, canister.ReleasePressure);
}
}
@@ -244,7 +239,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
private void OnCanisterActivate(EntityUid uid, GasCanisterComponent component, ActivateInWorldEvent args)
{
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out ActorComponent? actor))
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;
_userInterfaceSystem.GetUiOrNull(uid, GasCanisterUiKey.Key)?.Open(actor.PlayerSession);
@@ -254,16 +249,15 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
private void OnCanisterInteractHand(EntityUid uid, GasCanisterComponent component, InteractHandEvent args)
{
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out ActorComponent? actor))
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return;
_userInterfaceSystem.GetUiOrNull(uid, GasCanisterUiKey.Key)?.Open(actor.PlayerSession);
args.Handled = true;
}
private void OnCanisterInteractUsing(EntityUid uid, GasCanisterComponent component, InteractUsingEvent args)
private void OnCanisterInteractUsing(EntityUid canister, GasCanisterComponent component, InteractUsingEvent args)
{
var canister = EntityManager.GetEntity(uid);
var container = canister.EnsureContainer<ContainerSlot>(component.ContainerName);
// Container full.
@@ -271,11 +265,11 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
return;
// Check the used item is valid...
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.Used, out GasTankComponent? _))
if (!EntityManager.TryGetComponent(args.Used, out GasTankComponent? _))
return;
// Check the user has hands.
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out HandsComponent? hands))
if (!EntityManager.TryGetComponent(args.User, out HandsComponent? hands))
return;
if (!args.User.InRangeUnobstructed(canister, SharedInteractionSystem.InteractionRange, popup: true))
@@ -284,7 +278,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (!hands.Drop(args.Used, container))
return;
_adminLogSystem.Add(LogType.CanisterTankInserted, LogImpact.Medium, $"Player {args.User:player} inserted tank {container.ContainedEntities[0]} into {uid}");
_adminLogSystem.Add(LogType.CanisterTankInserted, LogImpact.Medium, $"Player {args.User:player} inserted tank {container.ContainedEntities[0]} into {canister}");
args.Handled = true;
}