‪TechbloxModdingAPI  ‪v2.2.0
‪The unofficial Techblox modding API
TechbloxModdingAPI.App.Game Class Reference

‪An in-game save. This can be a menu item for a local save or the currently loaded save. Support for Steam Workshop coming soon (hopefully). More...

Public Member Functions

 Game ()
 ‪Initializes a new instance of the T:TechbloxModdingAPI.App.Game class without id. This is assumed to be the current game. More...
 
 Game (EGID id)
 ‪Initializes a new instance of the T:TechbloxModdingAPI.App.Game class. More...
 
 Game (uint id)
 ‪Initializes a new instance of the T:TechbloxModdingAPI.App.Game class. More...
 
void AddDebugInfo (string id, Func< string > contentGetter)
 ‪Add information to the in-game debug display. When this object is garbage collected, this debug info is automatically removed. The provided getter function is called each frame so make sure it returns quickly. More...
 
void EnableScreenshotTaker ()
 ‪Enable the screenshot taker for updating the game's screenshot. Breaks the pause menu in a new save. More...
 
void EnterGame ()
 ‪Load the game save. This happens asynchronously, so when this method returns the game not loaded yet. Use the Game.Enter event to perform operations after the game has completely loaded. More...
 
void ExitGame (bool async=false)
 ‪Return to the menu. Part of this always happens asynchronously, so when this method returns the game has not exited yet. Use the Client.EnterMenu event to perform operations after the game has completely exited. More...
 
Block[] GetBlocksInGame (BlockIDs filter=BlockIDs.Invalid)
 ‪Gets the blocks in the game. This returns null when in a loading state, and throws AppStateException when in menu. More...
 
bool RemoveDebugInfo (string id)
 ‪Remove information from the in-game debug display. More...
 
void SaveGame ()
 ‪Saves the game. Part of this happens asynchronously, so when this method returns the game has not been saved yet. More...
 
void ToggleTimeMode ()
 ‪Toggles the time mode. More...
 

Static Public Member Functions

static void AddPersistentDebugInfo (string id, Func< string > contentGetter)
 ‪Add information to the in-game debug display. This debug info will be present for all games until it is manually removed. The provided getter function is called each frame so make sure it returns quickly. More...
 
static Game CurrentGame ()
 ‪Returns the currently loaded game. If in a menu, manipulating the returned object may not work as intended. More...
 
static Game NewGame ()
 ‪Creates a new game and adds it to the menu. If not in a menu, this will throw AppStateException. More...
 
static bool RemovePersistentDebugInfo (string id)
 ‪Remove persistent information from the in-game debug display. More...
 

Static Protected Attributes

static GameBuildSimEventEngine buildSimEventEngine = new GameBuildSimEventEngine()
 
static DebugInterfaceEngine debugOverlayEngine = new DebugInterfaceEngine()
 
static GameGameEngine gameEngine = new GameGameEngine()
 

Static Package Functions

static void Init ()
 

Static Package Attributes

static GameMenuEngine menuEngine = new GameMenuEngine()
 

Properties

string Description [get, set]
 ‪The game's description. More...
 
EGID EGID [get]
 ‪The game's unique menu EGID. More...
 
uint Id [get]
 ‪The game's unique menu identifier. More...
 
bool IsSimulating [get, set]
 ‪Whether the game is in simulation mode. More...
 
bool IsTimeRunning [get, set]
 ‪Whether the game is in time-running mode. Alias of IsSimulating. More...
 
bool IsTimeStopped [get, set]
 ‪Whether the game is in time-stopped mode. More...
 
bool MenuItem [get]
 ‪Whether the game is a (valid) menu item. More...
 
CurrentGameModeMode [get]
 ‪The mode of the game. More...
 
string Name [get, set]
 ‪The game's name. More...
 
string Path [get, set]
 ‪The path to the game's save folder. More...
 
ulong WorkshopId [get, set]
 ‪The Steam Workshop Id of the game save. In most cases this is invalid and returns 0, so this can be ignored. More...
 

Events

