Merge pull request #28 from solero/fix-stealth-mod

Fix for visible stealth mods
This commit is contained in:
Ben 2020-05-10 22:06:27 +01:00 committed by GitHub
commit ef2e32c473
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,7 +35,7 @@ class RoomMixin:
p.room = self p.room = self
async def remove_penguin(self, p): async def remove_penguin(self, p):
if not (p.is_vanilla_client and p.stealth_moderator): if not p.stealth_moderator:
await self.send_xt('rp', p.id, f=lambda penguin: penguin.id != p.id) await self.send_xt('rp', p.id, f=lambda penguin: penguin.id != p.id)
del self.penguins_by_id[p.id] del self.penguins_by_id[p.id]
@ -49,9 +49,7 @@ class RoomMixin:
p.toy = None p.toy = None
async def refresh(self, p): async def refresh(self, p):
if p.is_vanilla_client and p.stealth_moderator: await p.send_xt('grs', self.id, await self.get_string(f=stealth_mod_filter(p.id)))
return await p.send_xt('grs', self.id, await self.get_string(f=stealth_mod_filter(p.id)))
await p.send_xt('grs', self.id, await self.get_string())
async def get_string(self, f=None): async def get_string(self, f=None):
return '%'.join([await p.string for p in filter(f, self.penguins_by_id.values())]) return '%'.join([await p.string for p in filter(f, self.penguins_by_id.values())])
@ -126,10 +124,9 @@ class Room(db.Model, RoomMixin):
if self.game: if self.game:
await p.send_xt('jg', self.id) await p.send_xt('jg', self.id)
elif p.is_vanilla_client and p.stealth_moderator:
await p.send_xt('jr', self.id, await self.get_string(f=stealth_mod_filter(p.id)))
else: else:
await p.send_xt('jr', self.id, await self.get_string()) await p.send_xt('jr', self.id, await self.get_string(f=stealth_mod_filter(p.id)))
if not p.stealth_moderator:
await self.send_xt('ap', await p.string) await self.send_xt('ap', await p.string)
async def remove_penguin(self, p): async def remove_penguin(self, p):
@ -174,10 +171,8 @@ class PenguinIglooRoom(db.Model, RoomMixin):
async def add_penguin(self, p): async def add_penguin(self, p):
await RoomMixin.add_penguin(self, p) await RoomMixin.add_penguin(self, p)
if p.is_vanilla_client and p.stealth_moderator:
await p.send_xt('jr', self.external_id, await self.get_string(f=stealth_mod_filter(p.id))) await p.send_xt('jr', self.external_id, await self.get_string(f=stealth_mod_filter(p.id)))
else: if not p.stealth_moderator:
await p.send_xt('jr', self.external_id, await self.get_string())
await self.send_xt('ap', await p.string) await self.send_xt('ap', await p.string)
async def remove_penguin(self, p): async def remove_penguin(self, p):