Skip to content

Player

Player, a static global class, allows control over in-game players and their hand zones.

Example Usage: Player["White"].seated or Player["Green"].mute()

Member Variables

Like Object member variables, Player has its own member variables.

Variable Description Type
admin If the player is promoted or the host of the game. Read only.
blindfolded If the player is blindfolded.
color The player's Player Color. Read only.
host If the player is the host. Read only.
lift_height The lift height for the player. This is how far an object is raised when held in a player's hand. Value is ranged 0 to 1.
promoted If the current player is promoted.
seated If a player is currently seated at this color. Read only.
steam_id The Steam ID of the player. This is unique to each player's Steam account. Read only.
steam_name The Steam name of the player. Read only.
team The team of the player.
Options: "None", "Clubs", "Diamonds", "Hearts", "Spades", "Jokers".

Function Summary

Class Functions

Function Name Description Return  
attachCameraToObject( parameters) Makes a Player's camera follow an Object.
broadcast( message,  Color) Print message on Player's screen and their game chat log.
changeColor( player_color) Changes player to this Player Color.
getHandCount() Number of hand zones owned by this color.
getHandObjects( hand_index) Objects that are in this hand zone.
getHandTransform( hand_index) Returns a Table of data on this hand zone.
getHoldingObjects() Objects a Player is holding in their hand.
getHoverObject() Object that the Player's pointer is hovering over.
getPointerPosition() Player's pointer coordinates.
getPointerRotation() Player's pointer rotation.
getSelectedObjects() Objects that the Player has selected with an area selection.
kick() Kicks Player out of the room.
lookAt( parameters) Moves a Player's camera, forcing 3'rd person camera mode.
mute() Mutes or unmutes Player, preventing/allowing voice chat.
print( message,  message_color) Prints a message into the Player's game chat.
promote() Promotes/demotes a Player. Promoted players have access to most host privileges.
setHandTransform( parameters,  hand_index) Sets transform elements of a hand zone.

Direct Class Functions

These functions return direct references to Players, not a Player Color. See details section for usage.

Function Name Description Return  
getPlayers() Returns Table of all Players in the instance.
getSpectators() Returns Table of all Players in spectator (Grey).

Function Details

Class Function Details

attachCameraToObject(...)

 Makes a Player's camera follow an Object.

attachCameraToObject(parameters)

  • parameters: A Table with parameters which guide the function.
    • parameters.object: The Object to attach the camera to.
    • parameters.offset: A Vector to offset the camera by.
      • Optional, defaults to {x=0, y=0, z=0}.
self.attachCameraToObject({object=self})

broadcast(...)

 Print message on Player's screen and their game chat log.

broadcast(message, message_color)

  • message: The message to be displayed.
  • message_color: Tint of the message text.
    • Optional, defaults to {r=1, g=1, b=1}.

changeColor(...)

 Changes player to this Player Color (seat).

changeColor(player_color)

  • player_color: The Player Color seat to move the Player to.
Player["White"].changeColor("Red")

getHandObjects(...)

 Returns a Table of Objects that are in this hand zone.

getHandObjects(hand_index)

  • hand_index: An index, representing which hand zone to return Objects for.
    • Optional, defaults to 1.

Indexing

Hand indexes start at 1 and are numbered in the order of their creation. Each Player color has its own indexes.


getHandTransform(...)

 Returns a Table of data on this hand zone.

getHandTransform(hand_index)

  • hand_index: An index, representing which hand zone to return data on.
    • Optional, defaults to 1.

Return Data Table

  • data: The Table the data is returned in.
    • data.position: Position of the hand zone.
    • data.rotation: Rotation of the hand zone.
    • data.scale: Scale of the hand zone.
    • data.forward: Forward direction of the hand zone.
    • data.right: Right direction of the hand zone.
    • data.up: Up direction of the hand zone.

Indexing

Hand indexes start at 1 and are numbered in the order of their creation. Each Player color has its own indexes.


lookAt(...)

 Moves a Player's camera, forcing 3'rd person camera mode.

lookAt(parameters)

  • parameters: A Table of controlling parameters to point the player camera.
    • parameters.position: Position to center the camera on.
    • parameters.pitch: Pitch angle of the camera. 0 to 90.
      • Optional, defaults to 0.
    • parameters.yaw: Yaw angle of the camera. -180 to 180.
      • Optional, defaults to 0.
    • parameters.distance: Distance the camera is from the position Vector.
      • Optional, defaults to 40.
-- Assuming someone is in the White seat
Player["White"].lookAt({
    position = {x=0,y=0,z=0},
    pitch    = 25,
    yaw      = 180,
    distance = 20,
})

print(...)

 Prints a message into the Player's game chat.

print(message, message_color)

  • message: The text to be displayed.
  • message_color: Color for the message text to be tinted.
    • Optional, defaults to {r=1, g=1, b=1}.

setHandTransform(...)

 Sets transform elements of a hand zone.

setHandTransform(parameters, hand_index)

  • parameters: The Table the data to transform the hand zone with.
    • parameters.position: Position of the hand zone.
      • Optional, defaults to {x=0, y=0, z=0}.
    • parameters.rotation: Rotation of the hand zone.
      • Optional, defaults to {x=0, y=0, z=0}.
    • parameters.scale: Scale of the hand zone.
      • Optional, defaults to {x=0, y=0, z=0}.
  • hand_index: Index, representing which hand zone to modify.
    • Optional, defaults to 1.

Indexing

Hand indexes start at 1 and are numbered in the order of their creation. Each Player color has its own indexes.

-- Example of moving/rotating/scaling hand zone
params = {
    position = {x=0, y=5, z=0},
    rotation = {x=0, y=45, z=0},
    scale    = {x=2, y=2, z=2},
}
Player["White"].setHandTransform(params, 2)

Direct Class Function Details

getPlayers()

 Returns Table of all Players in the instance.

-- Blindfolding all players
playerList = Player.getPlayers()
for _, playerReference in ipairs(playerList) do
    playerReference.blindfolded = true
end

getSpectators()

 Returns Table of all Players in spectator (Grey).

-- Printing steam name of all players to host chat
playerList = Player.getSpectators()
for _, playerReference in ipairs(playerList) do
    print(playerReference.steam_name)
end