mirror of
https://github.com/solero/houdini.git
synced 2024-11-12 13:48:20 +00:00
Player module handlers
This commit is contained in:
parent
b7da63f376
commit
84e43e1cd4
@ -1,6 +1,7 @@
|
||||
from houdini import handlers
|
||||
from houdini.handlers import XTPacket
|
||||
|
||||
|
||||
async def get_player_info_by_id(p, id):
|
||||
if id in p.server.penguins_by_id:
|
||||
player = p.server.penguins_by_id[id]
|
||||
@ -14,6 +15,7 @@ async def get_player_info_by_id(p, id):
|
||||
|
||||
return str()
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('u', 'h'))
|
||||
@handlers.cooldown(59)
|
||||
async def handle_heartbeat(p):
|
||||
@ -25,3 +27,39 @@ async def handle_get_player_info_by_id(p, penguin_id: int):
|
||||
await p.send_xt('pbi', await get_player_info_by_id(p, penguin_id))
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('u', 'sp'))
|
||||
async def handle_set_player_position(p, x: int, y: int):
|
||||
p.x, p.y = x, y
|
||||
p.frame = 1
|
||||
await p.room.send_xt('sp', p.data.id, x, y)
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('u', 'sf'))
|
||||
@handlers.cooldown(.5)
|
||||
async def handle_set_player_frame(p, frame: int):
|
||||
p.frame = frame
|
||||
await p.room.send_xt('sf', p.data.id, frame)
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('u', 'sb'))
|
||||
@handlers.cooldown(1)
|
||||
async def handle_send_throw_ball(p, x: int, y: int):
|
||||
await p.room.send_xt('sb', p.data.id, x, y)
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('u', 'se'))
|
||||
@handlers.cooldown(1)
|
||||
async def handle_send_emote(p, emote: int):
|
||||
await p.room.send_xt('se', p.data.id, emote)
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('u', 'sa'))
|
||||
@handlers.cooldown(1)
|
||||
async def handle_send_action(p, action: int):
|
||||
await p.room.send_xt('sa', p.data.id, action)
|
||||
|
||||
|
||||
@handlers.handler(XTPacket('u', 'followpath'))
|
||||
@handlers.cooldown(1)
|
||||
async def handle_follow_path(p, path: int):
|
||||
await p.room.send_xt('followpath', p.data.id, path)
|
||||
|
Loading…
Reference in New Issue
Block a user