Skip to content

Commit 3c11a05

Browse files
committed
Show reason text of penaltyKickFailed event
1 parent cfa0d3c commit 3c11a05

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

src/proto/ssl_gc_game_event.proto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ message GameEvent {
446446
}
447447
// A challenge flag, requested by a team previously, is flagged
448448
message ChallengeFlag {
449-
// the team that substitutes robots
449+
// the team that requested the challenge flag
450450
required Team by_team = 1;
451451
}
452452
// An emergency stop, requested by team previously, occurred
@@ -478,6 +478,8 @@ message GameEvent {
478478
required Team by_team = 1;
479479
// the location of the ball at the moment of this event [m]
480480
optional Vector2 location = 2;
481+
// an explanation of the failure
482+
optional string reason = 3;
481483
}
482484

483485
enum Type {

src/sslProto.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12022,6 +12022,7 @@ export const GameEvent = $root.GameEvent = (() => {
1202212022
* @interface IPenaltyKickFailed
1202312023
* @property {Team} byTeam PenaltyKickFailed byTeam
1202412024
* @property {IVector2|null} [location] PenaltyKickFailed location
12025+
* @property {string|null} [reason] PenaltyKickFailed reason
1202512026
*/
1202612027

1202712028
/**
@@ -12055,6 +12056,14 @@ export const GameEvent = $root.GameEvent = (() => {
1205512056
*/
1205612057
PenaltyKickFailed.prototype.location = null;
1205712058

12059+
/**
12060+
* PenaltyKickFailed reason.
12061+
* @member {string} reason
12062+
* @memberof GameEvent.PenaltyKickFailed
12063+
* @instance
12064+
*/
12065+
PenaltyKickFailed.prototype.reason = "";
12066+
1205812067
/**
1205912068
* Creates a new PenaltyKickFailed instance using the specified properties.
1206012069
* @function create
@@ -12082,6 +12091,8 @@ export const GameEvent = $root.GameEvent = (() => {
1208212091
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.byTeam);
1208312092
if (message.location != null && Object.hasOwnProperty.call(message, "location"))
1208412093
$root.Vector2.encode(message.location, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
12094+
if (message.reason != null && Object.hasOwnProperty.call(message, "reason"))
12095+
writer.uint32(/* id 3, wireType 2 =*/26).string(message.reason);
1208512096
return writer;
1208612097
};
1208712098

@@ -12122,6 +12133,9 @@ export const GameEvent = $root.GameEvent = (() => {
1212212133
case 2:
1212312134
message.location = $root.Vector2.decode(reader, reader.uint32());
1212412135
break;
12136+
case 3:
12137+
message.reason = reader.string();
12138+
break;
1212512139
default:
1212612140
reader.skipType(tag & 7);
1212712141
break;
@@ -12172,6 +12186,9 @@ export const GameEvent = $root.GameEvent = (() => {
1217212186
if (error)
1217312187
return "location." + error;
1217412188
}
12189+
if (message.reason != null && message.hasOwnProperty("reason"))
12190+
if (!$util.isString(message.reason))
12191+
return "reason: string expected";
1217512192
return null;
1217612193
};
1217712194

@@ -12206,6 +12223,8 @@ export const GameEvent = $root.GameEvent = (() => {
1220612223
throw TypeError(".GameEvent.PenaltyKickFailed.location: object expected");
1220712224
message.location = $root.Vector2.fromObject(object.location);
1220812225
}
12226+
if (object.reason != null)
12227+
message.reason = String(object.reason);
1220912228
return message;
1221012229
};
1221112230

@@ -12225,11 +12244,14 @@ export const GameEvent = $root.GameEvent = (() => {
1222512244
if (options.defaults) {
1222612245
object.byTeam = options.enums === String ? "UNKNOWN" : 0;
1222712246
object.location = null;
12247+
object.reason = "";
1222812248
}
1222912249
if (message.byTeam != null && message.hasOwnProperty("byTeam"))
1223012250
object.byTeam = options.enums === String ? $root.Team[message.byTeam] : message.byTeam;
1223112251
if (message.location != null && message.hasOwnProperty("location"))
1223212252
object.location = $root.Vector2.toObject(message.location, options);
12253+
if (message.reason != null && message.hasOwnProperty("reason"))
12254+
object.reason = message.reason;
1223312255
return object;
1223412256
};
1223512257

src/texts.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,8 @@ export const mapGameEventToText = function (event) {
320320
return `${teamAndBot(event.boundaryCrossing)} kicked the ball over the field boundary`;
321321
}
322322
if (event.penaltyKickFailed != null) {
323-
return `Penalty kick failed by ${teamAndBot(event.penaltyKickFailed)}`;
323+
const reason = event.penaltyKickFailed.reason != null ? ": " + event.penaltyKickFailed.reason : "";
324+
return `Penalty kick failed by ${teamAndBot(event.penaltyKickFailed)}${reason}`;
324325
}
325326
if (event.challengeFlag != null) {
326327
return `${teamAndBot(event.challengeFlag)} raised a challenge flag`;

0 commit comments

Comments
 (0)