API
Introduction
The API can be found in the TOKModdingAPI
namespace. Members outside this namespace can still be used, but are not guaranteed to be stable across updates and may work differently than expected.
Piece API
The Piece API is a set of classes and methods that allow you to add new pieces to the game.
Pieces are custom content, and therefore are reloaded whenever the main menu is shown or manually by the user. This means these API methods should be used in the LoadContent
method of your mod.
Methods
PieceAPI.AddPiece(...)
Adds a new piece to the game.
PieceAPI.OverridePiece(...)
Overrides an existing piece in the game.
PieceAPI.BeginBuildPiece(...) -> PieceBuilder
Begins building a new piece. This is used to set the properties of the piece before adding it to the game.
To finish building the piece, call PieceBuilder.BuildPiece()
or PieceBuilder.BuildOverride()
. This will automatically add or override the piece in the game.