package state import ( "go.uber.org/zap/zapcore" ) // Synced contains all state that is synced between the server and its clients. type Synced struct { Map HexMap `json:"map"` User UserData `json:"user"` } func (s *Synced) MarshalLogObject(encoder zapcore.ObjectEncoder) error { mapErr := encoder.AddObject("map", s.Map) userErr := encoder.AddObject("user", s.User) if mapErr != nil { return mapErr } else { return userErr } } // Copy creates a deep copy of this Synced instance. func (s *Synced) Copy() Synced { return Synced{ Map: s.Map.Copy(), User: s.User.Copy(), } }