Change to use exit_obj in at_traverse hook kwargs instead

This commit is contained in:
Griatch 2022-08-02 14:32:47 +02:00
parent 4952ed5443
commit 69cf0a2be3
2 changed files with 10 additions and 5 deletions

View file

@ -177,6 +177,8 @@ Up requirements to Django 4.0+, Twisted 22+, Python 3.9 or 3.10
- New contrib `name_generator` for building random real-world based or fantasy-names
based on phonetic rules.
- Enable proper serialization of dict subclasses in Attributes (aogier)
- The `.at_traverse` hook now receives a `exit_obj` kwarg, linking back to the
exit triggering the hook (volund)
## Evennia 0.9.5

View file

@ -13,7 +13,6 @@ from collections import defaultdict
import inflect
from django.conf import settings
from django.utils.translation import gettext as _
from evennia.commands import cmdset
from evennia.commands.cmdsethandler import CmdSetHandler
from evennia.objects.manager import ObjectManager
@ -866,7 +865,7 @@ class DefaultObject(ObjectDB, metaclass=TypeclassBase):
Keyword Args:
Passed on to announce_move_to and announce_move_from hooks.
Exits will set the "exit" kwarg to themselves.
Exits will set the "exit_obj" kwarg to themselves.
Returns:
result (bool): True/False depending on if there were problems with the move.
@ -1556,7 +1555,9 @@ class DefaultObject(ObjectDB, metaclass=TypeclassBase):
}
)
location.msg_contents((string, {"type": move_type}), exclude=(self,), from_obj=self, mapping=mapping)
location.msg_contents(
(string, {"type": move_type}), exclude=(self,), from_obj=self, mapping=mapping
)
def announce_move_to(self, source_location, msg=None, mapping=None, move_type="move", **kwargs):
"""
@ -1624,7 +1625,9 @@ class DefaultObject(ObjectDB, metaclass=TypeclassBase):
}
)
destination.msg_contents((string, {"type": move_type}), exclude=(self,), from_obj=self, mapping=mapping)
destination.msg_contents(
(string, {"type": move_type}), exclude=(self,), from_obj=self, mapping=mapping
)
def at_post_move(self, source_location, move_type="move", **kwargs):
"""
@ -2890,7 +2893,7 @@ class DefaultExit(DefaultObject):
"""
source_location = traversing_object.location
if traversing_object.move_to(target_location, move_type="traverse", exit=self):
if traversing_object.move_to(target_location, move_type="traverse", exit_obj=self):
self.at_post_traverse(traversing_object, source_location)
else:
if self.db.err_traverse: