Interface: RoomDefinition<S>
Type parameters
Name | Type |
---|---|
S | extends State |
Hierarchy
ColyRoomDefinition
↳
RoomDefinition
Integration tests Properties
integrationHooks
• Optional
integrationHooks: Record
<string
, Partial
<Record
<IntegrationHookNames
, IntegrationHookCallback
<S
>> & { data?
: IntegrationHookData
}>>
All room's available integration tests hooks
Other Properties
botActivities
• Optional
botActivities: BotActionsSet
<S
>
Set of all possible actions a bot can take, with some guidance
maxClients
• Optional
maxClients: number
Inherited from
ColyRoomDefinition.maxClients
patchRate
• Optional
patchRate: number
Inherited from
ColyRoomDefinition.patchRate
playersCount
• Optional
playersCount: PlayersCount
Allowed count of human and bot players in this game.
NOTE: maxClients
refers to max players (human and bot) AND any spectators.
possibleActions
• Optional
possibleActions: ActionDefinition
<S
>[]
Set of all possible actions players can take in this game
stateConstructor
• Optional
stateConstructor: (...args
: any
[]) => S
Type declaration
• new stateConstructor(...args
)
Reference to your game's State
class. Will use just basic State
by default
Parameters
Name | Type |
---|---|
...args | any [] |
variantsConfig
• Optional
variantsConfig: VariantsConfig
<S
["variantData"
]>
The base
Lifecycle Methods
canGameStart
▸ Optional
canGameStart(this
): boolean
State your own conditions of whether the game can be started or not.
Parameters
Name | Type |
---|---|
this | Room <S , Record <string , unknown >> |
Returns
boolean
onInitGame
▸ Optional
onInitGame(this
, options?
): void
Will be called right after the game room is created, and game state is setup.
Parameters
Name | Type |
---|---|
this | Room <S , Record <string , unknown >> |
options? | RoomCreateOptions |
Returns
void
onPlayerTurnEnded
▸ Optional
onPlayerTurnEnded(this
, player
): void
| Command
<State
<Record
<string
, unknown
>>>[]
Invoked when players turn ends
Parameters
Name | Type |
---|---|
this | Room <S , Record <string , unknown >> |
player | Player |
Returns
void
| Command
<State
<Record
<string
, unknown
>>>[]
onPlayerTurnStarted
▸ Optional
onPlayerTurnStarted(this
, player
): void
| Command
<State
<Record
<string
, unknown
>>>[]
Invoked when players turn starts
Parameters
Name | Type |
---|---|
this | Room <S , Record <string , unknown >> |
player | Player |
Returns
void
| Command
<State
<Record
<string
, unknown
>>>[]
onRoundEnd
▸ Optional
onRoundEnd(this
): void
| Command
<State
<Record
<string
, unknown
>>>[]
Invoked when a round is near completion.
Parameters
Name | Type |
---|---|
this | Room <S , Record <string , unknown >> |
Returns
void
| Command
<State
<Record
<string
, unknown
>>>[]
onRoundStart
▸ Optional
onRoundStart(this
): void
| Command
<State
<Record
<string
, unknown
>>>[]
Invoked when each round starts.
Parameters
Name | Type |
---|---|
this | Room <S , Record <string , unknown >> |
Returns
void
| Command
<State
<Record
<string
, unknown
>>>[]
onStartGame
▸ Optional
onStartGame(this
): void
| Command
<State
<Record
<string
, unknown
>>>[]
Will be called when clients agree to start the game.
state.players
is already populated with all players.
After this function, the game will give turn to the first player.
Parameters
Name | Type |
---|---|
this | Room <S , Record <string , unknown >> |