character's at_pre_puppet tweak

Triggering at_object_receive only when room actually receives character
and accurately reporting that character came from None seems most reasonable,
then at_object_receive can decide if appearance of character from None location is actionable.
This commit is contained in:
BlauFeuer 2017-02-03 19:22:09 -05:00 committed by Griatch
parent 1ed5a0b4a6
commit 3334d3f078

View file

@ -1492,11 +1492,11 @@ class DefaultCharacter(DefaultObject):
session (Session): Session controlling the connection.
"""
if self.location is None: # Make sure character's location is never None before being puppeted.
# Return to last location (or home, which should always exist).
# Return to last location (or home, which should always exist),
self.location = self.db.prelogout_location if self.db.prelogout_location else self.home
self.location.at_object_receive(self, None) # and trigger the location's reception hook.
if self.location: # If the character is verified to be somewhere,
self.db.prelogout_location = self.location # save location again to be sure
self.location.at_object_receive(self, self.location) # and trigger the location's reception hook.
self.db.prelogout_location = self.location # save location again to be sure.
else:
player.msg("|r%s has no location and no home is set.|n" % self, session=session) # Note to set home.