From: Axy Date: Thu, 24 Sep 2026 21:32:42 +0000 (+0200) Subject: Fixups X-Git-Url: https://git.uwuaxy.net/?a=commitdiff_plain;h=ddb41af64e69a122665f0679d5b4d3dd09ad39a3;p=axy%2Fft%2Fpacman.git Fixups --- diff --git a/src/pacman/ecs/__init__.py b/src/pacman/ecs/__init__.py index 92a053e..7b72260 100644 --- a/src/pacman/ecs/__init__.py +++ b/src/pacman/ecs/__init__.py @@ -27,11 +27,14 @@ from pacman.ecs.world import ( Resource, Systems, World, - WorldIsInit, WorldShouldExit, ) +class WorldIsInit(Resource): + pass + + def run_startup(world: World, _: Not[WorldIsInit]) -> None: world.tick(StartupSchedule) world.spawn(WorldIsInit, WorldIsInit()) diff --git a/src/pacman/ecs/hierarchy.py b/src/pacman/ecs/hierarchy.py index fdaaa29..30ca1fd 100644 --- a/src/pacman/ecs/hierarchy.py +++ b/src/pacman/ecs/hierarchy.py @@ -1,5 +1,5 @@ from collections.abc import Callable, Generator, Iterable -from typing import cast, get_args, override +from typing import Self, cast, get_args, override from pacman.ecs.world import Component, Entity, FromWorld, World diff --git a/src/pacman/ecs/world.py b/src/pacman/ecs/world.py index 9b1014c..59d552a 100644 --- a/src/pacman/ecs/world.py +++ b/src/pacman/ecs/world.py @@ -850,7 +850,7 @@ class World(FromWorld): return self def run_main(self) -> None: - self.run(MainSchedule, self.add_raw_system(should_exit, lambda: False)) + self.run(MainSchedule, self.add_raw_system(should_exit)) _order_groups: int = 0 @@ -905,13 +905,9 @@ class Systems: return label -class WorldIsInit(Resource): - pass - - class WorldShouldExit(Resource): pass -def should_exit(_: WorldShouldExit) -> bool: - return True +def should_exit(e: Maybe[WorldShouldExit]) -> bool: + return e.v is not None