aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_room_mob.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/cmd_room_mob.go')
-rw-r--r--internal/game/cmd_room_mob.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/game/cmd_room_mob.go b/internal/game/cmd_room_mob.go
index ced170f..ce729d4 100644
--- a/internal/game/cmd_room_mob.go
+++ b/internal/game/cmd_room_mob.go
@@ -2,7 +2,6 @@ package game
import (
"fmt"
- "os"
"gopkg.in/yaml.v3"
"thehouseoficarus/internal/net"
@@ -44,7 +43,10 @@ func (g *Game) roomAddMob(sess *net.Session, args []string) {
path, _ := g.World.GetRoomPath(p.RoomID)
data, _ := yaml.Marshal(room)
- os.WriteFile(path, data, 0644)
+ if err := writeRoomFile(path, data); err != nil {
+ sess.WriteLine(fmt.Sprintf("Error saving room: %v", err))
+ return
+ }
sess.WriteLine(fmt.Sprintf("Added mob '%s' to room.", mobID))
}
@@ -77,6 +79,9 @@ func (g *Game) roomRemMob(sess *net.Session, args []string) {
path, _ := g.World.GetRoomPath(p.RoomID)
data, _ := yaml.Marshal(room)
- os.WriteFile(path, data, 0644)
+ if err := writeRoomFile(path, data); err != nil {
+ sess.WriteLine(fmt.Sprintf("Error saving room: %v", err))
+ return
+ }
sess.WriteLine(fmt.Sprintf("Removed mob '%s' from room.", mobID))
}