Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Game

Hierarchy

Implements

Index

Constructors

Properties

Accessors

Methods

Object literals

Constructors

constructor

  • Returns Game

Properties

absoluteTime

absoluteTime: number

autoSaveTimer

autoSaveTimer: number

cartographyTexture

cartographyTexture: WebGLTexture

contaminatedWater

contaminatedWater: IVector3[]

corpses

corpses: SaferArray<ICorpse>

crafted

crafted: object

Type declaration

creatureSpawnTimer

creatureSpawnTimer: number

creatures

creatures: SaferArray<ICreature>

debugRenderer

debugRenderer: ITextureDebugRenderer

difficulty

difficulty: Difficulty

doodads

doodads: SaferArray<IDoodad>

fadeInAmount

fadeInAmount: number

fillCount

fillCount: number

fillTile

fillTile: boolean[][]

flowFieldSyncCount

flowFieldSyncCount: number

glContext

glContext: WebGL2RenderingContext | null = null

glVersion

glVersion: number

interval

interval: 16.6666 = interval

isLoadingSave

isLoadingSave: boolean

isRealTime

isRealTime: boolean

items

items: IItemArray

lastCreationIds

lastCreationIds: object

Type declaration

  • [index: number]: number

mapContext

mapContext: CanvasRenderingContext2D | null = null

mapGenVersion

mapGenVersion: string = gameVersion

mapSize

mapSize: 512 = 512

mapSizeSq

mapSizeSq: number = this.mapSize * this.mapSize

notifier

notifier: INotifier

npcs

npcs: SaferArray<INPC>

particle

particle: IParticle

paused

paused: boolean

playing

playing: boolean

previousSaveVersion

previousSaveVersion: IVersionInfo

realTimeNextTick

realTimeNextTick: number

realTimeTickSpeed

realTimeTickSpeed: number

saveClear

saveClear: boolean

saveVersion

saveVersion: string

shouldUpdateTablesAndWeight

shouldUpdateTablesAndWeight: boolean

slot

slot: number

spawnCoords

spawnCoords: IVector3

spriteTexture

spriteTexture: WebGLTexture

spriteTextureSizeInversed

spriteTextureSizeInversed: Vec2

tile

tileContainers

tileContainers: ITileContainer[]

tileData

tileData: object

Type declaration

  • [index: number]: object
    • [index: number]: object

tileEvents

tileEvents: SaferArray<ITileEvent>

tileTexture

tileTexture: WebGLTexture

tileTextureSizeInversed

tileTextureSizeInversed: Vec2

time

updateFieldOfView

updateFieldOfView: boolean

updateRender

updateRender: boolean

version

version: string = gameVersion

visible

visible: boolean = true

Accessors

isDailyChallenge

  • get isDailyChallenge(): boolean
  • Returns boolean

Methods

addPlayer

addZoomLevel

  • addZoomLevel(amount: number): void
  • Parameters

    • amount: number

    Returns void

animateSkeletalRemains

  • animateSkeletalRemains(player: IPlayer, x: number, y: number, z: number): void

canASeeB

  • canASeeB(aX: number, aY: number, aZ: number, bX: number, bY: number, bZ: number, nondeterministic?: boolean): boolean
  • Parameters

    • aX: number
    • aY: number
    • aZ: number
    • bX: number
    • bY: number
    • bZ: number
    • Optional nondeterministic: boolean

    Returns boolean

cancel

  • cancel(events: string | number | Array<string | number>): this
  • cancel(events: string | number | Array<string | number>, cb: function): this
  • Removes all event handlers for the given event(s).

    Parameters

    • events: string | number | Array<string | number>

    Returns this

  • Removes the given event handler for the given event(s).

    Parameters

    • events: string | number | Array<string | number>
    • cb: function
        • (emitter: this, ...data: any[]): any
        • Parameters

          • emitter: this
          • Rest ...data: any[]

          Returns any

    Returns this

cancelAll

  • cancelAll(): this

changeTile

  • changeTile(newTileInfo: TerrainType | ITileData, x: number, y: number, z: number, stackTiles: boolean, dropTiles?: boolean): void
  • Parameters

    • newTileInfo: TerrainType | ITileData
    • x: number
    • y: number
    • z: number
    • stackTiles: boolean
    • Optional dropTiles: boolean

    Returns void

checkForHiddenMob

  • checkForHiddenMob(human: IBaseHumanEntity, x: number, y: number, z: number): void

checkWaterFill

  • checkWaterFill(x: number, y: number, z: number, needed: number): void
  • Parameters

    • x: number
    • y: number
    • z: number
    • needed: number

    Returns void

consumeWaterTile

  • consumeWaterTile(x: number, y: number, z: number): void
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns void

damage

deletePlayer

  • deletePlayer(plys: IPlayer[], identifier: string): void
  • Parameters

    • plys: IPlayer[]
    • identifier: string

    Returns void

directionToMovement

doLavaEvents

  • doLavaEvents(x: number, y: number, z: number): void
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns void

enableFlowFieldDebug

  • enableFlowFieldDebug(): void

fireBreath

  • fireBreath(x: number, y: number, z: number, facingDirection: Direction, itemName?: string): void
  • Parameters

    • x: number
    • y: number
    • z: number
    • facingDirection: Direction
    • Optional itemName: string

    Returns void

gameLoop

  • gameLoop(timeStamp: any): void
  • Parameters

    • timeStamp: any

    Returns void

getAmbientLightLevel

  • getAmbientLightLevel(z: number): number

getBenignity

  • getBenignity(): number

getBlackness

  • getBlackness(): number

getCompletedMilestoneCount

  • getCompletedMilestoneCount(): number

getDamageTypeString

  • getDamageTypeString(damageTypes: DamageType[], prefixes?: string[]): string

getDifficulty

getFireMessage

  • getFireMessage(decay?: number, isOpenFire?: boolean): Message
  • Parameters

    • Optional decay: number
    • Optional isOpenFire: boolean

    Returns Message

getHeight

  • getHeight(z0: number, z1: number, d: number): number
  • Parameters

    • z0: number
    • z1: number
    • d: number

    Returns number

getInspectHealthMessage

  • getInspectHealthMessage(percent: number, skillPercent: number, name: string): IMessagePack

getLightSourceAt

  • getLightSourceAt(x: number, y: number, z: number): number
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns number

getMalignity

  • getMalignity(): number

getMaxDurability

  • getMaxDurability(quality: ItemQuality, itemDurability: number): number

getMaxHealth

  • getMaxHealth(): number

getMovementFinishTime

  • getMovementFinishTime(): number

getName

getNameFromDescription

getNearestPlayer

  • getNearestPlayer(x: number, y: number, z?: number): IPlayer | undefined
  • Parameters

    • x: number
    • y: number
    • Optional z: number

    Returns IPlayer | undefined

getOrCreateTile

  • getOrCreateTile(x: number, y: number, z: number): ITile

getOrCreateTileData

  • getOrCreateTileData(x: number, y: number, z: number): ITileData[]

getPlayerAverage

  • getPlayerAverage(calc: function, round?: boolean): number | undefined
  • Parameters

    • calc: function
        • (player: IPlayer): number | undefined
        • Parameters

          Returns number | undefined

    • Optional round: boolean

    Returns number | undefined

getPlayerByIdentifier

  • getPlayerByIdentifier(identifier: string, includeAbsent?: boolean): IPlayer | undefined
  • Parameters

    • identifier: string
    • Default value includeAbsent: boolean = true

    Returns IPlayer | undefined

getPlayerByName

  • getPlayerByName(name: string): IPlayer | undefined

getPlayerByPid

  • getPlayerByPid(pid: number): IPlayer | undefined

getPlayers

  • getPlayers(includeGhosts?: boolean, includeConnecting?: boolean): IPlayer[]
  • Parameters

    • Optional includeGhosts: boolean
    • Optional includeConnecting: boolean

    Returns IPlayer[]

getPlayersAtPosition

  • getPlayersAtPosition(x: number, y: number, z: number, includeGhosts?: boolean, includeConnecting?: boolean): IPlayer[]
  • Parameters

    • x: number
    • y: number
    • z: number
    • Optional includeGhosts: boolean
    • Optional includeConnecting: boolean

    Returns IPlayer[]

getPlayersAtTile

  • getPlayersAtTile(tile: ITile, includeGhosts?: boolean, includeConnecting?: boolean): IPlayer[]
  • Parameters

    • tile: ITile
    • Optional includeGhosts: boolean
    • Optional includeConnecting: boolean

    Returns IPlayer[]

getPlayersThatSeePosition

  • getPlayersThatSeePosition(x: number, y: number, z: number): IPlayer[]

getRandomQuality

getReputation

  • getReputation(): number

getSkillPercent

getStrength

  • getStrength(): number
  • Returns number

getTactics

  • getTactics(): number
  • Returns number

getTile

  • getTile(x: number, y: number, z: number): ITile
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns ITile

getTileData

  • getTileData(x: number, y: number, z: number): ITileData[] | undefined
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns ITileData[] | undefined

getTileFromPoint

getTileUnsafe

  • getTileUnsafe(x: number, y: number, z: number): ITile
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns ITile

getValidPlayerName

  • getValidPlayerName(name: string | undefined): string
  • Parameters

    • name: string | undefined

    Returns string

getWrappedCoord

  • getWrappedCoord(x: number): number
  • Parameters

    • x: number

    Returns number

initialize

  • initialize(): void
  • Returns void

isFlammable

  • isFlammable(x: number, y: number, z: number): boolean
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns boolean

isOnFire

isPlayerAtPosition

  • isPlayerAtPosition(x: number, y: number, z: number, includeGhosts?: boolean, includeConnecting?: boolean): boolean
  • Parameters

    • x: number
    • y: number
    • z: number
    • Optional includeGhosts: boolean
    • Optional includeConnecting: boolean

    Returns boolean

isPlayerAtTile

  • isPlayerAtTile(tile: ITile, includeGhosts?: boolean, includeConnecting?: boolean): boolean
  • Parameters

    • tile: ITile
    • Optional includeGhosts: boolean
    • Optional includeConnecting: boolean

    Returns boolean

isPositionEmpty

  • isPositionEmpty(x: number, y: number, z: number): boolean
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns boolean

isPositionFull

  • isPositionFull(x: number, y: number, z: number): boolean
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns boolean

isRealTimeMode

  • isRealTimeMode(): boolean

isTileEmpty

  • isTileEmpty(tile: ITile): boolean
  • Parameters

    Returns boolean

isTileFull

  • isTileFull(tile: ITile): boolean
  • Parameters

    Returns boolean

makeCaveEntrance

makeLavaPassage

makeMiniMap

  • makeMiniMap(offsetX: number, offsetY: number, offsetZ: number, skillCheck?: boolean): void
  • Parameters

    • offsetX: number
    • offsetY: number
    • offsetZ: number
    • Optional skillCheck: boolean

    Returns void

on

  • on(events: string | number | Array<string | number>, cb: function): this
  • Binds an event handler on the given event or events. If the event handler is already bound to one of the given events, does nothing.

    Parameters

    • events: string | number | Array<string | number>
    • cb: function
        • (emitter: this, ...data: any[]): any
        • Parameters

          • emitter: this
          • Rest ...data: any[]

          Returns any

    Returns this

onGlobalSlotLoaded

  • onGlobalSlotLoaded(_: number, success: boolean): void
  • Parameters

    • _: number
    • success: boolean

    Returns void

onSaveLoaded

  • onSaveLoaded(slot: number): void
  • Parameters

    • slot: number

    Returns void

once

  • once(event: string | number, cb: function): this
  • Binds an event handler to the given event. The event handler will be removed after the first trigger.

    Parameters

    • event: string | number
    • cb: function
        • (emitter: this, ...data: any[]): any
        • Parameters

          • emitter: this
          • Rest ...data: any[]

          Returns any

    Returns this

outputFireMessage

  • outputFireMessage(player: IPlayer, decay?: number, isOpenFire?: boolean): void
  • Parameters

    • player: IPlayer
    • Optional decay: number
    • Optional isOpenFire: boolean

    Returns void

