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
|
|
@ -2,6 +2,7 @@
|
|||
This is where all of the crucial, core object models reside.
|
||||
"""
|
||||
import re
|
||||
import traceback
|
||||
|
||||
try: import cPickle as pickle
|
||||
except ImportError: import pickle
|
||||
|
|
@ -603,12 +604,16 @@ class Object(models.Model):
|
|||
attrib: (str) The attribute's name.
|
||||
"""
|
||||
if self.has_attribute(attrib):
|
||||
attrib = Attribute.objects.filter(attr_object=self).filter(attr_name=attrib)[0]
|
||||
try:
|
||||
attrib = Attribute.objects.filter(attr_object=self).filter(attr_name=attrib)[0]
|
||||
except:
|
||||
# safety, if something goes wrong (like unsynced db), catch it.
|
||||
logger.log_errmsg(traceback.print_exc())
|
||||
return default
|
||||
return attrib.get_value()
|
||||
else:
|
||||
return default
|
||||
|
||||
|
||||
def get_attribute_obj(self, attrib):
|
||||
"""
|
||||
Returns the attribute object matching the specified name.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue