Make Entity inherit from Object

Entity gains location from Object and narrows x/y back to int
(entities always have spatial coordinates). No behavioral change —
all existing tests pass unchanged.
This commit is contained in:
Jared Miller 2026-02-11 18:40:35 -05:00
parent d9e9d1b785
commit 51dc583818
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -2,14 +2,20 @@
from dataclasses import dataclass, field
from mudlib.object import Object
@dataclass
class Entity:
"""Base class for anything with position and identity in the world."""
class Entity(Object):
"""Base class for anything with position and identity in the world.
name: str
x: int
y: int
Inherits name, location from Object. Narrows x, y to int (entities
always have spatial coordinates).
"""
# Entities always have spatial coordinates (override Object's int | None)
x: int = 0
y: int = 0
# Combat stats
pl: float = 100.0 # power level (health and damage multiplier)
stamina: float = 100.0 # current stamina