Options
All
  • Public
  • Public/Protected
  • All
Menu

Class World

A class that represents a world

Hierarchy

  • World

Index

Constructors

constructor

Properties

Optional data

data: WorldData

The world data

Private server

server: Server

The server object

Methods

fetch

  • fetch(shouldGenerate?: boolean): Promise<void>
  • Fetches the world data from the cache, or db if not present. This will set the .data property. This doesn't auto generate worlds if not present.

    Parameters

    • Optional shouldGenerate: boolean

      Whether or not to auto generate a world if not present in cache or the database. Defaults to true

    Returns Promise<void>

fixData

  • fixData(): void
  • Fixes the world data and checks for invalid values.

    Returns void

generate

  • generate(): Promise<void>
  • Generates a world, it will save to cache after generating

    Returns Promise<void>

hasData

  • hasData(): boolean
  • Whether or not the world has it's data.

    Returns boolean

saveToCache

  • saveToCache(): Promise<void>
  • Saves world data to cache

    Returns Promise<void>

saveToDb

  • saveToDb(): Promise<void>
  • Saves world data to the database

    Returns Promise<void>

serialize

  • Serilizes the world packet. Fetches automatically from either the cache or database, if not present. Will also try to generate the world.

    Returns Promise<TankPacket>

uncache

  • uncache(): Promise<void>
  • Deletes the world from cache

    Returns Promise<void>

Static create

  • Creates a new instance of the world class.

    Parameters

    • server: Server

      The server class

    • name: string

      The name of the world

    Returns World

Generated using TypeDoc