mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-01 17:47:24 +02:00
* Refactor map loading & saving * test fixes * ISerializationManager tweaks * Fix component composition * Try fix entity deserialization component composition * comments * CL * error preinit * a * cleanup * error if version is too new * Add AlwaysPushSerializationTest * Add auto-inclusion test * Better categorization * Combine test components * Save -> TrySave Also better handling for saving multiple entities individually * Create new partial class for map loading * Add OrphanSerializationTest * Include MapIds in BeforeSerializationEvent * Addd LifetimeSerializationTest * Add TestMixedLifetimeSerialization * Add CategorizationTest * explicitly serialize list of nullspace entities * Add backwards compatibility test * Version comments also fixes wrong v4 format * add MapMergeTest * Add NetEntity support * Optimize EntityDeserializer Avoid unnecessary component deserialization * fix assert & other bugs * fucking containers strike again * Fix deletion of pre-init entities * fix release note merge conflict * Update Robust.Shared/Map/MapManager.GridCollection.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * VV --------- Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
61 lines
1.5 KiB
C#
61 lines
1.5 KiB
C#
using System;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Map.Components;
|
|
|
|
namespace Robust.Shared.GameObjects;
|
|
|
|
public abstract partial class SharedMapSystem
|
|
{
|
|
public bool IsPaused(MapId mapId)
|
|
{
|
|
if (mapId == MapId.Nullspace)
|
|
return false;
|
|
|
|
if(!Maps.TryGetValue(mapId, out var uid))
|
|
throw new ArgumentException($"Map {mapId} does not exist.");
|
|
|
|
return IsPaused(uid);
|
|
}
|
|
|
|
public bool IsPaused(Entity<MapComponent?> map)
|
|
{
|
|
if (!_mapQuery.Resolve(map, ref map.Comp))
|
|
return false;
|
|
|
|
return map.Comp.MapPaused || !map.Comp.MapInitialized;
|
|
}
|
|
|
|
public void SetPaused(MapId mapId, bool paused)
|
|
{
|
|
if(!Maps.TryGetValue(mapId, out var uid))
|
|
throw new ArgumentException($"Map {mapId} does not exist.");
|
|
|
|
SetPaused(uid, paused);
|
|
}
|
|
|
|
public void SetPaused(Entity<MapComponent?> map, bool paused)
|
|
{
|
|
if (!_mapQuery.Resolve(map, ref map.Comp))
|
|
return;
|
|
|
|
if (map.Comp.MapPaused == paused)
|
|
return;
|
|
|
|
map.Comp.MapPaused = paused;
|
|
if (map.Comp.LifeStage < ComponentLifeStage.Initializing)
|
|
return;
|
|
|
|
Dirty(map);
|
|
RecursiveSetPaused(map, paused);
|
|
}
|
|
|
|
internal void RecursiveSetPaused(EntityUid entity, bool paused)
|
|
{
|
|
_meta.SetEntityPaused(entity, paused);
|
|
foreach (var child in Transform(entity)._children)
|
|
{
|
|
RecursiveSetPaused(child, paused);
|
|
}
|
|
}
|
|
}
|