Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace IHookHost

Hierarchy

  • IHookHost

Implemented by

Index

Properties

Optional [SYMBOL_HOOKS]

[SYMBOL_HOOKS]: undefined | {}

Optional [SYMBOL_HOST_NAME]

[SYMBOL_HOST_NAME]: string[]

Functions

createHost

Methods

Optional onBuild

  • Called when something is built on a tile

    Parameters

    • human: Human

      The human object

    • item: Item

      The item used to build the object

    • tile: ITile

      The tile something was built on

    • doodad: Doodad

      The doodad that was created on the tile

    Returns void

Optional onCraft

  • Called when an item is crafted

    Parameters

    • human: Human

      The human object

    • item: Item

      The item that was crafted

    Returns void

Optional onCreateWorld

  • onCreateWorld(world: IWorld): void
  • Called right after the world is created, but before the renderer

    Parameters

    • world: IWorld

      The world object

    Returns void

Optional onCreatureDamage

  • Called when a creature is damaged

    Parameters

    Returns number | undefined

    The amount of damage the creature should take (the creature will take this damage) or undefined to use the default logic

Optional onCreatureDeath

  • onCreatureDeath(creature: Creature): void
  • Called when a creature dies

    Parameters

    • creature: Creature

      The creature object

    Returns void

Optional onCreatureSpawn

  • onCreatureSpawn(creature: Creature): void
  • Called when a creature spawns

    Parameters

    • creature: Creature

      The creature object

    Returns void

Optional onCreatureTamed

  • Called when a creature becomes tamed

    Parameters

    • creature: Creature

      The creature object

    • owner: Player

      The human which the creature is tamed for

    Returns void

Optional onDisplayMessage

  • Called when a message is displayed to the player

    Parameters

    Returns void

Optional onDoodadSpawn

  • onDoodadSpawn(doodad: Doodad): void
  • Called when a doodad spawns

    Parameters

    • doodad: Doodad

      The doodad object

    Returns void

Optional onEntityKill

  • Called when an entity is killed by another entity.

    Parameters

    Returns void

Optional onGameScreenVisible

  • onGameScreenVisible(): void
  • Called when the game screen becomes visible. Messages sent before this point will not be displayed.

    Returns void

Optional onGameStart

  • onGameStart(isLoadingSave: boolean, playedCount: number): void
  • Called when the game is starting

    Parameters

    • isLoadingSave: boolean

      True if a save game was loaded

    • playedCount: number

      The number of times the player has played the game (globally, not per slot)

    Returns void

Optional onGameTickEnd

  • onGameTickEnd(): void
  • Called when the game tick ends

    Returns void

Optional onGameTickStart

  • onGameTickStart(): void
  • Called when the game tick starts

    Returns void

Optional onHumanSkillChange

  • onHumanSkillChange(human: Human, skill: SkillType, currentSkill: number): void
  • Called when a human's skill changes.

    Parameters

    • human: Human

      The human whose skill changed

    • skill: SkillType

      The skill that changed

    • currentSkill: number

      The new value of the skill

    Returns void

Optional onItemDamage

  • onItemDamage(item: Item, modifier?: undefined | number): number | undefined
  • Called when an item is damaged

    Parameters

    • item: Item

      The item being damaged

    • Optional modifier: undefined | number

      The damage modifier

    Returns number | undefined

    The amount of damage the item shouldd take or undefined to use the default logic

Optional onItemEquip

  • Called when the player equips an item to a slot

    Parameters

    Returns void

Optional onItemQuickslot

  • onItemQuickslot(item: Item, player: Player, quickSlot: number | undefined): void
  • Called when the player quickslots an item

    Parameters

    • item: Item

      The item being quickslotted

    • player: Player

      The player object

    • quickSlot: number | undefined

      The quickslot number

    Returns void

Optional onLanguageChange

  • onLanguageChange(languageName: string): void
  • Called when the language is changed

    Parameters

    • languageName: string

      The name of the newly selected language

    Returns void

Optional onMove

  • onMove(player: Player, nextX: number, nextY: number, tile: ITile, direction: Direction): boolean | undefined
  • Called when the player is moving

    Parameters

    • player: Player

      The player object

    • nextX: number

      The x position the player is moving to

    • nextY: number

      The y position the player is moving to

    • tile: ITile

      The tile the player is moving to

    • direction: Direction

      The direction the player is facing

    Returns boolean | undefined

    False to cancel the move or undefined to use the default logic

Optional onMoveDirectionUpdate

  • Called when the human faces a different direction

    Parameters

    • human: Human

      The human object

    • direction: Direction

      The direction the player is now facing

    Returns void

Optional onNPCDamage

  • Called when an npc is damaged

    Parameters

    • npc: NPC

      The npc object

    • damageInfo: IDamageInfo

      The damage info object

    Returns number | undefined

    The amount of damage the npc should take (the npc will take this damage) or undefined to use the default logic

Optional onNPCDeath

  • onNPCDeath(npc: NPC): boolean | undefined
  • Called when an npc is killed

    Parameters

    Returns boolean | undefined

    False to stop the npc from dying or undefined to use the default logic

Optional onNPCSpawn

  • onNPCSpawn(npc: NPC): void
  • Called when an npc spawns

    Parameters

    • npc: NPC

      The npc object

    Returns void

Optional onOpenBook

  • Called when a book is opened by a player

    Parameters

    • human: Human

      The human that opened a book

    • book: BookType

      The book that was opened

    Returns void

Optional onPickupDoodad

  • Called when an doodad is picked up

    Parameters

    • player: Player

      The player object

    • doodad: Doodad

      The doodad object

    Returns void

Optional onPlayerJoin

  • onPlayerJoin(player: Player): void
  • Called when a player joins the server

    Parameters

    • player: Player

      The player object

    Returns void

Optional onPlayerLeave

  • onPlayerLeave(player: Player): void
  • Called when a player leaves the server Note: This hook is not called for the player who left the server (player will never be localPlayer)

    Parameters

    • player: Player

      The player object

    Returns void

Optional onQueueSoundEffect

  • onQueueSoundEffect(type: SfxType, x: number, y: number, z: number): SfxType | boolean | undefined
  • Called when a sound effect is queued

    Parameters

    • type: SfxType

      The sound effect type

    • x: number

      The x location in the world for the effect

    • y: number

      The y location in the world for the effect

    • z: number

      The z location in the world for the effect

    Returns SfxType | boolean | undefined

    False to cancel the sound effect, a sound effect to play instead of the given one, or undefined to use the default logic

Optional onRenderOverlay

  • Called when rendering the overlay

    Parameters

    Returns void

Optional onSailToCivilization

  • onSailToCivilization(player: Player): void
  • Called when a player sails to civilization.

    Parameters

    • player: Player

      The player that sailed to civilization

    Returns void

Optional onSpawnCreatureFromGroup

  • onSpawnCreatureFromGroup(creatureGroup: SpawnGroup, creaturePool: CreatureType[], x: number, y: number, z: number): boolean | undefined
  • Called when a creature is spawned from a creature group

    Parameters

    • creatureGroup: SpawnGroup

      The creature group

    • creaturePool: CreatureType[]

      The pool of creatures that can be spawned

    • x: number

      The x position to spawn the creature

    • y: number

      The y position to spawn the creature

    • z: number

      The z position to spawn the creature

    Returns boolean | undefined

    False to cancel spawning the creature or undefined to use the default logic

Optional onTurnEnd

  • onTurnEnd(player: Player): void
  • Called when a turn is ending

    Parameters

    • player: Player

      The player object

    Returns void

Optional onTurnStart

  • onTurnStart(player: Player): void
  • Called when a turn is starting

    Parameters

    • player: Player

      The player object

    Returns void

Optional onUpdateWeight

  • onUpdateWeight(player: Player, newWeight: number): number | undefined
  • Called when the players weight is being updated

    Parameters

    • player: Player

      The player object

    • newWeight: number

      The new weight of the player

    Returns number | undefined

    A number to set the player weight to or undefined to use the default logic

Optional postExecuteAction

  • Called after an action has been executed This is called after the action result is used

    Parameters

    Returns void

Optional postFieldOfView

  • postFieldOfView(): void
  • Called after the field of view has initialized

    Returns void

Optional postGenerateWorld

  • postGenerateWorld(generateNewWorld: boolean): void
  • Called after the world is generating

    Parameters

    • generateNewWorld: boolean

      True if a new world is being generated

    Returns void

Optional postRender

  • postRender(): void
  • Called after rendering everything

    Returns void

Optional postRenderPostProcess

  • postRenderPostProcess(): void
  • Caller after post processing the world render

    Returns void

Optional postRenderWorld

  • postRenderWorld(tileScale: number, viewWidth: number, viewHeight: number): void
  • Caller after rendering the world

    Parameters

    • tileScale: number

      The tile scale

    • viewWidth: number

      The width of the view port

    • viewHeight: number

      The height of the view port

    Returns void

Optional preExecuteAction

  • Called before an action is executed This is called before the action result is used

    Parameters

    Returns boolean | undefined

    False to cancel the action or undefined to use the default logic

Optional preExecuteCommand

  • preExecuteCommand(player: Player, command: Command, args: string | undefined): boolean | undefined
  • Called before a command is executed

    Parameters

    • player: Player

      The player object

    • command: Command

      The command

    • args: string | undefined

      The arguments

    Returns boolean | undefined

    False to cancel the command or undefined to use the default logic

Optional preLoadWorldDifferences

  • preLoadWorldDifferences(generateNewWorld: boolean): void
  • Called before loading world differences Loading differences involving setting up corpses, creatures, doodads, and related things onto the world

    Parameters

    • generateNewWorld: boolean

      True if a new world is being generated

    Returns void

Optional preRender

  • preRender(): void
  • Called before rendering everything

    Returns void

Optional preRenderPostProcess

  • preRenderPostProcess(): void
  • Caller before post processing the world render

    Returns void

Optional preRenderWorld

  • preRenderWorld(tileScale: number, viewWidth: number, viewHeight: number): void
  • Called before rendering the world

    Parameters

    • tileScale: number

      The tile scale

    • viewWidth: number

      The width of the view port

    • viewHeight: number

      The height of the view port

    Returns void

Optional processInput

  • processInput(player: Player): boolean | undefined
  • Called when input is being processed

    Parameters

    • player: Player

      The player object

    Returns boolean | undefined

    False to prevent input processing or undefined to use the default logic

Optional shouldCraft

  • Called when a craft is "requested". This currently happens when clicking an item in the crafting dialog.

    Parameters

    • requirementsMet: boolean

      Whether the requirements are currently met. This hook is a reduce hook, so this will contain whatever the result of the last hook host was, or the value of checker.requirementsMet(), by default.

    • item: ItemType

      The item to be crafted.

    • checker: ItemRecipeRequirementChecker

      The recipe requirement checker for this craft.

    Returns boolean | undefined

Optional shouldDisplayMessage

  • shouldDisplayMessage(player: Player, message: IMessage, messageId: number): boolean | undefined
  • Called when a message is about to be displayed

    Parameters

    • player: Player

      The player object

    • message: IMessage

      The message that will be displayed

    • messageId: number

      The Message, or -1 if the message being displayed isn't a Message

    Returns boolean | undefined

    False to not display the message or undefined to use the default logic

Optional shouldRender

  • Called when different object types are rendered

    Returns RenderFlag | undefined

    A bitwise list of render flags or undefined to use the default logic

Generated using TypeDoc