Table of Contents

Class TimbnPluginStations

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

Adds buildable workstations and bench extensions on behalf of a plugin, each offered at a build desk and built, worked and dismantled like the game's own. Core makes every definition the game expects from a few lines, keeps a built one out of the game's save so the save still loads once the plugin is gone, and removes everything when the plugin unloads. Reach it through the plugin's Stations property.

public sealed class TimbnPluginStations
Inheritance
TimbnPluginStations
Inherited Members

Methods

Add(string, Action<TimbnStationBuilder>)

Adds a workstation whose name and build desk description come from the plugin's lang files. The station and its construction site are named under the station's id, and the build desk entry under its BuildingId with the description under BuildingId_d. See Add(string, string, string, Action<TimbnStationBuilder>).

public TimbnStation Add(string id, Action<TimbnStationBuilder> station)

Parameters

id string

The station's world object id, for example "timbn_stick_box". Keep it stable, since saves name a built station by it.

station Action<TimbnStationBuilder>

Describes the station.

Returns

TimbnStation

The station, for naming it in a craft's In. It lives until the plugin unloads.

Examples

var box = Stations.Add("timbn_stick_box", station => station
    .Model(model, model.Size)
    .BasedOn("sawhorse")
    .Cost(("flitch", 2)));

with lang/en.txt holding timbn_stick_box, timbn_stick_box_place, timbn_stick_box_place_p and timbn_stick_box_place_p_d.

Exceptions

ArgumentException

The id is empty.

InvalidOperationException

No model was given.

Add(string, string, string, Action<TimbnStationBuilder>)

Adds a workstation the player builds from a build desk. Placing it puts down a construction site that the player works off with the hammer, then the station appears in its place, and the build desk's remove tool dismantles it for a refund. See TimbnStationBuilder for what a station can hold. Call it in OnAwake, before the crafts that run at it.

public TimbnStation Add(string id, string name, string description, Action<TimbnStationBuilder> station)

Parameters

id string

The station's world object id, for example "timbn_stick_box". Keep it stable, since saves name a built station by it.

name string

The name shown in the build desk and over the station. Empty leaves the text to the plugin's lang files.

description string

The description shown in the build desk. Empty leaves it to the lang files.

station Action<TimbnStationBuilder>

Describes the station.

Returns

TimbnStation

The station, for naming it in a craft's In. It lives until the plugin unloads, so unlike an extension or a craft there is no handle to remove it early.

Examples

A box that splits boards into sticks, worked like the sawhorse and taking a tool rack.

var model = Models.Build("StickBox", faces => faces.Block("stick_box", x: 0, y: 0, z: 0, depth: 40));
var box = Stations.Add("timbn_stick_box", "Stick Box", "A red box for splitting boards into sticks.", station => station
    .Model(model, model.Size)
    .BasedOn("sawhorse")
    .Icon("timbn_stick_box")
    .Cost(("flitch", 2))
    .Extensions("tool_rack"));

Exceptions

ArgumentException

The id is empty.

InvalidOperationException

No model was given.

AddExtension(string, Action<TimbnExtensionBuilder>)

Adds a bench extension whose name and build desk description come from the plugin's lang files, under the extension's id, its build desk entry id_p and the description id_p_d. See AddExtension(string, string, string, Action<TimbnExtensionBuilder>).

public IDisposable AddExtension(string id, Action<TimbnExtensionBuilder> extension)

Parameters

id string

The extension's world object id, for example "timbn_red_magic". Keep it stable, since saves name a built extension by it.

extension Action<TimbnExtensionBuilder>

Describes the extension.

Returns

IDisposable

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

Exceptions

ArgumentException

The id is empty.

InvalidOperationException

No model was given.

AddExtension(string, string, string, Action<TimbnExtensionBuilder>)

Adds a bench extension like the game's tool rack, placed straight from a build desk with no construction site. It attaches to a station that lists it in Extensions(string, params string[]) when the two stand next to each other, and crafts that call NeedsExtension with its id open at that station while it is attached. See TimbnExtensionBuilder for what an extension can hold. Call it in OnAwake.

public IDisposable AddExtension(string id, string name, string description, Action<TimbnExtensionBuilder> extension)

Parameters

id string

The extension's world object id, for example "timbn_red_magic". Keep it stable, since saves name a built extension by it.

name string

The name shown in the build desk. Empty leaves the text to the plugin's lang files.

description string

The description shown in the build desk. Empty leaves it to the lang files.

extension Action<TimbnExtensionBuilder>

Describes the extension.

Returns

IDisposable

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

Exceptions

ArgumentException

The id is empty.

InvalidOperationException

No model was given.