mirror of
https://github.com/thepaperpilot/Super-Auto-Coots.git
synced 2024-11-25 09:51:58 +00:00
Support battle outcomes being 3 states
This commit is contained in:
parent
1cc254546b
commit
bd5ccff23d
2 changed files with 6 additions and 4 deletions
|
@ -135,10 +135,10 @@ function setupSocket(socket: Socket<ServerToClientEvents, ClientToServerEvents>)
|
|||
main.team.value[index] = null;
|
||||
main.team.value[otherIndex] = char;
|
||||
});
|
||||
socket.on("stream", (enemyTeam, enemyNickname, victory) => {
|
||||
if (victory) {
|
||||
socket.on("stream", (enemyTeam, enemyNickname, outcome) => {
|
||||
if (outcome === "Victory") {
|
||||
main.wins.value++;
|
||||
} else {
|
||||
} else if (outcome === "Defeat") {
|
||||
main.lives.value--;
|
||||
}
|
||||
main.findingMatch.value = false;
|
||||
|
|
4
src/data/types.d.ts
vendored
4
src/data/types.d.ts
vendored
|
@ -12,6 +12,8 @@ interface Character {
|
|||
presence: number;
|
||||
}
|
||||
|
||||
type BattleOutcome = "Victory" | "Defeat" | "Tie";
|
||||
|
||||
interface ServerToClientEvents {
|
||||
"server version": (semver: string) => void;
|
||||
nickname: (nickname: string) => void;
|
||||
|
@ -21,7 +23,7 @@ interface ServerToClientEvents {
|
|||
buy: (shopIndex: number, teamIndex: number, char: Character) => void;
|
||||
move: (index: number, otherIndex: number) => void;
|
||||
merge: (shopIndex: number, teamIndex: number, char: Character) => void;
|
||||
stream: (enemyTeam: Character[], nickname: string, victory: boolean) => void;
|
||||
stream: (enemyTeam: (Character | null)[], nickname: string, outcome: BattleOutcome) => void;
|
||||
}
|
||||
|
||||
interface ClientToServerEvents {
|
||||
|
|
Loading…
Reference in a new issue