Added sessid keyword to at_pre_puppet and at_post_unpuppet hooks, where the sessid is otherwise not yet available, as per Issue 383.
This commit is contained in:
parent
92339362ec
commit
0164574c00
2 changed files with 9 additions and 7 deletions
|
|
@ -465,12 +465,13 @@ class Object(TypeClass):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def at_pre_puppet(self, player):
|
def at_pre_puppet(self, player, sessid=None):
|
||||||
"""
|
"""
|
||||||
Called just before a Player connects to this object
|
Called just before a Player connects to this object
|
||||||
to puppet it.
|
to puppet it.
|
||||||
|
|
||||||
player - connecting player object
|
player - connecting player object
|
||||||
|
sessid - session id controlling the connection
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -488,13 +489,14 @@ class Object(TypeClass):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def at_post_unpuppet(self, player):
|
def at_post_unpuppet(self, player, sessid=None):
|
||||||
"""
|
"""
|
||||||
Called just after the Player successfully disconnected
|
Called just after the Player successfully disconnected
|
||||||
from this object, severing all connections.
|
from this object, severing all connections.
|
||||||
|
|
||||||
player - the player object that just disconnected from
|
player - the player object that just disconnected from
|
||||||
this object.
|
this object.
|
||||||
|
sessid - session id controlling the connection
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -793,7 +795,7 @@ class Character(Object):
|
||||||
"Default is to look around after a move."
|
"Default is to look around after a move."
|
||||||
self.execute_cmd('look')
|
self.execute_cmd('look')
|
||||||
|
|
||||||
def at_pre_puppet(self, player):
|
def at_pre_puppet(self, player, sessid=None):
|
||||||
"""
|
"""
|
||||||
This recovers the character again after having been "stoved away" at the unpuppet
|
This recovers the character again after having been "stoved away" at the unpuppet
|
||||||
"""
|
"""
|
||||||
|
|
@ -809,7 +811,7 @@ class Character(Object):
|
||||||
self.location.msg_contents("%s has entered the game." % self.name, exclude=[self])
|
self.location.msg_contents("%s has entered the game." % self.name, exclude=[self])
|
||||||
self.location.at_object_receive(self, self.location)
|
self.location.at_object_receive(self, self.location)
|
||||||
else:
|
else:
|
||||||
player.msg("{r%s has no location and no home is set.{n" % self)
|
player.msg("{r%s has no location and no home is set.{n" % self, sessid=sessid)
|
||||||
|
|
||||||
def at_post_puppet(self):
|
def at_post_puppet(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -820,7 +822,7 @@ class Character(Object):
|
||||||
if self.location:
|
if self.location:
|
||||||
self.location.msg_contents("%s has entered the game." % self.name, exclude=[self])
|
self.location.msg_contents("%s has entered the game." % self.name, exclude=[self])
|
||||||
|
|
||||||
def at_post_unpuppet(self, player):
|
def at_post_unpuppet(self, player, sessid=None):
|
||||||
"""
|
"""
|
||||||
We stove away the character when the player goes ooc/logs off, otherwise the character object will
|
We stove away the character when the player goes ooc/logs off, otherwise the character object will
|
||||||
remain in the room also after the player logged off ("headless", so to say).
|
remain in the room also after the player logged off ("headless", so to say).
|
||||||
|
|
|
||||||
|
|
@ -421,7 +421,7 @@ class PlayerDB(TypedObject):
|
||||||
# with a lingering player/sessid reference from an unclean server kill or similar
|
# with a lingering player/sessid reference from an unclean server kill or similar
|
||||||
|
|
||||||
if normal_mode:
|
if normal_mode:
|
||||||
_GA(obj.typeclass, "at_pre_puppet")(self.typeclass)
|
_GA(obj.typeclass, "at_pre_puppet")(self.typeclass, sessid=sessid)
|
||||||
# do the connection
|
# do the connection
|
||||||
obj.sessid = sessid
|
obj.sessid = sessid
|
||||||
obj.player = self
|
obj.player = self
|
||||||
|
|
@ -453,7 +453,7 @@ class PlayerDB(TypedObject):
|
||||||
del obj.dbobj.player
|
del obj.dbobj.player
|
||||||
session.puppet = None
|
session.puppet = None
|
||||||
session.puid = None
|
session.puid = None
|
||||||
_GA(obj.typeclass, "at_post_unpuppet")(self)
|
_GA(obj.typeclass, "at_post_unpuppet")(self.typeclass, sessid=sessid)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def unpuppet_all(self):
|
def unpuppet_all(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue