Skip to main content

ObjectPipeline

A class in Root.Township, the global namespace.

A serializable chain that turns an input object (usually a Distribution) into one result, such as picking a random prefab. Used by cave cluster generators and forest encounters.

Constructors​

MemberWhat it is
ObjectPipeline()Creates an ObjectPipeline with default values.

Fields​

6 private and internal fields
MemberWhat it is
private Object cachedResult after the first cacheDepth steps, kept between calls until Reset.
private int cacheDepthHow many pipeline steps to run once and cache; later calls to Get start from the cached result.
private Object inputThe starting object, usually a distribution.
private bool isRunTrue once Get has run and the cache is filled.
private static Logger loggerNLog logger for this class.
private int[] pipelineIndexes into Elements: the steps run on the input, in order.

Properties​

MemberWhat it is
static PipelineElement[] Elements { get; }The available steps: pick from a distribution, and flatten a distribution.
bool HasInput { get; }Whether an input object is set.

Methods​

MemberWhat it is
Object Get(SpawnData spawnData, string errorName = "Unknown")Runs the chain and returns the result. Steps up to the cache depth run once and are reused.
Object Get(Func<double> random, SpawnData spawnData, string errorName = "Unknown")Runs the chain and returns the result. Steps up to the cache depth run once and are reused.
IEnumerable<Object> GetAll() (iterator)Lists every result each step could give for the input.
void Reset()Clears the cache so the next Get runs every step again.

Used in​

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