mirror of
https://github.com/solero/houdini.git
synced 2024-11-22 05:27:23 +00:00
Return an error if room join cooldown is triggered
Prevents players being stuck on a loading screen
This commit is contained in:
parent
3f50f0589d
commit
194327fb93
@ -59,7 +59,7 @@ async def handle_join_server(p, penguin_id: int, login_key: str):
|
|||||||
p.membership_days_remain, server_time_offset, int(p.opened_playercard),
|
p.membership_days_remain, server_time_offset, int(p.opened_playercard),
|
||||||
p.map_category, p.status_field)
|
p.map_category, p.status_field)
|
||||||
|
|
||||||
spawn = random.choice(p.server.spawn_rooms)
|
spawn = random.choice(p.server.rooms.spawn_rooms)
|
||||||
await p.join_room(spawn)
|
await p.join_room(spawn)
|
||||||
|
|
||||||
p.server.penguins_by_id[p.id] = p
|
p.server.penguins_by_id[p.id] = p
|
||||||
@ -76,8 +76,12 @@ async def handle_join_server(p, penguin_id: int, login_key: str):
|
|||||||
await p.server.redis.hincrby('houdini.population', p.server.config.id, 1)
|
await p.server.redis.hincrby('houdini.population', p.server.config.id, 1)
|
||||||
|
|
||||||
|
|
||||||
|
async def room_cooling(p):
|
||||||
|
return await p.send_error(210)
|
||||||
|
|
||||||
|
|
||||||
@handlers.handler(XTPacket('j', 'jr'))
|
@handlers.handler(XTPacket('j', 'jr'))
|
||||||
@handlers.cooldown(1)
|
@handlers.cooldown(1, callback=room_cooling)
|
||||||
async def handle_join_room(p, room: Room, x: int, y: int):
|
async def handle_join_room(p, room: Room, x: int, y: int):
|
||||||
if p.is_legacy_client and room.tables:
|
if p.is_legacy_client and room.tables:
|
||||||
await p.send_xt('jr', room.id)
|
await p.send_xt('jr', room.id)
|
||||||
@ -107,7 +111,7 @@ async def create_temporary_room(p, penguin_id):
|
|||||||
|
|
||||||
|
|
||||||
@handlers.handler(XTPacket('j', 'jp'), client=ClientType.Vanilla)
|
@handlers.handler(XTPacket('j', 'jp'), client=ClientType.Vanilla)
|
||||||
@handlers.cooldown(1)
|
@handlers.cooldown(1, callback=room_cooling)
|
||||||
async def handle_join_player_room(p, penguin_id: int, room_type: str):
|
async def handle_join_player_room(p, penguin_id: int, room_type: str):
|
||||||
if room_type == 'backyard' and p.room.igloo and p.room.penguin_id == p.id:
|
if room_type == 'backyard' and p.room.igloo and p.room.penguin_id == p.id:
|
||||||
backyard = PenguinBackyardRoom()
|
backyard = PenguinBackyardRoom()
|
||||||
@ -137,6 +141,8 @@ async def handle_refresh_room(p):
|
|||||||
@handlers.disconnected
|
@handlers.disconnected
|
||||||
@handlers.player_attribute(joined_world=True)
|
@handlers.player_attribute(joined_world=True)
|
||||||
async def handle_disconnect_room(p):
|
async def handle_disconnect_room(p):
|
||||||
|
if p.room.blackhole:
|
||||||
|
await p.room.leave_blackhole(p)
|
||||||
await p.room.remove_penguin(p)
|
await p.room.remove_penguin(p)
|
||||||
|
|
||||||
minutes_played = (datetime.now() - p.login_timestamp).total_seconds() / 60.0
|
minutes_played = (datetime.now() - p.login_timestamp).total_seconds() / 60.0
|
||||||
|
Loading…
Reference in New Issue
Block a user