aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_say.go
blob: 3d619a0ce060424147a30f2c1d5f7e0b51ae362a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package game

import (
	"fmt"

	"thehouseoficarus/internal/net"
)

func (g *Game) doSay(sess *net.Session, msg string) {
	p := sess.Player
	roomID := p.RoomID

	for _, other := range g.Hub.PlayersInRoom(roomID) {
		if other == sess {
			other.WriteLine(fmt.Sprintf("You say: %s", g.colorize(sess, "say", msg)))
		} else {
			other.WriteLine(fmt.Sprintf("\n%s says: %s", g.colorize(other, "player_name", p.Name), g.colorize(other, "say", msg)))
		}
	}
}