Files
RobustToolbox/Robust.Shared/Map/Components/MapComponent.cs
T
fbc706f37b Refactor map loading & saving (#5572)
* 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>
2025-02-16 21:25:07 +11:00

41 lines
1.3 KiB
C#

using System;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Robust.Shared.Map.Components
{
[RegisterComponent]
[NetworkedComponent]
public sealed partial class MapComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public bool LightingEnabled { get; set; } = true;
[ViewVariables(VVAccess.ReadOnly), Access(typeof(SharedMapSystem), Other = AccessPermissions.ReadExecute)]
public MapId MapId { get; internal set; } = MapId.Nullspace;
[DataField, Access(typeof(SharedMapSystem), typeof(MapManager))]
public bool MapPaused;
[DataField, Access(typeof(SharedMapSystem), typeof(MapManager))]
public bool MapInitialized;
}
/// <summary>
/// Serialized state of a <see cref="MapGridComponentState"/>.
/// </summary>
[Serializable, NetSerializable]
public sealed class MapComponentState(MapId mapId, bool lightingEnabled, bool paused, bool init)
: ComponentState
{
public MapId MapId = mapId;
public bool LightingEnabled = lightingEnabled;
public bool MapPaused = paused;
public bool Initialized = init;
}
}