Skip to content

Commit

Permalink
feat: Expose method types to plugin fnWrap & improve events errors (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
delucis authored Aug 14, 2021
1 parent 7254749 commit f97a08d
Show file tree
Hide file tree
Showing 11 changed files with 469 additions and 91 deletions.
18 changes: 18 additions & 0 deletions docs/documentation/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,21 @@ const game = {

!> This doesn't apply to events in moves or hooks, but just the
ability to call an event directly from a client.

### Calling events from hooks

The events API is available in game hooks like it is inside moves. However,
because of how hooks and events interact, certain events cannot be called from
certain hooks. The following table shows which hooks support which events.

| | turn<br>`onMove` | turn<br>`onBegin` | turn<br>`onEnd` | phase<br>`onBegin` | phase<br>`onEnd` | game<br>`onEnd` |
|-------------------:|:----------------:|:-----------------:|:---------------:|:------------------:|:----------------:|:---------------:|
| `setStage` |||||||
| `endStage` |||||||
| `setActivePlayers` |||||||
| `endTurn` |||||||
| `setPhase` |||||||
| `endPhase` |||||||
| `endGame` |||||||

✅ = supported &nbsp;&nbsp;&nbsp; ❌ = not supported
10 changes: 9 additions & 1 deletion packages/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
*/

import { INVALID_MOVE } from '../src/core/constants';
import { GameMethod } from '../src/core/game-methods';
import { ActivePlayers, TurnOrder, Stage } from '../src/core/turn-order';
import { PlayerView } from '../src/core/player-view';

export { ActivePlayers, Stage, TurnOrder, PlayerView, INVALID_MOVE };
export {
ActivePlayers,
GameMethod,
Stage,
TurnOrder,
PlayerView,
INVALID_MOVE,
};
Loading

0 comments on commit f97a08d

Please sign in to comment.