diff options
| author | historia <[not public]> | 2026-06-27 16:50:41 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-27 16:50:41 -0400 |
| commit | 988b006a5bb9edb6465653566e7bdf8175347b8c (patch) | |
| tree | 3a1fceff2ee80c11b5dafcc49c13ababe021e880 /internal/game/look_room.go | |
| parent | 1cab9ca20e24742f770a676f84e4ed9f1636f297 (diff) | |
| download | thehouseoficarus-988b006a5bb9edb6465653566e7bdf8175347b8c.tar.gz | |
feat: one-way map links, blocked paths on map, map grid startup validation, user colors for maps
Diffstat (limited to 'internal/game/look_room.go')
| -rw-r--r-- | internal/game/look_room.go | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/internal/game/look_room.go b/internal/game/look_room.go index 8a1da04..585efb0 100644 --- a/internal/game/look_room.go +++ b/internal/game/look_room.go @@ -11,10 +11,28 @@ import ( ) func (g *Game) showRoomName(sess *net.Session, p *player.Player, room *world.Room) { - sess.WriteLines( - "", - fmt.Sprintf("%s (%s)", g.colorize(sess, "room_name", room.Name), g.colorize(sess, "room_number", fmt.Sprintf("#%d", room.ID))), - ) + title := fmt.Sprintf("%s (%s)", g.colorize(sess, "room_name", room.Name), g.colorize(sess, "room_number", fmt.Sprintf("#%d", room.ID))) + if bracket := g.roomSymbolBracket(sess, p, room); bracket != "" { + title += " " + bracket + } + sess.WriteLines("", title) +} + +// roomSymbolBracket renders a dim-bracketed colored symbol (e.g. "[D]") when the +// player has set a custom symbol for this room, else "". +func (g *Game) roomSymbolBracket(sess *net.Session, p *player.Player, room *world.Room) string { + if p == nil { + return "" + } + if _, ok := p.MapSymbols[room.ID]; !ok { + return "" + } + ch, spec := roomMapSymbol(g, sess, room.ID, false) + mode := g.colorMode(sess) + dimSpec := g.resolveColor(sess, "dim") + return color.Render(mode, dimSpec, "[") + + color.Render(mode, spec, string(ch)) + + color.Render(mode, dimSpec, "]") } func (g *Game) showRoomDescription(sess *net.Session, p *player.Player, room *world.Room) []string { |
