Fix some build warnings (#6832)

Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2022-02-21 14:41:50 +11:00
committed by GitHub
parent f9c853f100
commit b87806f7ed
36 changed files with 53 additions and 76 deletions

View File

@@ -87,8 +87,6 @@ namespace Content.Server.AI.Commands
shell.WriteLine(Loc.GetString("faction-command-unknown-faction-argument-error"));
break;
}
return;
}
}
}

View File

@@ -26,7 +26,6 @@ namespace Content.Server.AI.Steering
{
// http://www.red3d.com/cwr/papers/1999/gdc99steer.html for a steering overview
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IPauseManager _pauseManager = default!;
[Dependency] private readonly PathfindingSystem _pathfindingSystem = default!;
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
@@ -264,7 +263,7 @@ namespace Content.Server.AI.Steering
return SteeringStatus.NoPath;
}
if (_pauseManager.IsGridPaused(EntityManager.GetComponent<TransformComponent>(entity).GridID))
if (_mapManager.IsGridPaused(EntityManager.GetComponent<TransformComponent>(entity).GridID))
{
controller.VelocityDir = Vector2.Zero;
return SteeringStatus.Pending;

View File

@@ -25,7 +25,7 @@ namespace Content.Server.AI.Utility.Actions.Idle
{
var lastStorage = context.GetState<LastOpenedStorageState>().GetValue();
if (lastStorage == null)
if (!lastStorage.IsValid())
{
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{

View File

@@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Hands
{
var owner = context.GetState<SelfState>().GetValue();
if (owner == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out HandsComponent? handsComponent))
if (!owner.IsValid() || !IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out HandsComponent? handsComponent))
{
return 0.0f;
}

View File

@@ -28,7 +28,7 @@ namespace Content.Server.AI.Utility.Considerations.State
}
context.GetStoredState(stateData, out StoredStateData<EntityUid> state);
return state.GetValue() == null ? 1.0f : 0.0f;
return !state.GetValue().IsValid() ? 1.0f : 0.0f;
}
}
}

View File

@@ -19,7 +19,6 @@ namespace Content.Server.Botany.Systems
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly TagSystem _tags = default!;
private int _nextUid = 0;
private float _timer = 0f;

View File

@@ -364,7 +364,7 @@ namespace Content.Server.Chat.Managers
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
msg.Channel = ChatChannel.LOOC;
msg.Message = message;
msg.MessageWrap = Loc.GetString("chat-manager-entity-looc-wrap-message", ("entityName", Name: _entManager.GetComponent<MetaDataComponent>(entity).EntityName));
msg.MessageWrap = Loc.GetString("chat-manager-entity-looc-wrap-message", ("entityName", _entManager.GetComponent<MetaDataComponent>(entity).EntityName));
_netManager.ServerSendToMany(msg, sessions.Select(o => o.ConnectedClient).ToList());

View File

