mirror of
https://github.com/thepaperpilot/Super-Auto-Coots.git
synced 2024-11-22 08:31:34 +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[index] = null;
|
||||||
main.team.value[otherIndex] = char;
|
main.team.value[otherIndex] = char;
|
||||||
});
|
});
|
||||||
socket.on("stream", (enemyTeam, enemyNickname, victory) => {
|
socket.on("stream", (enemyTeam, enemyNickname, outcome) => {
|
||||||
if (victory) {
|
if (outcome === "Victory") {
|
||||||
main.wins.value++;
|
main.wins.value++;
|
||||||
} else {
|
} else if (outcome === "Defeat") {
|
||||||
main.lives.value--;
|
main.lives.value--;
|
||||||
}
|
}
|
||||||
main.findingMatch.value = false;
|
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;
|
presence: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type BattleOutcome = "Victory" | "Defeat" | "Tie";
|
||||||
|
|
||||||
interface ServerToClientEvents {
|
interface ServerToClientEvents {
|
||||||
"server version": (semver: string) => void;
|
"server version": (semver: string) => void;
|
||||||
nickname: (nickname: string) => void;
|
nickname: (nickname: string) => void;
|
||||||
|
@ -21,7 +23,7 @@ interface ServerToClientEvents {
|
||||||
buy: (shopIndex: number, teamIndex: number, char: Character) => void;
|
buy: (shopIndex: number, teamIndex: number, char: Character) => void;
|
||||||
move: (index: number, otherIndex: number) => void;
|
move: (index: number, otherIndex: number) => void;
|
||||||
merge: (shopIndex: number, teamIndex: number, char: Character) => 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 {
|
interface ClientToServerEvents {
|
||||||
|
|
Loading…
Reference in a new issue