mirror of
https://github.com/solero/houdini.git
synced 2024-11-21 21:17:21 +00:00
Table handlers
This commit is contained in:
parent
8e67710f4c
commit
69b83cbbdb
22
houdini/handlers/games/table.py
Normal file
22
houdini/handlers/games/table.py
Normal file
@ -0,0 +1,22 @@
|
||||
from houdini import handlers
|
||||
from houdini.handlers import XTPacket, check
|
||||
|
||||
|
||||
def table_handler(logic):
|
||||
def check_table_game(_, p):
|
||||
if p.table is not None and type(p.table.logic) == logic:
|
||||
return True
|
||||
return False
|
||||
return check(check_table_game)
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('a', 'gt'))
|
||||
async def handle_get_waddle_population(p):
|
||||
await p.send_xt('gt', '%'.join(f'{table.id}|{",".join(penguin.safe_name for penguin in table.penguins)}'
|
||||
for table in p.room.tables.values()))
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('a', 'jt'))
|
||||
async def handle_join_table(p, table_id: int):
|
||||
table = p.room.tables[table_id]
|
||||
await table.add(p)
|
Loading…
Reference in New Issue
Block a user