using System.Linq; using Content.Server.Worldgen.Systems.Debris; using Content.Server.Worldgen.Tools; using Content.Shared.Maps; using Content.Shared.Storage; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary; namespace Content.Server.Worldgen.Components.Debris; /// /// This is used for populating a grid with random entities automatically. /// [RegisterComponent] [Access(typeof(SimpleFloorPlanPopulatorSystem))] public sealed partial class SimpleFloorPlanPopulatorComponent : Component { private Dictionary? _caches; /// /// The prototype facing floor plan populator entries. /// [DataField("entries", required: true, customTypeSerializer: typeof(PrototypeIdDictionarySerializer, ContentTileDefinition>))] private Dictionary> _entries = default!; /// /// The spawn collections used to place entities on different tile types. /// [ViewVariables] public Dictionary Caches { get { if (_caches is null) { _caches = _entries .Select(x => new KeyValuePair(x.Key, new EntitySpawnCollectionCache(x.Value))) .ToDictionary(x => x.Key, x => x.Value); } return _caches; } } }