Files

40 lines
1006 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 mapUid = _map.CreateMap();
_metaData.SetEntityName(mapUid, Loc.GetString("polymorph-paused-map-name"));
_map.SetPaused(mapUid, true);
PausedMap = mapUid;
2022-05-18 00:05:22 -04:00
}
}