mirror of
https://github.com/evennia/evennia.git
synced 2026-03-23 08:16:30 +01:00
Delete char from player list upon obj deletion
This commit is contained in:
parent
6f67b7e43b
commit
e7de2de63b
1 changed files with 13 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ from django.conf import settings
|
|||
from src.typeclasses.models import (TypedObject, TagHandler, NickHandler,
|
||||
AliasHandler, AttributeHandler)
|
||||
from src.objects.manager import ObjectManager
|
||||
from ev import managers
|
||||
from src.players.models import PlayerDB
|
||||
from src.commands.cmdsethandler import CmdSetHandler
|
||||
from src.commands import cmdhandler
|
||||
|
|
@ -714,6 +715,18 @@ class ObjectDB(TypedObject):
|
|||
|
||||
self.delete_iter += 1
|
||||
|
||||
# If this is a character, delete it from the player's playable characters list
|
||||
if _GA(self, 'locks').get("puppet"):
|
||||
# Extract Player id
|
||||
try:
|
||||
pid = _GA(self, "locks").get("puppet")
|
||||
pid = pid[pid.find("pid(")+4:]
|
||||
pid = int(pid[:pid.find(")")])
|
||||
except ValueError:
|
||||
return False
|
||||
player = managers.players.get_id(pid)
|
||||
player.db._playable_characters.remove(self)
|
||||
|
||||
# See if we need to kick the player off.
|
||||
|
||||
for session in _GA(self, "sessions"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue