Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Game

Hierarchy

  • Game

Implements

Index

Constructors

Properties

Methods

Object literals

Constructors

constructor

  • Returns Game

Properties

autoSaveTimer

autoSaveTimer: number

cartographyTexture

cartographyTexture: WebGLTexture

contaminatedWater

contaminatedWater: IPointZ[]

corpses

corpses: ICorpse[]

crafted

crafted: object

Type declaration

  • [index: number]: boolean

creatures

creatures: ICreature[]

dailyChallenge

dailyChallenge: boolean = false

dayNight

dayNight: number

dayNightSwitch

dayNightSwitch: number

debugRenderer

debugRenderer: ITextureDebugRenderer

doodads

doodads: IDoodad[]

fadeInAmount

fadeInAmount: number

fillCount

fillCount: number

fillTile

fillTile: boolean[]

flowFieldManager

flowFieldManager: FlowFieldManager

fov

glContext

glContext: WebGLRenderingContext

halfMapSize

halfMapSize: number = this.mapSize / 2

healthRegen

healthRegen: number

highscores

highscores: IHighscore[] = []

hintIndex

hintIndex: number

hungerRegen

hungerRegen: number

interval

interval: number = 16.6666

isLoadingSave

isLoadingSave: boolean

items

items: IItemArray

lastPlayedVersion

lastPlayedVersion: string | null = null

loadedResources

loadedResources: boolean

Private loadedWorld

loadedWorld: boolean

mapContext

mapContext: CanvasRenderingContext2D

mapSize

mapSize: number = 512

mapSizeSq

mapSizeSq: number = this.mapSize * this.mapSize

messageTimer

messageTimer: number

moveAnim

moveAnim: number

newCrafted

newCrafted: object

Type declaration

  • [index: number]: boolean

nextProcessInput

nextProcessInput: number

notifier

notifier: Notifier

particle

particle: Particle

playedCount

playedCount: number = 0

playing

playing: boolean

raft

raft: number | null = null

saveClear

saveClear: boolean

saveVersion

saveVersion: string | null

savedHighscore

savedHighscore: boolean

Private shouldUpdateCraftTableAndWeight

shouldUpdateCraftTableAndWeight: boolean

slot

slot: number

slotName

slotName: string

spawnCoords

spawnCoords: any

spriteTexture

spriteTexture: WebGLTexture

spriteTextureSizeInversed

spriteTextureSizeInversed: Vec2

staminaRegen

staminaRegen: number

tamedCreatures

tamedCreatures: number[]

thirstRegen

thirstRegen: number

tile

tileContainers

tileContainers: ITileContainer[]

tileData

tileData: ITileData[]

tileEvents

tileEvents: ITileEvent[]

tileTexture

tileTexture: WebGLTexture

tileTextureSizeInversed

tileTextureSizeInversed: Vec2

time

time: number

turnFinishTime

turnFinishTime: number

turnProgress

turnProgress: number

turnProgressCompleted

turnProgressCompleted: boolean

unloading

unloading: boolean

updateRender

updateRender: boolean

version

version: string = gameVersion

walkSoundCounter

walkSoundCounter: number

wonGame

wonGame: boolean

Static Private gameMovement

gameMovement: IInputMovement[] = [{keyBind: KeyBind.Right,direction: FacingDirection.East,x: 1,y: 0},{keyBind: KeyBind.Left,direction: FacingDirection.West,x: -1,y: 0},{keyBind: KeyBind.Up,direction: FacingDirection.North,x: 0,y: -1},{keyBind: KeyBind.Down,direction: FacingDirection.South,x: 0,y: 1}]

Methods

addDelay

  • addDelay(delay: Delay, replace?: boolean): void
  • Parameters

    • delay: Delay
    • Optional replace: boolean

    Returns void

addZoomLevel

  • addZoomLevel(amount: number): void
  • Parameters

    • amount: number

    Returns void

animateSkeletalRemains

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

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

    Returns void

blockMove

  • blockMove(): void
  • Returns void

changeTile

  • changeTile(newTile: any, changeX: number, changeY: number, changeZ: number, stackTiles: boolean): void
  • Parameters

    • newTile: any
    • changeX: number
    • changeY: number
    • changeZ: number
    • stackTiles: boolean

    Returns void

checkAndRemoveBlood

  • checkAndRemoveBlood(): boolean
  • Returns boolean

checkForHiddenMob

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

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

    Returns void

checkForMobInRange

  • checkForMobInRange(range: number): object
  • Parameters

    • range: number

    Returns object

    • found: boolean
    • id: number
    • obstacle: boolean
    • water: boolean
    • x: number
    • y: number
    • z: number

checkUnderPlayer

  • checkUnderPlayer(inFacingDirection?: boolean, autoActions?: boolean, enterCave?: boolean, forcePickUp?: boolean): void
  • Parameters

    • Optional inFacingDirection: boolean
    • Optional autoActions: boolean
    • Default value enterCave: boolean = true
    • Default value forcePickUp: boolean = false

    Returns 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

contaminateWater

  • contaminateWater(): void
  • Returns void

createWorld

  • createWorld(): void
  • Returns void

createWorldRenderer

  • createWorldRenderer(): void
  • Returns void

enableFlowFieldDebug

  • enableFlowFieldDebug(): void
  • Returns void

findUnique

  • findUnique(a: any, b: any): Array<any>
  • Parameters

    • a: any
    • b: any

    Returns Array<any>

fireBreath

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

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

    Returns void

gameLoop

  • gameLoop(timeStamp: any): void
  • Parameters

    • timeStamp: any

    Returns void

getAmbientLightLevel

  • getAmbientLightLevel(): number
  • Returns number

getBlackness

  • getBlackness(): number
  • Returns number

getFireMessage

  • getFireMessage(decay: number): Message
  • Parameters

    • decay: number

    Returns Message

getHeight

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

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

    Returns number

getLightSourceAt

  • getLightSourceAt(worldX: number, worldY: number): number
  • Parameters

    • worldX: number
    • worldY: number

    Returns number

getName

  • Parameters

    Returns string

getNameFromDescription

  • Parameters

    • description: IObjectDescription | undefined
    • Default value textCase: TextCase = TextCase.None
    • Default value withPrefix: boolean = true

    Returns string

getOrCreateTile

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

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

    Returns ITile

Private getPotentialRecipesInContainer

  • getPotentialRecipesInContainer(container: IContainer, typesChecked: object, potentialRecipes: object): void
  • Parameters

    • container: IContainer
    • typesChecked: object
      • [index: number]: boolean
    • potentialRecipes: object
      • [index: number]: boolean

    Returns void

getSerializationProperties

  • getSerializationProperties(_: string): Array<string>

getTile

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

    • x: number
    • y: number
    • Default value z: number = player.z

    Returns ITile

getTileInFrontOfPlayer

  • getTileInFrontOfPlayer(): ITile
  • Returns ITile

getTileUnsafe

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

    • x: number
    • y: number
    • Default value z: number = player.z

    Returns ITile

getWrappedCoord

  • getWrappedCoord(x: number): number
  • Parameters

    • x: number

    Returns number

hasDelay

  • hasDelay(): boolean
  • Returns boolean

initializeGameState

  • initializeGameState(isTravelling?: boolean): void
  • Parameters

    • Default value isTravelling: boolean = false

    Returns void

inspect

  • inspect(x: any, y: number, z?: number): IInspect[]
  • Parameters

    • x: any
    • y: number
    • Default value z: number = player.z

    Returns IInspect[]

inspectTile

  • Parameters

    Returns IInspect[]

isOnScreen

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

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

    Returns boolean

isTileEmpty

  • isTileEmpty(x: number, y: number, z?: number): boolean
  • Parameters

    • x: number
    • y: number
    • Default value z: number = player.z

    Returns boolean

isTileFull

  • isTileFull(x: number, y: number, z?: number): boolean
  • Parameters

    • x: number
    • y: number
    • Default value z: number = player.z

    Returns boolean

isTileFullEx

  • isTileFullEx(tile: ITile): boolean
  • Parameters

    Returns boolean

loadResources

  • loadResources(): void
  • Returns void

makeCaveEntrance

makeMiniMap

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

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

    Returns void

Private move

  • Parameters

    Returns void

nullFilter

  • nullFilter(element: any): boolean
  • Parameters

    • element: any

    Returns boolean

onGlobalSlotLoaded

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

    • _: number
    • success: boolean

    Returns void

onSaveLoaded

  • onSaveLoaded(): void
  • Returns void

outputFireMessage

  • outputFireMessage(decay: number): void
  • Parameters

    • decay: number

    Returns void

passTurn

  • Parameters

    Returns void

play

  • play(saveSlot: number): void
  • Parameters

    • saveSlot: number

    Returns void

