func (p *playerClient) EchoMessage(msg string) { p.player.Enqueue(func(_ *Player) { buf := new(bytes.Buffer) proto.WriteChatMessage(buf, msg) p.TransmitPacket(buf.Bytes()) }) }
func (game *Game) BroadcastMessage(msg string) { buf := new(bytes.Buffer) proto.WriteChatMessage(buf, msg) game.enqueue(func(_ *Game) { game.multicastPacket(buf.Bytes(), nil) }) }
func (player *Player) sendChatMessage(message string, sendToSelf bool) { buf := new(bytes.Buffer) proto.WriteChatMessage(buf, message) packet := buf.Bytes() if sendToSelf { player.TransmitPacket(packet) } player.chunkSubs.curShard.ReqMulticastPlayers( player.chunkSubs.curChunkLoc, player.EntityId, packet, ) }
func (game *Game) BroadcastMessage(msg string) { buf := new(bytes.Buffer) proto.WriteChatMessage(buf, msg) game.BroadcastPacket(buf.Bytes()) }