From e373e1733b7f586f4bdb673aba398e2fdc1ab9fe Mon Sep 17 00:00:00 2001 From: Griatch Date: Thu, 8 Sep 2016 22:11:22 +0200 Subject: [PATCH] Make the move transition hooks use get_display_name to make them compatible with the rpsystem contrib as per #1051. --- evennia/contrib/rpsystem.py | 2 +- evennia/objects/objects.py | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/evennia/contrib/rpsystem.py b/evennia/contrib/rpsystem.py index de138e13f0..385a6649f6 100644 --- a/evennia/contrib/rpsystem.py +++ b/evennia/contrib/rpsystem.py @@ -1296,7 +1296,7 @@ class ContribRPObject(DefaultObject): except AttributeError: recog = None sdesc = recog or (hasattr(self, "sdesc") and self.sdesc.get()) or self.key - pose = " %s" % ((self.db.pose or "") if kwargs.get("pose", False) else "") + pose = " %s" % (self.db.pose or "") if kwargs.get("pose", False) else "" return "%s%s%s" % (sdesc, idstr, pose) def return_appearance(self, looker): diff --git a/evennia/objects/objects.py b/evennia/objects/objects.py index 97145a0ade..24bb02a055 100644 --- a/evennia/objects/objects.py +++ b/evennia/objects/objects.py @@ -1136,12 +1136,12 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): """ if not self.location: return - name = self.name - loc_name = "" - loc_name = self.location.name - dest_name = destination.name string = "%s is leaving %s, heading for %s." - self.location.msg_contents(string % (name, loc_name, dest_name), exclude=self) + location = self.location + for obj in self.location.contents: + obj.msg(string % (self.get_display_name(obj), + location.get_display_name(obj) if location else "nowhere", + destination.get_display_name(obj))) def announce_move_to(self, source_location): """ @@ -1153,20 +1153,19 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)): """ - name = self.name if not source_location and self.location.has_player: # This was created from nowhere and added to a player's # inventory; it's probably the result of a create command. - string = "You now have %s in your possession." % name + string = "You now have %s in your possession." % self.get_display_name(self.location) self.location.msg(string) return - src_name = "nowhere" - loc_name = self.location.name - if source_location: - src_name = source_location.name string = "%s arrives to %s from %s." - self.location.msg_contents(string % (name, loc_name, src_name), exclude=self) + location = self.location + for obj in self.location.contents: + obj.msg(string % (self.get_display_name(obj), + location.get_display_name(obj) if location else "nowhere", + source_location.get_display_name(obj))) def at_after_move(self, source_location): """