diff options
| author | historia <[not public]> | 2026-09-19 03:15:59 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-19 03:15:59 -0400 |
| commit | 0e60567a7a0addb9421769ee7be7853bfa8788cb (patch) | |
| tree | 7645112db0e4eae95b8a83c1e4f9aab38bede655 /internal/game/cmd_room_spawn.go | |
| parent | cc33072eced3d5460512c09c42ec4531c807d7af (diff) | |
| download | thehouseoficarus-0e60567a7a0addb9421769ee7be7853bfa8788cb.tar.gz | |
refactor: simplifcation, change how rooms are stored in player yaml, remove legacy code
Diffstat (limited to 'internal/game/cmd_room_spawn.go')
| -rw-r--r-- | internal/game/cmd_room_spawn.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/internal/game/cmd_room_spawn.go b/internal/game/cmd_room_spawn.go index c626acb..d48664a 100644 --- a/internal/game/cmd_room_spawn.go +++ b/internal/game/cmd_room_spawn.go @@ -4,7 +4,6 @@ import ( "fmt" "strconv" - "gopkg.in/yaml.v3" "thehouseoficarus/internal/net" "thehouseoficarus/internal/world" ) @@ -60,10 +59,7 @@ func (g *Game) roomAddSpawn(sess *net.Session, args []string) { RespawnTicks: respawnTicks, }) - path, _ := g.World.GetRoomPath(p.RoomID) - data, _ := yaml.Marshal(room) - if err := writeRoomFile(path, data); err != nil { - sess.WriteLine(fmt.Sprintf("Error saving room: %v", err)) + if !g.mutateRoom(sess, func(r *world.Room) { *r = *room }) { return } sess.WriteLine(fmt.Sprintf("Added item spawn '%s' x%d (respawn: %.0f ticks) to room.", itemID, quantity, respawnTicks)) @@ -96,10 +92,7 @@ func (g *Game) roomRemSpawn(sess *net.Session, args []string) { } room.ItemSpawns = filtered - path, _ := g.World.GetRoomPath(p.RoomID) - data, _ := yaml.Marshal(room) - if err := writeRoomFile(path, data); err != nil { - sess.WriteLine(fmt.Sprintf("Error saving room: %v", err)) + if !g.mutateRoom(sess, func(r *world.Room) { *r = *room }) { return } sess.WriteLine(fmt.Sprintf("Removed item spawn '%s' from room.", itemID)) |
