using System; using System.Collections.Frozen; using System.Collections.Generic; using Robust.Shared.Collections; using Robust.Shared.GameStates; namespace Robust.Shared.GameObjects; /// /// Represents a component registered into a . /// /// /// public sealed class ComponentRegistration { /// /// The name of the component. /// This is used as the type field in the component declarations if entity prototypes. /// /// public string Name { get; } public CompIdx Idx { get; } /// /// If this is true, the component will not be saved when saving a map/grid. /// /// public bool Unsaved { get; } /// /// ID used to reference the component type across the network. /// If null, no network synchronization will be available for this component. /// /// public ushort? NetID { get; internal set; } /// /// The type that will be instantiated if this component is created. /// public Type Type { get; } /// /// Fields that are networked for this component. Used for delta states. /// public string[] NetworkedFields = []; public FrozenDictionary NetworkedFieldLookup = FrozenDictionary.Empty; // Internal for sandboxing. // Avoid content passing an instance of this to ComponentFactory to get any type they want instantiated. internal ComponentRegistration(string name, Type type, CompIdx idx, bool unsaved = false) { Name = name; Type = type; Idx = idx; Unsaved = unsaved; } public override string ToString() { return $"ComponentRegistration({Name}: {Type})"; } }