aboutsummaryrefslogtreecommitdiff
path: root/internal/game/object_def.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/object_def.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/object_def.go')
-rw-r--r--internal/game/object_def.go28
1 files changed, 19 insertions, 9 deletions
diff --git a/internal/game/object_def.go b/internal/game/object_def.go
index e27aeb0..6cf2464 100644
--- a/internal/game/object_def.go
+++ b/internal/game/object_def.go
@@ -4,30 +4,40 @@ import "thehouseoficarus/internal/object"
// resolveObjectDef returns the ObjectDef for a room object instance. File
// objects (the common case) resolve through the cached object store with no
-// disk I/O on a hit, and a store miss is just a map lookup; only inline objects
+// disk I/O on a hit, and a store miss is just a map lookup; only local objects
// — which never live in the store — fall through to a freshly-read room, so
// they keep live-edit semantics without slowing file-object lookups. defID is
-// the ObjState DefID (a normalized name for inline objects, a file id
+// the ObjState DefID (a normalized name for local objects, a file id
// otherwise).
//
// Use this from display or generic-handling sites. Sites that look up a
// specific interactable behavior (gather/use-station/safespot/steal/etc.) may
-// call ObjectStore.Load directly: inline objects are guaranteed non-interactable
+// call ObjectStore.Load directly: local objects are guaranteed non-interactable
// and simply fall through those sites' existing error guards.
-func (g *Game) resolveObjectDef(roomID int, defID string) (*object.ObjectDef, error) {
+func (g *Game) resolveObjectDef(roomID int, defID string) (*object.ObjectDef, bool, error) {
def, err := g.ObjectStore.Load(defID)
if err == nil {
- return def, nil
+ if room, rerr := g.World.LoadRoom(roomID); rerr == nil {
+ for i := range room.Objects {
+ ro := &room.Objects[i]
+ if ro.Local == nil && ro.ID == defID && ro.HiddenOverride {
+ copy := *def
+ copy.Hidden = true
+ return &copy, false, nil
+ }
+ }
+ }
+ return def, false, nil
}
if room, rerr := g.World.LoadRoom(roomID); rerr == nil {
for i := range room.Objects {
ro := &room.Objects[i]
- if ro.Inline != nil && ro.ID == defID {
- d := *ro.Inline
+ if ro.Local != nil && ro.ID == defID {
+ d := *ro.Local
d.ID = defID
- return &d, nil
+ return &d, true, nil
}
}
}
- return nil, err
+ return nil, false, err
}