mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
39 lines
966 B
C#
39 lines
966 B
C#
using Content.Shared.GameTicking;
|
|
|
|
namespace Content.Server.Polymorph.Systems;
|
|
|
|
public sealed partial class PolymorphSystem
|
|
{
|
|
public EntityUid? PausedMap { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Used to subscribe to the round restart event
|
|
/// </summary>
|
|
private void InitializeMap()
|
|
{
|
|
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
|
|
}
|
|
|
|
private void OnRoundRestart(RoundRestartCleanupEvent _)
|
|
{
|
|
if (PausedMap == null || !Exists(PausedMap))
|
|
return;
|
|
|
|
Del(PausedMap.Value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Used internally to ensure a paused map that is
|
|
/// stores polymorphed entities.
|
|
/// </summary>
|
|
private void EnsurePausedMap()
|
|
{
|
|
if (PausedMap != null && Exists(PausedMap))
|
|
return;
|
|
|
|
var newmap = _mapManager.CreateMap();
|
|
_mapManager.SetMapPaused(newmap, true);
|
|
PausedMap = _mapManager.GetMapEntityId(newmap);
|
|
}
|
|
}
|