Skip to main content

PluginInstance

A class in Root.Township, Alta.Caves.

One cave generation Plugin running for one generator (cave layer). Made by Plugin.GetInstance; holds the plugin's part instances and runs them on each map chunk. Both sides build the rock from the same seed.

Constructors​

MemberWhat it is
PluginInstance(IGenerator generator, Plugin plugin, bool isEnabled)Creates a PluginInstance from generator, plugin and isEnabled.

Fields​

1 private and internal field
MemberWhat it is
private IPartInstance[] partsPer-generator instances of the plugin's parts, passed to Plugin.Modify.

Properties​

MemberWhat it is
IGenerator Generator { get; private set; }The generator (cave layer) this instance belongs to.
bool IsEnabled { get; private set; }Whether it runs. A dynamic plugin is only enabled while the generator is generating dynamic content (on the server, the first time a layer ever generates).
string Name { get; private set; }The plugin asset's name, used in logs.
Plugin Plugin { get; private set; }The plugin asset.
int RandomPluginIdentifier { get; private set; }A random number from the generator's seeded hash and the plugin id, the same on every machine.
GenerationBase RenderGenerator { get; private set; }The generator cast to GenerationBase, or null if it isn't one.

Methods​

MemberWhat it is
bool ModifyChunk(MapChunk chunk)Adds this plugin's layer to the map chunk and runs its parts. Returns false and logs if a part throws.
IEnumerator RenderChunk(MapChunk chunk) (iterator)Coroutine that renders the plugin's output for a map chunk, if enabled.

Used in​

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