aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_goto.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-28 02:40:30 -0400
committerhistoria <[not public]>2026-06-28 02:40:30 -0400
commita1b6613c6c6a2f8d6e1ecd47e766bd40f92ac295 (patch)
tree4ff8fefb029c93f2aa3db7361658b0b4e9805b66 /internal/game/cmd_goto.go
parent87dacfbb3dd16e7f55a82361eace98f9a39d75c8 (diff)
downloadthehouseoficarus-a1b6613c6c6a2f8d6e1ecd47e766bd40f92ac295.tar.gz
feat: admin accounts, god mode, OLC commands like dig/room, 'inline' objects changed to 'local' objects
Diffstat (limited to 'internal/game/cmd_goto.go')
-rw-r--r--internal/game/cmd_goto.go74
1 files changed, 74 insertions, 0 deletions
diff --git a/internal/game/cmd_goto.go b/internal/game/cmd_goto.go
new file mode 100644
index 0000000..41e7b37
--- /dev/null
+++ b/internal/game/cmd_goto.go
@@ -0,0 +1,74 @@
+package game
+
+import (
+ "fmt"
+ "strconv"
+
+ "thehouseoficarus/internal/net"
+)
+
+func (g *Game) executeGoto(sess *net.Session, args []string, rawInput string) {
+ if !g.checkAdmin(sess) {
+ sess.WriteLine("Unknown command.")
+ return
+ }
+ p := sess.Player
+ if p == nil {
+ return
+ }
+ if len(args) == 0 {
+ sess.WriteLine("Goto where?")
+ return
+ }
+ roomID, err := strconv.Atoi(args[0])
+ if err != nil {
+ sess.WriteLine("Invalid room ID.")
+ return
+ }
+ if _, err := g.World.LoadRoom(roomID); err != nil {
+ sess.WriteLine(fmt.Sprintf("Room %d not found.", roomID))
+ return
+ }
+
+ oldRoom := p.RoomID
+ p.ClearMoveState()
+ if g.Combat.Get(p.Name) != nil {
+ g.stopCombat(p.Name)
+ }
+ p.Action = nil
+ g.cancelRest(p.Name)
+ g.cancelEnterSeq(p.Name)
+ if p.EnterSeqRoom != 0 && p.EnterSeqRoom == oldRoom {
+ p.EnterSeqRoom = 0
+ }
+ if ss, ok := g.safespot.Get(p.Name); ok {
+ g.forceLeaveSafespot(sess, p, &ss, "")
+ }
+
+ p.RoomID = roomID
+ p.HazardTimer = 0
+ p.Stats.RecordRoomVisit(roomID)
+ g.AccountStore.SaveCharacter(p)
+
+ g.World.SeedGroundItems(roomID)
+ g.seedRoomMobs(roomID)
+ g.seedRoomObjects(roomID)
+
+ if g.Hub != nil {
+ for _, other := range g.Hub.PlayersInRoom(oldRoom) {
+ if other != sess {
+ other.WriteLine(fmt.Sprintf("%s vanishes.", p.Name))
+ }
+ }
+ g.Hub.EnterRoom(sess, roomID)
+ for _, other := range g.Hub.PlayersInRoom(roomID) {
+ if other != sess {
+ other.WriteLine(fmt.Sprintf("%s appears.", p.Name))
+ }
+ }
+ }
+
+ g.doLook(sess)
+ g.runEnterSteps(sess, roomID)
+ g.checkAggro(sess)
+}