Broaden type hints to Entity where applicable

This commit is contained in:
Jared Miller 2026-02-07 20:32:15 -05:00
parent 028dcb51b8
commit 910597e92d
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -3,6 +3,7 @@
from typing import Any
from mudlib.commands import CommandDefinition, register
from mudlib.entity import Entity
from mudlib.player import Player, players
# World instance will be injected by the server
@ -93,11 +94,11 @@ async def move_player(player: Player, dx: int, dy: int, direction_name: str) ->
await cmd_look(player, "")
async def send_nearby_message(player: Player, x: int, y: int, message: str) -> None:
"""Send a message to all players near a location, excluding the player.
async def send_nearby_message(entity: Entity, x: int, y: int, message: str) -> None:
"""Send a message to all players near a location, excluding the entity.
Args:
player: The player who triggered the message (excluded from receiving it)
entity: The entity who triggered the message (excluded from receiving it)
x: X coordinate of the location
y: Y coordinate of the location
message: The message to send
@ -106,7 +107,7 @@ async def send_nearby_message(player: Player, x: int, y: int, message: str) -> N
viewport_range = 10
for other in players.values():
if other.name == player.name:
if other.name == entity.name:
continue
# Check if other player is within viewport range (wrapping)