From 51dc583818a0df2b88db21fbdd37bc40e01606ee Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Wed, 11 Feb 2026 18:40:35 -0500 Subject: [PATCH] Make Entity inherit from Object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/mudlib/entity.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/mudlib/entity.py b/src/mudlib/entity.py index cc94d97..ac26660 100644 --- a/src/mudlib/entity.py +++ b/src/mudlib/entity.py @@ -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