logo bannerlogo banner
Page Navigator

This is used in the Teams, Spatula, and KOTC game modes to notify you when specific game state information changes.

In teams, this has:

  • teamScore - an array of scores for each team

In spatula, this has:

  • teamScore - an array of scores for each team
  • spatula - an object containing spatula-specific info

In KOTC, this has:

  • teamScore - an array of scores for each team
  • kotc - an object containing KOTC-specific info
  • playersOnZone - an array of players on the zone

updates is an object involving only the fields listed above for each mode, which have before and after properties referencing the data.

For example, in a KOTC game:

bot.on('gameStateChange', (updates) => {
    if (updates.kotc) console.log(`KOTC state changed from`, updates.kotc.before, `to`, updates.kotc.after);
    // also has updates.teamScore & updates.playersOnZone
});

In a spatula game:

bot.on('gameStateChange', (updates) => {
    if (updates.spatula) console.log(`Spatula state changed from`, updates.spatula.before, `to`, updates.spatula.after);
    // also has updates.teamScore
});

In teams, it has only teamScore:

bot.on('gameStateChange', (updates) => {
    if (updates.teamScore) console.log(`Team scores changed from`, updates.teamScore.before, `to`, updates.teamScore.after);
});
  • updates.teamScore: an array of scores for each team, with the Team constant referencing each index of this array ([unused, blue, red])
  • updates.spatula: a copy of bot.game.spatula as before and a reference to bot.game.spatula as after
  • updates.kotc: a copy of bot.game.kotc as before and a reference to bot.game.kotc as after
  • updates.playersOnZone.before: an array of players who were on the zone before the change (no after exists due to extra computation needed)
// the type:
export interface GameStateChanges {
    teamScore: { before: number[], after: number[] };
    kotc?: { before: GameKOTC, after: GameKOTC };
    spatula?: { before: GameSpatula, after: GameSpatula };
    playersOnZone?: { before: GamePlayer[] };
}