**This is an old revision of the document!**

Component: Debug

The Debug Card, which is only available in creative mode, provides a set of fairly dangerous functionality for use in setting things up to debug and test code. Do not use the Debug Card without backups. No, really. One time I accidentally converted a vertical slice of the world entirely to Sign objects with no writing on them.

The debug card's “container” refers to the robot, computer or tablet with a debug card installed in it.

  • debug.getWorld(): userdata
    returns a World object (see below) that can manipulate the world containing the container of the debug card.
  • debug.getPlayer(name:string): userdata
    returns a Player object (see below) that can interact with the named player.
  • debug.getX(): number
  • debug.getY(): number
  • debug.getZ(): number
    Returns the X, Y, and Z coordinates of the container.
  • debug.changeBuffer(number): number
    Alters the power stored in the container's energy buffer.
  • debug.runCommand(command:string):number
    Runs an arbitrary command using the common OC fake player. The name and UUID of this fake player can be changed in the config.

World Object

The world object reflects the current world (dimension) the container is in.

  • getDimensionName(): string
  • getDimensionID(): number
  • getSeed(): number
  • isRaining(): boolean
  • setRaining(boolean)
  • isThundering(): boolean
  • setThundering(boolean)
  • getTime(): number
  • setTime(number)
  • getSpawnPoint(): number, number, number
  • setSpawnPoint(x: number, y:number, z:number)
  • getBlockId(x: number, y:number, z:number): number
  • getMetadata(x: number, y:number, z:number): number
  • isLoaded(x: number, y:number, z:number): number
  • hasTileEntity(x: number, y:number, z:number): number
  • getLightOpacity(x: number, y:number, z:number): number
  • getLightValue(x: number, y:number, z:number): number
  • canSeeSky(x: number, y:number, z:number): number
  • setBlock(x: number, y:number, z:number, id:number, meta:number)
  • setBlocks(x0: number, y0:number, z0:number, x1: number, y1:number, z1:number, id:number, meta:number)

Player Object

A player object represents a given player in the world.

  • getWorld(): userdata
  • getGameType(): string
  • setGameType(value: string)
  • getPosition(): number, number, number
  • setPosition(x: number, y:number, z:number)
  • getHealth(): number
  • getMaxHealth(): number
  • setHealth(value:number)