Table of Contents

Class TimbnExtensionBuilder

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

Describes a bench extension for the plugin's Stations.AddExtension, like the game's tool rack. An extension is placed straight from the build desk with no construction site, has nothing to interact with, and attaches to a station that lists it in Extensions(string, params string[]) when the two are built next to each other. Core turns it into the extension, its build desk entry and its removal, with their text. Only Model(TimbnModel, Vector3) is required. An extension with no Cost(params (string Item, int Count)[]) is free, and one with no UnlockedBy(string) is on the build desk from the start.

public sealed class TimbnExtensionBuilder
Inheritance
TimbnExtensionBuilder
Inherited Members

Examples

A pillar that opens a craft at the Stick Box when built next to it.

var model = Models.Build("RedPillar", faces => faces.Block("red_pillar", x: 0, y: 0, z: 0, depth: 20));
Stations.AddExtension("timbn_red_magic", "Red Magic Pillar", "A humming red pillar.", pillar => pillar
    .Model(model, model.Size)
    .Icon("timbn_red_magic")
    .Cost(("flitch", 2)));

Methods

BasedOn(string)

The game extension the new one is copied from, the tool rack ("tool_rack") by default. Its build desk entry and removal are copied from the same extension when it has them, otherwise from the tool rack's.

public TimbnExtensionBuilder BasedOn(string extensionId)

Parameters

extensionId string

The game extension's world object id.

Returns

TimbnExtensionBuilder

BuildsInSlot(string)

Lets the player build the extension only into a slot of a station, one that has a Slot(string, Vector3, Vector3) with this id, the way the conveyor furnace takes its bellows. The station lists the extension in Extensions(string, params string[]) for crafts that need it. Its footprint should match the slot.

public TimbnExtensionBuilder BuildsInSlot(string slotId)

Parameters

slotId string

The slot's id.

Returns

TimbnExtensionBuilder

Exceptions

ArgumentException

The id is empty.

BuiltAt(string, string?)

Which build desk offers the extension, the yard's ("builder_yard") by default, and a build area in its zone to limit it to. See BuiltAt(string, string?).

public TimbnExtensionBuilder BuiltAt(string buildDeskId, string? areaId = null)

Parameters

buildDeskId string

The build desk's world object id.

areaId string

A build area id in the build desk's zone, or null for the default.

Returns

TimbnExtensionBuilder

Cost(params (string Item, int Count)[])

What the build desk charges to place the extension, for example ("flitch", 2). A second call adds to the first, and an extension with no cost is free. Half of it comes back when it is dismantled unless Refund((string Item, int Count), params (string Item, int Count)[]) or NoRefund() says otherwise.

public TimbnExtensionBuilder Cost(params (string Item, int Count)[] items)

Parameters

items (string Item, int Count)[]

Item ids with counts.

Returns

TimbnExtensionBuilder

Edit(Action<WGODef>)

Changes anything else on the extension's definition after Core has filled it in.

public TimbnExtensionBuilder Edit(Action<WGODef> edit)

Parameters

edit Action<WGODef>

Runs on the copy each time the balance loads.

Returns

TimbnExtensionBuilder

Icon(string)

The icon shown in the build desk and on the station's craft window row. Any sprite the game has, or one added with the plugin's Sprites.AddEmbeddedPng. Without one the template's icons stay.

public TimbnExtensionBuilder Icon(string spriteId)

Parameters

spriteId string

The sprite name, for example "timbn_red_magic".

Returns

TimbnExtensionBuilder

Model(TimbnModel, Vector3)

The extension's look, a model from the plugin's Models with a box shaped footprint of the given size and a solid body.

public TimbnExtensionBuilder Model(TimbnModel model, Vector3 size)

Parameters

model TimbnModel

The model, centered on the extension with its base at the ground.

size Vector3

Width, height and depth in world units, for example (0.5, 1, 0.5) for a pillar.

Returns

TimbnExtensionBuilder

Exceptions

ArgumentOutOfRangeException

The size is zero or below on any axis.

NoRefund()

Gives nothing back when the extension is dismantled, instead of half the cost.

public TimbnExtensionBuilder NoRefund()

Returns

TimbnExtensionBuilder

Reach(float)

How far past the footprint the extension reaches to attach to a station, 0.64 by default like the tool rack.

public TimbnExtensionBuilder Reach(float distance)

Parameters

distance float

The reach in world units.

Returns

TimbnExtensionBuilder

Refund((string Item, int Count), params (string Item, int Count)[])

What dismantling the extension gives back, instead of half the cost. A second call adds to the first.

public TimbnExtensionBuilder Refund((string Item, int Count) item, params (string Item, int Count)[] more)

Parameters

item (string Item, int Count)

An item id with its count.

more (string Item, int Count)[]

More item ids with counts.

Returns

TimbnExtensionBuilder

UnlockedBy(string)

Has a technology put the extension on the build desk, like UnlockedBy(string) for a station. It is missing from the build desk until the save has the tech.

public TimbnExtensionBuilder UnlockedBy(string techId)

Parameters

techId string

The technology's id.

Returns

TimbnExtensionBuilder