From 97024e31d676a7bd38b61aa2c30ee330309f2e00 Mon Sep 17 00:00:00 2001 From: BananaHampster Date: Thu, 21 Dec 2023 12:50:08 -0800 Subject: [PATCH] fallback for team color parsing (fixes piggies) --- src/parser.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/parser.ts b/src/parser.ts index 47cbbb9..f07d143 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -1292,8 +1292,21 @@ export class Event { case "spectator": return TeamColor.Spectator; default: - throw "unknown team: " + team; + break; } + + // try to determine color based on inclusion of color string + if (team.indexOf('blue') > -1) + return TeamColor.Blue; + if (team.indexOf('red') > -1) + return TeamColor.Red; + if (team.indexOf('yellow') > -1) + return TeamColor.Yellow; + if (team.indexOf('green') > -1) + return TeamColor.Green; + + // otherwise, throw + throw `unknown team: ${team}`; } public static parseWeapon(weapon: string): Weapon {