Adjust some function names in the script parents to be at_ instead of a_. Also re-designed the scheduling system to be a lot more pythonic and easy to use. Utilizes classes to represent events. Much easier to plug in events from within the game directory now as well.

This commit is contained in:
Greg Taylor 2009-04-06 16:19:07 +00:00
parent b3c386a2c3
commit 5a465746c5
8 changed files with 159 additions and 145 deletions

View file

@ -136,10 +136,10 @@ def cmd_look(command):
target_obj = source_object.get_location()
# SCRIPT: Get the item's appearance from the scriptlink.
source_object.emit_to(target_obj.scriptlink.return_appearance(source_object))
source_object.emit_to(target_obj.scriptlink.return_appearance(pobject=source_object))
# SCRIPT: Call the object's script's a_desc() method.
target_obj.scriptlink.a_desc(source_object)
target_obj.scriptlink.at_desc(pobject=source_object)
GLOBAL_CMD_TABLE.add_command("look", cmd_look)
def cmd_get(command):
@ -179,7 +179,7 @@ def cmd_get(command):
exclude=source_object)
# SCRIPT: Call the object's script's a_get() method.
target_obj.scriptlink.a_get(source_object)
target_obj.scriptlink.at_get(source_object)
GLOBAL_CMD_TABLE.add_command("get", cmd_get)
def cmd_drop(command):
@ -211,7 +211,7 @@ def cmd_drop(command):
exclude=source_object)
# SCRIPT: Call the object's script's a_drop() method.
target_obj.scriptlink.a_drop(source_object)
target_obj.scriptlink.at_drop(source_object)
GLOBAL_CMD_TABLE.add_command("drop", cmd_drop),
def cmd_examine(command):

View file

@ -110,9 +110,9 @@ def cmd_ps(command):
source_object.emit_to("-- Interval Events --")
for event in scheduler.schedule:
source_object.emit_to(" [%d/%d] %s" % (
scheduler.get_event_nextfire(event),
scheduler.get_event_interval(event),
scheduler.get_event_description(event)))
event.get_nextfire(),
event.interval,
event.description))
source_object.emit_to("Totals: %d interval events" % (len(scheduler.schedule),))
GLOBAL_CMD_TABLE.add_command("@ps", cmd_ps,
priv_tuple=("genperms.process_control")),

View file

@ -741,6 +741,10 @@ def cmd_destroy(command):
source_object.emit_to("That object is already destroyed.")
return
# Run any scripted things that happen before destruction.
target_obj.scriptlink.at_pre_destroy(pobject=source_object)
# Notify destroyer and do the deed.
source_object.emit_to("You destroy %s." % target_obj.get_name())
target_obj.destroy()
GLOBAL_CMD_TABLE.add_command("@destroy", cmd_destroy,