Allow setting a custom name for a test match.

This commit is contained in:
Patrick Fairbank
2022-07-24 16:50:41 -07:00
parent c78c5323bb
commit 3236456089
5 changed files with 44 additions and 14 deletions

View File

@@ -326,6 +326,19 @@ func (web *Web) matchPlayWebsocketHandler(w http.ResponseWriter, r *http.Request
ws.WriteError(err.Error())
continue
}
case "setTestMatchName":
if web.arena.CurrentMatch.Type != "test" {
// Don't allow changing the name of a non-test match.
continue
}
name, ok := data.(string)
if !ok {
ws.WriteError(fmt.Sprintf("Failed to parse '%s' message.", messageType))
continue
}
web.arena.CurrentMatch.DisplayName = name
web.arena.MatchLoadNotifier.Notify()
continue
case "updateRealtimeScore":
args := data.(map[string]interface{})
web.arena.BlueScore.AutoPoints = int(args["blueAuto"].(float64))