mirror of
https://github.com/evennia/evennia.git
synced 2026-04-06 16:44:08 +02:00
Added a convenience property player.character that will return the (puppeted) Object if in MULTISESSION_MODE 0 or 1, all puppeted Objects for MULTISESSION_MODE=2. Note that this is not quite the same as the old player.character - it will only return a character if that character is actually puppeted (the old scheme returned it also if the Player was offline).
This commit is contained in:
parent
be2d0086a3
commit
ea4c30a0b1
2 changed files with 14 additions and 2 deletions
|
|
@ -484,6 +484,18 @@ class PlayerDB(TypedObject):
|
|||
return puppets
|
||||
return [puppet.typeclass for puppet in puppets]
|
||||
|
||||
def __get_single_puppet(self):
|
||||
"""
|
||||
This is a legacy convenience link for users of
|
||||
MULTISESSION_MODE 0 or 1. It will return
|
||||
only the first puppet. For mode 2, this returns
|
||||
a list of all characters.
|
||||
"""
|
||||
puppets = self.get_all_puppets()
|
||||
if _MULTISESSION_MODE in (0, 1):
|
||||
return puppets and puppets[0] or None
|
||||
return puppets
|
||||
character = property(__get_single_puppet)
|
||||
|
||||
# utility methods
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue