mirror of
				https://github.com/solero/houdini.git
				synced 2025-11-04 14:41:56 +00:00 
			
		
		
		
	Leave table handlers
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
			
		||||
from houdini import handlers
 | 
			
		||||
from houdini.handlers import XTPacket, check
 | 
			
		||||
from houdini.handlers.play.navigation import handle_join_room, handle_join_player_room
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def table_handler(logic):
 | 
			
		||||
@@ -20,3 +21,27 @@ async def handle_get_waddle_population(p):
 | 
			
		||||
async def handle_join_table(p, table_id: int):
 | 
			
		||||
    table = p.room.tables[table_id]
 | 
			
		||||
    await table.add(p)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@handlers.handler(XTPacket('a', 'lt'))
 | 
			
		||||
async def handle_leave_table(p):
 | 
			
		||||
    if p.table is not None:
 | 
			
		||||
        await p.table.remove(p)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@handlers.handler(XTPacket('j', 'jr'), after=handle_join_room)
 | 
			
		||||
async def handle_join_room_table(p):
 | 
			
		||||
    if p.table is not None:
 | 
			
		||||
        await p.table.remove(p)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@handlers.handler(XTPacket('j', 'jp'), after=handle_join_player_room)
 | 
			
		||||
async def handle_join_player_room_table(p):
 | 
			
		||||
    if p.table is not None:
 | 
			
		||||
        await p.table.remove(p)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@handlers.disconnected
 | 
			
		||||
async def handle_disconnect_table(p):
 | 
			
		||||
    if p.table is not None:
 | 
			
		||||
        await p.table.remove(p)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user