static EventHandler< GameEventArgsEdit [add, remove]
 ‪An event that fires whenever a game is switched to edit mode (time stopped mode). This does not fire when a game is loaded. More...
 
static EventHandler< GameEventArgsEnter [add, remove]
 ‪An event that fires right after a game is completely loaded. More...
 
static EventHandler< GameEventArgsExit [add, remove]
 ‪An event that fires right before a game returns to the main menu. At this point, Techblox is transitioning state so many things are invalid/unstable here. More...
 
static EventHandler< GameEventArgsSimulate [add, remove]
 ‪An event that fires whenever a game is switched to simulation mode (time running mode). More...
 

Detailed Description

An in-game save. This can be a menu item for a local save or the currently loaded save. Support for Steam Workshop coming soon (hopefully).

Constructor & Destructor Documentation

◆ Game() [1/3]

TechbloxModdingAPI.App.Game.Game ( uint  id)
inline

‪Initializes a new instance of the T:TechbloxModdingAPI.App.Game class.

Parameters
id‪Menu identifier.

◆ Game() [2/3]

TechbloxModdingAPI.App.Game.Game ( EGID  id)
inline

‪Initializes a new instance of the T:TechbloxModdingAPI.App.Game class.

Parameters
id‪Menu identifier.

◆ Game() [3/3]

TechbloxModdingAPI.App.Game.Game ( )
inline

‪Initializes a new instance of the T:TechbloxModdingAPI.App.Game class without id. This is assumed to be the current game.

Member Function Documentation

◆ AddDebugInfo()

void TechbloxModdingAPI.App.Game.AddDebugInfo ( string  id,
Func< string >  contentGetter 
)
inline

‪Add information to the in-game debug display. When this object is garbage collected, this debug info is automatically removed. The provided getter function is called each frame so make sure it returns quickly.

Parameters
id‪Debug info identifier.
contentGetter‪A function that returns the current information.

◆ AddPersistentDebugInfo()

static void TechbloxModdingAPI.App.Game.AddPersistentDebugInfo ( string  id,
Func< string >  contentGetter 
)
inlinestatic

‪Add information to the in-game debug display. This debug info will be present for all games until it is manually removed. The provided getter function is called each frame so make sure it returns quickly.

Parameters
id‪Debug info identifier.
contentGetter‪A function that returns the current information.

◆ CurrentGame()

static Game TechbloxModdingAPI.App.Game.CurrentGame ( )
inlinestatic

‪Returns the currently loaded game. If in a menu, manipulating the returned object may not work as intended.

Returns
‪The current game.

◆ EnableScreenshotTaker()

void TechbloxModdingAPI.App.Game.EnableScreenshotTaker ( )
inline

‪Enable the screenshot taker for updating the game's screenshot. Breaks the pause menu in a new save.

◆ EnterGame()

void TechbloxModdingAPI.App.Game.EnterGame ( )
inline

‪Load the game save. This happens asynchronously, so when this method returns the game not loaded yet. Use the Game.Enter event to perform operations after the game has completely loaded.

◆ ExitGame()

void TechbloxModdingAPI.App.Game.ExitGame ( bool  async = false)
inline

‪Return to the menu. Part of this always happens asynchronously, so when this method returns the game has not exited yet. Use the Client.EnterMenu event to perform operations after the game has completely exited.

Parameters
async‪If set to true, do this async.

◆ GetBlocksInGame()

Block [] TechbloxModdingAPI.App.Game.GetBlocksInGame ( BlockIDs  filter = BlockIDs.Invalid)
inline

‪Gets the blocks in the game. This returns null when in a loading state, and throws AppStateException when in menu.

Returns
‪The blocks in game.
Parameters
filter‪The block to search for. BlockIDs.Invalid will return all blocks.

◆ Init()

static void TechbloxModdingAPI.App.Game.Init ( )
inlinestaticpackage

◆ NewGame()

static Game TechbloxModdingAPI.App.Game.NewGame ( )
inlinestatic

‪Creates a new game and adds it to the menu. If not in a menu, this will throw AppStateException.

Returns
‪The new game.

◆ RemoveDebugInfo()

bool TechbloxModdingAPI.App.Game.RemoveDebugInfo ( string  id)
inline

