Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Player

A player in the game

Hierarchy

  • Player

Index

Methods

getCursorPosition

getCursorVelocity

getHandCards

  • getHandCards(): Card[]
  • Get the card holder that represents the hand of the player

    Returns Card[]

getHandHolder

getHeldObjects

getHighlightedObject

getName

  • getName(): string

getOwnedObjects

getPlayerColor

  • getPlayerColor(): Color

getPosition

getPrimaryColor

  • getPrimaryColor(): Color

getRotation

getSecondaryColor

  • getSecondaryColor(): Color

getSelectedObjects

  • Return the objects that the player has currently selected. Note that held objects always count as selected.

    Returns GameObject[]

getSlot

  • getSlot(): number
  • Return the player slot of this player (a number from 0 to 19, or -1 if the player is a spectator). The slot determines the color of the player and what objects they own.

    Returns number

getTeam

  • getTeam(): number

isBlindfolded

  • isBlindfolded(): boolean
  • Return whether the player is currently blindfolded

    Returns boolean

isGameMaster

  • isGameMaster(): boolean
  • Returns if the player is currently a game master

    Returns boolean

isHolding

  • isHolding(): boolean
  • Return whether the player is currently holding objects

    Returns boolean

isHoldingObject

  • Return whether the player is currently holding the specified object

    Parameters

    Returns boolean

isHost

  • isHost(): boolean
  • Return whether this player is the host of the current game

    Returns boolean

isScriptKeyDown

  • isScriptKeyDown(index: number): boolean
  • Return whether a script action key is held by the player

    Parameters

    • index: number

    Returns boolean

isSpectator

  • isSpectator(): boolean
  • Returns if the player is currently a spectator

    Returns boolean

isUsingVR

  • isUsingVR(): boolean
  • Return whether the player is using a VR headset to play.

    Returns boolean

isValid

  • isValid(): boolean
  • Return whether the player is valid. A player becomes invalid when it drops out from the game

    Returns boolean

sendChatMessage

  • sendChatMessage(message: string, color: Color | [r: number, g: number, b: number, a: number]): void
  • Send a message to the player's chat

    Parameters

    • message: string
    • color: Color | [r: number, g: number, b: number, a: number]

    Returns void

setBlindfolded

  • setBlindfolded(on: boolean): void
  • Set whether the player is blindfolded

    Parameters

    • on: boolean

    Returns void

setDrawingColor

  • setDrawingColor(color: Color | [r: number, g: number, b: number, a: number]): void
  • Set the color in which this player is drawing lines

    Parameters

    • color: Color | [r: number, g: number, b: number, a: number]

    Returns void

setDrawingGlow

  • setDrawingGlow(glow: boolean): void
  • Set the whether lines drawn by this player should be glowing

    Parameters

    • glow: boolean

    Returns void

setDrawingThickness

  • setDrawingThickness(thickness: number): void
  • Set the thickness for lines drawn by this player

    Parameters

    • thickness: number

    Returns void

setHandHolder

  • Set the card holder that represents the hand of the player. Can only be set to a holder that is owned by this player or a holder that has no owner.

    Parameters

    Returns void

setPositionAndRotation

  • setPositionAndRotation(position: Vector | [x: number, y: number, z: number], rotation: Rotator | [pitch: number, yaw: number, roll: number]): void
  • Set the player's position. After using for a VR player, won't do anything for that player for one second to prevent making players sick.

    Parameters

    • position: Vector | [x: number, y: number, z: number]
    • rotation: Rotator | [pitch: number, yaw: number, roll: number]

    Returns void

setPrimaryColor

  • setPrimaryColor(newColor: Color | [r: number, g: number, b: number, a: number]): void
  • Set the player's primary color

    Parameters

    • newColor: Color | [r: number, g: number, b: number, a: number]

    Returns void

setSecondaryColor

  • setSecondaryColor(newColor: Color | [r: number, g: number, b: number, a: number]): void
  • Set the player's secondary color

    Parameters

    • newColor: Color | [r: number, g: number, b: number, a: number]

    Returns void

setSelectedObjects

  • Set the selected objects for this player. Only works for objects that can be selected in the current cursor mode: in ground mode, regular objects in the list will be ignored. In modes that don't allow selecting objects (such as drawing mode), no objects will be selected. If the player is currently holding objects, the selection will not be changed.

    Parameters

    Returns void

showMessage

  • showMessage(message: string): void
  • Show a message on the player's screen

    Parameters

    • message: string

    Returns void

switchSlot

  • switchSlot(newSlot: number): boolean
  • Switch the player to a new slot. Returns whether the switch was successful (it fails if another player already occupies the chosen slot or if the slot number is invalid). Switching slots changes the player's color.

    Parameters

    • newSlot: number

      The new player slot, between 0 and 19, or -1 to make the player a spectator

    Returns boolean