Files
tbd-station-14/Content.Server/Worldgen/Components/Debris/NoiseDrivenDebrisSelectorComponent.cs
Moony e91fc652a3 Dynamic space world generation and debris. (#15120)
* World generation (squash)

* Test fixes.

* command

* o

* Access cleanup.

* Documentation touchups.

* Use a prototype serializer for BiomeSelectionComponent

* Struct enumerator in SimpleFloorPlanPopulatorSystem

* Safety margins around PoissonDiskSampler, cookie acquisition methodologies

* Struct enumerating PoissonDiskSampler; internal side

* Struct enumerating PoissonDiskSampler: Finish it

* Update WorldgenConfigSystem.cs

awa

---------

Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
Co-authored-by: 20kdc <asdd2808@gmail.com>
2023-05-16 06:36:45 -05:00

45 lines
1.5 KiB
C#

using Content.Server.Worldgen.Prototypes;
using Content.Server.Worldgen.Systems.Debris;
using Content.Server.Worldgen.Tools;
using Content.Shared.Storage;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Worldgen.Components.Debris;
/// <summary>
/// This is used for selecting debris with a probability determined by a noise channel.
/// Takes priority over SimpleDebrisSelectorComponent and should likely be used in combination.
/// </summary>
[RegisterComponent]
[Access(typeof(NoiseDrivenDebrisSelectorSystem))]
public sealed class NoiseDrivenDebrisSelectorComponent : Component
{
private EntitySpawnCollectionCache? _cache;
/// <summary>
/// The prototype-facing debris table entries.
/// </summary>
[DataField("debrisTable", required: true)]
private List<EntitySpawnEntry> _entries = default!;
/// <summary>
/// The debris entity spawn collection.
/// </summary>
public EntitySpawnCollectionCache CachedDebrisTable
{
get
{
_cache ??= new EntitySpawnCollectionCache(_entries);
return _cache;
}
}
/// <summary>
/// The noise channel to use as a density controller.
/// </summary>
/// <remarks>This noise channel should be mapped to exactly the range [0, 1] unless you want a lot of warnings in the log.</remarks>
[DataField("noiseChannel", customTypeSerializer: typeof(PrototypeIdSerializer<NoiseChannelPrototype>))]
public string NoiseChannel { get; } = default!;
}