Resource,
Systems,
World,
- WorldIsInit,
WorldShouldExit,
)
+class WorldIsInit(Resource):
+ pass
+
+
def run_startup(world: World, _: Not[WorldIsInit]) -> None:
world.tick(StartupSchedule)
world.spawn(WorldIsInit, WorldIsInit())
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
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
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