Skip to content

Commit

Permalink
fallback for team color parsing (fixes piggies)
Browse files Browse the repository at this point in the history
  • Loading branch information
bananahampster committed Dec 21, 2023
1 parent 03f39e1 commit 97024e3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 97024e3

Please sign in to comment.