Fix some build warnings (#2226)

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-10-12 01:42:53 +11:00
committed by GitHub
parent b64cb24059
commit d769661692
11 changed files with 16 additions and 22 deletions

View File

@@ -23,10 +23,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
[Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IOverlayManager _overlayManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IComponentManager _componentManager = default!;
[Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!;
private SuspicionGui? _gui;

View File

@@ -22,7 +22,6 @@ namespace Content.Client.GameObjects.EntitySystems
internal sealed class AtmosDebugOverlaySystem : SharedAtmosDebugOverlaySystem
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
private Dictionary<GridId, AtmosDebugOverlayMessage> _tileData =
new Dictionary<GridId, AtmosDebugOverlayMessage>();

View File

@@ -78,7 +78,10 @@ namespace Content.Client.UserInterface
grid.MapToGrid(mousePosWorld), args.PointerLocation, item.Uid);
// client side command handlers will always be sent the local player session.
var session = _playerManager.LocalPlayer.Session;
var session = _playerManager.LocalPlayer?.Session;
if (session == null)
return false;
inputSys.HandleInputCommand(session, func, message);
}
else

View File

@@ -845,7 +845,7 @@ namespace Content.Server.GameObjects.Components.Atmos
{
Tiles.Add(indices, new TileAtmosphere(this, gridId, indices, (GasMixture)uniqueMixes![mix].Clone()));
}
catch (ArgumentOutOfRangeException e)
catch (ArgumentOutOfRangeException)
{
Logger.Error($"Error during atmos serialization! Tile at {indices} points to an unique mix ({mix}) out of range!");
throw;

View File

@@ -64,7 +64,8 @@ namespace Content.Server.GameObjects.Components
"This plaque commemorates the fall of the Atmos LINDA division. For all the charred, dizzy, and brittle men who have died in its hands.",
PlaqueType.Zas =>
"This plaque commemorates the fall of the Atmos ZAS division. For all the charred, dizzy, and brittle men who have died in its hands.",
PlaqueType.Unset => "Uhm"
PlaqueType.Unset => "Uhm",
_ => "Uhm",
};
Owner.Name = _type switch
@@ -77,7 +78,8 @@ namespace Content.Server.GameObjects.Components
"LINDA Atmospherics Division plaque",
PlaqueType.Zas =>
"ZAS Atmospherics Division plaque",
PlaqueType.Unset => "Uhm"
PlaqueType.Unset => "Uhm",
_ => "Uhm",
};
if (Owner.TryGetComponent(out SpriteComponent sprite))

View File

@@ -32,7 +32,6 @@ namespace Content.Server.GameObjects.Components.Construction
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IComponentFactory _componentFactory = default!;
public override string Name => "Construction";

View File

@@ -15,8 +15,6 @@ namespace Content.Server.GameObjects.Components.Items.Storage
[RegisterComponent]
internal sealed class StorageFillComponent : Component, IMapInit
{
[Dependency] private readonly IEntityManager _entityManager;
public override string Name => "StorageFill";
private List<PrototypeItemData> _contents;
@@ -56,7 +54,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
for (var i = 0; i < storageItem.Amount; i++)
{
storage.Insert(_entityManager.SpawnEntity(storageItem.PrototypeName, Owner.Transform.Coordinates));
storage.Insert(Owner.EntityManager.SpawnEntity(storageItem.PrototypeName, Owner.Transform.Coordinates));
}
if (!string.IsNullOrEmpty(storageItem.GroupId)) alreadySpawnedGroups.Add(storageItem.GroupId);
}

View File

@@ -9,7 +9,7 @@ namespace Content.Server.GameObjects.Components.Mobs.Speech
[RegisterComponent]
public class OwOAccentComponent : Component, IAccentComponent
{
[Dependency] private readonly IRobustRandom _random;
[Dependency] private readonly IRobustRandom _random = default!;
public override string Name => "OwOAccent";

View File

@@ -24,8 +24,6 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents
[RegisterComponent]
public class PowerProviderComponent : BaseApcNetComponent, IPowerProvider
{
[Dependency] private readonly IServerEntityManager _serverEntityManager;
public override string Name => "PowerProvider";
/// <summary>
@@ -93,13 +91,13 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents
private List<PowerReceiverComponent> FindAvailableReceivers()
{
var nearbyEntities = _serverEntityManager
var nearbyEntities = Owner.EntityManager
.GetEntitiesInRange(Owner, PowerTransferRange);
return nearbyEntities.Select(entity => entity.TryGetComponent<PowerReceiverComponent>(out var receiver) ? receiver : null)
.Where(receiver => receiver != null)
.Where(receiver => receiver.Connectable)
.Where(receiver => receiver.NeedsProvider)
.Where(receiver => receiver.Owner.Transform.Coordinates.TryDistance(_serverEntityManager, Owner.Transform.Coordinates, out var distance) && distance < Math.Min(PowerTransferRange, receiver.PowerReceptionRange))
.Where(receiver => receiver.Owner.Transform.Coordinates.TryDistance(Owner.EntityManager, Owner.Transform.Coordinates, out var distance) && distance < Math.Min(PowerTransferRange, receiver.PowerReceptionRange))
.ToList();
}

View File

@@ -29,8 +29,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
private TimeSpan _lastAttackTime;
private TimeSpan _cooldownEnd;
private readonly string _hitSound;
private readonly string _missSound;
private readonly string _hitSound = default!;
private readonly string _missSound = default!;
public float ArcCooldownTime { get; private set; } = 1f;
public float CooldownTime { get; private set; } = 0.5f;
@@ -93,7 +93,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
var entities = ArcRayCast(eventArgs.User.Transform.WorldPosition, angle, eventArgs.User);
var audioSystem = EntitySystem.Get<AudioSystem>();
if (entities.Count() != 0)
if (entities.Count != 0)
{
audioSystem.PlayFromEntity( _hitSound, entities.First());
}

View File

@@ -23,7 +23,6 @@ namespace Content.Server.StationEvents
// Based on Goonstation style radiation storm with some TG elements (announcer, etc.)
[Dependency] private IEntityManager _entityManager = default!;
[Dependency] private IMapManager _mapManager = default!;
[Dependency] private IRobustRandom _robustRandom = default!;
public override string Name => "RadiationStorm";
@@ -72,7 +71,6 @@ namespace Content.Server.StationEvents
// IOC uninject?
_entityManager = null;
_mapManager = null;
_robustRandom = null;
var componentManager = IoCManager.Resolve<IComponentManager>();