Don't spawn rad pulses on paused grids (#2121)
* Don't spawn rad pulses on paused grids * Only radiate default grid Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -14,6 +14,9 @@ namespace Content.IntegrationTests
|
||||
{
|
||||
public GameRunLevel RunLevel { get; } = GameRunLevel.InRound;
|
||||
|
||||
public MapId DefaultMap { get; } = MapId.Nullspace;
|
||||
public GridId DefaultGridId { get; } = GridId.Invalid;
|
||||
|
||||
public event Action<GameRunLevelChangedEventArgs> OnRunLevelChanged
|
||||
{
|
||||
add { }
|
||||
|
||||
@@ -99,6 +99,10 @@ namespace Content.Server.GameTicking
|
||||
|
||||
|
||||
[ViewVariables] public bool Paused { get; private set; }
|
||||
|
||||
[ViewVariables] public MapId DefaultMap { get; private set; }
|
||||
|
||||
[ViewVariables] public GridId DefaultGridId { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public GameRunLevel RunLevel
|
||||
@@ -687,10 +691,11 @@ namespace Content.Server.GameTicking
|
||||
|
||||
private void _preRoundSetup()
|
||||
{
|
||||
var newMapId = _mapManager.CreateMap();
|
||||
DefaultMap = _mapManager.CreateMap();
|
||||
var startTime = _gameTiming.RealTime;
|
||||
var grid = _mapLoader.LoadBlueprint(newMapId, MapFile);
|
||||
|
||||
var grid = _mapLoader.LoadBlueprint(DefaultMap, MapFile);
|
||||
|
||||
DefaultGridId = grid.Index;
|
||||
_spawnPoint = grid.ToCoordinates();
|
||||
|
||||
var timeSpan = _gameTiming.RealTime - startTime;
|
||||
|
||||
@@ -15,6 +15,16 @@ namespace Content.Server.Interfaces.GameTicking
|
||||
public interface IGameTicker
|
||||
{
|
||||
GameRunLevel RunLevel { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The map loaded by the GameTicker on round start.
|
||||
/// </summary>
|
||||
MapId DefaultMap { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The GridId loaded by the GameTicker on round start.
|
||||
/// </summary>
|
||||
GridId DefaultGridId { get; }
|
||||
|
||||
event Action<GameRunLevelChangedEventArgs> OnRunLevelChanged;
|
||||
event Action<GameRuleAddedEventArgs> OnRuleAdded;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.GameObjects.Components.StationEvents;
|
||||
using Content.Server.Interfaces.GameTicking;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Content.Shared.Utility;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Server.Interfaces.Timing;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
@@ -104,12 +106,14 @@ namespace Content.Server.StationEvents
|
||||
|
||||
if (_timeUntilPulse <= 0.0f)
|
||||
{
|
||||
// TODO: Probably rate-limit this for small grids (e.g. no more than 25% covered)
|
||||
foreach (var grid in _mapManager.GetAllGrids())
|
||||
{
|
||||
if (grid.IsDefaultGrid) continue;
|
||||
SpawnPulse(grid);
|
||||
}
|
||||
var pauseManager = IoCManager.Resolve<IPauseManager>();
|
||||
var gameTicker = IoCManager.Resolve<IGameTicker>();
|
||||
var defaultGrid = IoCManager.Resolve<IMapManager>().GetGrid(gameTicker.DefaultGridId);
|
||||
|
||||
if (pauseManager.IsGridPaused(defaultGrid))
|
||||
return;
|
||||
|
||||
SpawnPulse(defaultGrid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user