ModuleClientApi - GameLib Game
Class representing the GameLib Game inside the ModuleServerAPI.
Methods
start
Start the game, advertise it to the control and make player requesting possible.
Game.start();
stop
Stop the game, remove all players and stop advertising to the control.
Game.stop();
Scoreboard
requestScoreboard
Get a scoreboard for the game.
Game.requestScoreboard(details);
| Argument | Type | Description |
|---|---|---|
| details | ScoreboardDetails | Simple object that specifies the style and behaviour of a scoreboard. |
Return Scoreboard Scoreboard instance.
setMainScoreboard
Set the main scoreboard for the game.
Game.setMainScoreboard(scoreboard);
| Argument | Type | Description |
|---|---|---|
| scoreboard | Scoreboard / string | Scoreboard instance or scoreboard id. |
Players
requestFromQueue
Request a player from the queue. When the queue is empty it will return null.
Game.requestFromQueue();
Return GamePlayer GamePlayer instance.
removePlayer
Remove a player from the game and show them their endscreen.
Game.removePlayer(clientId, endScreen);
| Argument | Type | Description |
|---|---|---|
| clientId | string | The client id of the player. |
| endScreen | EndScreen | The endscreen data. |
getPlayer
Get a player in the game.
Game.getPlayer(clientId);
| Argument | Type | Description |
|---|---|---|
| clientId | string | The client id of the player. |
Return GamePlayer GamePlayer instance.
hasPlayer
Check if a player is in the game.
Game.hasPlayer(clientId);
| Argument | Type | Description |
|---|---|---|
| clientId | string | The client id of the player. |
Return boolean Player is in the game.
getPlayers
Get the players in the game.
Game.getPlayers();
Return GamePlayer[] GamePlayer instances.
Events
on: playerJoinGame
Triggers when a player joins the game.
Game.on('playerJoinGame', (player) => {});
| Argument | Type | Description |
|---|---|---|
| player | GamePlayer | The player that joined the game. |
on: playerLeaveGame
Triggers when a player leaves the game.
Game.on('playerLeaveGame', (player) => {});
| Argument | Type | Description |
|---|---|---|
| player | GamePlayer | The player that leaved the game. |
on: gameStart
Triggers when the game starts.
Game.on('gameStart', () => {});
on: gameStop
Triggers when the game stops.
Game.on('gameStop', () => {});
on: action
Receive actions from a players controller.
Game.on('action', (player, action, mode, intensity?) => {});
| Argument | Type | Description |
|---|---|---|
| player | GamePlayer | The player that leaved the game. |
| action | "left" / "right" / "up" / "down" / "upleft" / "upright" / "downleft" / "downright" / "start" / "select" / "back" / "identify" | The received action. |
| mode | "on" / "off" | The mode of the action. |
| (Optional) intensity | number | *Only when control is analog. The intensity of the action. |
on: customAction
Receive custom from for a players controller.
Game.on('customAction', (player, action, mode, intensity?) => {});
| Argument | Type | Description |
|---|---|---|
| player | GamePlayer | The player that leaved the game. |
| action | string | The received action. |
| mode | "on" / "off" | The mode of the action. |
| (Optional) intensity | number | *Only when control is analog. The intensity of the action. |
Getting Started
Module Development
- Introduction
- V2 Module Structure
- V1 Module Structure
- Development environment/Building
- Module Config
- Module Debugging
- GetiyoModuleTool
- Bug/Feature Reporting
- Contact Details
ModuleServerAPI
ModuleServerAPI GameLib
ModuleClientAPI
ModuleApi Shared
© Vix Entertainment 2023 - © Mooren Productief 2023 - All rights reserved