aboutsummaryrefslogtreecommitdiff
path: root/internal/game
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 20:11:29 -0400
committerhistoria <[not public]>2026-09-18 20:11:29 -0400
commit0f812ccc307ea0550511ccced40b65dfb0cdaa91 (patch)
tree7f2f343985275a478ba7295a37fcd48871ca4956 /internal/game
parent79764732406d6484f67d3dec045483dcb5d08c28 (diff)
downloadthehouseoficarus-0f812ccc307ea0550511ccced40b65dfb0cdaa91.tar.gz
fix: world and casino integrity fixes
Diffstat (limited to 'internal/game')
-rw-r--r--internal/game/cmd_swapid.go16
-rw-r--r--internal/game/cmd_undig.go27
-rw-r--r--internal/game/look_entities.go8
3 files changed, 32 insertions, 19 deletions
diff --git a/internal/game/cmd_swapid.go b/internal/game/cmd_swapid.go
index 8b637fb..d1dbd68 100644
--- a/internal/game/cmd_swapid.go
+++ b/internal/game/cmd_swapid.go
@@ -66,13 +66,15 @@ func (g *Game) executeSwapID(sess *net.Session, args []string, rawInput string)
// Refuse while non-admin players are online: swapping room IDs relocates
// every character whose state embeds those IDs, which is disruptive to
// normal play. Admins may stay online (their own state is migrated too).
- for _, other := range g.Hub.AllSessions() {
- if other == sess || other.Player == nil {
- continue
- }
- if !g.checkAdmin(other) {
- sess.WriteLine("Cannot swap room IDs while non-admin players are online.")
- return
+ if g.Hub != nil {
+ for _, other := range g.Hub.AllSessions() {
+ if other == sess || other.Player == nil {
+ continue
+ }
+ if !g.checkAdmin(other) {
+ sess.WriteLine("Cannot swap room IDs while non-admin players are online.")
+ return
+ }
}
}
diff --git a/internal/game/cmd_undig.go b/internal/game/cmd_undig.go
index c752c86..88dd661 100644
--- a/internal/game/cmd_undig.go
+++ b/internal/game/cmd_undig.go
@@ -224,18 +224,23 @@ func (g *Game) performUndig(sess *net.Session, p *player.Player, targetID int) {
g.World.RebuildRoomIndex(g.DataDir)
- if p.RoomID == targetID {
- p.RoomID = 0
- }
-
- for _, other := range g.Hub.AllSessions() {
- if other.Player != nil && other.Player.RoomID == targetID {
- other.Player.RoomID = p.RoomID
- if g.Hub != nil {
- g.Hub.EnterRoom(other, p.RoomID)
+ // Everyone in the deleted room relocates to the admin's room. If the
+ // admin is somehow standing in the target room (0 is not a valid room),
+ // fall back to the starting room rather than teleporting players to a
+ // nonexistent room and soft-locking them.
+ destination := p.RoomID
+ if destination == targetID {
+ destination = g.StartingRoom
+ }
+
+ if g.Hub != nil {
+ for _, other := range g.Hub.AllSessions() {
+ if other.Player != nil && other.Player.RoomID == targetID {
+ other.Player.RoomID = destination
+ g.Hub.EnterRoom(other, destination)
+ other.WriteLine("The room around you dissolves. You find yourself elsewhere.")
+ g.doLook(other)
}
- other.WriteLine("The room around you dissolves. You find yourself elsewhere.")
- g.doLook(other)
}
}
diff --git a/internal/game/look_entities.go b/internal/game/look_entities.go
index 70077a3..e06d49f 100644
--- a/internal/game/look_entities.go
+++ b/internal/game/look_entities.go
@@ -230,7 +230,13 @@ func (g *Game) showRoomCasinos(sess *net.Session, room *world.Room) []string {
}
var lines []string
for _, table := range room.CasinoTables {
- name := casinoGameLabel(table.Game) + " table"
+ // Legacy slots declared under casino_tables are instantiated as the
+ // room's slots machine, so label them as a machine, not a table.
+ kind := "table"
+ if table.Game == casino.GameSlots {
+ kind = "machine"
+ }
+ name := casinoGameLabel(table.Game) + " " + kind
lines = append(lines, fmt.Sprintf("A %s is here.", g.colorize(sess, "casino_action", name)))
}
for _, machine := range room.CasinoMachines {