Progress: Documentation

This commit is contained in:
Jeremiah Billmann
2013-07-30 21:36:38 -04:00
parent 1226373489
commit 166e32a5bc
+19 -16
View File
@@ -440,6 +440,7 @@ Function to be invoked upon event firing.
`data` **number** `data` **number**
The client start time when the ping was initiated. The client start time when the ping was initiated.
--- ---
```js ```js
options.onEvent(callback(data)) options.onEvent(callback(data))
@@ -468,13 +469,13 @@ GarageServerIO.getPlayers() : [, {id, state, [, inputs], [, {states, executionTi
**_Returns:_ array** **_Returns:_ array**
`id` **string** `id` **string**
Id of the player.
`state` **object literal** `state` **object literal**
Current state of the player.
`inputs` **array of object literals** `inputs` **array of object literals**
List of all the inputs received for this player that need to be processed.
`stateHistory` **array of object literals** `stateHistory` **array of object literals**
List of all previous states up to `options.maxHistorySecondBuffer`.
#### getEntities #### getEntities
--- ---
```js ```js
@@ -483,59 +484,61 @@ GarageServerIO.getEntities() : [,{id, state, [, {state, executionTime }]}]
**_Returns:_ array** **_Returns:_ array**
`id` **string** `id` **string**
Id of the entity.
`state` **object literal** `state` **object literal**
Current state of the entity.
`stateHistory` **array of object literals** `stateHistory` **array of object literals**
List of all previous states up to `options.maxHistorySecondBuffer`.
#### updatePlayerState #### updatePlayerState
--- ---
```js ```js
GarageServerIO.updatePlayerState(id, state) GarageServerIO.updatePlayerState(id, state)
``` ```
`id` **string** `id` **string**
Id of the player whose state should be updated.
`state` **object literal** `state` **object literal**
New state of the entity containing all of the properties pertaining to a player for your game - x, y, z, time, etc., whatever you want to add to it.
#### updateEntityState #### updateEntityState
--- ---
```js ```js
GarageServerIO.updateEntityState(id, state) GarageServerIO.updateEntityState(id, state)
``` ```
`id` **string** `id` **string**
Id of the entity whose state should be updated.
`state` **object literal** `state` **object literal**
New state of the entity containing all of the properties pertaining to an entity for your game - x, y, z, time, etc., whatever you want to add to it.
#### addEntity #### addEntity
--- ---
```js ```js
GarageServerIO.addEntity(id) GarageServerIO.addEntity(id)
``` ```
`id` **string** `id` **string**
Id of the entity to be added.
#### removeEntity #### removeEntity
--- ---
```js ```js
GarageServerIO.removeEntity(id) GarageServerIO.removeEntity(id)
``` ```
`id` **string** `id` **string**
Id of the entity to be removed.
#### sendPlayerEvent #### sendPlayerEvent
--- ---
```js ```js
GarageServerIO.sendPlayerEvent(id, data) GarageServerIO.sendPlayerEvent(id, data)
``` ```
Allows server to broadcast events to a specific player.
`id` **string** `id` **string**
Id of the player to receive event.
`data` **object literal** `data` **object literal**
Object containing all properties pertaining to the custom event.
#### sendPlayersEvent #### sendPlayersEvent
--- ---
```js ```js
GarageServerIO.sendPlayersEvent(data) GarageServerIO.sendPlayersEvent(data)
``` ```
Allows server to broadcast events to a all players.
`data` **object literal** `data` **object literal**
Object containing all properties pertaining to the custom event.
## License ## License