Table of Contents

Class TimbnStationBuilder

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

Describes a buildable workstation for the plugin's Stations.Add, with its look, which game station it behaves like, and what it costs at the build desk. Core turns it into the five definitions the game expects, the station, its construction site, the build desk entry and the two removals, with their text, the same way the game's own woodworking bench is set up. Only Model(TimbnModel) is required. A station 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 TimbnStationBuilder
Inheritance
TimbnStationBuilder
Inherited Members

Examples

A smoking rack that works like the kitchen oven, built in the yard for 4 boards.

var model = Models.Build("SmokingRack", faces => faces.Block("smoking_rack", x: 0, y: 0, z: 0, depth: 30));
var rack = Stations.Add("timbn_smoking_rack", "Smoking Rack", "A plain rack for smoking fish.", station => station
    .Model(model, model.Size)
    .BasedOn("kitchen_oven")
    .Icon("timbn_red_workbench")
    .Cost(("flitch", 4))
    .NoFuel()
    .NoExtensions());

Methods

Automatic(int)

Makes the station run its crafts by itself over time, the way the kitchen oven cooks while the player is away, whose tick duration is 10. Use Manual() for one that only progresses while someone works it.

public TimbnStationBuilder Automatic(int tickDuration)

Parameters

tickDuration int

The game's autocraft tick duration, for example 10.

Returns

TimbnStationBuilder

BasedOn(string)

The game station the new one behaves like, copied field by field. "kitchen_oven" gives a timed station that cooks on its own and takes a zombie, "sawhorse" a bench worked by hand. The woodworking bench ("woodworking_workbench_1") by default. Its site, build desk entry and removals are copied from the same station when the game builds it from a build desk, otherwise from the woodworking bench's.

public TimbnStationBuilder BasedOn(string stationId)

Parameters

stationId string

The game station's world object id.

Returns

TimbnStationBuilder

BuildTab(string)

Which tab of the build desk's menu lists the station. An empty string is the first tab, and a station based on a bench keeps the bench's, which is the second tab at the morgue and the "tab_building_extension" tab at the yard. Use a tab id the build desk already has, from TimbnGameIds.BuildTabs, such as BuildTabs.MetallurgyExtension or BuildTabs.SewingExtension at the yard or BuildTabs.GraveyardModule at the graveyard, since a tab nothing else uses has no icon.

public TimbnStationBuilder BuildTab(string tabId)

Parameters

tabId string

The tab's id, or BuildTabs.First (an empty string) for the first tab.

Returns

TimbnStationBuilder

BuildsInSlot(string)

Lets the player build the station only into a slot of another station, one that has a Slot(string, Vector3, Vector3) with this id, through the game's own slot check, the one the conveyor furnace's bellows use. It goes down finished with no construction site like the game's own slot pieces, and it is still a normal station the player works. Its footprint should match the slot, and it is still offered by the build desk from BuiltAt(string, string?), which has to be the one whose zone the slotted station stands in.

public TimbnStationBuilder BuildsInSlot(string slotId)

Parameters

slotId string

The slot's id.

Returns

TimbnStationBuilder

Exceptions

ArgumentException

The id is empty.

BuiltAt(string, string?)

Which build desk offers the station, the yard's ("builder_yard") by default. Each build desk builds in its own zone, for example "builder_graveyard" or "builder_garden". The station can be limited to one build area in that zone, such as "yard_place". Without an area it goes anywhere in the zone, except that the template's own area is kept on a build desk the template also uses.

public TimbnStationBuilder 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

TimbnStationBuilder

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

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

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

Parameters

items (string Item, int Count)[]

Item ids with counts.

Returns

TimbnStationBuilder

CraftSlots(int)

How many ingredient slots the station's craft window has, which caps how many different items one craft can take at once. The woodworking bench has 50. Left alone it is the base station's.

public TimbnStationBuilder CraftSlots(int slots)

Parameters

slots int

The slot count, 0 or more.

Returns

TimbnStationBuilder

Exceptions

ArgumentOutOfRangeException

The count is below zero.

DockDistance(float)

