Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Mod

Hierarchy

Index

Constructors

constructor

  • new Mod(index: number): Mod

Methods

addActionType

addCreature

addDoodad

addHairstyle

addItem

addKeyBind

  • addKeyBind(name: string, defaultKeyCode: number): number
  • Parameters

    • name: string
    • defaultKeyCode: number

    Returns number

addMessage

  • addMessage(name: string, message: string): number
  • Parameters

    • name: string
    • message: string

    Returns number

addSkillType

addTerrain

addTerrainResource

canConsumeItem

  • Called before consuming an item

    Parameters

    Returns boolean | undefined

    True if the player can consume the item (default logic isn't called, should use your own code for consumption), false if the player cannot consume the item, or undefined to use the default logic

canCreatureAttack

  • canCreatureAttack(creatureId: number, creature: ICreature): boolean | undefined
  • Called before a creature attacks

    Parameters

    • creatureId: number

      The creature id

    • creature: ICreature

      The creature object

    Returns boolean | undefined

    False if the creature cannot attack, or undefined to use the default logic

canCreatureMove

  • canCreatureMove(creatureId: number, creature: ICreature, tile: ITile, moveType: MoveType): boolean | undefined
  • Called when a creature tries to move

    Parameters

    • creatureId: number

      The creature id

    • creature: ICreature

      The creature object

    • tile: ITile

      The tile the creature is trying to move to

    • moveType: MoveType

      The creatures move type

    Returns boolean | undefined

    True if the creature can move, false if the creature cannot move, or undefined to use the default logic

canCreatureSpawn

  • canCreatureSpawn(type: CreatureType, x: number, y: number, z: number, aberrant: boolean): boolean | undefined
  • Called when a creature is about to be spawned

    Parameters

    • type: CreatureType

      The type of creature

    • x: number

      The x coordinate where the creature will be spawned

    • y: number

      The y coordinate where the creature will be spawned

    • z: number

      The z coordinate where the creature will be spawned

    • aberrant: boolean

      True if the creature is an aberrant

    Returns boolean | undefined

    False if the creature cannot spawn, or undefined to use the default logic

canDropItem

  • canDropItem(item: IItem, tile: ITile, dropAll: boolean, dropAllQuality: ItemQuality | null): boolean | undefined
  • Called when an item is being dropped

    Parameters

    • item: IItem

      The item to be dropped

    • tile: ITile

      The tile the item will be dropped on

    • dropAll: boolean

      True if all items of this type will be dropped

    • dropAllQuality: ItemQuality | null

      If not null, all items of this quality will be dropped

    Returns boolean | undefined

    True if the item can be dropped, false if the item can not be dropped, or undefined to use the default logic

canPlayerAttack

  • canPlayerAttack(weapon: IItem | null, attackType: AttackType): boolean | undefined
  • Called before a player attacks

    Parameters

    • weapon: IItem | null

      The weapon used to attack

    • attackType: AttackType

      The attack type

    Returns boolean | undefined

    False if the player cannot attack, or undefined to use the default logic

canSeeCreature

  • canSeeCreature(creatureId: number, creature: ICreature, tile: ITile): boolean | undefined
  • Called when calculating creatures in the viewport

    Parameters

    • creatureId: number

      The creature id

    • creature: ICreature

      The creature object

    • tile: ITile

      The tile the creature is on

    Returns boolean | undefined

    False if the player should not see the creature or undefined to use the default logic

createButton

  • createButton(buttonName: string, imagePath: string, tooltip: string, keyBind?: number): JQuery
  • Parameters

    • buttonName: string
    • imagePath: string
    • tooltip: string
    • Optional keyBind: number

    Returns JQuery

createDialog

  • createDialog(container: JQuery, dialogInfo: IDialogInfo): JQuery

createOptionsSection

  • createOptionsSection(sectionName: string): JQuery

getButtons

getCreatureSpriteBatchLayer

  • Called when rendering creatures in the viewport

    Parameters

    • creatureId: number

      The creature id

    • creature: ICreature

      The creature object

    • batchLayer: SpriteBatchLayer

      The batch layer the creature will render in

    Returns SpriteBatchLayer | undefined

    The batch layer the creature should render in or undefined to use the default logic

getDialog

  • getDialog(title: string): JQuery
  • Parameters

    • title: string

    Returns JQuery

getIndex

  • getIndex(): number | undefined
  • Returns number | undefined

getItemByName

getItemByType

getName

  • getName(): string | undefined
  • Returns string | undefined

getPath

  • getPath(): string | undefined
  • Returns string | undefined

getPlayerMaxHealth

  • getPlayerMaxHealth(player: IPlayer): number | undefined
  • Called when getting the players maximum health

    Parameters

    • player: IPlayer

      The player object

    Returns number | undefined

    The maximum health of the player or undefined to use the default logic

getPlayerSpriteBatchLayer

  • Called when rendering the player in the viewport

    Parameters

    Returns SpriteBatchLayer | undefined

    The batch layer the player should render in or undefined to use the default logic

isPlayerSwimming

  • isPlayerSwimming(player: IPlayer, isSwimming: boolean): boolean | undefined
  • Called when checking if a player is swimming

    Parameters

    • player: IPlayer

      The player object

    • isSwimming: boolean

      True if the player is swimming

    Returns boolean | undefined

    True if the player should be swimming, false if the player should not be swimming, or undefined to use the default logic

isTileInspectable

  • isTileInspectable(tile: ITile): boolean | undefined
  • Called when checking if a tile is inspectable (used for showing custom world tooltips over tiles) Normally used in conjunction with the OnInspectTile hook

    Parameters

    • tile: ITile

      The tile object

    Returns boolean | undefined

    True if you want to show a custom inspect message, false to display no messages, or undefined to use the default logic

itemNameToObjectType

  • itemNameToObjectType(name: string): ItemType | undefined

loadFile

  • loadFile(file: string, callback: function): boolean
  • Parameters

    • file: string
    • callback: function
        • (fileText: string, success: boolean): void
        • Parameters

          • fileText: string
          • success: boolean

          Returns void

    Returns boolean

onBuild

  • Called when something is built on a tile

    Parameters

    • item: IItem

      The item used to build the object

    • tile: ITile

      The tile something was built on

    • doodad: IDoodad

      The doodad that was created on the tile

    Returns void

onButtonBarClick

  • onButtonBarClick(buttonName: string): void
  • Called when a button on the button bar is clicked

    Parameters

    • buttonName: string

      The button name

    Returns void

onContainerItemAdd

  • Called when an item is added to a container.

    Parameters

    • item: IItem

      The item object

    • container: IContainer

      The container object the item was added to. This container might be inventory or a container within the inventory.

    Returns void

onContainerItemRemove

  • Called when an item is removed from a container.

    Parameters

    • item: IItem

      The item object

    • container: IContainer

      The container object the item was removed from.

    Returns void

onContainerItemUpdate

  • Called when an item is moved from one container to another.

    Parameters

    • item: IItem

      The item object

    • containerFrom: IContainer | null

      The container object the item was moved to. This container might be inventory or a container within the inventory.

    • containerTo: IContainer

      The container object the item was moved to. This container might be inventory or a container within the inventory.

    Returns void

onCraft

  • onCraft(item: IItem): void
  • Called when an item is crafted

    Parameters

    • item: IItem

      The item that was crafted

    Returns void

onCreateWorld

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

    Parameters

    • world: IWorld

      The world object

    Returns void

onCreatureDamage

  • onCreatureDamage(creatureId: number, creature: ICreature, damageInfo: IDamageInfo): number | null | undefined
  • Called when a creature is damaged

    Parameters

    • creatureId: number

      The creature id

    • creature: ICreature

      The creature object

    • damageInfo: IDamageInfo

      The damage info object

    Returns number | null | undefined

    Null if nothing should happen (do not damage the creature) or the amount of damage the creature should take (the creature will take this damage) or undefined to use the default logic

onCreatureDeath

  • onCreatureDeath(creatureId: number, creature: ICreature): void
  • Called when a creature dies

    Parameters

    • creatureId: number

      The creature id

    • creature: ICreature

      The creature object

    Returns void

onCreatureSpawn

  • onCreatureSpawn(creatureId: number, creature: ICreature): void
  • Called when a creature spawns

    Parameters

    • creatureId: number

      The creature id

    • creature: ICreature

      The creature object

    Returns void

onDisplayMessage

  • onDisplayMessage(message: Message, messageType?: MessageType, ...args: any[]): boolean | undefined
  • Called when a message is about to be displayed to the player

    Parameters

    • message: Message

      The message

    • Optional messageType: MessageType

      The message type

    • Rest ...args: any[]

      The message arguments

    Returns boolean | undefined

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

onGameEnd

  • Called when the game is ending

    Parameters

    Returns void

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

onInitialize

  • onInitialize(saveDataGlobal: any): void
  • Called when the mod is initialized (when it's enabled via the Mod Manager)

    Parameters

    • saveDataGlobal: any

      The save data object you previously saved via onUninitialize()

    Returns void

onInspectTile

  • Called when a tile is being inspected

    Parameters

    • tile: ITile

      The tile being inspected

    Returns IInspect[] | undefined

    The inspects to be shown or undefined to use the default logic

onInventoryItemAdd

  • Called when an item is added to the players inventory

    Parameters

    • item: IItem

      The item object

    • container: IContainer

      The container object the item was added to. This container might be inventory or a container within the inventory.

    Returns void

onInventoryItemRemove

  • Called when an item is removed from the players inventory

    Parameters

    • item: IItem

      The item object

    • container: IContainer

      The container object the item was moved to.

    Returns void

onInventoryItemUpdate

  • Called when an item is moved from one container to another, while still in the players inventory.

    Parameters

    • item: IItem

      The item object

    • container: IContainer

      The container object the item was moved to. This container might be inventory or a container within the inventory.

    Returns void

onItemEquip

  • Called when the player equips an item to a slot

    Parameters

    Returns void

onKeyBindPress

  • onKeyBindPress(keyBind: KeyBind): boolean | undefined
  • Called when a keybind is pressed

    Parameters

    Returns boolean | undefined

    False to cancel the keybind press or undefined to use the default logic

onKeyDown

  • onKeyDown(event: JQueryEventObject): boolean | undefined
  • Called when a key is pressed down

    Parameters

    • event: JQueryEventObject

      The event object

    Returns boolean | undefined

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

onKeyUp

  • onKeyUp(event: JQueryEventObject): boolean | undefined
  • Called when a key is let go

    Parameters

    • event: JQueryEventObject

      The event object

    Returns boolean | undefined

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

onLoad

  • onLoad(saveData: any): void
  • Called when the mod is loaded. This will be called after a player starts a game (ran before resources & the world are setup)

    Parameters

    • saveData: any

      The save data object you previously saved via onSave()

    Returns void

onMouseDown

  • onMouseDown(event: JQueryEventObject): boolean | undefined
  • Called when a mouse button is pressed

    Parameters

    • event: JQueryEventObject

      The mouse event object

    Returns boolean | undefined

    False to cancel the mouse event or undefined to use the default logic

onMouseMove

  • onMouseMove(event: JQueryEventObject): boolean | undefined
  • Called when a mouse button is pressed

    Parameters

    • event: JQueryEventObject

      The mouse event object

    Returns boolean | undefined

    False to cancel the mouse event or undefined to use the default logic

onMouseScroll

  • onMouseScroll(event: JQueryEventObject): boolean | undefined
  • Called when a mouse button is pressed

    Parameters

    • event: JQueryEventObject

      The mouse event object

    Returns boolean | undefined

    False to cancel the mouse event or undefined to use the default logic

onMouseUpOrLeave

  • onMouseUpOrLeave(event: JQueryEventObject): boolean | undefined
  • Called when a mouse button is let go or if the mouse leaves the screen

    Parameters

    • event: JQueryEventObject

      The mouse event object

    Returns boolean | undefined

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

onMove

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

    Parameters

    • 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: FacingDirection

      The direction the player is facing

    Returns boolean | undefined

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

onMoveDirectionUpdate

  • Called when the player faces a different direction

    Parameters

    Returns void

onNoInputReceived

  • onNoInputReceived(): void
  • Called when no input is received

    Returns void

onPlayerDamage

  • onPlayerDamage(amount: number, damageMessage: string): boolean | undefined
  • Called when the player takes damage

    preturns

    False to stop the player from taking damage or undefined to use the default logic

    Parameters

    • amount: number

      The amount of damage taken

    • damageMessage: string

      The message associated with the damaged

    Returns boolean | undefined

onPlayerDeath

  • onPlayerDeath(player: IPlayer): boolean | undefined
  • Called when the player is killed

    preturns

    False to stop the player from dieing or undefined to use the default logic

    Parameters

    Returns boolean | undefined

onSave

  • onSave(): any
  • Called when the game is saved or the mod is unloaded This will be called before onUnload

    Returns any

    An object containing the data you want to save

onShowInGameScreen

  • onShowInGameScreen(): void
  • Called when the in game screen is shown

    Returns void

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

onTurnComplete

  • onTurnComplete(): void
  • Called when a turn is completing

    Returns void

onTurnStart

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

    Returns void

onUninitialize

  • onUninitialize(): any
  • Called when the mod is uninitialized (when it's disabled via the Mod Manager)

    Returns any

    An object containing the data you want to save (saved globally, not per slot)

onUnload

  • onUnload(): void
  • Called when the mod is unloaded

    Returns void

onUpdateWeight

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

    Parameters

    • 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

postGenerateWorld

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

    Parameters

    • generateNewWorld: boolean

      True if a new world is being generated

    Returns void

postRender

  • postRender(): void
  • Called after rendering

    Returns void

preRender

  • preRender(): void
  • Called before rendering

    Returns void

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

processInput

  • processInput(): void
  • Called when input is being processed

    Returns void

removeButton

  • removeButton(buttonName: string): void
  • Parameters

    • buttonName: string

    Returns void

removeOptionsSection

  • removeOptionsSection(sectionName: string): void

shouldRender

  • Called when different object types are rendered

    Returns RenderFlag | undefined

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

unallocateEnums

  • unallocateEnums(): void
  • This is called internally after unloading a mod

    Returns void

Generated using TypeDoc