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:
@@ -89,7 +89,16 @@ func (b *BattleshipRules) InitBoards(players []*structs.Player, cfg GameConfigur
|
||||
// Assign player boards
|
||||
// ------------------------------
|
||||
func (b *BattleshipRules) AssignPlayerSymbols(players []*structs.Player) {
|
||||
// nothing needed for classic mode
|
||||
// nothing needed for battleship
|
||||
}
|
||||
|
||||
// ------------------------------
|
||||
// Attach Game Metadata
|
||||
// ------------------------------
|
||||
func (b *BattleshipRules) AttachGameMetadata(state *structs.MatchState) {
|
||||
state.Metadata["phase"] = "placement"
|
||||
state.Metadata["p0_ready"] = false
|
||||
state.Metadata["p1_ready"] = false
|
||||
}
|
||||
|
||||
// ------------------------------
|
||||
|
||||
Reference in New Issue
Block a user