@@ -10,7 +10,6 @@ namespace Content.Server.Chemistry.EntitySystems;
public sealed partial class ChemistrySystem : EntitySystem
{
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
[Dependency] private readonly AdminLogSystem _logs = default!;
[Dependency] private readonly BloodstreamSystem _blood = default!;
[Dependency] private readonly DoAfterSystem _doAfter = default!;

View File

@@ -11,7 +11,6 @@ namespace Content.Server.Chemistry.EntitySystems
[UsedImplicitly]
public sealed class ReagentDispenserSystem : SharedReagentDispenserSystem
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public override void Initialize()
{
base.Initialize();

View File

@@ -33,7 +33,7 @@ namespace Content.Server.Cuffs.Components
[ViewVariables]
public int CuffedHandCount => Container.ContainedEntities.Count * 2;
protected EntityUid LastAddedCuffs => Container.ContainedEntities[^1];
private EntityUid LastAddedCuffs => Container.ContainedEntities[^1];
public IReadOnlyList<EntityUid> StoredEntities => Container.ContainedEntities;

View File

@@ -11,8 +11,6 @@ namespace Content.Server.Engineering.EntitySystems
[UsedImplicitly]
public sealed class DisassembleOnAltVerbSystem : EntitySystem
{
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
public override void Initialize()
{
base.Initialize();

View File

@@ -88,9 +88,8 @@ namespace Content.Server.GameTicking.Commands
shell.RemoteExecuteCommand("showmarkers");
var newGrid = mapManager.GetAllGrids().OrderByDescending(g => (int) g.Index).First();
var pauseManager = IoCManager.Resolve<IPauseManager>();
pauseManager.SetMapPaused(newGrid.ParentMapId, true);
mapManager.SetMapPaused(newGrid.ParentMapId, true);
shell.WriteLine($"Created unloaded map from file {mapName} with id {mapId}. Use \"savebp {newGrid.Index} foo.yml\" to save the new grid as a map.");
}

View File

@@ -74,7 +74,7 @@ namespace Content.Server.GameTicking
AddGamePresetRules();
DefaultMap = _mapManager.CreateMap();
_pauseManager.AddUninitializedMap(DefaultMap);
_mapManager.AddUninitializedMap(DefaultMap);
_startingRound = false;
var startTime = _gameTiming.RealTime;
var maps = new List<GameMapPrototype>() { _gameMapManager.GetSelectedMapChecked(true) };
@@ -89,7 +89,7 @@ namespace Content.Server.GameTicking
{
// Create other maps for the others since we need to.
toLoad = _mapManager.CreateMap();
_pauseManager.AddUninitializedMap(toLoad);
_mapManager.AddUninitializedMap(toLoad);
}
_mapLoader.LoadMap(toLoad, map.MapPath.ToString());
@@ -273,7 +273,7 @@ namespace Content.Server.GameTicking
}
// MapInitialize *before* spawning players, our codebase is too shit to do it afterwards...
_pauseManager.DoMapInitialize(DefaultMap);
_mapManager.DoMapInitialize(DefaultMap);
// Allow game rules to spawn players by themselves if needed. (For example, nuke ops or wizard)
RaiseLocalEvent(new RulePlayerSpawningEvent(readyPlayers, profiles, force));

View File

@@ -90,7 +90,6 @@ namespace Content.Server.GameTicking
[Dependency] private readonly IBaseServer _baseServer = default!;
[Dependency] private readonly IWatchdogApi _watchdogApi = default!;
[Dependency] private readonly IGameMapManager _gameMapManager = default!;
[Dependency] private readonly IPauseManager _pauseManager = default!;
#if EXCEPTION_TOLERANCE
[Dependency] private readonly IRuntimeLog _runtimeLog = default!;
#endif

View File

@@ -35,7 +35,7 @@ namespace Content.Server.Lathe.Components
private LatheState _state = LatheState.Base;
protected LatheState State
private LatheState State
{
get => _state;
set => _state = value;
@@ -228,7 +228,7 @@ namespace Content.Server.Lathe.Components
return queue;
}
protected enum LatheState
private enum LatheState : byte
{
Base,
Inserting,

View File

@@ -15,7 +15,6 @@ namespace Content.Server.Medical;
public sealed class HealingSystem : EntitySystem
{
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
[Dependency] private readonly AdminLogSystem _logs = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!;

View File

@@ -26,7 +26,6 @@ namespace Content.Server.Nuke
public sealed class NukeSystem : EntitySystem
{
[Dependency] private readonly NukeCodeSystem _codes = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly ItemSlotsSystem _itemSlots = default!;
[Dependency] private readonly PopupSystem _popups = default!;
[Dependency] private readonly IEntityLookup _lookup = default!;

View File

@@ -16,22 +16,22 @@ namespace Content.Server.Objectives.Conditions
[DataDefinition]
public sealed class RandomTraitorAliveCondition : IObjectiveCondition
{
protected Mind.Mind? Target;
private Mind.Mind? _target;
public IObjectiveCondition GetAssigned(Mind.Mind mind)
{
var entityMgr = IoCManager.Resolve<IEntityManager>();
List<Mind.Mind> _allOtherTraitors = new List<Mind.Mind>();
var allOtherTraitors = new List<Mind.Mind>();
foreach (var targetMind in entityMgr.EntityQuery<MindComponent>())
{
if (targetMind.Mind?.CharacterDeadIC == false && targetMind.Mind != mind && targetMind.Mind?.HasRole<TraitorRole>() == true)
{
_allOtherTraitors.Add(targetMind.Mind);
allOtherTraitors.Add(targetMind.Mind);
}
}
return new RandomTraitorAliveCondition {Target = IoCManager.Resolve<IRobustRandom>().Pick(_allOtherTraitors)};
return new RandomTraitorAliveCondition {_target = IoCManager.Resolve<IRobustRandom>().Pick(allOtherTraitors)};
}
public string Title
@@ -39,14 +39,14 @@ namespace Content.Server.Objectives.Conditions
get
{
var targetName = string.Empty;
var jobName = Target?.CurrentJob?.Name ?? "Unknown";
var jobName = _target?.CurrentJob?.Name ?? "Unknown";
if (Target == null)
if (_target == null)
return Loc.GetString("objective-condition-other-traitor-alive-title", ("targetName", targetName), ("job", jobName));
if (Target.CharacterName != null)
targetName = Target.CharacterName;
else if (Target.OwnedEntity is {Valid: true} owned)
if (_target.CharacterName != null)
targetName = _target.CharacterName;
else if (_target.OwnedEntity is {Valid: true} owned)
targetName = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(owned).EntityName;
return Loc.GetString("objective-condition-other-traitor-alive-title", ("targetName", targetName), ("job", jobName));
@@ -57,13 +57,13 @@ namespace Content.Server.Objectives.Conditions
public SpriteSpecifier Icon => new SpriteSpecifier.Rsi(new ResourcePath("Objects/Misc/bureaucracy.rsi"), "folder-white");
public float Progress => (!Target?.CharacterDeadIC ?? true) ? 1f : 0f;
public float Progress => (!_target?.CharacterDeadIC ?? true) ? 1f : 0f;
public float Difficulty => 1.75f;
public bool Equals(IObjectiveCondition? other)
{
return other is RandomTraitorAliveCondition kpc && Equals(Target, kpc.Target);
return other is RandomTraitorAliveCondition kpc && Equals(_target, kpc._target);
}
public override bool Equals(object? obj)
@@ -75,7 +75,7 @@ namespace Content.Server.Objectives.Conditions
public override int GetHashCode()
{
return Target?.GetHashCode() ?? 0;
return _target?.GetHashCode() ?? 0;
}
}
}

View File

@@ -18,7 +18,6 @@ namespace Content.Server.PDA.Ringer
{
public sealed class RingerSystem : SharedRingerSystem
{
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IRobustRandom _random = default!;
public override void Initialize()

View File

@@ -17,7 +17,6 @@ namespace Content.Server.Plants.Systems
{
[Dependency] private readonly SecretStashSystem _stashSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
public override void Initialize()
{

View File

@@ -27,7 +27,6 @@ namespace Content.Server.Salvage
public sealed class SalvageSystem : EntitySystem
{
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IPauseManager _pauseManager = default!;
[Dependency] private readonly IMapLoader _mapLoader = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
@@ -346,7 +345,7 @@ namespace Content.Server.Salvage
var gridId = gridIdAndState.Key;
// Not handling the case where the salvage we spawned got paused
// They both need to be paused, or it doesn't make sense
if (_pauseManager.IsGridPaused(gridId)) continue;
if (_mapManager.IsGridPaused(gridId)) continue;
state.CurrentTime += secondsPassed;
var deleteQueue = new RemQueue<SalvageMagnetComponent>();

View File

@@ -73,7 +73,7 @@ namespace Content.Server.Singularity.Components
}
}
protected void SetAppearance(RadiationCollectorVisualState state)
private void SetAppearance(RadiationCollectorVisualState state)
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<AppearanceComponent?>(Owner, out var appearance))
{

View File

@@ -66,7 +66,7 @@ namespace Content.Server.StationEvents.Events
if (_timeUntilPulse <= 0.0f)
{
var pauseManager = IoCManager.Resolve<IPauseManager>();
var mapManager = IoCManager.Resolve<IMapManager>();
// Account for split stations by just randomly picking a piece of it.
var possibleTargets = _entityManager.EntityQuery<StationComponent>()
.Where(x => x.Station == _target).ToArray();
@@ -76,7 +76,7 @@ namespace Content.Server.StationEvents.Events
if (!_entityManager.TryGetComponent<IMapGridComponent>(stationEnt, out var grid))
return;
if (pauseManager.IsGridPaused(grid.GridIndex))
if (mapManager.IsGridPaused(grid.GridIndex))
return;
SpawnPulse(grid.Grid);

View File

@@ -127,7 +127,7 @@ namespace Content.Server.UserInterface
}
}
public class UserOpenActivatableUIAttemptEvent : CancellableEntityEventArgs //have to one-up the already stroke-inducing name
public sealed class UserOpenActivatableUIAttemptEvent : CancellableEntityEventArgs //have to one-up the already stroke-inducing name
{
public EntityUid User { get; }
public UserOpenActivatableUIAttemptEvent(EntityUid who)

View File

@@ -11,10 +11,10 @@ using Robust.Shared.Random;
namespace Content.Server.Weapon.Melee.EnergySword
{
internal sealed class EnergySwordSystem : EntitySystem
public sealed class EnergySwordSystem : EntitySystem
{
[Dependency] private readonly ActionBlockerSystem _blockerSystem = default!;
[Dependency] private readonly IRobustRandom _random = default!;
public override void Initialize()
{
base.Initialize();

View File

@@ -34,7 +34,6 @@ namespace Content.Server.Weapon.Ranged;
public sealed partial class GunSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IPrototypeManager _protoMan = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
[Dependency] private readonly AdminLogSystem _logs = default!;

View File

@@ -19,7 +19,6 @@ namespace Content.Server.WireHacking
public sealed class WireHackingSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
[Dependency] private readonly ToolSystem _tools = default!;
[ViewVariables] private readonly Dictionary<string, WireLayout> _layouts =