Removed the normal_mode and ignore_empty keywords of puppet/unpuppet_object and instead handling those checks in the calling methods instead. This makes the call clearer. Also changed to using the on-object scripthandler for validation rather than importing and calling the manager unnecessarily.

This commit is contained in:
Griatch 2015-02-28 09:48:40 +01:00
parent 43a597efba
commit 4dc3a3df09
2 changed files with 25 additions and 21 deletions

View file

@ -77,9 +77,16 @@ class ServerSession(Session):
if self.puid:
# reconnect puppet (puid is only set if we are coming
# back from a server reload)
# back from a server reload). This does all the steps
# done in the default @ic command but without any
# hooks, echoes or access checks.
obj = _ObjectDB.objects.get(id=self.puid)
self.player.puppet_object(self.sessid, obj, normal_mode=False)
obj.sessid.add(self.sessid)
obj.player = self.player
self.puid = obj.id
self.puppet = obj
obj.scripts.validate()
obj.locks_cache_lock_bypass(obj)
def at_login(self, player):
"""
@ -110,7 +117,8 @@ class ServerSession(Session):
if self.logged_in:
sessid = self.sessid
player = self.player
player.unpuppet_object(sessid, ignore_empty=True)
if self.puppet:
player.unpuppet_object(sessid)
uaccount = player
uaccount.last_login = datetime.now()
uaccount.save()