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

@@ -9,12 +9,9 @@ using Content.Server.UserInterface;
using Content.Server.VendingMachines;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Popups;
using Content.Shared.Sound;
using Content.Shared.Tools;
using Content.Shared.Wires;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Audio;
@@ -36,8 +33,7 @@ namespace Content.Server.WireHacking
#pragma warning restore 618
{
[Dependency] private readonly IRobustRandom _random = default!;
private AudioSystem _audioSystem = default!;
[Dependency] private readonly IEntityManager _entities = default!;
private bool _isPanelOpen;
@@ -117,7 +113,7 @@ namespace Content.Server.WireHacking
private void UpdateAppearance()
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
if (_entities.TryGetComponent(Owner, out AppearanceComponent? appearance))
{
appearance.SetData(WiresVisuals.MaintenancePanelState, IsPanelOpen && IsPanelVisible);
}
@@ -173,9 +169,8 @@ namespace Content.Server.WireHacking
protected override void Initialize()
{
base.Initialize();
_audioSystem = EntitySystem.Get<AudioSystem>();
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
if (_entities.TryGetComponent(Owner, out AppearanceComponent? appearance))
{
appearance.SetData(WiresVisuals.MaintenancePanelState, IsPanelOpen);
}
@@ -230,7 +225,7 @@ namespace Content.Server.WireHacking
hackingSystem.TryGetLayout(_layoutId, out layout);
}
foreach (var wiresProvider in IoCManager.Resolve<IEntityManager>().GetComponents<IWires>(Owner))
foreach (var wiresProvider in _entities.GetComponents<IWires>(Owner))
{
var builder = new WiresBuilder(this, wiresProvider, layout);
wiresProvider.RegisterWires(builder);
@@ -334,8 +329,8 @@ namespace Content.Server.WireHacking
/// </summary>
public class WiresBuilder
{
[NotNull] private readonly WiresComponent _wires;
[NotNull] private readonly IWires _owner;
private readonly WiresComponent _wires;
private readonly IWires _owner;
private readonly WireLayout? _layout;
public WiresBuilder(WiresComponent wires, IWires owner, WireLayout? layout)
@@ -411,12 +406,12 @@ namespace Content.Server.WireHacking
case WiresActionMessage msg:
var wire = WiresList.Find(x => x.Id == msg.Id);
var player = serverMsg.Session.AttachedEntity;
if (wire == null || player == null)
if (wire == null || player == default)
{
return;
}
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(player, out HandsComponent? handsComponent))
if (!_entities.TryGetComponent(player, out HandsComponent? handsComponent))
{
Owner.PopupMessage(player, Loc.GetString("wires-component-ui-on-receive-message-no-hands"));
return;
@@ -428,10 +423,9 @@ namespace Content.Server.WireHacking
return;
}
var activeHandEntity = handsComponent.GetActiveHand?.Owner;
ToolComponent? tool = null;
if(activeHandEntity != null)
IoCManager.Resolve<IEntityManager>().TryGetComponent(activeHandEntity, out tool);
if (handsComponent.GetActiveHand?.Owner is {Valid: true} activeHandEntity)
_entities.TryGetComponent(activeHandEntity, out tool);
var toolSystem = EntitySystem.Get<ToolSystem>();
switch (msg.Action)
@@ -443,8 +437,7 @@ namespace Content.Server.WireHacking
return;
}
// activeHandEntity cannot be null because tool is not null.
toolSystem.PlayToolSound(activeHandEntity!, tool);
toolSystem.PlayToolSound(tool.Owner, tool);
wire.IsCut = true;
UpdateUserInterface();
break;
@@ -455,8 +448,7 @@ namespace Content.Server.WireHacking
return;
}
// activeHandEntity cannot be null because tool is not null.
toolSystem.PlayToolSound(activeHandEntity!, tool);
toolSystem.PlayToolSound(tool.Owner, tool);
wire.IsCut = false;
UpdateUserInterface();
break;
@@ -502,7 +494,7 @@ namespace Content.Server.WireHacking
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ToolComponent?>(eventArgs.Using, out var tool))
if (!_entities.TryGetComponent<ToolComponent?>(eventArgs.Using, out var tool))
{
return false;
}
@@ -514,7 +506,7 @@ namespace Content.Server.WireHacking
(tool.Qualities.Contains(_cuttingQuality) ||
tool.Qualities.Contains(_pulsingQuality)))
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
if (_entities.TryGetComponent(eventArgs.User, out ActorComponent? actor))
{
OpenInterface(actor.PlayerSession);
return true;