Cleanup (#2111)
This commit is contained in:
@@ -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; }
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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<ICollidableComponent>();
|
||||
|
||||
Assert.True(body.HasController<ClimbController>(), "Player has no ClimbController");
|
||||
Assert.That(body.HasController<ClimbController>(), "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<ClimbController>(), "Player wrongly has a ClimbController");
|
||||
Assert.That(!body.HasController<ClimbController>(), "Player wrongly has a ClimbController", Is.True);
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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<RotateEvent>(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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -628,8 +628,8 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>();
|
||||
if (used != null)
|
||||
{
|
||||
interactionSystem.Interaction(Owner, used, hand.Entity,
|
||||
EntityCoordinates.Invalid);
|
||||
_ = interactionSystem.Interaction(Owner, used, hand.Entity,
|
||||
EntityCoordinates.Invalid);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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<SignalTransmitterComponent> _transmitters;
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -27,8 +27,6 @@ namespace Content.Server.GameObjects.Components.Movement
|
||||
[ComponentReference(typeof(IClimbable))]
|
||||
public class ClimbableComponent : SharedClimbableComponent, IDragDropOn
|
||||
{
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The range from which this entity can be climbed.
|
||||
/// </summary>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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<IEntity> 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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<SharedInteractionSystem>().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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user