Replace pragma warning 649 disable/restore with default!
This commit is contained in:
@@ -36,11 +36,9 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
||||
* There's probably a better data structure to use though you'd need to benchmark multiple ones to compare,
|
||||
* at the very least on the memory side it could definitely be better.
|
||||
*/
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IMapManager _mapmanager;
|
||||
[Dependency] private IGameTiming _gameTiming;
|
||||
#pragma warning restore 649
|
||||
private PathfindingSystem _pathfindingSystem;
|
||||
|
||||
/// <summary>
|
||||
@@ -87,7 +85,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
||||
#if DEBUG
|
||||
SubscribeLocalEvent<PlayerAttachSystemMessage>(SendDebugMessage);
|
||||
#endif
|
||||
_mapmanager.OnGridRemoved += GridRemoved;
|
||||
_mapManager.OnGridRemoved += GridRemoved;
|
||||
}
|
||||
|
||||
private void GridRemoved(GridId gridId)
|
||||
@@ -161,7 +159,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
||||
/// <returns></returns>
|
||||
public bool CanAccess(IEntity entity, IEntity target, float range = 0.0f)
|
||||
{
|
||||
var targetTile = _mapmanager.GetGrid(target.Transform.GridID).GetTileRef(target.Transform.GridPosition);
|
||||
var targetTile = _mapManager.GetGrid(target.Transform.GridID).GetTileRef(target.Transform.GridPosition);
|
||||
var targetNode = _pathfindingSystem.GetNode(targetTile);
|
||||
|
||||
var collisionMask = 0;
|
||||
@@ -199,7 +197,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
||||
return false;
|
||||
}
|
||||
|
||||
var entityTile = _mapmanager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.GridPosition);
|
||||
var entityTile = _mapManager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.GridPosition);
|
||||
var entityNode = _pathfindingSystem.GetNode(entityTile);
|
||||
var entityRegion = GetRegion(entityNode);
|
||||
var targetRegion = GetRegion(targetNode);
|
||||
@@ -409,7 +407,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
||||
/// <returns></returns>
|
||||
public PathfindingRegion GetRegion(IEntity entity)
|
||||
{
|
||||
var entityTile = _mapmanager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.GridPosition);
|
||||
var entityTile = _mapManager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.GridPosition);
|
||||
var entityNode = _pathfindingSystem.GetNode(entityTile);
|
||||
return GetRegion(entityNode);
|
||||
}
|
||||
@@ -686,7 +684,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
||||
|
||||
private void SendRegionsDebugMessage(GridId gridId)
|
||||
{
|
||||
var grid = _mapmanager.GetGrid(gridId);
|
||||
var grid = _mapManager.GetGrid(gridId);
|
||||
// Chunk / Regions / Nodes
|
||||
var debugResult = new Dictionary<int, Dictionary<int, List<Vector2>>>();
|
||||
var chunkIdx = 0;
|
||||
@@ -709,7 +707,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
||||
|
||||
foreach (var node in region.Nodes)
|
||||
{
|
||||
var nodeVector = grid.GridTileToLocal(node.TileRef.GridIndices).ToMapPos(_mapmanager);
|
||||
var nodeVector = grid.GridTileToLocal(node.TileRef.GridIndices).ToMapPos(_mapManager);
|
||||
debugRegionNodes.Add(nodeVector);
|
||||
}
|
||||
|
||||
@@ -729,7 +727,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
||||
/// <param name="cached"></param>
|
||||
private void SendRegionCacheMessage(GridId gridId, IEnumerable<PathfindingRegion> regions, bool cached)
|
||||
{
|
||||
var grid = _mapmanager.GetGrid(gridId);
|
||||
var grid = _mapManager.GetGrid(gridId);
|
||||
var debugResult = new Dictionary<int, List<Vector2>>();
|
||||
|
||||
foreach (var region in regions)
|
||||
@@ -738,7 +736,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
||||
|
||||
foreach (var node in region.Nodes)
|
||||
{
|
||||
var nodeVector = grid.GridTileToLocal(node.TileRef.GridIndices).ToMapPos(_mapmanager);
|
||||
var nodeVector = grid.GridTileToLocal(node.TileRef.GridIndices).ToMapPos(_mapManager);
|
||||
|
||||
debugResult[_runningCacheIdx].Add(nodeVector);
|
||||
}
|
||||
|
||||
@@ -25,11 +25,9 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
|
||||
public sealed class AiSteeringSystem : EntitySystem
|
||||
{
|
||||
// http://www.red3d.com/cwr/papers/1999/gdc99steer.html for a steering overview
|
||||
[Dependency] private IMapManager _mapManager = default!;
|
||||
[Dependency] private IPauseManager _pauseManager = default!;
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IMapManager _mapManager;
|
||||
[Dependency] private IPauseManager _pauseManager;
|
||||
#pragma warning restore 649
|
||||
private PathfindingSystem _pathfindingSystem;
|
||||
|
||||
/// <summary>
|
||||
@@ -255,7 +253,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
|
||||
}
|
||||
|
||||
var entitySteering = steeringRequest as EntityTargetSteeringRequest;
|
||||
|
||||
|
||||
if (entitySteering != null && entitySteering.Target.Deleted)
|
||||
{
|
||||
controller.VelocityDir = Vector2.Zero;
|
||||
@@ -279,10 +277,10 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
|
||||
// Check if we have arrived
|
||||
var targetDistance = (entity.Transform.MapPosition.Position - steeringRequest.TargetMap.Position).Length;
|
||||
steeringRequest.TimeUntilInteractionCheck -= frameTime;
|
||||
|
||||
|
||||
if (targetDistance <= steeringRequest.ArrivalDistance && steeringRequest.TimeUntilInteractionCheck <= 0.0f)
|
||||
{
|
||||
if (!steeringRequest.RequiresInRangeUnobstructed ||
|
||||
if (!steeringRequest.RequiresInRangeUnobstructed ||
|
||||
InteractionChecks.InRangeUnobstructed(entity, steeringRequest.TargetMap, steeringRequest.ArrivalDistance, ignoredEnt: entity))
|
||||
{
|
||||
// TODO: Need cruder LOS checks for ranged weaps
|
||||
@@ -353,7 +351,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
|
||||
if (entitySteering != null)
|
||||
{
|
||||
// Check if target's moved too far
|
||||
if (_entityTargetPosition.TryGetValue(entity, out var targetGrid) &&
|
||||
if (_entityTargetPosition.TryGetValue(entity, out var targetGrid) &&
|
||||
(entitySteering.TargetGrid.Position - targetGrid.Position).Length >= entitySteering.TargetMaxMove)
|
||||
{
|
||||
// We'll just repath and keep following the existing one until we get a new one
|
||||
|
||||
@@ -11,9 +11,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
||||
{
|
||||
public class ExamineSystem : ExamineSystemShared
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IEntityManager _entityManager;
|
||||
#pragma warning restore 649
|
||||
[Dependency] private IEntityManager _entityManager = default!;
|
||||
|
||||
private static readonly FormattedMessage _entityNotFoundMessage;
|
||||
|
||||
|
||||
@@ -39,9 +39,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
||||
[UsedImplicitly]
|
||||
public sealed class InteractionSystem : SharedInteractionSystem
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
#pragma warning restore 649
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -36,10 +36,8 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
[UsedImplicitly]
|
||||
internal class ConstructionSystem : SharedConstructionSystem
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
#pragma warning restore 649
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
|
||||
private readonly Dictionary<string, ConstructionPrototype> _craftRecipes = new Dictionary<string, ConstructionPrototype>();
|
||||
|
||||
|
||||
@@ -27,10 +27,8 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
[UsedImplicitly]
|
||||
internal sealed class HandsSystem : EntitySystem
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
[Dependency] private readonly IServerNotifyManager _notifyManager;
|
||||
#pragma warning restore 649
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IServerNotifyManager _notifyManager = default!;
|
||||
|
||||
private const float ThrowForce = 1.5f; // Throwing force of mobs in Newtons
|
||||
|
||||
|
||||
@@ -6,9 +6,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
public class NodeGroupSystem : EntitySystem
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly INodeGroupManager _groupManager;
|
||||
#pragma warning restore 649
|
||||
[Dependency] private readonly INodeGroupManager _groupManager = default!;
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
|
||||
@@ -6,9 +6,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
public class PowerNetSystem : EntitySystem
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IPowerNetManager _powerNetManager;
|
||||
#pragma warning restore 649
|
||||
[Dependency] private readonly IPowerNetManager _powerNetManager = default!;
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
|
||||
@@ -10,10 +10,8 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
public class RoundEndSystem : EntitySystem
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IGameTicker _gameTicker;
|
||||
[Dependency] private IGameTiming _gameTiming;
|
||||
#pragma warning restore 649
|
||||
[Dependency] private readonly IGameTicker _gameTicker = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
private CancellationTokenSource _roundEndCancellationTokenSource = new CancellationTokenSource();
|
||||
public bool IsRoundEndCountdownStarted { get; private set; }
|
||||
|
||||
@@ -21,11 +21,9 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents
|
||||
// Somewhat based off of TG's implementation of events
|
||||
public sealed class StationEventSystem : EntitySystem
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IServerNetManager _netManager;
|
||||
[Dependency] private readonly IPlayerManager _playerManager;
|
||||
[Dependency] private readonly IGameTicker _gameTicker;
|
||||
#pragma warning restore 649
|
||||
[Dependency] private readonly IServerNetManager _netManager = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IGameTicker _gameTicker = default!;
|
||||
|
||||
public StationEvent CurrentEvent { get; private set; }
|
||||
public IReadOnlyCollection<StationEvent> StationEvents => _stationEvents;
|
||||
@@ -33,7 +31,7 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents
|
||||
private List<StationEvent> _stationEvents = new List<StationEvent>();
|
||||
|
||||
private const float MinimumTimeUntilFirstEvent = 600;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// How long until the next check for an event runs
|
||||
/// </summary>
|
||||
@@ -77,7 +75,7 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents
|
||||
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Admins can forcibly run events by passing in the Name
|
||||
/// </summary>
|
||||
@@ -88,14 +86,14 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents
|
||||
// Could use a dictionary but it's such a minor thing, eh.
|
||||
// Wasn't sure on whether to localize this given it's a command
|
||||
var upperName = name.ToUpperInvariant();
|
||||
|
||||
|
||||
foreach (var stationEvent in _stationEvents)
|
||||
{
|
||||
if (stationEvent.Name.ToUpperInvariant() != upperName)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
CurrentEvent?.Shutdown();
|
||||
CurrentEvent = stationEvent;
|
||||
stationEvent.Startup();
|
||||
@@ -114,12 +112,12 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents
|
||||
{
|
||||
var availableEvents = AvailableEvents(true);
|
||||
var randomEvent = FindEvent(availableEvents);
|
||||
|
||||
|
||||
if (randomEvent == null)
|
||||
{
|
||||
return Loc.GetString("No valid events available");
|
||||
}
|
||||
|
||||
|
||||
CurrentEvent?.Shutdown();
|
||||
CurrentEvent = randomEvent;
|
||||
CurrentEvent.Startup();
|
||||
@@ -134,7 +132,7 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents
|
||||
public string StopEvent()
|
||||
{
|
||||
string resultText;
|
||||
|
||||
|
||||
if (CurrentEvent == null)
|
||||
{
|
||||
resultText = Loc.GetString("No event running currently");
|
||||
@@ -145,11 +143,11 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents
|
||||
CurrentEvent.Shutdown();
|
||||
CurrentEvent = null;
|
||||
}
|
||||
|
||||
|
||||
ResetTimer();
|
||||
return resultText;
|
||||
}
|
||||
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -212,7 +210,7 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents
|
||||
if (CurrentEvent != null)
|
||||
{
|
||||
CurrentEvent.Update(frameTime);
|
||||
|
||||
|
||||
// Shutdown the event and set the timer for the next event
|
||||
if (!CurrentEvent.Running)
|
||||
{
|
||||
@@ -262,14 +260,14 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
var sumOfWeights = 0;
|
||||
|
||||
foreach (var stationEvent in availableEvents)
|
||||
{
|
||||
sumOfWeights += (int) stationEvent.Weight;
|
||||
}
|
||||
|
||||
|
||||
var robustRandom = IoCManager.Resolve<IRobustRandom>();
|
||||
sumOfWeights = robustRandom.Next(sumOfWeights);
|
||||
|
||||
@@ -295,7 +293,7 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents
|
||||
{
|
||||
TimeSpan currentTime;
|
||||
var playerCount = IoCManager.Resolve<IPlayerManager>().PlayerCount;
|
||||
|
||||
|
||||
// playerCount does a lock so we'll just keep the variable here
|
||||
if (!ignoreEarliestStart)
|
||||
{
|
||||
@@ -346,7 +344,7 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents
|
||||
CurrentEvent.Shutdown();
|
||||
CurrentEvent = null;
|
||||
}
|
||||
|
||||
|
||||
foreach (var stationEvent in _stationEvents)
|
||||
{
|
||||
stationEvent.Occurrences = 0;
|
||||
|
||||
@@ -14,9 +14,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
public class VerbSystem : EntitySystem
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IEntityManager _entityManager;
|
||||
#pragma warning restore 649
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user