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 teamIn spatula, this has:
teamScore - an array of scores for each teamspatula - an object containing spatula-specific infoIn KOTC, this has:
teamScore - an array of scores for each teamkotc - an object containing KOTC-specific infoplayersOnZone - an array of players on the zoneupdates 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 afterupdates.kotc: a copy of bot.game.kotc as before and a reference to bot.game.kotc as afterupdates.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[] };
}
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 teamIn spatula, this has:
teamScore - an array of scores for each teamspatula - an object containing spatula-specific infoIn KOTC, this has:
teamScore - an array of scores for each teamkotc - an object containing KOTC-specific infoplayersOnZone - an array of players on the zoneupdates 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 afterupdates.kotc: a copy of bot.game.kotc as before and a reference to bot.game.kotc as afterupdates.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[] };
}