diff --git a/src/commands/default/general.py b/src/commands/default/general.py index 9bad725951..f87ef24d79 100644 --- a/src/commands/default/general.py +++ b/src/commands/default/general.py @@ -275,7 +275,7 @@ class CmdGet(MuxCommand): if not self.args: caller.msg("Get what?") return - obj = caller.search(self.args) + obj = caller.search(self.args, location=caller.location) if not obj: return if caller == obj: @@ -326,7 +326,7 @@ class CmdDrop(MuxCommand): # Because the DROP command by definition looks for items # in inventory, call the search function using location = caller results = caller.search(self.args, location=caller, ignore_errors=True) - + # now we send it into the error handler (this will output consistent # error messages if there are problems). obj = AT_SEARCH_RESULT(caller, self.args, results, False) diff --git a/src/objects/models.py b/src/objects/models.py index 0ae21b7cdd..af5e430b7f 100644 --- a/src/objects/models.py +++ b/src/objects/models.py @@ -514,7 +514,8 @@ class ObjectDB(TypedObject): location/inventory. This is overruled if location keyword is given. 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 + location : If None, use caller's current location, and caller.contents. + This can also be a list of locations player: return the Objects' controlling Player, instead, if available ignore_errors : Don't display any error messages even if there are none/multiple matches - @@ -562,10 +563,14 @@ class ObjectDB(TypedObject): if global_search: # only allow exact matching if searching the entire database exact = True + elif location: + # location(s) were given + candidates = [] + for obj in make_iter(location): + candidates.extend([o.dbobj for o in obj.contents]) else: # local search. Candidates are self.contents, self.location and self.location.contents - if not location: - location = self.location + location = self.location candidates = self.contents if location: candidates = candidates + [location] + location.contents