packGround

  • packGround(x: number, y: number, z: number): void
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns void

passTurn

play

  • Parameters

    Returns Promise<boolean>

processWaterContamination

  • processWaterContamination(): void

rangeFinder

  • rangeFinder(weaponRange: number, playerSkillLevel: number): number
  • Parameters

    • weaponRange: number
    • playerSkillLevel: number

    Returns number

removePlayer

  • removePlayer(pid: number): void
  • Parameters

    • pid: number

    Returns void

requestPlay

  • requestPlay(options: Partial<IPlayOptions> & object): Promise<boolean>
  • Parameters

    Returns Promise<boolean>

resetGameState

  • resetGameState(skipSave?: boolean): Promise<void>
  • Parameters

    • Default value skipSave: boolean = false

    Returns Promise<void>

resetWebGL

  • resetWebGL(): void
  • Returns void

resizeRenderer

  • resizeRenderer(): void

saveGame

setGlContextSize

  • setGlContextSize(width: number, height: number): void
  • Parameters

    • width: number
    • height: number

    Returns void

setLocalPlayer

  • setLocalPlayer(player: IPlayer): void
  • Parameters

    Returns void

setPaused

  • setPaused(paused: boolean, showChatMessage?: boolean): void
  • Parameters

    • paused: boolean
    • Default value showChatMessage: boolean = false

    Returns void

setTile

  • setTile(x: number, y: number, z: number, tile: ITile): ITile
  • Parameters

    • x: number
    • y: number
    • z: number
    • tile: ITile

    Returns ITile

setupGl

  • setupGl(restoring: boolean): void
  • Parameters

    • restoring: boolean

    Returns void

setupSave

  • setupSave(_: number): void
  • Parameters

    • _: number

    Returns void

shouldRender

  • shouldRender(): number

synchronizeFlowFields

  • synchronizeFlowFields(plys: IPlayer[]): void

tickRealtime

  • tickRealtime(): void

trigger

  • trigger(event: string | number, ...data: any[]): Promise<any[]>
  • Triggers the given event with any number of arguments.

    Parameters

    • event: string | number
    • Rest ...data: any[]

    Returns Promise<any[]>

triggerSync

  • triggerSync<T>(event: string | number, ...data: any[]): T[]
  • Type parameters

    • T

    Parameters

    • event: string | number
    • Rest ...data: any[]

    Returns T[]

until

  • Until the given event happens, allows you to bind an event to another emitter.

    Parameters

    • event: string | number

    Returns IEmitterUntil<this>

updateAmbientLightLevel

  • updateAmbientLightLevel(z: number): void
  • Parameters

    • z: number

    Returns void

updateFlowFieldTile

  • updateFlowFieldTile(tile: ITile, x: number, y: number, z: number): void

updateOption

  • updateOption(player: IPlayer | undefined, id: keyof IOptions, value: boolean | number): void
  • Parameters

    • player: IPlayer | undefined
    • id: keyof IOptions
    • value: boolean | number

    Returns void

updateReputation

  • updateReputation(reputation: number): void
  • Parameters

    • reputation: number

    Returns void

updateTablesAndWeight

  • updateTablesAndWeight(): void
  • AVOID USING THIS. USE updateTablesAndWeightNextTick INSTEAD! For most cases you don't need this

    Returns void

updateTablesAndWeightNextTick

  • updateTablesAndWeightNextTick(): void
  • Returns void

updateThumbnail

  • updateThumbnail(): Promise<void>

updateView

  • updateView(updateFov: boolean): void
  • Parameters

    • updateFov: boolean

    Returns void

waitUntil

  • waitUntil(event: string | number): Promise<any[]>
  • Returns a promise that will resolve when the event is triggered.

    Parameters

    • event: string | number

    Returns Promise<any[]>

wrapCoordinate

  • wrapCoordinate(cordinate: number, reference: number): number
  • Parameters

    • cordinate: number
    • reference: number

    Returns number

Object literals

seeds

seeds: object

base

base: number = 0

saved

saved: number = 0

Generated using TypeDoc