Move waddle handler check into houdini.handlers

This commit is contained in:
Ben 2020-03-26 22:14:30 +00:00
parent 657ee1d063
commit 1d7ef65d44
3 changed files with 21 additions and 20 deletions

View File

@ -258,3 +258,19 @@ def player_in_room(*room_ids):
def check_room_id(_, p): def check_room_id(_, p):
return p.room is not None and p.room.id in room_ids return p.room is not None and p.room.id in room_ids
return check(check_room_id) return check(check_room_id)
def table(*logic):
def check_table_game(_, p):
if p.table is not None and type(p.table.logic) in logic:
return True
return False
return check(check_table_game)
def waddle(*waddle):
def check_waddle_game(_, p):
if p.waddle is not None and type(p.waddle) in waddle:
return True
return False
return check(check_waddle_game)

View File

@ -1,14 +1,6 @@
from houdini import handlers from houdini import handlers
from houdini.handlers import XTPacket, check from houdini.handlers import XTPacket
from houdini.handlers.play.navigation import handle_join_room, handle_join_player_room from houdini.handlers.play.navigation import handle_join_player_room, handle_join_room
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')) @handlers.handler(XTPacket('a', 'gt'))

View File

@ -1,14 +1,7 @@
from houdini import handlers from houdini import handlers
from houdini.handlers import XTPacket, check from houdini.data.room import Room
from houdini.handlers.play.navigation import handle_join_room, handle_join_player_room from houdini.handlers import XTPacket
from houdini.handlers.play.navigation import handle_join_player_room, handle_join_room
def waddle_handler(waddle):
def check_waddle_game(_, p):
if p.waddle is not None and type(p.waddle) == waddle:
return True
return False
return check(check_waddle_game)
@handlers.handler(XTPacket('gw', ext='z')) @handlers.handler(XTPacket('gw', ext='z'))