SimpleDebrisSelectorComponent.cs 961 B

12345678910111213141516171819202122232425262728293031323334
  1. using Content.Server.Worldgen.Systems.Debris;
  2. using Content.Server.Worldgen.Tools;
  3. using Content.Shared.Storage;
  4. namespace Content.Server.Worldgen.Components.Debris;
  5. /// <summary>
  6. /// This is used for a very simple debris selection for simple biomes. Just uses a spawn table.
  7. /// </summary>
  8. [RegisterComponent]
  9. [Access(typeof(DebrisFeaturePlacerSystem))]
  10. public sealed partial class SimpleDebrisSelectorComponent : Component
  11. {
  12. private EntitySpawnCollectionCache? _cache;
  13. /// <summary>
  14. /// The prototype-facing debris table entries.
  15. /// </summary>
  16. [DataField("debrisTable", required: true)]
  17. private List<EntitySpawnEntry> _entries = default!;
  18. /// <summary>
  19. /// The debris entity spawn collection.
  20. /// </summary>
  21. public EntitySpawnCollectionCache CachedDebrisTable
  22. {
  23. get
  24. {
  25. _cache ??= new EntitySpawnCollectionCache(_entries);
  26. return _cache;
  27. }
  28. }
  29. }