Skip to main content

GenerationCore

A class in Root.Township, the global namespace.

A procedural set piece (an encounter, a camp) placed by forest or cave generation. Its GeneratableParts build static content first and, when the chunk is being generated, dynamic content after.

Constructors​

MemberWhat it is
GenerationCore()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

5 private and internal fields
MemberWhat it is
private Logger loggerNLog logger, used to report generation errors.
private float maximumRadiusBacking field for MaximumRadius, the largest allowed generation radius.
private float minimumRadiusBacking field for MinimumRadius, the smallest allowed generation radius.
private GeneratablePart[] partsGeneratable parts run by Generate, set in the prefab.
private List<GeneratablePart> workingPartsParts for the current generation: a copy of parts plus any added with AddPart.

Properties​

MemberWhat it is
Chunk Chunk { get; private set; }Chunk the core is in: its chunking parent's chunk, or the best chunk at its position.
NetworkEntity ChunkingParent { get; private set; }Entity spawned content is chunked under, if any.
bool IsDynamic { get; private set; }Whether the core is dynamic. Never set in this code, so always false.
float MaximumRadius { get; }Largest radius this core may be placed with. Also used to filter it in distributions.
float MinimumRadius { get; }Smallest radius this core may be placed with.
float Radius { get; private set; }Radius chosen for this placement.
int Seed { get; private set; }Seed passed to Generate.
SpawnData SpawnData { get; private set; }Spawn data passed to Generate.

Methods​

MemberWhat it is
void AddPart(GeneratablePart part)Adds a part to the list being generated this run.
void Generate(SpawnData spawnData, NetworkEntity chunkingParent, bool isModifyingTerrain, float radius, int seed = 0)Runs every part's static generation with the given spawn data, radius and seed.
void GenerateDynamic()If the spawn data is generating, runs every part's dynamic generation and the static generation helper.
override void Release()Destroys the core's object.
5 private and internal methods
MemberWhat it is
private float Alta.Caves.IDistributionValue.Evaluate(AttributeSet set)Distribution weight: 1 when the set's special biome radius is inside the min and max radius, else 0.
private void OnDrawGizmos()Editor: draws the minimum and maximum radius circles.
private void TestGenerate()Editor context menu "Test": generates with default spawn data and a random radius.
private void TestNodeGenerate()Editor context menu "Test Node": generates as if on the nearest forest node in this chunk.
private void TestPathGenerate()Editor context menu "Test Path": generates as if on the nearest forest edge in this chunk.

Used in​

Members of other types that take, return or hold a GenerationCore: