Skip to content

Commit ad5db39

Browse files
committed
feature: Add texts for new game events
1 parent 7f02553 commit ad5db39

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/texts.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ export const mapGameEventToText = function (event) {
120120
return `${teamAndBot(event.botSubstitution)} requests bot substitution`;
121121
}
122122
if (event.tooManyRobots != null) {
123-
return `${teamAndBot(event.tooManyRobots)} has too many robots on field`;
123+
return `${teamAndBot(event.tooManyRobots)} has ${event.tooManyRobots.numRobotsOnField} robots on the field, `
124+
+ `but only ${event.tooManyRobots.numRobotsAllowed} are allowed`;
124125
}
125126
if (event.ballLeftFieldTouchLine != null) {
126127
return `${teamAndBot(event.ballLeftFieldTouchLine)} kicked ball out via touch line`;
@@ -140,6 +141,9 @@ export const mapGameEventToText = function (event) {
140141
if (event.chippedGoal != null) {
141142
return `${teamAndBot(event.chippedGoal)} chipped on goal`;
142143
}
144+
if (event.invalidGoal != null) {
145+
return `Scored goal by ${teamAndBot(event.invalidGoal)} is invalid: ${event.invalidGoal.message}`;
146+
}
143147
if (event.aimlessKick != null) {
144148
return `${teamAndBot(event.aimlessKick)} kicked aimlessly`;
145149
}
@@ -180,7 +184,7 @@ export const mapGameEventToText = function (event) {
180184
}
181185
if (event.attackerTooCloseToDefenseArea != null) {
182186
return `${teamAndBot(event.attackerTooCloseToDefenseArea)} too close to opponent defense area `
183-
+ `(${distance(event.attackerTooCloseToDefenseArea.distance)})`;
187+
+ `(${distance(event.attackerTooCloseToDefenseArea.distance)}m)`;
184188
}
185189
if (event.botInterferedPlacement != null) {
186190
return `${teamAndBot(event.botInterferedPlacement)} interfered placement`;
@@ -311,5 +315,17 @@ export const mapGameEventToText = function (event) {
311315
return `Major unsporting behavior by ${teamAndBot(event.unsportingBehaviorMajor)}: `
312316
+ event.unsportingBehaviorMajor.reason;
313317
}
318+
if (event.boundaryCrossing != null) {
319+
return `${teamAndBot(event.boundaryCrossing)} kicked the ball over the field boundary`;
320+
}
321+
if (event.penaltyKickFailed != null) {
322+
return `Penalty kick failed by ${teamAndBot(event.penaltyKickFailed)}`;
323+
}
324+
if (event.challengeFlag != null) {
325+
return `${teamAndBot(event.challengeFlag)} raised a challenge flag`;
326+
}
327+
if (event.emergencyStop != null) {
328+
return `Emergency stop for ${teamAndBot(event.emergencyStop)} executed`;
329+
}
314330
return 'unknown game event';
315331
};

0 commit comments

Comments
 (0)