diff --git a/Content.Client/GameObjects/Components/Atmos/GasAnalyzerComponent.cs b/Content.Client/GameObjects/Components/Atmos/GasAnalyzerComponent.cs index c39e425fe7..705d3583c9 100644 --- a/Content.Client/GameObjects/Components/Atmos/GasAnalyzerComponent.cs +++ b/Content.Client/GameObjects/Components/Atmos/GasAnalyzerComponent.cs @@ -12,7 +12,7 @@ using Robust.Shared.ViewVariables; namespace Content.Client.GameObjects.Components.Atmos { [RegisterComponent] - class GasAnalyzerComponent : SharedGasAnalyzerComponent, IItemStatus + internal class GasAnalyzerComponent : SharedGasAnalyzerComponent, IItemStatus { [ViewVariables(VVAccess.ReadWrite)] private bool _uiUpdateNeeded; [ViewVariables] public GasAnalyzerDanger Danger { get; private set; } diff --git a/Content.Client/GameObjects/Components/ExtinguisherCabinetVisualizer.cs b/Content.Client/GameObjects/Components/ExtinguisherCabinetVisualizer.cs index 931a26229e..74c24a34b6 100644 --- a/Content.Client/GameObjects/Components/ExtinguisherCabinetVisualizer.cs +++ b/Content.Client/GameObjects/Components/ExtinguisherCabinetVisualizer.cs @@ -6,8 +6,6 @@ namespace Content.Client.GameObjects.Components { public class ExtinguisherCabinetVisualizer : AppearanceVisualizer { - private string _prefix; - public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); diff --git a/Content.Client/Sandbox/SandboxManager.cs b/Content.Client/Sandbox/SandboxManager.cs index d903f21bde..6e613f13ca 100644 --- a/Content.Client/Sandbox/SandboxManager.cs +++ b/Content.Client/Sandbox/SandboxManager.cs @@ -92,7 +92,7 @@ namespace Content.Client.Sandbox private EntitySpawnWindow _spawnWindow; private TileSpawnWindow _tilesSpawnWindow; private bool _sandboxWindowToggled; - bool SpawnEntitiesButton { get; set; } + private bool SpawnEntitiesButton { get; set; } public void Initialize() { diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs index feb32163bd..63d8164791 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs @@ -24,7 +24,6 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement IEntity human; IEntity table; - IEntity carpet; ClimbableComponent climbable; ClimbingComponent climbing; @@ -41,20 +40,20 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement // Test for climb components existing // Players and tables should have these in their prototypes. - Assert.True(human.TryGetComponent(out climbing!), "Human has no climbing"); - Assert.True(table.TryGetComponent(out climbable!), "Table has no climbable"); + Assert.That(human.TryGetComponent(out climbing!), "Human has no climbing", Is.True); + Assert.That(table.TryGetComponent(out climbable!), "Table has no climbable", Is.True); // Now let's make the player enter a climbing transitioning state. climbing.IsClimbing = true; climbing.TryMoveTo(human.Transform.WorldPosition, table.Transform.WorldPosition); var body = human.GetComponent(); - Assert.True(body.HasController(), "Player has no ClimbController"); + Assert.That(body.HasController(), "Player has no ClimbController", Is.True); // Force the player out of climb state. It should immediately remove the ClimbController. climbing.IsClimbing = false; - Assert.True(!body.HasController(), "Player wrongly has a ClimbController"); + Assert.That(!body.HasController(), "Player wrongly has a ClimbController", Is.True); }); diff --git a/Content.Server/Chat/ChatCommands.cs b/Content.Server/Chat/ChatCommands.cs index 8ae70c0465..94aa2ae25c 100644 --- a/Content.Server/Chat/ChatCommands.cs +++ b/Content.Server/Chat/ChatCommands.cs @@ -118,8 +118,6 @@ namespace Content.Server.Chat internal class SuicideCommand : IClientCommand { - [Dependency] private readonly IPlayerManager _playerManager = default!; - public string Command => "suicide"; public string Description => "Commits suicide"; diff --git a/Content.Server/GameObjects/Components/Atmos/AirtightComponent.cs b/Content.Server/GameObjects/Components/Atmos/AirtightComponent.cs index 22c0783548..298a184326 100644 --- a/Content.Server/GameObjects/Components/Atmos/AirtightComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/AirtightComponent.cs @@ -20,9 +20,6 @@ namespace Content.Server.GameObjects.Components.Atmos [RegisterComponent] public class AirtightComponent : Component, IMapInit { - [Dependency] private readonly IMapManager _mapManager = default!; - [Dependency] private readonly IEntityManager _entityManager = default!; - private (GridId, MapIndices) _lastPosition; private AtmosphereSystem _atmosphereSystem = default!; @@ -86,7 +83,7 @@ namespace Content.Server.GameObjects.Components.Atmos // will not be airtight. A warning is much easier to track down than the object magically // not being airtight, so log one if the SnapGrid component is missing. if (!Owner.EnsureComponent(out SnapGridComponent _)) - Logger.Warning($"Entity {Owner} at {Owner.Transform.MapPosition.ToString()} didn't have a {nameof(SnapGridComponent)}"); + Logger.Warning($"Entity {Owner} at {Owner.Transform.MapPosition} didn't have a {nameof(SnapGridComponent)}"); Owner.EntityManager.EventBus.SubscribeEvent(EventSource.Local, this, RotateEvent); @@ -106,7 +103,7 @@ namespace Content.Server.GameObjects.Components.Atmos var newAirBlockedDirs = AtmosDirection.Invalid; // TODO ATMOS MULTIZ When we make multiZ atmos, special case this. - for (int i = 0; i < Atmospherics.Directions; i++) + for (var i = 0; i < Atmospherics.Directions; i++) { var direction = (AtmosDirection) (1 << i); if (!AirBlockedDirection.HasFlag(direction)) continue; diff --git a/Content.Server/GameObjects/Components/Atmos/GasAnalyzerComponent.cs b/Content.Server/GameObjects/Components/Atmos/GasAnalyzerComponent.cs index 841901b7cb..3b7511c6ae 100644 --- a/Content.Server/GameObjects/Components/Atmos/GasAnalyzerComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/GasAnalyzerComponent.cs @@ -14,7 +14,6 @@ using Robust.Server.Interfaces.Player; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.Interfaces.Map; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Map; @@ -25,7 +24,6 @@ namespace Content.Server.GameObjects.Components.Atmos [RegisterComponent] public class GasAnalyzerComponent : SharedGasAnalyzerComponent, IAfterInteract, IDropped, IUse { - [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!; private GasAnalyzerDanger _pressureDanger; diff --git a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs index 1893a36fc4..7aaeb48adb 100644 --- a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs +++ b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs @@ -38,7 +38,6 @@ namespace Content.Server.GameObjects.Components.Buckle [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IEntitySystemManager _entitySystem = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; - [Dependency] private readonly IMapManager _mapManager = default!; private int _size; diff --git a/Content.Server/GameObjects/Components/Conveyor/ConveyorComponent.cs b/Content.Server/GameObjects/Components/Conveyor/ConveyorComponent.cs index ee91058f95..a6c8c9cc66 100644 --- a/Content.Server/GameObjects/Components/Conveyor/ConveyorComponent.cs +++ b/Content.Server/GameObjects/Components/Conveyor/ConveyorComponent.cs @@ -29,7 +29,6 @@ namespace Content.Server.GameObjects.Components.Conveyor public class ConveyorComponent : Component, IInteractUsing { [Dependency] private readonly IEntityManager _entityManager = default!; - [Dependency] private readonly IRobustRandom _random = default!; public override string Name => "Conveyor"; diff --git a/Content.Server/GameObjects/Components/GUI/HandsComponent.cs b/Content.Server/GameObjects/Components/GUI/HandsComponent.cs index 0112d0441f..c5694eb0b7 100644 --- a/Content.Server/GameObjects/Components/GUI/HandsComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/HandsComponent.cs @@ -628,8 +628,8 @@ namespace Content.Server.GameObjects.Components.GUI var interactionSystem = _entitySystemManager.GetEntitySystem(); if (used != null) { - interactionSystem.Interaction(Owner, used, hand.Entity, - EntityCoordinates.Invalid); + _ = interactionSystem.Interaction(Owner, used, hand.Entity, + EntityCoordinates.Invalid); } else { diff --git a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs index aa7d873ab4..84adb1fc23 100644 --- a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs @@ -445,8 +445,8 @@ namespace Content.Server.GameObjects.Components.GUI { if (activeHand != null) { - interactionSystem.Interaction(Owner, activeHand.Owner, itemContainedInSlot.Owner, - new EntityCoordinates()); + _ = interactionSystem.Interaction(Owner, activeHand.Owner, itemContainedInSlot.Owner, + new EntityCoordinates()); } else if (Unequip(msg.Inventoryslot)) { diff --git a/Content.Server/GameObjects/Components/Interactable/ToolCommands.cs b/Content.Server/GameObjects/Components/Interactable/ToolCommands.cs index 1c833051ad..c4ec4a2a05 100644 --- a/Content.Server/GameObjects/Components/Interactable/ToolCommands.cs +++ b/Content.Server/GameObjects/Components/Interactable/ToolCommands.cs @@ -108,7 +108,7 @@ namespace Content.Server.GameObjects.Components.Interactable { if (entity.TryGetComponent(out AnchorableComponent? anchorable)) { - anchorable.TryAnchor(player.AttachedEntity, force: true); + _ = anchorable.TryAnchor(player.AttachedEntity, force: true); } } } @@ -153,7 +153,7 @@ namespace Content.Server.GameObjects.Components.Interactable { if (entity.TryGetComponent(out AnchorableComponent? anchorable)) { - anchorable.TryUnAnchor(player.AttachedEntity, force: true); + _ = anchorable.TryUnAnchor(player.AttachedEntity, force: true); } } } diff --git a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs index 9f39ecbda7..8c8cde3022 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs @@ -37,7 +37,6 @@ namespace Content.Server.GameObjects.Components.Items.Storage public class ServerStorageComponent : SharedStorageComponent, IInteractUsing, IUse, IActivate, IStorageComponent, IDestroyAct, IExAct, IDragDrop { - [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!; private const string LoggerName = "Storage"; diff --git a/Content.Server/GameObjects/Components/MachineLinking/SignalReceiverComponent.cs b/Content.Server/GameObjects/Components/MachineLinking/SignalReceiverComponent.cs index 4cf3d9bb33..d72e9ca5ec 100644 --- a/Content.Server/GameObjects/Components/MachineLinking/SignalReceiverComponent.cs +++ b/Content.Server/GameObjects/Components/MachineLinking/SignalReceiverComponent.cs @@ -15,8 +15,6 @@ namespace Content.Server.GameObjects.Components.MachineLinking [RegisterComponent] public class SignalReceiverComponent : Component, IInteractUsing { - [Dependency] private readonly IMapManager _mapManager = default!; - public override string Name => "SignalReceiver"; private List _transmitters; diff --git a/Content.Server/GameObjects/Components/MachineLinking/SignalTransmitterComponent.cs b/Content.Server/GameObjects/Components/MachineLinking/SignalTransmitterComponent.cs index 36390f2dd1..eccdd7a2f9 100644 --- a/Content.Server/GameObjects/Components/MachineLinking/SignalTransmitterComponent.cs +++ b/Content.Server/GameObjects/Components/MachineLinking/SignalTransmitterComponent.cs @@ -17,7 +17,6 @@ namespace Content.Server.GameObjects.Components.MachineLinking [RegisterComponent] public class SignalTransmitterComponent : Component, IInteractUsing { - [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!; public override string Name => "SignalTransmitter"; diff --git a/Content.Server/GameObjects/Components/Movement/ClimbableComponent.cs b/Content.Server/GameObjects/Components/Movement/ClimbableComponent.cs index ae1df3aad4..41e64d79d5 100644 --- a/Content.Server/GameObjects/Components/Movement/ClimbableComponent.cs +++ b/Content.Server/GameObjects/Components/Movement/ClimbableComponent.cs @@ -27,8 +27,6 @@ namespace Content.Server.GameObjects.Components.Movement [ComponentReference(typeof(IClimbable))] public class ClimbableComponent : SharedClimbableComponent, IDragDropOn { - [Dependency] private readonly IPlayerManager _playerManager = default!; - /// /// The range from which this entity can be climbed. /// diff --git a/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs b/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs index 36c90fabf0..2794f08c03 100644 --- a/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs +++ b/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs @@ -26,7 +26,6 @@ namespace Content.Server.GameObjects.Components.Movement [RegisterComponent] public class ServerTeleporterComponent : Component, IAfterInteract { - [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IServerEntityManager _serverEntityManager = default!; [Dependency] private readonly IRobustRandom _spreadRandom = default!; @@ -96,7 +95,7 @@ namespace Content.Server.GameObjects.Components.Movement public void TryDirectedTeleport(IEntity user, MapCoordinates mapCoords) { // Checks - if ((user.Transform.WorldPosition - mapCoords.Position).LengthSquared > (_range * _range)) + if ((user.Transform.WorldPosition - mapCoords.Position).LengthSquared > _range * _range) { return; } diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerProviderComponent.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerProviderComponent.cs index b6b59ad714..5f2ed4bf49 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerProviderComponent.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerProviderComponent.cs @@ -24,7 +24,6 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents [RegisterComponent] public class PowerProviderComponent : BaseApcNetComponent, IPowerProvider { - [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IServerEntityManager _serverEntityManager; public override string Name => "PowerProvider"; diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs index 951cbbdfe4..5d802704f1 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs @@ -29,8 +29,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee private TimeSpan _lastAttackTime; private TimeSpan _cooldownEnd; - private string _hitSound; - private string _missSound; + private readonly string _hitSound; + private readonly string _missSound; public float ArcCooldownTime { get; private set; } = 1f; public float CooldownTime { get; private set; } = 0.5f; @@ -191,7 +191,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee private HashSet ArcRayCast(Vector2 position, Angle angle, IEntity ignore) { var widthRad = Angle.FromDegrees(ArcWidth); - var increments = 1 + (35 * (int) Math.Ceiling(widthRad / (2 * Math.PI))); + var increments = 1 + 35 * (int) Math.Ceiling(widthRad / (2 * Math.PI)); var increment = widthRad / increments; var baseAngle = angle - widthRad / 2; diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Pathfinders/JpsPathfindingJob.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Pathfinders/JpsPathfindingJob.cs index db3639e513..b1a7d62a48 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Pathfinders/JpsPathfindingJob.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Pathfinders/JpsPathfindingJob.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -494,13 +494,13 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Pathfinders } if ((closedNeighborOne == null || !PathfindingHelpers.Traversable(_pathfindingArgs.CollisionMask, _pathfindingArgs.Access, closedNeighborOne)) && - (openNeighborOne != null && PathfindingHelpers.Traversable(_pathfindingArgs.CollisionMask, _pathfindingArgs.Access, openNeighborOne))) + openNeighborOne != null && PathfindingHelpers.Traversable(_pathfindingArgs.CollisionMask, _pathfindingArgs.Access, openNeighborOne)) { return true; } if ((closedNeighborTwo == null || !PathfindingHelpers.Traversable(_pathfindingArgs.CollisionMask, _pathfindingArgs.Access, closedNeighborTwo)) && - (openNeighborTwo != null && PathfindingHelpers.Traversable(_pathfindingArgs.CollisionMask, _pathfindingArgs.Access, openNeighborTwo))) + openNeighborTwo != null && PathfindingHelpers.Traversable(_pathfindingArgs.CollisionMask, _pathfindingArgs.Access, openNeighborTwo)) { return true; } diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index 1007c475bf..a2c2ab5fe9 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -406,7 +406,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click // InteractUsing/AfterInteract: We will either use the item on the nearby object if (item != null) { - Interaction(player, item, attacked, coordinates); + _ = Interaction(player, item, attacked, coordinates); } // InteractHand/Activate: Since our hand is empty we will use InteractHand/Activate else diff --git a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs index b10fb320f2..1ec5de0688 100644 --- a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs @@ -28,7 +28,6 @@ namespace Content.Server.GameObjects.EntitySystems [UsedImplicitly] internal sealed class HandsSystem : EntitySystem { - [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!; private const float ThrowForce = 1.5f; // Throwing force of mobs in Newtons @@ -126,10 +125,10 @@ namespace Content.Server.GameObjects.EntitySystems var entCoords = ent.Transform.Coordinates.Position; var entToDesiredDropCoords = coords.Position - entCoords; var targetLength = Math.Min(entToDesiredDropCoords.Length, SharedInteractionSystem.InteractionRange - 0.001f); // InteractionRange is reduced due to InRange not dealing with floating point error - var newCoords = coords.WithPosition((entToDesiredDropCoords.Normalized * targetLength) + entCoords).ToMap(_entityManager); + var newCoords = coords.WithPosition(entToDesiredDropCoords.Normalized * targetLength + entCoords).ToMap(_entityManager); var rayLength = Get().UnobstructedDistance(ent.Transform.MapPosition, newCoords, ignoredEnt: ent); - handsComp.Drop(handsComp.ActiveHand, coords.WithPosition(entCoords + (entToDesiredDropCoords.Normalized * rayLength))); + handsComp.Drop(handsComp.ActiveHand, coords.WithPosition(entCoords + entToDesiredDropCoords.Normalized * rayLength)); return true; }