This commit is contained in:
@@ -16,7 +16,6 @@ type MatchmakingTicket struct {
|
|||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// GENERIC MATCHMAKER — Supports ALL Games & Modes
|
// GENERIC MATCHMAKER — Supports ALL Games & Modes
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
func MatchmakerMatched(
|
func MatchmakerMatched(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
logger runtime.Logger,
|
logger runtime.Logger,
|
||||||
@@ -36,8 +35,8 @@ func MatchmakerMatched(
|
|||||||
mode, okMode := props0["mode"].(string)
|
mode, okMode := props0["mode"].(string)
|
||||||
|
|
||||||
if !okGame || !okMode {
|
if !okGame || !okMode {
|
||||||
logger.Warn("MatchmakerMatched: Missing 'game' or 'mode' properties.")
|
logger.Error("MatchmakerMatched: Missing 'game' or 'mode' properties.")
|
||||||
return "", nil
|
return "", runtime.NewError("missing matchmaking properties", 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure ALL players match game + mode
|
// Ensure ALL players match game + mode
|
||||||
@@ -57,10 +56,11 @@ func MatchmakerMatched(
|
|||||||
// This depends on how "game" was registered in main.go.
|
// This depends on how "game" was registered in main.go.
|
||||||
// Example: initializer.RegisterMatch("tictactoe", NewGenericMatch(TicTacToeRules))
|
// Example: initializer.RegisterMatch("tictactoe", NewGenericMatch(TicTacToeRules))
|
||||||
matchParams := map[string]interface{}{
|
matchParams := map[string]interface{}{
|
||||||
|
"game": game,
|
||||||
"mode": mode,
|
"mode": mode,
|
||||||
}
|
}
|
||||||
|
|
||||||
matchID, err := nk.MatchCreate(ctx, game, matchParams)
|
matchID, err := nk.MatchCreate(ctx, "generic", matchParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("MatchmakerMatched: MatchCreate failed: %v", err)
|
logger.Error("MatchmakerMatched: MatchCreate failed: %v", err)
|
||||||
return "", runtime.NewError("failed to create match", 13)
|
return "", runtime.NewError("failed to create match", 13)
|
||||||
|
|||||||
Reference in New Issue
Block a user