Files

39 lines
966 B
C#
Raw Permalink Normal View History

2022-05-18 00:05:22 -04:00
using Content.Shared.GameTicking;
namespace Content.Server.Polymorph.Systems;
public sealed partial class PolymorphSystem
2022-05-18 00:05:22 -04:00
{
public EntityUid? PausedMap { get; private set; }
2022-05-18 00:05:22 -04:00
/// <summary>
/// Used to subscribe to the round restart event
/// </summary>
private void InitializeMap()
{
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
}
2022-05-18 00:05:22 -04:00
private void OnRoundRestart(RoundRestartCleanupEvent _)
{
if (PausedMap == null || !Exists(PausedMap))
return;
2022-05-18 00:05:22 -04:00
Del(PausedMap.Value);
}
2022-05-18 00:05:22 -04:00
/// <summary>
/// Used internally to ensure a paused map that is
/// stores polymorphed entities.
/// </summary>
private void EnsurePausedMap()
{
if (PausedMap != null && Exists(PausedMap))
return;
2023-03-06 12:37:18 -05:00
var newmap = _mapManager.CreateMap();
_mapManager.SetMapPaused(newmap, true);
PausedMap = _mapManager.GetMapEntityId(newmap);
2022-05-18 00:05:22 -04:00
}
}