CommandQueue

Keeps track of the queue off commands to execute for a player

Constructor

new CommandQueue()

Members

lagRemaining :number

In seconds get how long until the next command will run, rounded to nearest tenth of a second

queue :Array.<Object>

Methods

enqueue(executable, lag)

Parameters:
Name Type Description
executable Object

Thing to run with an execute and a queue label

lag number

Amount of lag to apply to the queue after the command is run

execute() → {boolean}

Execute the currently pending command if it's ready

Returns:
boolean -

whether the command was executed

flush()

Flush all pending commands

getTimeTilRun(commandIndex) → {number}

For a given command index find how long until it will run

Parameters:
Name Type Description
commandIndex number
Returns:
number