Fixed errors in the ExtendedRoom contrib, pertaining to the detail command. Resolves #741.
This commit is contained in:
parent
63ddf1cbae
commit
8cdb5bec4f
2 changed files with 20 additions and 19 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
BSD license
|
BSD license
|
||||||
===========
|
===========
|
||||||
|
|
||||||
|
Evennia MU* creation system
|
||||||
Copyright (c) 2012-, Griatch (griatch <AT> gmail <DOT> com), Gregory Taylor
|
Copyright (c) 2012-, Griatch (griatch <AT> gmail <DOT> com), Gregory Taylor
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -349,25 +349,27 @@ class CmdExtendedDesc(default_cmds.CmdDesc):
|
||||||
if not location:
|
if not location:
|
||||||
caller.msg("No location to detail!")
|
caller.msg("No location to detail!")
|
||||||
return
|
return
|
||||||
if not self.rhs:
|
if self.switches and self.switches[0] in 'del':
|
||||||
# no '=' used - list content of given detail
|
# removing a detail.
|
||||||
if self.args in location.db.details:
|
if self.lhs in location.db.details:
|
||||||
string = "{wDetail '%s' on %s:\n{n" % (self.args, location)
|
del location.db.details[self.lhs]
|
||||||
string += location.db.details[self.args]
|
caller.msg("Detail %s deleted, if it existed." % self.lhs)
|
||||||
caller.msg(string)
|
self.reset_times(location)
|
||||||
return
|
return
|
||||||
if not self.args:
|
if not self.args:
|
||||||
# No args given. Return all details on location
|
# No args given. Return all details on location
|
||||||
string = "{wDetails on %s{n:\n" % location
|
string = "{wDetails on %s{n:\n" % location
|
||||||
string += "\n".join(" {w%s{n: %s" % (key, utils.crop(text)) for key, text in location.db.details.items())
|
string += "\n".join(" {w%s{n: %s" % (key, utils.crop(text)) for key, text in location.db.details.items())
|
||||||
caller.msg(string)
|
caller.msg(string)
|
||||||
return
|
return
|
||||||
if self.switches and self.switches[0] in 'del':
|
if not self.rhs:
|
||||||
# removing a detail.
|
# no '=' used - list content of given detail
|
||||||
if self.lhs in location.db.details:
|
if self.args in location.db.details:
|
||||||
del location.db.detail
|
string = "{wDetail '%s' on %s:\n{n" % (self.args, location)
|
||||||
caller.msg("Detail %s deleted, if it existed." % self.lhs)
|
string += str(location.db.details[self.args])
|
||||||
self.reset_times(location)
|
caller.msg(string)
|
||||||
|
else:
|
||||||
|
caller.msg("Detail '%s' not found." % self.args)
|
||||||
return
|
return
|
||||||
# setting a detail
|
# setting a detail
|
||||||
location.db.details[self.lhs] = self.rhs
|
location.db.details[self.lhs] = self.rhs
|
||||||
|
|
@ -410,7 +412,7 @@ class CmdExtendedDesc(default_cmds.CmdDesc):
|
||||||
self.reset_times(location)
|
self.reset_times(location)
|
||||||
caller.msg("Seasonal description was set on %s." % location.key)
|
caller.msg("Seasonal description was set on %s." % location.key)
|
||||||
else:
|
else:
|
||||||
# Not seasonal desc set, maybe this is not an extended room
|
# No seasonal desc set, maybe this is not an extended room
|
||||||
if self.rhs:
|
if self.rhs:
|
||||||
text = self.rhs
|
text = self.rhs
|
||||||
obj = caller.search(self.lhs)
|
obj = caller.search(self.lhs)
|
||||||
|
|
@ -419,14 +421,12 @@ class CmdExtendedDesc(default_cmds.CmdDesc):
|
||||||
else:
|
else:
|
||||||
text = self.args
|
text = self.args
|
||||||
obj = location
|
obj = location
|
||||||
obj.db.desc = self.rhs # a compatibility fallback
|
obj.db.desc = text # a compatibility fallback
|
||||||
if utils.inherits_from(obj, ExtendedRoom):
|
if obj.attributes.has("general_desc"):
|
||||||
# this is an extended room, we need to reset
|
|
||||||
# times and set general_desc
|
|
||||||
obj.db.general_desc = text
|
obj.db.general_desc = text
|
||||||
self.reset_times(obj)
|
|
||||||
caller.msg("General description was set on %s." % obj.key)
|
caller.msg("General description was set on %s." % obj.key)
|
||||||
else:
|
else:
|
||||||
|
# this is not an ExtendedRoom.
|
||||||
caller.msg("The description was set on %s." % obj.key)
|
caller.msg("The description was set on %s." % obj.key)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue