Cleaned up @link, @open and @dig, making these commands more useful and less buggy with strange input. Also made them work not only with #dbrefs but with any unique game object (possibly one should limit this to e.g. room's); if there's a multiple match a list of the relevant dbrefs are shown. You can also now inspect links/home settins using this command.
@open also supports script_parents when creating exits. /Griatch
This commit is contained in:
parent
66095a0b16
commit
42254355a0
3 changed files with 201 additions and 105 deletions
|
|
@ -133,15 +133,20 @@ class ObjectManager(models.Manager):
|
|||
except IndexError:
|
||||
return None
|
||||
|
||||
def global_object_name_search(self, ostring, exact_match=False):
|
||||
def global_object_name_search(self, ostring, exact_match=False, limit_types=[]):
|
||||
"""
|
||||
Searches through all objects for a name match.
|
||||
limit_types is a list of types as defined in defines_global.
|
||||
"""
|
||||
if self.is_dbref(ostring):
|
||||
return [self.dbref_search(ostring, limit_types=limit_types)]
|
||||
|
||||
if exact_match:
|
||||
o_query = self.filter(name__iexact=ostring)
|
||||
else:
|
||||
o_query = self.filter(name__icontains=ostring)
|
||||
|
||||
if limit_types:
|
||||
o_query = o_query.include(type__in=limit_types)
|
||||
return o_query.exclude(type__in=[defines_global.OTYPE_GARBAGE,
|
||||
defines_global.OTYPE_GOING])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue