Plugin
A class in Root.Township, Alta.Caves.
A cave generation step asset (blob, tunnels, crystals, structures and so on), made of MapGeneratorParts that write values into a per-chunk layer. Run through a PluginInstance for each cave layer.
- Listed in World generation
- Inherits or implements
GeneralValue - Derived types
MarchingCubesPlugin,RoomFixPlugin - Attributes
CreateAssetMenu - Documented in Caves
Constructors
| Member | What it is |
|---|---|
Plugin() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
9 private and internal fields
| Member | What it is |
|---|---|
private Element element | Backing field for Element. The base Render spawns this element's prefab. |
private GenerationStage generationStage | Backing field for Stage, the generation stage the plugin runs in. |
private bool isDynamic | Backing field for IsDynamic (formerly isServerOnly). Dynamic plugins only run when the generator generates dynamic content. |
private bool isEnabled | Backing field for IsEnabled. Disabled plugins make instances that skip modify and render. |
private bool isNonZeroListCreated | Backing field for IsNonZeroListCreated. If set, each layer builds a list of its non-zero cells after generation. |
private int layerHeight | Backing field for LayerHeight, the Y size of this plugin's chunk layer. |
private int layerOverflowXZ | Backing field for LayerOverflowXZ: extra cells the layer reaches past each chunk edge. 1 by default. |
private List<MapGeneratorPart> parts | Backing field for Parts, the generator parts that modify each chunk in order. |
private int pluginIdentifier | Backing field for PluginIdentifier. Seeds the per-plugin random hash and is cached in generated loot saves. |
Properties
| Member | What it is |
|---|---|
Element Element { get; } | Optional element whose prefab the default Render spawns. |
bool IsDynamic { get; } | Marks plugins that place saved things (crystals, structures, totems). They only run when a layer is first generated on the server. |
bool IsEnabled { get; } | Turns the plugin off entirely when false. |
bool IsNonZeroListCreated { get; } | When true, the chunk layer builds a list of its non-zero values for later passes such as spawners. |
int LayerHeight { get; } | Height in cells of this plugin's value layer in each map chunk. |
int LayerOverflowXZ { get; } | Extra cells kept around each chunk edge in this plugin's layer, so parts can read past the border. |
List<MapGeneratorPart> Parts { get; } | The generator parts run in order by Modify. |
int PluginIdentifier { get; } | Stable id that seeds the plugin's randomness. Set from the instance id if it is 0 or less. |
GenerationStage Stage { get; } | Which generation stage the plugin belongs to. |
Methods
| Member | What it is |
|---|---|
virtual PluginInstance GetInstance(IGenerator generator) | Makes a PluginInstance of this plugin for a generator. |
virtual void Modify(MapChunk chunk, IPartInstance[] parts) | Runs each part on the map chunk. Subclasses can change this. |
void RegenerateIdentifier() | Editor: sets PluginIdentifier from the asset's instance id. |
virtual IEnumerator Render(MapChunk chunk, PluginInstance pluginInstance) (iterator) | Coroutine that spawns Element's prefab for the chunk, if there is one. |
1 private and internal method
Used in
Members of other types that take, return or hold a Plugin:
BiomeResources.plugins, BiomeResources.Plugins, WallAlignedDisplay.floorPlan, GenerationBase.floorPlugin, GenerationBase.FloorPlugin, MapChunk.GetLayer, MapChunk.layers, MarchingCubesPlugin.generatorLayer, PluginInstance.Plugin, PluginInstance.PluginInstance, PluginList.plugins, PluginList.Plugins, CopyPart.from, CopyPart.From, CopyPartInstance.from, MapGeneratorPart.overrideTarget, MapGeneratorPart.OverrideTarget, MapGeneratorPartInstance<T>.Plugin, MapGeneratorPartInstance<T>.Target, Mask.mask, Mask.MaskPlugin, OperationPart.a, OperationPart.A, OperationPart.b, OperationPart.B, OperationPartInstance.a, OperationPartInstance.b, RandomNoise.coverageMultiplier, RandomNoise.CoverageMultiplier, RoomFixes.manMadeLayer, RoomFixes.ManMadeLayer, Stretch.heightMapLayer, Stretch.HeightMapLayer, RoomFixPluginInstance.RoomFixPluginInstance, Ecosystem.PopulationApplication.plugin, Ecosystem.PopulationApplication.Plugin.