From a5a0d92985ae31078e45caae7512f230c0f23584 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 20 Sep 2009 00:02:57 +0000 Subject: [PATCH] Added some more information to the move-announcement hooks; these also know from where the object is coming from (this can be useful for admins wanting to produce e.g. 'player arrives from ' messages insteda of the default uninformative 'player arrives.'. ) /Griatch --- src/objects/models.py | 5 +++-- src/script_parents/basicobject.py | 6 ++++-- src/script_parents/basicplayer.py | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/objects/models.py b/src/objects/models.py index 7f5dc523b1..1b06ba1c6a 100755 --- a/src/objects/models.py +++ b/src/objects/models.py @@ -887,7 +887,8 @@ class Object(models.Model): if not quiet: #tell the old room we are leaving - self.scriptlink.announce_move_from() + self.scriptlink.announce_move_from(target) + source_location = self.location #perform move self.location = target @@ -895,7 +896,7 @@ class Object(models.Model): if not quiet: #tell the new room we are there. - self.scriptlink.announce_move_to() + self.scriptlink.announce_move_to(source_location) #execute eventual extra commands on this object after moving it self.scriptlink.at_after_move() diff --git a/src/script_parents/basicobject.py b/src/script_parents/basicobject.py index f0f0a7c080..b29b33e999 100644 --- a/src/script_parents/basicobject.py +++ b/src/script_parents/basicobject.py @@ -83,9 +83,10 @@ class EvenniaBasicObject(object): """ pass - def announce_move_from(self): + def announce_move_from(self, target_location): """ Called when announcing to leave a destination. + target_location - the place we are going to """ obj = self.scripted_obj loc = obj.get_location() @@ -94,9 +95,10 @@ class EvenniaBasicObject(object): if loc.is_player(): loc.emit_to("%s has left your inventory." % (obj.get_name())) - def announce_move_to(self): + def announce_move_to(self, source_location): """ Called when announcing one's arrival at a destination. + source_location - the place we are coming from """ obj = self.scripted_obj loc = obj.get_location() diff --git a/src/script_parents/basicplayer.py b/src/script_parents/basicplayer.py index 293850df71..531a4ed836 100644 --- a/src/script_parents/basicplayer.py +++ b/src/script_parents/basicplayer.py @@ -57,9 +57,10 @@ class EvenniaBasicPlayer(object): """ pass - def announce_move_from(self): + def announce_move_from(self, target_location): """ Called when announcing to leave a destination. + target_location - the place we are about to move to """ obj = self.scripted_obj loc = obj.get_location() @@ -68,9 +69,10 @@ class EvenniaBasicPlayer(object): if loc.is_player(): loc.emit_to("%s has left your inventory." % (obj.get_name())) - def announce_move_to(self): + def announce_move_to(self, source_location): """ Called when announcing one's arrival at a destination. + source_location - the place we are coming from """ obj = self.scripted_obj loc = obj.get_location()