mirror of
https://github.com/solero/houdini.git
synced 2025-10-17 04:48:18 +00:00
Toy book handlers
Experimental: players who open newspapers will persist after changing rooms.
This commit is contained in:
@@ -102,6 +102,7 @@ async def handle_pbsm_finish(p):
|
||||
async def handle_set_player_position(p, x: int, y: int):
|
||||
p.x, p.y = x, y
|
||||
p.frame = 1
|
||||
p.toy = None
|
||||
await p.room.send_xt('sp', p.data.id, x, y)
|
||||
|
||||
|
||||
|
@@ -0,0 +1,29 @@
|
||||
from houdini import handlers, ClientType
|
||||
from houdini.handlers import XTPacket
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('t', 'at'))
|
||||
async def handle_open_book(p, toy_id: int):
|
||||
p.toy = toy_id
|
||||
await p.room.send_xt('at', p.data.id, toy_id)
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('t', 'rt'))
|
||||
async def handle_close_book(p):
|
||||
p.toy = None
|
||||
await p.room.send_xt('rt', p.data.id)
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('j', 'jr'), client=ClientType.Legacy)
|
||||
async def handle_join_room_toy(p):
|
||||
for penguin in p.room.penguins:
|
||||
if penguin.toy is not None:
|
||||
await p.send_xt('at', penguin.data.id, penguin.toy)
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('j', 'crl'), client=ClientType.Vanilla)
|
||||
@handlers.depends_on_packet(XTPacket('j', 'jr'))
|
||||
async def handle_client_room_loaded_toy(p):
|
||||
for penguin in p.room.penguins:
|
||||
if penguin.toy is not None:
|
||||
await p.send_xt('at', penguin.data.id, penguin.toy)
|
||||
|
Reference in New Issue
Block a user