Check buddy has joined the world before pushing presence to them

This commit is contained in:
Ben 2020-06-12 15:17:52 +01:00
parent d25df447cc
commit d6c73fc6d6

View File

@ -11,12 +11,14 @@ async def update_player_presence(p):
for buddy_id in p.buddies.keys(): for buddy_id in p.buddies.keys():
if buddy_id in p.server.penguins_by_id: if buddy_id in p.server.penguins_by_id:
buddy = p.server.penguins_by_id[buddy_id] buddy = p.server.penguins_by_id[buddy_id]
if buddy.joined_world:
await p.send_xt('bon', buddy.id, p.server.config.id, buddy.room.id) await p.send_xt('bon', buddy.id, p.server.config.id, buddy.room.id)
await buddy.send_xt('bon', p.id, p.server.config.id, p.room.id) await buddy.send_xt('bon', p.id, p.server.config.id, p.room.id)
for character_id in p.character_buddies.keys(): for character_id in p.character_buddies.keys():
if character_id in p.server.penguins_by_character_id: if character_id in p.server.penguins_by_character_id:
character = p.server.penguins_by_character_id[character_id] character = p.server.penguins_by_character_id[character_id]
if character.joined_world:
await p.send_xt('caon', character_id, p.server.config.id, character.room.id) await p.send_xt('caon', character_id, p.server.config.id, character.room.id)
if p.character is not None: if p.character is not None: