diff options
| author | historia <[not public]> | 2026-06-29 17:19:40 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-29 17:19:40 -0400 |
| commit | feb80b7dde200d4121cd9f9c583a08f9869c5588 (patch) | |
| tree | 3271cae1d74c8f3b84ef3ae84f8f62e563029dff /internal/game/cmd_room.go | |
| parent | c6cbf76b33ac20d071d25e74b70f6901476193a6 (diff) | |
| download | thehouseoficarus-feb80b7dde200d4121cd9f9c583a08f9869c5588.tar.gz | |
feat: incardinal directions (nw, ne, sw, se). probably janky in ways I haven't yet discovered.
Diffstat (limited to 'internal/game/cmd_room.go')
| -rw-r--r-- | internal/game/cmd_room.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/internal/game/cmd_room.go b/internal/game/cmd_room.go index 24763fa..971e298 100644 --- a/internal/game/cmd_room.go +++ b/internal/game/cmd_room.go @@ -7,6 +7,7 @@ import ( "gopkg.in/yaml.v3" "thehouseoficarus/internal/behavior" + "thehouseoficarus/internal/color" "thehouseoficarus/internal/net" "thehouseoficarus/internal/player" "thehouseoficarus/internal/world" @@ -46,6 +47,10 @@ func (g *Game) executeRoom(sess *net.Session, args []string, rawInput string) { g.roomMob(sess, action, rest) case "addspawn", "remspawn": g.roomSpawn(sess, action, rest) + case "color": + g.roomSetColor(sess, rest) + case "insert": + g.roomInsert(sess, rest) default: sess.WriteLine(fmt.Sprintf("Unknown room action: %s", action)) g.showRoomHelp(sess) @@ -66,6 +71,8 @@ func (g *Game) showRoomHelp(sess *net.Session) { sess.WriteLine(" room remmob <mob_id> — remove a mob spawn") sess.WriteLine(" room addspawn <item_id> [qty] [respawn_ticks] — add an item spawn") sess.WriteLine(" room remspawn <item_id> — remove an item spawn") + sess.WriteLine(" room color <spec|off> — set or clear room map color") + sess.WriteLine(" room insert <direction> [name] — insert a new room into the exit, pushing rooms beyond") } func (g *Game) roomSetName(sess *net.Session, args []string) { @@ -92,6 +99,36 @@ func (g *Game) roomSetDesc(sess *net.Session, args []string) { sess.WriteLine("Room description updated.") } +func (g *Game) roomSetColor(sess *net.Session, args []string) { + if len(args) == 0 { + sess.WriteLine("Usage: room color <spec|off>") + sess.WriteLine("Format: <00-FF> [bg:<00-FF>] [bold] [dim] [underline]") + sess.WriteLine("Example: D0 bold") + return + } + value := strings.Join(args, " ") + if value == "off" { + value = "" + } + if value != "" { + spec := color.Parse(value) + if spec.Empty() { + sess.WriteLine(fmt.Sprintf("Invalid color string: %s", value)) + sess.WriteLine("Format: <00-FF> [bg:<00-FF>] [bold] [dim] [underline]") + sess.WriteLine("Example: D0 bold") + return + } + } + g.writeRoom(sess, func(room *world.Room) { + room.Color = value + }) + if value == "" { + sess.WriteLine("Room color cleared.") + } else { + sess.WriteLine(fmt.Sprintf("Room color set to: %s", value)) + } +} + func (g *Game) loadRoomWrite(p *player.Player) (*world.Room, string, error) { path, ok := g.World.GetRoomPath(p.RoomID) if !ok { |
