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 <foo>' messages insteda of the default uninformative 'player arrives.'. )

/Griatch
This commit is contained in:
Griatch 2009-09-20 00:02:57 +00:00
parent 4cee971169
commit a5a0d92985
3 changed files with 11 additions and 6 deletions

View file

@ -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()

View file

@ -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()

View file

@ -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()