Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Body

A celestial body located within the game.

Hierarchy

Implements

  • IBaseGameObject

Index

Properties

amount

amount: number

The amount of material the object has, or energy if it is a planet.

bodyType

bodyType: "planet" | "asteroid" | "sun"

The type of celestial body it is. Either 'planet', 'asteroid', or 'sun'.

gameObjectName

gameObjectName: string

String representing the top level Class that this game object is an instance of. Used for reflection to create new instances on clients, but exposed for convenience should AIs want this data.

id

id: string

A unique id for each instance of a GameObject or a sub class. Used for client and server communication. Should never change value after being set.

logs

logs: string[]

Any strings logged will be stored here. Intended for debugging.

materialType

materialType: "none" | "genarium" | "rarium" | "legendarium" | "mythicite"

The type of material the celestial body has. Either 'none', 'genarium', 'rarium', 'legendarium', or 'mythicite'.

owner

owner: Player | undefined

The Player that owns and can control this Body.

radius

radius: number

The radius of the circle that this body takes up.

x

x: number

The x value this celestial body is on.

y

y: number

The y value this celestial body is on.

Methods

log

  • log(message: string): Promise<void>
  • Adds a message to this GameObject's logs. Intended for your own debugging purposes, as strings stored here are saved in the gamelog.

    Parameters

    • message: string

      A string to add to this GameObject's log. Intended for debugging.

    Returns Promise<void>

nextX

  • nextX(num: number): Promise<number>
  • The x value of this body a number of turns from now. (0-how many you want).

    Parameters

    • num: number

      The number of turns in the future you wish to check.

    Returns Promise<number>

    The x position of the body the input number of turns in the future.

nextY

  • nextY(num: number): Promise<number>
  • The x value of this body a number of turns from now. (0-how many you want).

    Parameters

    • num: number

      The number of turns in the future you wish to check.

    Returns Promise<number>

    The x position of the body the input number of turns in the future.

spawn

  • spawn(x: number, y: number, title: string): Promise<boolean>
  • Spawn a unit on some value of this celestial body.

    Parameters

    • x: number

      The x value of the spawned unit.

    • y: number

      The y value of the spawned unit.

    • title: string

      The job title of the unit being spawned.

    Returns Promise<boolean>

    True if successfully taken, false otherwise.

toString

  • toString(): string
  • A toString override for easier debugging.

    example

    String(gameObject); 🠞 "GameObjectName #1245"

    Returns string

    A human readable representation of the game object.

Generated using TypeDoc