Hooks
Hooks are script functions that are called at specific moments. This way, you can insert code into the game.
They are specified in script files and tagged with the Hook
specifier. They also must be placed within a namespace to avoid ambiguity between multiple mods.
The following is an example of such a file:
namespace MyTestMod { [Hook] void BaseGameModeConstructor(BaseGameMode@ baseGameMode){ print("Hello World"); } }
BaseGameModeConstructor
void BaseGameModeConstructor(BaseGameMode@ basegamemode)
Called when the gamemode is being constructed. Useful for initial setting up, for example to add new definitions for items, cvars etc.
PlayerRecordSave
void PlayerRecordSave(PlayerRecord@ record, SValueBuilder &builder)
Called when a player record is being saved. Use builder
to serialize data.
PlayerRecordLoad
void PlayerRecordLoad(PlayerRecord@ record, SValue@ sval)
Called when a player record is being loaded. Use sval
to deserialize data.
PlayerRecordRefreshModifiers
void PlayerRecordRefreshModifiers(PlayerRecord@ record)
Called when modifiers are refreshed in a player record.
CreateCharacter
void CreateCharacter(PlayerRecord@ record)
Called when Character Creation is initialized.
LoadWidgetProducers
void LoadWidgetProducers(GUIBuilder@ builder)
Called when widget producers should be loaded. This allows you to initialize custom widget producers that can produce custom widgets. builder
is where you would call AddWidgetProducer
on to initialize the widget producer.
HUDConstructor
void HUDConstructor(HUD@ hud, GUIBuilder@ b)
PlayerRefreshScene
void PlayerRefreshScene(PlayerBase@ player)
LevelupCharacter
void LevelupCharacter(PlayerRecord@ record)
PlayerMenuConstructor
void PlayerMenuConstructor(PlayerMenu@ menu)
GameModeUpdate
void GameModeUpdate(BaseGameMode@ baseGameMode, int ms, GameInput& gameInput, MenuInput& menuInput)
Called every frame update.
PlayerRecordConstructor
void PlayerRecordConstructor(PlayerRecord@ record)
Called when the PlayerRecord constructor is called.
GameModePreRenderFrame
void GameModePreRenderFrame(BaseGameMode@ baseGameMode, int idt)
GameModeRenderFrame
void GameModeRenderFrame(BaseGameMode@ baseGameMode, int idt, SpriteBatch& sb)
GameModeStart
void GameModeStart(BaseGameMode@ baseGameMode, SValue@ save)
GameModePostStart
void GameModePostStart(BaseGameMode@ baseGameMode)
GameModeSpawnPlayer
void GameModeSpawnPlayer(BaseGameMode@ baseGameMode, PlayerRecord@ record)
Called when a player spawned.
GameModeSpawnPlayerCorpse
void GameModeSpawnPlayerCorpse(BaseGameMode@ baseGameMode, PlayerRecord@ record)
Called when a player corpse is spawned.