Moved the last hard-wired emits from objects/models.py into scriptparent hooks. This allows the admin to customize this without having to mess with the engine.

Other small bugfixes, fixes to @dig to properly call creation hooks of all newly created objects (it was not setting anything before). Also fixed some of the annoying bugs around using several of the building commands that didn't properly handle spaces around the separator = symbol.
/Griatch
This commit is contained in:
Griatch 2009-09-19 15:18:42 +00:00
parent b95d45e251
commit 8fbeea99dc
5 changed files with 73 additions and 17 deletions

View file

@ -410,6 +410,9 @@ class ObjectManager(models.Manager):
if new_object.get_owner().get_zone():
new_object.zone = new_object.get_owner().get_zone()
# Run the script parent's oncreation function
# If we have a 'home' key, use that for our home value. Otherwise use
# the location key.
if home:

View file

@ -878,27 +878,21 @@ class Object(models.Model):
force_look: (bool) If true and self is a player, make them 'look'.
"""
#before the move, call the appropriate hook
#before the move, call eventual pre-commands.
if self.scriptlink.at_before_move(target) != None:
return
if not quiet:
location = self.get_location()
if location:
location.emit_to_contents("%s has left." %
(self.get_name(),), exclude=self)
if location.is_player():
location.emit_to("%s has left your inventory." %
(self.get_name()))
#tell the old room we are leaving
self.scriptlink.announce_move_from()
#perform move
self.location = target
self.save()
if not quiet:
arrival_message = "%s has arrived." % (self.get_name())
self.get_location().emit_to_contents(arrival_message, exclude=self)
if self.location.is_player():
self.location.emit_to("%s is now in your inventory." % (self.get_name()))
#tell the new room we are there.
self.scriptlink.announce_move_to()
#execute eventual extra commands on this object after moving it
self.scriptlink.at_after_move()