Table of Contents

Class TimbnPluginModels

Namespace
Timbn.GraveyardKeeperTwo.Core.Framework
Assembly
Timbn.GraveyardKeeperTwo.Core.dll

Adds 3D models on behalf of a plugin. It builds models from the plugin's PNGs and draws them with the game's own prop shader. Hand a model to the plugin's Stations to make a buildable station or bench extension, or to AddPart for a part hung on a grave. Everything is freed when the plugin unloads. Reach it through the plugin's Models property.

public sealed class TimbnPluginModels
Inheritance
TimbnPluginModels
Inherited Members

Methods

AddPart(string, TimbnModel, Bounds?)

Makes a model an extra part that the game hangs on a world object with the AddWgoPart expression, the way a headstone or a fence goes on a grave. The part sits at the world object's origin, so the offset goes into the prefab, for example a headstone 0.3 units toward the back of the grave with its base 0.13 up. A part is walked through unless it gets a solid box. A fence needs one, since a grave hides its own mound and collision while a fence is in it and expects the fence to bring both. A part hung on a world object is kept out of the game's save while the game writes it and put back on load, so the save still loads once the mod is gone.

public IDisposable AddPart(string partId, TimbnModel model, Bounds? solid = null)

Parameters

partId string

The id AddWgoPart and RemoveWgoPart use, for example "timbn_grave_bot_1".

model TimbnModel

The model to draw.

solid Bounds?

A box the player bumps into, in the world object's space, or null for none. For example new Bounds(new Vector3(0f, 0.3f, 0.075f), new Vector3(0.6f, 0.6f, 1f)) covers a grave.

Returns

IDisposable

A handle that removes the part's look early when disposed. You don't need to keep it.

Build(string, Action<TimbnModelFaces>)

Makes a model from PNGs with no 3D modeling and no Unity, drawn with the game's own prop shader so it takes the game's lighting. Each PNG is a face exactly as the player sees it (a front standing up, a top lying flat, or a block that is both), its own size is the face's size, and you only say where it stands (see TimbnModelFaces). Hand the result to the plugin's Stations or AddPart. It is freed when the plugin unloads.

public TimbnModel Build(string name, Action<TimbnModelFaces> build)

Parameters

name string

The model's name, for example "PcDesk".

build Action<TimbnModelFaces>

Adds the model's faces.

Returns

TimbnModel

The model, ready for a station's Model.

Exceptions

InvalidOperationException

The model has no faces, a PNG is missing or unreadable, a block's depth leaves no front, or two faces on the same plane overlap.

ArgumentOutOfRangeException

A face's position is below zero or a block's depth is below 1.