* Updated and expanded the State system; the API changed a bit. You now have to first *create* the state using

GLOBAL_STATE_TABLE.add_state() before adding commands to it. The state can now be much more configured by including as much or as
little of the normal default commands into it as wanted (so you can now have states which are almost as normal, except some
commands are missing or change their behaviour ... illness or darkness comes to mind). The possibilities here are limitless.
* States now also optionally allow traversing exits as well as using command tables defined on objects.
* States now better handle error messages (so if you try 'look' in a state which does not contain a look command you will no
longer get the 'Huh?' but will be told that the command is not available at the moment).
* All examples in commands/examples/ have been updated to use the new State system. Also added a @test_state function for trying out
the functionality.
* Added hooks at_before_move() and at_after_move(), useful for character based move-restrictions and checks (e.g. movement speed)
* Minor tweaks to the event system; avoiding the counters to go negative should they hit an uncaught traceback.
* Small fixes of typos and minor extra safety checks.
/Griatch
This commit is contained in:
Griatch 2009-08-16 01:18:58 +00:00
parent f5b40648a6
commit 1d4f075ca7
16 changed files with 555 additions and 196 deletions

View file

@ -72,6 +72,24 @@ class EvenniaBasicObject(object):
#print "SCRIPT TEST: %s got %s." % (pobject, self.scripted_obj)
pass
def at_before_move(self, target_location):
"""
This hook is called just before the object is moved.
arg:
target_location (obj): the place where this object is to be moved
returns:
if this function returns anything but None, the move is cancelled.
"""
pass
def at_after_move(self):
"""
This hook is called just after the object was successfully moved.
No return values.
"""
pass
def at_drop(self, pobject):
"""
Perform this action when someone uses the DROP command on the object.