mirror of
https://github.com/solero/houdini.git
synced 2024-11-25 15:07:24 +00:00
Move buddy and character disconnect to a dummy handler
This commit is contained in:
parent
90ce0a0ab7
commit
d176b92e4a
@ -191,3 +191,18 @@ async def handle_toggle_best_character(p, character_id: int):
|
||||
if character_id in p.data.character_buddies:
|
||||
character_buddy_record = p.data.character_buddies[character_id]
|
||||
await character_buddy_record.update(best_buddy=not character_buddy_record.best_buddy).apply()
|
||||
|
||||
|
||||
@handlers.disconnected
|
||||
@handlers.player_attribute(joined_world=True)
|
||||
async def handle_disconnect_buddy(p):
|
||||
if p.data.character is not None:
|
||||
del p.server.penguins_by_character_id[p.data.character]
|
||||
|
||||
for penguin in p.server.penguins_by_id.values():
|
||||
if p.data.character in penguin.data.character_buddies:
|
||||
await penguin.send_xt('caof', p.data.character)
|
||||
|
||||
for buddy_id in p.data.buddies:
|
||||
if buddy_id in p.server.penguins_by_id:
|
||||
await p.server.penguins_by_id[buddy_id].send_xt('bof', p.data.id)
|
||||
|
@ -319,17 +319,6 @@ class Penguin(Spheniscidae):
|
||||
del self.server.penguins_by_id[self.data.id]
|
||||
del self.server.penguins_by_username[self.data.username]
|
||||
|
||||
if self.data.character is not None:
|
||||
del self.server.penguins_by_character_id[self.data.character]
|
||||
|
||||
for penguin in self.server.penguins_by_id.values():
|
||||
if self.data.character in penguin.data.character_buddies:
|
||||
await penguin.send_xt('caof', self.data.character)
|
||||
|
||||
for buddy_id in self.data.buddies:
|
||||
if buddy_id in self.server.penguins_by_id:
|
||||
await self.server.penguins_by_id[buddy_id].send_xt('bof', self.data.id)
|
||||
|
||||
await self.server.redis.hincrby('population', self.server.server_config['Id'], -1)
|
||||
|
||||
await super()._client_disconnected()
|
||||
|
Loading…
Reference in New Issue
Block a user