Removed at_before_traverse hook completely since it was not used and also makes no sense to use due to how exits works. Overload at_traverse if wanting to tweak how traversal happens. Resolves #902.
This commit is contained in:
parent
0ae1f9f171
commit
0bf05a8795
3 changed files with 9 additions and 20 deletions
|
|
@ -25,9 +25,11 @@ class Exit(DefaultExit):
|
||||||
attribute `err_traverse` is not defined.
|
attribute `err_traverse` is not defined.
|
||||||
|
|
||||||
Relevant hooks to overload (compared to other types of Objects):
|
Relevant hooks to overload (compared to other types of Objects):
|
||||||
at_before_traverse(traveller) - called just before traversing.
|
at_traverse(traveller, target_loc) - called to do the actual traversal and calling of the other hooks.
|
||||||
at_after_traverse(traveller, source_loc) - called just after traversing.
|
If overloading this, consider using super() to use the default
|
||||||
at_failed_traverse(traveller) - called if traversal failed for some reason. Will
|
movement implementation (and hook-calling).
|
||||||
|
at_after_traverse(traveller, source_loc) - called by at_traverse just after traversing.
|
||||||
|
at_failed_traverse(traveller) - called by at_traverse if traversal failed for some reason. Will
|
||||||
not be called if the attribute `err_traverse` is
|
not be called if the attribute `err_traverse` is
|
||||||
defined, in which case that will simply be echoed.
|
defined, in which case that will simply be echoed.
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -133,8 +133,10 @@ class Object(DefaultObject):
|
||||||
at_object_receive(obj, source_location) - called when this object receives
|
at_object_receive(obj, source_location) - called when this object receives
|
||||||
another object
|
another object
|
||||||
|
|
||||||
at_before_traverse(traversing_object) - (exit-objects only)
|
at_traverse(traversing_object, source_loc) - (exit-objects only)
|
||||||
called just before an object traverses this object
|
handles all moving across the exit, including
|
||||||
|
calling the other exit hooks. Use super() to retain
|
||||||
|
the default functionality.
|
||||||
at_after_traverse(traversing_object, source_location) - (exit-objects only)
|
at_after_traverse(traversing_object, source_location) - (exit-objects only)
|
||||||
called just after a traversal has happened.
|
called just after a traversal has happened.
|
||||||
at_failed_traverse(traversing_object) - (exit-objects only) called if
|
at_failed_traverse(traversing_object) - (exit-objects only) called if
|
||||||
|
|
|
||||||
|
|
@ -1159,21 +1159,6 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def at_before_traverse(self, traversing_object):
|
|
||||||
"""
|
|
||||||
Called just before an object uses this object to traverse to
|
|
||||||
another object (i.e. this object is a type of Exit)
|
|
||||||
|
|
||||||
Args:
|
|
||||||
traversing_object (Object): The object traversing us.
|
|
||||||
|
|
||||||
Notes:
|
|
||||||
The target destination should normally be available as
|
|
||||||
`self.destination`.
|
|
||||||
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def at_traverse(self, traversing_object, target_location):
|
def at_traverse(self, traversing_object, target_location):
|
||||||
"""
|
"""
|
||||||
This hook is responsible for handling the actual traversal,
|
This hook is responsible for handling the actual traversal,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue