feat(rules): add game-specific metadata attachment and unify match metadata initialization
Added AttachGameMetadata to GameRules interface Implemented metadata setup for Battleship (phase + readiness flags) Implemented no-op metadata hook for TicTacToe Moved generic phase/ready metadata out of MatchInit Added game/mode metadata to match state Fixed json:"metadata" tag in MatchState
This commit is contained in:
@@ -130,9 +130,9 @@ func (m *GenericMatch) MatchInit(
|
||||
GameOver: false,
|
||||
Metadata: map[string]interface{}{},
|
||||
}
|
||||
state.Metadata["phase"] = "placement"
|
||||
state.Metadata["p0_ready"] = false
|
||||
state.Metadata["p1_ready"] = false
|
||||
state.Metadata["game"] = m.GameName
|
||||
state.Metadata["mode"] = m.Mode
|
||||
m.Rules.AttachGameMetadata(state)
|
||||
|
||||
label := fmt.Sprintf("%s:%s", m.GameName, m.Mode)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user