Tile class

Hierarchy

  • default

Implements

Constructors

Properties

Accessors

Methods

Constructors

  • Constructed during map gen

    Parameters

    • island: default
    • x: number
    • y: number
    • z: number
    • id: number
    • rendererData: number
    • quality: Quality
    • Optional isFake: true

    Returns default

Properties

containedItems?: default[]

ITileContainer

corpses?: default[]

Note: corpses must be ordered by id asc

creature?: default

Entities on the tile

doodad?: default
events?: default[]

Note: tile events must be ordered by id asc

id: number
island: default
islandId: `${number},${number}`

IVector4

npc?: default
vehicle?: default
x: number
y: number
z: WorldZ

Accessors

  • get asContainer(): undefined | this & IContainer & IVector3
  • Returns undefined | this & IContainer & IVector3

  • get asCorpse(): undefined
  • Returns undefined

  • get asCreature(): undefined
  • Returns undefined

  • get asDoodad(): undefined
  • Returns undefined

  • get asEntity(): undefined
  • Returns undefined

  • get asHuman(): undefined
  • Returns undefined

  • get asItem(): undefined
  • Returns undefined

  • get asLocalPlayer(): undefined
  • Returns undefined

  • get asNPC(): undefined
  • Returns undefined

  • get asPlayer(): undefined
  • Returns undefined

  • get asTile(): default
  • Returns default

  • get asTileEvent(): undefined
  • Returns undefined

  • get asUnion(): default
  • Returns default

  • get depth(): number
  • Gets the depth of the tile (how far it is dug down to).

    Returns number

  • get doodadAnimationDisabled(): boolean
  • Returns boolean

  • set doodadAnimationDisabled(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

  • get doodadOverHidden(): boolean
  • This should only be called if you know what you're doing Ensure a tile data with tilled is created Otherwise the game state could get out of sync

    Returns boolean

  • set doodadOverHidden(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

  • get hasBlockingDoodad(): boolean
  • Checks if the tile has a blocking doodad

    Returns boolean

  • get hasBlockingTerrain(): boolean
  • Checks if the tile has terrain that blocks

    Returns boolean

  • get hasBlockingTileEvent(): boolean
  • Checks if the tile has any blocking tile event

    Returns boolean

  • get hasTileContainer(): boolean
  • Check if this tile contains some items

    Returns boolean

  • get isBlocked(): boolean
  • Check if the tile is blocked (impassable terrain / creatures / npcs / players / doodads that cause blocked movement).

    Returns boolean

  • get isDeepHole(): boolean
  • Gets if the tile is a deep hole to perform special functionality.

    Returns boolean

  • get isEmpty(): boolean
  • Checks for: Passable No doodads No tile items No creatures No corpses No tile events No holes/depth No girls

    Returns boolean

  • get isFlammable(): boolean
  • Check if the tile can be lit on fire (has terrain/doodad/items that are flammable)

    Returns boolean

  • get isFull(): boolean
  • Checks if the tile is full of items

    Returns boolean

  • get isLocalPlayer(): boolean
  • Returns boolean

  • get isMapEdge(): boolean
  • Returns boolean

  • get isOnFire(): FireType
  • Gets the fire type of a fire on the tile if there is one

    Returns FireType

  • get isOpen(): boolean
  • Check if the tile is open. Opposite of isTileBlocked.

    Returns boolean

  • get isOverfished(): boolean
  • Gets if the tile is overfished.

    Returns boolean

  • get isTilled(): boolean
  • Returns boolean

  • get isVoid(): boolean
  • Check if this tile is Void type

    Returns boolean

  • get isWater(): boolean
  • Check if the tile is water or not.

    Returns boolean

  • get livingEntity(): undefined | default<unknown, number, EntityReferenceTypes, unknown>
  • Gets the primary/first blocking entity on this tile, that is a creature, NPC, or player.

    Returns undefined | default<unknown, number, EntityReferenceTypes, unknown>

  • get maxCapacity(): number
  • Gets the tile's max capacity based on the TILE_MAX_CAPACITY constant with variation provided by the depth of the tile.

    Returns number

  • get maxDur(): undefined | number
  • Returns undefined | number

  • set maxDur(value: undefined | number): void
  • Parameters

    • value: undefined | number

    Returns void

  • get minDur(): undefined | number
  • Returns undefined | number

  • set minDur(value: undefined | number): void
  • Parameters

    • value: undefined | number

    Returns void

  • get point(): IVector3
  • Returns IVector3

  • get quality(): Quality
  • Returns Quality

  • set quality(value: undefined | Quality): void
  • Parameters

    Returns void

  • get type(): TerrainType
  • Returns TerrainType

  • set type(value: number): void
  • Parameters

    • value: number

    Returns void

  • get variation(): number
  • Returns number

  • get vehicleOrDoodad(): undefined | default
  • Returns undefined | default

Methods

  • Parameters

    Returns void

  • Parameters

    • type: CanASeeBType
    • islandId: `${number},${number}`
    • x: number
    • y: number
    • z: number
    • fieldOfView: undefined | FieldOfView = renderer.fieldOfView
    • Optional customRadius: number

    Returns boolean

  • Checks things can slip on this tile

    Parameters

    • entity: undefined | default<unknown, number, EntityReferenceTypes, unknown>
    • Optional isClientSide: boolean

      When true, it will assume puddles do not cause slipping

    Returns boolean

  • Changes the tile

    Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns boolean

  • Clears all the water puddles on the tile.

    Parameters

    • executor: default<unknown, number, NPC | Player>

      The player to send the message to.

    Returns boolean

  • Returns void

  • Decrease the depth of a water tile if under 6 connected tiles

    Returns void

  • Converts shallow single bodies of fresh/swamp water into seawater

    Returns void

  • Contaminate water sources when new ones are created based on the surrounding water.

    Parameters

    • Optional count: number

    Returns void

  • Finds either lava or water ajacent to either lava or water, and cools the lava down based its findings.

    Returns void

  • Cools the tile (such as lava) and reveals to any in-LOS players about it.

    Returns void

  • Parameters

    • particle: undefined | IRGB
    • count: number = 1
    • intensity: number = 5

    Returns void

  • Create puddles around a point and limit them (so they can't expand infinitely)

    Returns void

  • Parameters

    • isMatchingTile: ((tile: default) => boolean)
    • options: {
          canVisitTile?: ((tile: default) => boolean);
          maxTilesChecked?: number;
      } = {}
      • Optional canVisitTile?: ((tile: default) => boolean)
      • Optional maxTilesChecked?: number

    Returns undefined | default

  • Parameters

    • isMatchingTile: ((tile: default) => boolean)
    • options: {
          canVisitTile?: ((tile: default) => boolean);
          maxTiles?: number;
          maxTilesChecked?: number;
      } = {}
      • Optional canVisitTile?: ((tile: default) => boolean)
      • Optional maxTiles?: number
      • Optional maxTilesChecked?: number

    Returns default[]

  • A* path finding

    Returns

    Tile path or undefined if no path is available

    Parameters

    • entity: undefined | default<unknown, number, EntityReferenceTypes, unknown>

      The entity moving

    • target: default

      The target tile to move to

    • isTileBlocked: ((tile: default) => boolean)

      Function for determining if the entity can move onto the tile

    • Optional getTilePenalty: ((tile: default) => number)

      Function for determining the tile penalty

    • maxNodesChecked: number = 300

      Maximum number of nodes to pathfind though

    • Optional shouldEndEarly: ((tile: default) => boolean)

    Returns undefined | default[]

  • Find a path using the preferred algorithm. Use only if you're not calling this very often, or you're calling it clientside.

    Parameters

    Returns undefined | default[]

  • Use game.changeTile or game.removeTopTile when modifying tiles. This should only be called if you know what you're doing. Otherwise the game state could get out of sync.

    Parameters

    Returns void

  • IterableIterator version of TileHelpers.getTilesAround

    Parameters

    • includeCurrentTile: boolean = false
    • includeCorners: boolean = false

    Returns Generator<default, void, unknown>

  • Gets the direction from this tile to the target tile

    Parameters

    Returns Direction

  • Gets the nearest player based.

    Parameters

    • Optional canSee: boolean

      If set to true, check if the player can see the x/y/z coords. Defaults to false.

    • Optional includeGhosts: boolean
    • Optional includeConnecting: boolean

    Returns {
        distance?: number;
        player?: default<unknown, number, NPC | Player>;
    }

    • Optional distance?: number
    • Optional player?: default<unknown, number, NPC | Player>
  • Returns ITileData[]

  • Parameters

    • Optional includeGhosts: boolean
    • includeConnecting: boolean = true
    • Optional includeZMovement: boolean

    Returns default<unknown, number, NPC | Player>[]

  • Gets the preferred adjacent tile for the human to walk onto.

    • Doesn't choose tiles that the "walk to" algorithm considers blocked
    • Prefers tiles with lower "walk to" algorithm penalty
    • Prefers the facing tile if it has the same penalty as others

    Parameters

    Returns undefined | default

  • Returns undefined | ITileData[]

  • Gets the adjacent tile in the direction

    Parameters

    Returns undefined | default

  • Array version of tilesAround

    Parameters

    • includeCurrentTile: boolean = false
    • includeCorners: boolean = false

    Returns default[]

  • Parameters

    • Optional noTileDataOffset: boolean

    Returns number

  • Parameters

    Returns number

  • Parameters

    Returns boolean

  • Checks if another cave entrance is nearby.

    Returns

    True if it created cave entrances

    Returns boolean

  • Checks if a tile is dangerous for a human

    Parameters

    Returns false | {
        message: default;
        object: default;
    }

  • Parameters

    • Optional includeGhosts: boolean
    • includeConnecting: boolean = true
    • Optional includeZMovement: boolean

    Returns boolean

  • Check if a tile is a suitable spawn point

    Returns boolean

  • Check if a tile is a suitable spawn point

    Parameters

    • ensureConnectedToOcean: boolean

    Returns boolean

  • Check if a tile is a suitable spawn point

    Parameters

    • Optional disallowWater: boolean

    Returns boolean

  • Check if a tile is a suitable spawn point for a creature

    Returns boolean

  • Returns whether the tile is blocked (completely impassible) for the human

    Parameters

    Returns boolean

  • Used to genererate and find appropriate cave entrances

    Returns

    True if it created cave entrances

    Parameters

    Returns boolean

  • Used to check if lava exists below, then create a passage above

    Returns

    True if it created a lava passage

    Parameters

    Returns boolean

  • Parameters

    • range: number
    • includeCurrentTile: boolean = false
    • excludeWater: boolean = false

    Returns undefined | default

  • Pack or set the ground as untilled

    Returns void

  • Plants a random seed at the given coordinates based on what can grow on that tile naturally. This will replace any doodad that is there.

    Returns

    True if a seed was planted.

    Returns boolean

  • Parameters

    • type: SfxType
    • Optional delay: number
    • Optional speed: number

    Returns void

  • Updates the DoodadOverHidden tile flag if the creature is large. Large creatures/corpses should render over the doodad over layer, which means we should hide the doodad over layer for doodads on the creatures tile. This should be called when a doodad changes (add / remove / growth change)

    Returns void

  • Parameters

    Returns void

  • Removes the top tiledata (index 0) from the tile If there is no remaining tile data, a new tile data will be added with the newTileTypeWhenEmpty type

    Parameters

    Returns void

  • Used to spawn a random doodad on the current biome type and at a set location (and terrain type) based on spawnOnWorldGen properties in doodad descriptions.

    Parameters

    • terrainType: TerrainType = ...

      Optional terrain type for overriding the biome item types

    Returns void

  • Used to spawn a random item on the current biome type based on spawnOnWorldGen properties in item descriptions.

    Parameters

    • terrainType: TerrainType = ...

      Optional terrain type for overriding the biome item types

    Returns void

  • Create particle effects when moving over a puddle and reduce its decay.

    Parameters

    • noSound: boolean = false

      True when no sound should be made when splashing.

    Returns void

  • Possibly collapses or opens up a cave (on both sides) and breaks any doodads.

    Parameters

    • Optional checkType: TerrainType

      TerrainType to check if the tile point equals this before switching.

    Returns void

  • Parameters

    • range: number
    • includeCurrentTile: boolean = false

    Returns default[]

  • Returns string

  • Updates the flow field state for the tile

    Parameters

    Returns void

  • Updates the world renderer & flow field state for the tile

    Parameters

    • tileUpdateType: TileUpdateType
    • Optional updateNeighbors: boolean
    • Optional skipFlowFieldUpdate: boolean

    Returns void

  • Creates a fake tile

    Parameters

    • island: default
    • x: number = 0
    • y: number = 0
    • z: number = 0

    Returns default

  • Parameters

    • value: any

    Returns value is default

Generated using TypeDoc