Renames World to BaseWorld

This commit is contained in:
nejdetckenobi committed 2026-10-17 18:01:29 +03:00
1 parent 8ad4106b36
commit ce5eedbea2
1 file changed
+3 -2
+3 -2
View File
@@ -10,7 +10,7 @@ type EntityComponentStorage = dict[Entity, ComponentMap]
@dataclass
class World:
class BaseWorld:
registry: dict[Archetype, EntityComponentStorage] = field(default_factory=dict)
next_entity_index: int = 0
systems: list[type[System]] = field(default_factory=list)
@@ -40,13 +40,14 @@ class World:
for entity, component_storage in entity_component_storage.items():
yield entity, component_storage
def get_components(self, entity: int, pop=False):
def get_components(self, entity: int, pop=False) -> dict[type, Any] | None:
for archetype in self.registry.values():
if entity in archetype:
if pop:
return archetype.pop(entity, None)
else:
return archetype[entity]
return None
def tick(self, *args, **kwargs):
for system in self.systems: