aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_room_spawn.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 16:13:49 -0400
committerhistoria <[not public]>2026-09-18 16:13:49 -0400
commit194164a77eb4f2479b94c19e6f0e1278ab608781 (patch)
tree53413add8ed6f32a34d1733397e380cc98ef70ef /internal/game/cmd_room_spawn.go
parent67e01aab85607b9e601185c7d62dff576af3bb43 (diff)
downloadthehouseoficarus-194164a77eb4f2479b94c19e6f0e1278ab608781.tar.gz
fix: more casino, economy, gameplay, security, and world data hardening gaps
Diffstat (limited to 'internal/game/cmd_room_spawn.go')
-rw-r--r--internal/game/cmd_room_spawn.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/game/cmd_room_spawn.go b/internal/game/cmd_room_spawn.go
index d4353e4..c626acb 100644
--- a/internal/game/cmd_room_spawn.go
+++ b/internal/game/cmd_room_spawn.go
@@ -2,7 +2,6 @@ package game
import (
"fmt"
- "os"
"strconv"
"gopkg.in/yaml.v3"
@@ -63,7 +62,10 @@ func (g *Game) roomAddSpawn(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 item spawn '%s' x%d (respawn: %.0f ticks) to room.", itemID, quantity, respawnTicks))
}
@@ -96,6 +98,9 @@ func (g *Game) roomRemSpawn(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 item spawn '%s' from room.", itemID))
}