‪Remove information from the in-game debug display.

Returns
true, if debug info was removed, false otherwise.
Parameters
id‪Debug info identifier.

◆ RemovePersistentDebugInfo()

static bool TechbloxModdingAPI.App.Game.RemovePersistentDebugInfo ( string  id)
inlinestatic

‪Remove persistent information from the in-game debug display.

Returns
true, if debug info was removed, false otherwise.
Parameters
id‪Debug info identifier.

◆ SaveGame()

void TechbloxModdingAPI.App.Game.SaveGame ( )
inline

‪Saves the game. Part of this happens asynchronously, so when this method returns the game has not been saved yet.

◆ ToggleTimeMode()

void TechbloxModdingAPI.App.Game.ToggleTimeMode ( )
inline

‪Toggles the time mode.

Member Data Documentation

◆ buildSimEventEngine

GameBuildSimEventEngine TechbloxModdingAPI.App.Game.buildSimEventEngine = new GameBuildSimEventEngine()
staticprotected

◆ debugOverlayEngine

DebugInterfaceEngine TechbloxModdingAPI.App.Game.debugOverlayEngine = new DebugInterfaceEngine()
staticprotected

◆ gameEngine

GameGameEngine TechbloxModdingAPI.App.Game.gameEngine = new GameGameEngine()
staticprotected

◆ menuEngine

GameMenuEngine TechbloxModdingAPI.App.Game.menuEngine = new GameMenuEngine()
staticpackage

Property Documentation

◆ Description

string TechbloxModdingAPI.App.Game.Description
getset

‪The game's description.

The description.

◆ EGID

EGID TechbloxModdingAPI.App.Game.EGID
get

‪The game's unique menu EGID.

The egid.

◆ Id

uint TechbloxModdingAPI.App.Game.Id
get

‪The game's unique menu identifier.

The identifier.

◆ IsSimulating

bool TechbloxModdingAPI.App.Game.IsSimulating
getset

‪Whether the game is in simulation mode.

true if is simulating; otherwise, false.

◆ IsTimeRunning

bool TechbloxModdingAPI.App.Game.IsTimeRunning
getset

‪Whether the game is in time-running mode. Alias of IsSimulating.

true if is time running; otherwise, false.

◆ IsTimeStopped

bool TechbloxModdingAPI.App.Game.IsTimeStopped
getset

‪Whether the game is in time-stopped mode.

true if is time stopped; otherwise, false.

◆ MenuItem

bool TechbloxModdingAPI.App.Game.MenuItem
get

‪Whether the game is a (valid) menu item.

true if menu item; otherwise, false.

◆ Mode

CurrentGameMode? TechbloxModdingAPI.App.Game.Mode
get

‪The mode of the game.

◆ Name

string TechbloxModdingAPI.App.Game.Name
getset

‪The game's name.

The name.

◆ Path

string TechbloxModdingAPI.App.Game.Path
getset

‪The path to the game's save folder.

The path.

◆ WorkshopId

ulong TechbloxModdingAPI.App.Game.WorkshopId
getset

‪The Steam Workshop Id of the game save. In most cases this is invalid and returns 0, so this can be ignored.

The workshop identifier.

Event Documentation

◆ Edit

EventHandler< GameEventArgs> TechbloxModdingAPI.App.Game.Edit
staticaddremove

‪An event that fires whenever a game is switched to edit mode (time stopped mode). This does not fire when a game is loaded.

◆ Enter

EventHandler< GameEventArgs> TechbloxModdingAPI.App.Game.Enter
staticaddremove

‪An event that fires right after a game is completely loaded.

◆ Exit

EventHandler< GameEventArgs> TechbloxModdingAPI.App.Game.Exit
staticaddremove

‪An event that fires right before a game returns to the main menu. At this point, Techblox is transitioning state so many things are invalid/unstable here.

◆ Simulate

EventHandler< GameEventArgs> TechbloxModdingAPI.App.Game.Simulate
staticaddremove

‪An event that fires whenever a game is switched to simulation mode (time running mode).


The documentation for this class was generated from the following file: