diff --git a/houdini/handlers/__init__.py b/houdini/handlers/__init__.py index b9ff3b6..9b12ffe 100644 --- a/houdini/handlers/__init__.py +++ b/houdini/handlers/__init__.py @@ -258,3 +258,19 @@ def player_in_room(*room_ids): def check_room_id(_, p): return p.room is not None and p.room.id in room_ids 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) diff --git a/houdini/handlers/games/table.py b/houdini/handlers/games/table.py index c6ad7d7..202d399 100644 --- a/houdini/handlers/games/table.py +++ b/houdini/handlers/games/table.py @@ -1,14 +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): - 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) +from houdini.handlers import XTPacket +from houdini.handlers.play.navigation import handle_join_player_room, handle_join_room @handlers.handler(XTPacket('a', 'gt')) diff --git a/houdini/handlers/games/waddle.py b/houdini/handlers/games/waddle.py index 2babb97..66e09d4 100644 --- a/houdini/handlers/games/waddle.py +++ b/houdini/handlers/games/waddle.py @@ -1,14 +1,7 @@ from houdini import handlers -from houdini.handlers import XTPacket, check -from houdini.handlers.play.navigation import handle_join_room, handle_join_player_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) +from houdini.data.room import Room +from houdini.handlers import XTPacket +from houdini.handlers.play.navigation import handle_join_player_room, handle_join_room @handlers.handler(XTPacket('gw', ext='z'))