Adding some more script hooks.

This commit is contained in:
Greg Taylor 2007-07-10 15:34:07 +00:00
parent ebb145654f
commit 9c57e1cf7a
2 changed files with 28 additions and 2 deletions

View file

@ -180,6 +180,9 @@ def cmd_get(cdat):
target_obj.move_to(pobject, quiet=True)
session.msg("You pick up %s." % (target_obj.get_name(),))
pobject.get_location().emit_to_contents("%s picks up %s." % (pobject.get_name(), target_obj.get_name()), exclude=pobject)
# SCRIPT: Call the object's script's a_get() method.
target_obj.get_scriptlink().a_get(pobject)
def cmd_drop(cdat):
"""
@ -206,6 +209,9 @@ def cmd_drop(cdat):
target_obj.move_to(pobject.get_location(), quiet=True)
session.msg("You drop %s." % (target_obj.get_name(),))
pobject.get_location().emit_to_contents("%s drops %s." % (pobject.get_name(), target_obj.get_name()), exclude=pobject)
# SCRIPT: Call the object's script's a_drop() method.
target_obj.get_scriptlink().a_drop(pobject)
def cmd_examine(cdat):
"""

View file

@ -12,15 +12,35 @@ class BasicObject:
"""
self.source_obj = source_obj
def a_desc(self, looker):
def a_desc(self, actor):
"""
Perform this action when someone uses the LOOK command on the object.
looker: (Object) Reference to the looker
actor: (Object) Reference to the looker
"""
# Un-comment the line below for an example
#print "SCRIPT TEST: %s looked at %s." % (looker, self.source_obj)
pass
def a_get(self, actor):
"""
Perform this action when someone uses the GET command on the object.
actor: (Object) Reference to the person who got the object
"""
# Un-comment the line below for an example
#print "SCRIPT TEST: %s got %s." % (looker, self.source_obj)
pass
def a_drop(self, actor):
"""
Perform this action when someone uses the GET command on the object.
actor: (Object) Reference to the person who dropped the object
"""
# Un-comment the line below for an example
#print "SCRIPT TEST: %s got %s." % (looker, self.source_obj)
pass
def class_factory(source_obj):
"""