playGame

  • playGame(): void
  • Returns void

Private playPostSeed

  • playPostSeed(seed: number | null): void
  • Parameters

    • seed: number | null

    Returns void

postGenerateWorld

  • postGenerateWorld(): void
  • Returns void

postLoadResources

  • postLoadResources(): void
  • Returns void

Private prePlay

  • prePlay(mapSeed: number | null, isLoadingSave: boolean): void
  • Parameters

    • mapSeed: number | null
    • isLoadingSave: boolean

    Returns void

Private processInput

  • processInput(): void
  • Returns void

Private processMessages

  • processMessages(): void
  • Returns void

rangeFinder

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

    • weaponRange: number
    • playerSkillLevel: number

    Returns number

Private render

  • render(delta: number): void
  • Parameters

    • delta: number

    Returns void

resetGameState

  • resetGameState(): void
  • Returns void

resizeRenderer

  • resizeRenderer(): void
  • Returns void

saveGame

  • Parameters

    Returns void

setPlayerZ

  • setPlayerZ(z: number): void
  • Parameters

    • z: number

    Returns void

setRaft

  • setRaft(itemId: number | null): void
  • Parameters

    • itemId: number | null

    Returns void

setTile

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

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

    Returns ITile

setZoomLevel

  • setZoomLevel(): void
  • Returns void

setupSave

  • setupSave(_: number): void
  • Parameters

    • _: number

    Returns void

setupWorldResources

  • setupWorldResources(): void
  • Returns void

shouldRender

  • shouldRender(): number
  • Returns number

Private showStatsHint

  • showStatsHint(): void
  • Returns void

Private stats

  • stats(): void
  • Returns void

Private swimCheck

  • swimCheck(): void
  • Returns void

updateCraftTableAndWeight

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

    Returns void

updateCraftTableAndWeightNextTurn

  • updateCraftTableAndWeightNextTurn(): void
  • Returns void

updateGame

  • updateGame(resting?: boolean): void
  • Parameters

    • Optional resting: boolean

    Returns void

upgradeGlobalSave

  • Parameters

    Returns void

upgradeSave

  • Parameters

    Returns void

Private upgradeToClasses

  • upgradeToClasses<T>(arr: T[], c: object, onUpdate?: function): boolean
  • Type parameters

    • T

    Parameters

    • arr: T[]
    • c: object
      • constructor: function
        • Returns __type

    • Optional onUpdate: function
        • (value: T): void
        • Parameters

          • value: T

          Returns void

    Returns boolean

Private youNotice

  • youNotice(x: number, y: number, messageType: Message, messageArg?: string): boolean
  • Parameters

    • x: number
    • y: number
    • messageType: Message
    • Optional messageArg: string

    Returns boolean

Static getVersionInfo

  • getVersionInfo(version: string | null, defaultVerison?: string): IVersionInfo
  • Parameters

    • version: string | null
    • Default value defaultVerison: string = "2.0.5"

    Returns IVersionInfo

Object literals

options

options: object

alternateContextMenu

alternateContextMenu: boolean = false

autoGather

autoGather: boolean = true

autoPickup

autoPickup: boolean = true

binds

binds: IBindArray = <IBindArray>[]

currentGame

currentGame: number = 0

dialogOpacity

dialogOpacity: number = 0.5

dropOnGather

dropOnGather: boolean = false

dropUnderYourself

dropUnderYourself: boolean = false

effects

effects: number = 0.4

fontStyle

fontStyle: boolean = true

hints

hints: boolean = true

keepSortActive

keepSortActive: boolean = false

keyBinds

keyBinds: IKeyBind = <IKeyBind>[]

modBinds

modBinds: IModBindArray = <IModBindArray>{}

mouseMovement

mouseMovement: boolean = true

music

music: number = 0.2

mute

mute: boolean = false

protectedCraftingItems

protectedCraftingItems: boolean = false

skipIntro

skipIntro: boolean = false

visionMode

visionMode: boolean = false

warnOnDangerousActions

warnOnDangerousActions: boolean = true

warnWhenBreakingItems

warnWhenBreakingItems: boolean = true

windowMode

windowMode: boolean = false

worldTooltips

worldTooltips: boolean = true

zoomFactor

zoomFactor: number = 1

zoomLevel

zoomLevel: number = 4

zoomOnScroll

zoomOnScroll: boolean = true

seeds

seeds: object

base

base: number = 0

saved

saved: number = 0

Generated using TypeDoc