From 8cdb5bec4fdccb4e5b7cfb5238ec06c3253fad54 Mon Sep 17 00:00:00 2001 From: Griatch Date: Wed, 29 Apr 2015 16:07:57 +0200 Subject: [PATCH] Fixed errors in the ExtendedRoom contrib, pertaining to the detail command. Resolves #741. --- LICENSE.txt | 1 + evennia/contrib/extended_room.py | 38 ++++++++++++++++---------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index e0daf8748c..30c47bbed0 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,7 @@ BSD license =========== +Evennia MU* creation system Copyright (c) 2012-, Griatch (griatch gmail com), Gregory Taylor All rights reserved. diff --git a/evennia/contrib/extended_room.py b/evennia/contrib/extended_room.py index 982c3784a4..7f51e9cd51 100644 --- a/evennia/contrib/extended_room.py +++ b/evennia/contrib/extended_room.py @@ -349,25 +349,27 @@ class CmdExtendedDesc(default_cmds.CmdDesc): if not location: caller.msg("No location to detail!") return - if not self.rhs: - # no '=' used - list content of given detail - if self.args in location.db.details: - string = "{wDetail '%s' on %s:\n{n" % (self.args, location) - string += location.db.details[self.args] - caller.msg(string) - return + if self.switches and self.switches[0] in 'del': + # removing a detail. + if self.lhs in location.db.details: + del location.db.details[self.lhs] + caller.msg("Detail %s deleted, if it existed." % self.lhs) + self.reset_times(location) + return if not self.args: # No args given. Return all details on 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()) caller.msg(string) return - if self.switches and self.switches[0] in 'del': - # removing a detail. - if self.lhs in location.db.details: - del location.db.detail - caller.msg("Detail %s deleted, if it existed." % self.lhs) - self.reset_times(location) + if not self.rhs: + # no '=' used - list content of given detail + if self.args in location.db.details: + string = "{wDetail '%s' on %s:\n{n" % (self.args, location) + string += str(location.db.details[self.args]) + caller.msg(string) + else: + caller.msg("Detail '%s' not found." % self.args) return # setting a detail location.db.details[self.lhs] = self.rhs @@ -410,7 +412,7 @@ class CmdExtendedDesc(default_cmds.CmdDesc): self.reset_times(location) caller.msg("Seasonal description was set on %s." % location.key) 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: text = self.rhs obj = caller.search(self.lhs) @@ -419,14 +421,12 @@ class CmdExtendedDesc(default_cmds.CmdDesc): else: text = self.args obj = location - obj.db.desc = self.rhs # a compatibility fallback - if utils.inherits_from(obj, ExtendedRoom): - # this is an extended room, we need to reset - # times and set general_desc + obj.db.desc = text # a compatibility fallback + if obj.attributes.has("general_desc"): obj.db.general_desc = text - self.reset_times(obj) caller.msg("General description was set on %s." % obj.key) else: + # this is not an ExtendedRoom. caller.msg("The description was set on %s." % obj.key)