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

@@ -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;
}