diff --git a/src/commands/default/building.py b/src/commands/default/building.py index 4e1ba3f682..66a51ac998 100644 --- a/src/commands/default/building.py +++ b/src/commands/default/building.py @@ -1750,7 +1750,7 @@ class CmdExamine(ObjManipCommand): self.player_mode = "player" in self.switches or obj_name.startswith('*') - obj = caller.search(obj_name, player=self.player_mode) + obj = caller.search(obj_name, player=self.player_mode, global_dbref=True) if not obj: continue diff --git a/src/objects/models.py b/src/objects/models.py index 8204f51132..c3c3c6d245 100644 --- a/src/objects/models.py +++ b/src/objects/models.py @@ -508,6 +508,7 @@ class ObjectDB(TypedObject): def search(self, ostring, global_search=False, + global_dbref=False, attribute_name=None, use_nicks=False, location=None, player=False, @@ -521,6 +522,7 @@ class ObjectDB(TypedObject): start of ostring. global_search: Search all objects, not just the current location/inventory. This is overruled if location keyword is given. + global_dbref: Search globally -only- if a valid #dbref is given, otherwise local. attribute_name: (string) Which attribute to match (if None, uses default 'name') use_nicks : Use nickname replace (off by default) location : If None, use caller's current location, and caller.contents. @@ -558,6 +560,7 @@ class ObjectDB(TypedObject): if ostring in (_ME, _SELF, '*' + _ME, '*' + _SELF): return self + if use_nicks: nick = None nicktype = "object" @@ -574,7 +577,7 @@ class ObjectDB(TypedObject): break candidates=None - if global_search: + if global_search or (global_dbref and ostring.startswith("#")): # only allow exact matching if searching the entire database exact = True elif location: diff --git a/src/objects/objects.py b/src/objects/objects.py index adfc066d5e..8ae03b32fc 100644 --- a/src/objects/objects.py +++ b/src/objects/objects.py @@ -92,7 +92,8 @@ class Object(TypeClass): * Helper methods (see src.objects.objects.py for full headers) - search(ostring, global_search=False, attribute_name=None, use_nicks=False, location=None, ignore_errors=False, player=False) + search(ostring, global_search=False, global_dbref=False, attribute_name=None, + use_nicks=False, location=None, ignore_errors=False, player=False) execute_cmd(raw_string) msg(message, from_obj=None, data=None) msg_contents(message, exclude=None, from_obj=None, data=None) @@ -150,6 +151,7 @@ class Object(TypeClass): def search(self, ostring, global_search=False, + global_dbref=False, attribute_name=None, use_nicks=False, location=None, @@ -195,6 +197,7 @@ class Object(TypeClass): """ return self.dbobj.search(ostring, global_search=global_search, + global_dbref=global_dbref, attribute_name=attribute_name, use_nicks=use_nicks, location=location,