Use entity.send() for nearby message broadcasting

This commit is contained in:
Jared Miller 2026-02-07 20:31:16 -05:00
parent fea563f158
commit 3cba2cdb7a
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -69,8 +69,7 @@ async def move_player(player: Player, dx: int, dy: int, direction_name: str) ->
# Check if the target is passable
if not world.is_passable(target_x, target_y):
player.writer.write("You can't go that way.\r\n")
await player.writer.drain()
await player.send("You can't go that way.\r\n")
return
# Send departure message to players in the old area
@ -116,8 +115,7 @@ async def send_nearby_message(player: Player, x: int, y: int, message: str) -> N
dx_dist = min(dx_dist, world.width - dx_dist)
dy_dist = min(dy_dist, world.height - dy_dist)
if dx_dist <= viewport_range and dy_dist <= viewport_range:
other.writer.write(message)
await other.writer.drain()
await other.send(message)
# Define individual movement command handlers