How far past the footprint's edge the dock spot is, for every side, where a zombie stands to work it and finished items drop. Left alone it is 0.45, which suits a deep bench, and a small station looks better with the zombie closer. It only moves the finished station's dock. The construction site keeps at least 0.45, since the keeper has to stand at the site's dock to work it and a closer one sits inside the site's solid body.

public TimbnStationBuilder DockDistance(float distance)

Parameters

distance float

World units from the edge of the footprint, for example 0.2 to stand right at it.

Returns

TimbnStationBuilder

Exceptions

ArgumentOutOfRangeException

The distance is below zero.

Edit(Action<WGODef>)

Changes anything else on the station's definition after Core has filled it in, for example its craftInventorySize.

public TimbnStationBuilder Edit(Action<WGODef> edit)

Parameters

edit Action<WGODef>

Runs on the copy each time the balance loads.

Returns

TimbnStationBuilder

Extensions(string, params string[])

Which bench extensions attach to the station when built next to it, the game's "tool_rack" or one added with Stations.AddExtension. The first call replaces the template's list and a second call adds to it. A craft that calls NeedsExtension with one of these ids only runs while that extension is attached.

public TimbnStationBuilder Extensions(string extensionId, params string[] more)

Parameters

extensionId string

An extension's world object id.

more string[]

More extensions' world object ids.

Returns

TimbnStationBuilder

HoldsZombie()

Lets the player lay a zombie on the station and take it back, the way the game's corpse pallet holds a corpse. E with a zombie overhead puts it in the station's one slot, where it stops being drawn, and E with free hands takes it back unless a craft is running there, so a craft started on the station holds the zombie until it ends. The station can't be dismantled while a zombie lies on it. Show the zombie with ShowWhen(TimbnLookCondition, TimbnModel, bool) and HoldsGroup(string, int)("zombie"), and start a craft there with the plugin's Crafts.Start. The game's resurrection table ("resurrection_table_1") makes a good base.

public TimbnStationBuilder HoldsZombie()

Returns

TimbnStationBuilder

Icon(string)

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

public TimbnStationBuilder Icon(string spriteId)

Parameters

spriteId string

The sprite name, for example "timbn_red_workbench".

Returns

TimbnStationBuilder

Left(TimbnModel, TimbnModel?)

The station's look when it faces left, which the player gets by turning it with R while placing it. It has its own footprint from the model, and its dock spot is on the left edge. The station is still one building with one id, so crafts and patches never care which way it faces. R turns through the facings a station has in the order down, left, up, right.

public TimbnStationBuilder Left(TimbnModel model, TimbnModel? site = null)

Parameters

model TimbnModel

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

site TimbnModel

The construction site's look for this facing, or null for the generated outline. See Site(TimbnModel).

Returns

TimbnStationBuilder

Examples

A still that is long when it faces the camera and narrow when it faces left, with a flipped copy for right.

station
    .Model(longStill)
    .Left(narrowStill)
    .MirrorSides();

Exceptions

ArgumentOutOfRangeException

The model has no size on some axis.

Left(TimbnModel, Vector3, TimbnModel?)

The station's look when it faces left, with a footprint of the given size. See Left(TimbnModel, TimbnModel?).

public TimbnStationBuilder Left(TimbnModel model, Vector3 size, TimbnModel? site = null)

Parameters

model TimbnModel

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

size Vector3

Width, height and depth in world units.

site TimbnModel

The construction site's look for this facing, or null for the generated outline.

Returns

TimbnStationBuilder

Exceptions

ArgumentOutOfRangeException

The size is zero or below on some axis.

Limit(int)

Caps how many of the station the player can have at once, through the game's own build limit, so the build desk shows how many are built out of how many are allowed and refuses to place another at the cap. Core counts the stations and construction sites standing in the world each time, so a site counts from the moment it is placed and stops counting once it is gone, however it went.

public TimbnStationBuilder Limit(int max)

Parameters

max int

The most the player can have, 1 or more.

Returns

TimbnStationBuilder

Exceptions

ArgumentOutOfRangeException

The limit is below 1.

Manual()

Makes the station progress its crafts only while the player or a zombie works it, like the circular saw.

public TimbnStationBuilder Manual()

Returns

TimbnStationBuilder

MirrorSides()

Fills a missing left or right facing with a left to right flipped copy of the other one, drawn with the same model and site, so a mod needs art for one of the two only. A copy is only made when the other facing exists and this one wasn't given. Down and up look the same flipped and are never mirrored, and nothing is ever flipped top to bottom. The order of this call among the others doesn't matter.

public TimbnStationBuilder MirrorSides()

Returns

TimbnStationBuilder

Model(TimbnModel)

The finished station's look when it faces the camera, which every station has, with a box shaped footprint the size of the model, a solid body, an interaction area and a dock spot in front where the player works and finished items drop. A station with only this side stays as it is placed. Add Left(TimbnModel, TimbnModel?), Right(TimbnModel, TimbnModel?) or Up(TimbnModel, TimbnModel?) to let the player turn it with R in build mode.

public TimbnStationBuilder Model(TimbnModel model)

Parameters

model TimbnModel

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

Returns

TimbnStationBuilder

Exceptions

ArgumentOutOfRangeException

The model has no size on some axis.

Model(TimbnModel, Vector3)

The finished station's look when it faces the camera, with a footprint of the given size instead of the model's own. See Model(TimbnModel).

public TimbnStationBuilder Model(TimbnModel model, Vector3 size)

Parameters

model TimbnModel

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

size Vector3

Width, height and depth in world units, for example (1.5, 0.8, 1) for a bench.

Returns

TimbnStationBuilder

Exceptions

ArgumentOutOfRangeException

The size is zero or below on some axis.

NoConstruction()

Puts the finished station down as soon as it is placed, with no construction site and no hammer work, for a station that is more of a placed object than something built. Its cost is still taken when it is placed.

public TimbnStationBuilder NoConstruction()

Returns

TimbnStationBuilder

NoExtensions()

Takes away the template's bench extensions, so none attaches to the station.

public TimbnStationBuilder NoExtensions()

Returns

TimbnStationBuilder

NoFuel()

Takes away the fuel the template burns, so a station copied from the kitchen oven runs without fire.

public TimbnStationBuilder NoFuel()

Returns

TimbnStationBuilder

NoRefund()

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

public TimbnStationBuilder NoRefund()

Returns

TimbnStationBuilder

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

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

public TimbnStationBuilder 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

TimbnStationBuilder

Right(TimbnModel, TimbnModel?)

The station's look when it faces right, with its own footprint from the model and its dock spot on the right edge. Leave it out and call MirrorSides() to get it from Left(TimbnModel, TimbnModel?) flipped.

public TimbnStationBuilder Right(TimbnModel model, TimbnModel? site = null)

Parameters

model TimbnModel

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

site TimbnModel

The construction site's look for this facing, or null for the generated outline.

Returns

TimbnStationBuilder

Exceptions

ArgumentOutOfRangeException

The model has no size on some axis.

Right(TimbnModel, Vector3, TimbnModel?)

The station's look when it faces right, with a footprint of the given size. See Right(TimbnModel, TimbnModel?).

public TimbnStationBuilder Right(TimbnModel model, Vector3 size, TimbnModel? site = null)

Parameters

model TimbnModel

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

size Vector3

Width, height and depth in world units.

site TimbnModel

The construction site's look for this facing, or null for the generated outline.

Returns

TimbnStationBuilder

Exceptions

ArgumentOutOfRangeException

The size is zero or below on some axis.

ShowWhen(TimbnFacing, TimbnLookCondition, TimbnModel, bool)

Adds a model to one facing that shows while a condition holds. A mirrored facing shows the models of the facing it flips, so give them to that one. See ShowWhen(TimbnLookCondition, TimbnModel, bool).

public TimbnStationBuilder ShowWhen(TimbnFacing facing, TimbnLookCondition condition, TimbnModel model, bool replacesBase = false)

Parameters

facing TimbnFacing

The facing the model belongs to, which has to be a drawn one.

condition TimbnLookCondition

When the model shows, from TimbnLook.

model TimbnModel

The model to show.

replacesBase bool

True to hide that facing's own model while this one shows. Only one model per facing may.

Returns

TimbnStationBuilder

Exceptions

ArgumentNullException

The condition or the model is null.

ShowWhen(TimbnLookCondition, TimbnModel, bool)

Adds a model to the station's front facing that shows while a condition holds and goes away when it doesn't, the way the game's autopsy table shows a cloth over a body. The game checks the condition again when the station's items, resources, worker or work change, and when the station loads, so it needs nothing from the mod. The model lines up with the station's own when both are built from faces, whatever their sizes. It adds no footprint, body or dock, so it can't change where the station stands or where a zombie works it.

public TimbnStationBuilder ShowWhen(TimbnLookCondition condition, TimbnModel model, bool replacesBase = false)

Parameters

condition TimbnLookCondition

When the model shows, from TimbnLook.

model TimbnModel

The model to show.

replacesBase bool

True to hide the station's own model while this one shows, for a full swap of the look.

Returns

TimbnStationBuilder

Examples

A slab that shows a zombie lying on it while one is seated, instead of the empty stone.

station
    .Model(emptySlab)
    .ShowWhen(TimbnLook.HasWorker(), slabWithZombie, replacesBase: true);

Exceptions

ArgumentNullException

The condition or the model is null.

Site(TimbnModel)

The construction site's look when the station faces the camera, the outline that stands there until the player works it off with the hammer. It gets the same footprint as the station. Without one the site is a dashed outline of the footprint on the ground with the game's own warning sign at the front. The other facings take their site as an argument, and a mirrored facing uses the site of the one it flips.

public TimbnStationBuilder Site(TimbnModel model)

Parameters

model TimbnModel

The site's model.

Returns

TimbnStationBuilder

Slot(string, Vector3, Vector3)

Builds a slot into the station's front facing, a spot where a station or extension that calls BuildsInSlot with the same id goes, the way the game's conveyor furnace has spots for its bellows and press. In build mode the game marks each free slot in green, places it only there, and links the two, so the station finds what sits in its slots with Extensions(WgoData). Removing the station removes what sits in its slots, with their refund and anything they hold dropped on the ground. A slot is the size of what goes in it, so pass the same size given to that one's Model. The game snaps both to its build grid, so the size has to be whole cells (0.32 across and 0.3 deep) and the slot's corner a whole number of cells from the corner of this station's footprint, and Stations.Add says the nearest spot that fits when it isn't. A slot can sit beside the station, the way the yard furnace takes its bellows, or inside its footprint, the way the conveyor furnace takes its pieces on top.

public TimbnStationBuilder Slot(string slotId, Vector3 position, Vector3 size)

Parameters

slotId string

The slot's id, which the station or extension that goes in it names.

position Vector3

Where the center of what goes in the slot sits, from the center of this station on the ground. The height is ignored.

size Vector3

The size of what goes in the slot. The height is ignored.

Returns

TimbnStationBuilder

Examples

A table with a stand's slot on its left and another on its right.

station
    .Model(table, new Vector3(1.28f, 0.8f, 0.6f))
    .Slot("timbn_stand_slot", new Vector3(-0.96f, 0f, 0f), new Vector3(0.64f, 1f, 0.6f))
    .Slot("timbn_stand_slot", new Vector3(0.96f, 0f, 0f), new Vector3(0.64f, 1f, 0.6f));

Exceptions

ArgumentException

The id is empty.

ArgumentOutOfRangeException

The width or depth is zero or below.

Slot(TimbnFacing, string, Vector3, Vector3)

Builds a slot into one facing of the station, from the center of that facing's footprint. A mirrored facing gets the slots of the facing it flips, flipped, so give them to that one. See Slot(string, Vector3, Vector3).

public TimbnStationBuilder Slot(TimbnFacing facing, string slotId, Vector3 position, Vector3 size)

Parameters

facing TimbnFacing

The facing the slot belongs to, which has to be a drawn one.

slotId string

The slot's id, which the station or extension that goes in it names.

position Vector3

Where the center of what goes in the slot sits, from the center of this facing on the ground. The height is ignored.

size Vector3

The size of what goes in the slot. The height is ignored.

Returns

TimbnStationBuilder

Exceptions

ArgumentException

The id is empty.

ArgumentOutOfRangeException

The width or depth is zero or below.

Storage(int)

How many slots the station's own inventory has, where fuel and anything a craft leaves in the station goes. Zero gives it none. Left alone it is the base station's.

public TimbnStationBuilder Storage(int slots)

Parameters

slots int

The slot count, 0 or more.

Returns

TimbnStationBuilder

Exceptions

ArgumentOutOfRangeException

The count is below zero.

TakesZombie(bool)

Whether the player can put a zombie to work at the station. Left alone it is the base station's.

public TimbnStationBuilder TakesZombie(bool takes = true)

Parameters

takes bool

True to take a zombie, false to leave the station to the player.

Returns

TimbnStationBuilder

Talent(string)

The talent the station is worked under, which is the skill its crafts and its dismantling use. The game's kitchen oven uses "talent_green" and its woodworking bench and circular saw "talent_orange". Left alone it is the base station's.

public TimbnStationBuilder Talent(string talentId)

Parameters

talentId string

The talent's id, for example "talent_orange".

Returns

TimbnStationBuilder

Tool(ItemType)

The tool the player or a zombie needs to work the station, which also picks the zombie's work animation. A craft's own tool, when it has one, wins over this. The kitchen oven's is none, so a station based on it needs no tool, and a hammer here makes it a bench worked with the hammer. Left alone it is the base station's.

public TimbnStationBuilder Tool(ItemType tool)

Parameters

tool ItemType

The item type, such as ItemType.Hammer, or ItemType.None for no tool.

Returns

TimbnStationBuilder

UnlockedBy(string)

Has a technology put the station on the build desk, the way "work_with_wood_1" opens the woodworking bench. The tech's tooltip lists the station, researching the tech unlocks it, and a save that already has the tech gets it as soon as it loads. The station is missing from the build desk until then. The tech is put back when the plugin unloads, and a tech the game doesn't have is logged.

public TimbnStationBuilder UnlockedBy(string techId)

Parameters

techId string

The technology's id.

Returns

TimbnStationBuilder

Up(TimbnModel, TimbnModel?)

The station's look when it faces away from the camera, with its own footprint from the model and its dock spot on the back edge. It is never mirrored, since it looks the same flipped.

public TimbnStationBuilder Up(TimbnModel model, TimbnModel? site = null)

Parameters

model TimbnModel

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

site TimbnModel

The construction site's look for this facing, or null for the generated outline.

Returns

TimbnStationBuilder

Exceptions

ArgumentOutOfRangeException

The model has no size on some axis.

Up(TimbnModel, Vector3, TimbnModel?)

The station's look when it faces away from the camera, with a footprint of the given size. See Up(TimbnModel, TimbnModel?).

public TimbnStationBuilder Up(TimbnModel model, Vector3 size, TimbnModel? site = null)

Parameters

model TimbnModel

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

size Vector3

Width, height and depth in world units.

site TimbnModel

The construction site's look for this facing, or null for the generated outline.

Returns

TimbnStationBuilder

Exceptions

ArgumentOutOfRangeException

The size is zero or below on some axis.

WorkSound(string)

The sound the station makes each time its work ticks, for example "woodworking_workbench_tick" for the woodworking bench. Any sound id the game has. Left alone it is the base station's.

public TimbnStationBuilder WorkSound(string soundId)

Parameters

soundId string

The sound's id.

Returns

TimbnStationBuilder

ZombieSpot(bool)

Gives the station a spot where the game's own handler seats a zombie, for a station based on the game's zombie supplier ("zombie_supplier_station") or another that uses its handler. The player puts a zombie in with E and takes it out the usual way, and the zombie is the station's worker. Core bakes the spot at the dock edge of every facing, looking back at the station. A seated zombie stays a caretaker, which asks its zone for orders and walks off to carry things for zombie crafter benches, so Core keeps it sitting unless the station takes orders.

public TimbnStationBuilder ZombieSpot(bool takesOrders = false)

Parameters

takesOrders bool

True to leave the zombie to take orders like the game's own supplier does, for a mod that makes a real one.

Returns

TimbnStationBuilder