Class: Player

Player()

Class representing a player.

Constructor

new Player()

Source:

Members

group :Group

This player's group.

Type:
Source:

id :String

The player's ID.

Type:
  • String
Source:

idInGroup :Number

Type:
  • Number
Source:

participant :Participant

This player's participant.

Type:
Source:

points :number

Type:
  • number
Default Value:
  • 0
Source:

stage :Stage

Type:
Default Value:
  • null
Source:

stageIndex :number

Type:
  • number
Default Value:
  • 0
Source:

status :string

The current status of this player.

  1. 'ready': the player is ready to play their current stage, but is waiting (for their fellow group members).
  2. 'playing': the player is playing their current stage.
  3. 'done': the player is done playing their current stage, waiting to call 'Stage.playerEnd(player)'.
  4. 'finished': player is ready to move to next stage.

See Session Flow tutorial for more details.

Type:
  • string
Default Value:
  • 'ready'
Source:

Methods

(static) load(json, session) → {type}

Parameters:
Name Type Description
json type

description

session type

description

Source:
Returns:

description

Type
type

addClient(client)

addClient - description

Parameters:
Name Type Description
client type

description

Source:

app()

app - description

Source:
Returns:

App The app that this player is a member of.

appIndex() → {type}

appIndex - description

Source:
Returns:

description

Type
type

atLeastFinishedStage()

Is the player at least finished the given stage of the given period?

Return false if any of the following are true:

  • the player is in a previous app.
  • the player is in the same app, but a previous period.
  • the player is in the same period, but a previous stage.
  • the player is in the same stage, but is still 'playing'.

Otherwise return true.

CALLED FROM:

  • Stage#playerCanGroupProceedToNextStage.
Source:

compId() → {type}

compId - description

Source:
Returns:

description

Type
type

emit(name, dta)

emit - description

Parameters:
Name Type Description
name type

description

dta type

description

Source:

emitUpdate() → {type}

emitUpdate - description

Source:
Returns:

description

Type
type

isFinished() → {type}

isFinished - description

Source:
Returns:

description

Type
type

isReady() → {type}

isReady - description

Source:
Returns:

description

Type
type

matchesPlayer(plyrShell) → {boolean}

matchesPlayer - description

Parameters:
Name Type Description
plyrShell type

description

Source:
Returns:

whether or not the inputted player matches this one.

Type
boolean

nextStage()

The next stage for this player.

Source:

old() → {type}

old - description

Source:
Returns:

description

Type
type

otherPlayersInGroup() → {type}

otherPlayersInGroup - description

Source:
Returns:

description

Type
type

period() → {type}

period - description

Source:
Returns:

description

Type
type

periodIndex() → {type}

periodIndex - description

Source:
Returns:

description

Type
type

roomId() → {type}

roomId - description

Source:
Returns:

description

Type
type

save()

save - description

Source:

sendUpdate(channel)

sendUpdate - description

Parameters:
Name Type Description
channel type

description

Source:

session() → {type}

session - description

Source:
Returns:

description

Type
type

shell() → {type}

this - description

Source:
Returns:

description

Type
type

shellWithChildren() → {type}

CALLED FROM

  • Participant#shellAll
Source:
Returns:

description

Type
type