mirror of
https://github.com/evennia/evennia.git
synced 2026-04-05 15:37:17 +02:00
Added at_post_disconnect() hook to Player, to allow for clean deletion of players at disconnect (for example for Guest-account implementation)
This commit is contained in:
parent
88efc50054
commit
1874300ad1
2 changed files with 12 additions and 0 deletions
|
|
@ -383,6 +383,16 @@ class Player(TypeClass):
|
|||
reason = reason and "(%s)" % reason or ""
|
||||
self._send_to_connect_channel("{R%s disconnected %s{n" % (self.key, reason))
|
||||
|
||||
def at_post_disconnect(self):
|
||||
"""
|
||||
This is called after disconnection is complete. No messages
|
||||
can be relayed to the player from here. After this call, the
|
||||
player should not be accessed any more, making this a good
|
||||
spot for deleting it (in the case of a guest player account,
|
||||
for example).
|
||||
"""
|
||||
pass
|
||||
|
||||
def at_message_receive(self, message, from_obj=None):
|
||||
"""
|
||||
Called when any text is emitted to this
|
||||
|
|
|
|||
|
|
@ -123,6 +123,8 @@ class ServerSession(Session):
|
|||
if not self.sessionhandler.sessions_from_player(player):
|
||||
# no more sessions connected to this player
|
||||
player.is_connected = False
|
||||
# this may be used to e.g. delete player after disconnection etc
|
||||
_GA(player.typeclass, "at_post_disconnect")()
|
||||
|
||||
def get_player(self):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue