Table of Contents

Class TimbnPluginCrafts

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

Adds crafts on behalf of a plugin, at the game's own stations or at ones added with Stations.Add. Each craft is copied from one of the game's, shows up in the station's craft window straight away, and is removed when the plugin unloads. Core keeps a queued one out of the game's save so the save still loads once the plugin is gone. Reach it through the plugin's Crafts property.

public sealed class TimbnPluginCrafts
Inheritance
TimbnPluginCrafts
Inherited Members

Methods

Add(string, Action<TimbnCraftBuilder>)

Adds a craft whose name and description come from the plugin's lang files, under the craft's id and id_d. See Add(string, string, string, Action<TimbnCraftBuilder>).

public IDisposable Add(string id, Action<TimbnCraftBuilder> craft)

Parameters

id string

The craft's id, for example "timbn_smoke_fillet_fish_river". Keep it stable, since a save keeps a queued craft under it.

craft Action<TimbnCraftBuilder>

Describes the craft.

Returns

IDisposable

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

Examples

Crafts.Add("timbn_smoke_fillet_fish_river", craft => craft
    .In(rack)
    .BasedOn("cook_baked_fish")
    .Needs(("fillet_fish_river", 1), ("firewood", 1))
    .Makes("timbn_smoked_fish"));

with lang/en.txt holding timbn_smoke_fillet_fish_river and timbn_smoke_fillet_fish_river_d.

Exceptions

ArgumentException

The id is empty, or a count expression doesn't parse.

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

Adds a craft. See TimbnCraftBuilder for what it can hold. The craft window titles the craft with the name and shows the description in its tooltip. Call it in OnAwake, after the station it runs at when that is a station of the plugin's own.

public IDisposable Add(string id, string name, string description, Action<TimbnCraftBuilder> craft)

Parameters

id string

The craft's id, for example "timbn_smoke_fillet_fish_river". Keep it stable, since a save keeps a queued craft under it.

name string

The name shown in the craft window. Empty leaves the text to the plugin's lang files.

description string

The description shown in the craft's tooltip. Empty leaves it to the lang files.

craft Action<TimbnCraftBuilder>

Describes the craft.

Returns

IDisposable

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

Examples

Smoked fish from a river fillet and a log at the smoking rack, copied from the oven's baked fish.

Crafts.Add("timbn_smoke_fillet_fish_river", "Smoked Fish", "A fish fillet and a log of firewood make one smoked fish.", craft => craft
    .In(rack)
    .BasedOn("cook_baked_fish")
    .Needs(("fillet_fish_river", 1), ("firewood", 1))
    .Makes("timbn_smoked_fish")
    .AutoFinish());

Exceptions

ArgumentException

The id is empty, or a count expression doesn't parse.

Finish(WgoData)

Finishes the craft at the front of a station's queue now, as if its time ran out, so it pays out and the next queued craft starts. Does nothing when the station has no craft.

public void Finish(WgoData station)

Parameters

station WgoData

The station.

Start(WgoData, string)

Starts a craft at a station from code, with no craft window, the way the game's own StartCraft expression puts the berries on a bush. The craft goes in the station's queue and runs like one the player started, so a station that already runs one starts it after. End it early with Finish(WgoData).

public bool Start(WgoData station, string craftId)

Parameters

station WgoData

The station, for example one found with FindAll(string).

craftId string

The craft's id. It has to be one made at that station.

Returns

bool

False when the game has no such craft.