From 13dfc3e2402598244e6bd83fd2fd2a383f660dda Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sat, 18 May 2024 17:48:24 -0500 Subject: [PATCH] organize systems and actions --- adventure/{actions.py => actions/base.py} | 0 adventure/{optional_actions.py => actions/optional.py} | 0 adventure/game_system.py | 2 +- adventure/main.py | 2 +- adventure/simulate.py | 2 +- adventure/{rpg_systems => systems/rpg}/crafting_actions.py | 0 adventure/{rpg_systems => systems/rpg}/language_actions.py | 0 adventure/{rpg_systems => systems/rpg}/magic_actions.py | 0 adventure/{rpg_systems => systems/rpg}/movement_actions.py | 0 adventure/{sim_systems => systems/sim}/__init__.py | 0 adventure/{sim_systems => systems/sim}/combat_actions.py | 0 adventure/{sim_systems => systems/sim}/environment_logic.yaml | 0 adventure/{sim_systems => systems/sim}/environment_triggers.py | 0 adventure/{sim_systems => systems/sim}/hunger_actions.py | 0 adventure/{sim_systems => systems/sim}/hunger_logic.yaml | 0 adventure/{sim_systems => systems/sim}/hygiene_actions.py | 0 adventure/{sim_systems => systems/sim}/hygiene_logic.yaml | 0 adventure/{sim_systems => systems/sim}/mood_logic.yaml | 0 adventure/{sim_systems => systems/sim}/sleeping_actions.py | 0 adventure/{sim_systems => systems/sim}/sleeping_logic.yaml | 0 20 files changed, 3 insertions(+), 3 deletions(-) rename adventure/{actions.py => actions/base.py} (100%) rename adventure/{optional_actions.py => actions/optional.py} (100%) rename adventure/{rpg_systems => systems/rpg}/crafting_actions.py (100%) rename adventure/{rpg_systems => systems/rpg}/language_actions.py (100%) rename adventure/{rpg_systems => systems/rpg}/magic_actions.py (100%) rename adventure/{rpg_systems => systems/rpg}/movement_actions.py (100%) rename adventure/{sim_systems => systems/sim}/__init__.py (100%) rename adventure/{sim_systems => systems/sim}/combat_actions.py (100%) rename adventure/{sim_systems => systems/sim}/environment_logic.yaml (100%) rename adventure/{sim_systems => systems/sim}/environment_triggers.py (100%) rename adventure/{sim_systems => systems/sim}/hunger_actions.py (100%) rename adventure/{sim_systems => systems/sim}/hunger_logic.yaml (100%) rename adventure/{sim_systems => systems/sim}/hygiene_actions.py (100%) rename adventure/{sim_systems => systems/sim}/hygiene_logic.yaml (100%) rename adventure/{sim_systems => systems/sim}/mood_logic.yaml (100%) rename adventure/{sim_systems => systems/sim}/sleeping_actions.py (100%) rename adventure/{sim_systems => systems/sim}/sleeping_logic.yaml (100%) diff --git a/adventure/actions.py b/adventure/actions/base.py similarity index 100% rename from adventure/actions.py rename to adventure/actions/base.py diff --git a/adventure/optional_actions.py b/adventure/actions/optional.py similarity index 100% rename from adventure/optional_actions.py rename to adventure/actions/optional.py diff --git a/adventure/game_system.py b/adventure/game_system.py index 68f2ba9..d8806ed 100644 --- a/adventure/game_system.py +++ b/adventure/game_system.py @@ -12,7 +12,6 @@ class FormatPerspective(Enum): THIRD_PERSON = "third-person" -# TODO: remove the attributes parameter from all of these class SystemFormat(Protocol): def __call__( self, @@ -59,6 +58,7 @@ class GameSystem: return f"GameSystem(format={format_callable(self.format)}, generate={format_callable(self.generate)}, simulate={format_callable(self.simulate)})" +# TODO: move to utils def format_callable(fn: Callable | None) -> str: if fn: return f"{fn.__module__}:{fn.__name__}" diff --git a/adventure/main.py b/adventure/main.py index e8f1d85..d7d4f2c 100644 --- a/adventure/main.py +++ b/adventure/main.py @@ -273,7 +273,7 @@ def main(): extra_actions = [] if args.optional_actions: logger.info("loading optional actions") - from adventure.optional_actions import init as init_optional_actions + from adventure.actions.optional import init as init_optional_actions optional_actions = init_optional_actions() logger.info( diff --git a/adventure/simulate.py b/adventure/simulate.py index d153479..955ad8e 100644 --- a/adventure/simulate.py +++ b/adventure/simulate.py @@ -8,7 +8,7 @@ from packit.results import multi_function_or_str_result from packit.toolbox import Toolbox from packit.utils import could_be_json -from adventure.actions import ( +from adventure.actions.base import ( action_ask, action_give, action_look, diff --git a/adventure/rpg_systems/crafting_actions.py b/adventure/systems/rpg/crafting_actions.py similarity index 100% rename from adventure/rpg_systems/crafting_actions.py rename to adventure/systems/rpg/crafting_actions.py diff --git a/adventure/rpg_systems/language_actions.py b/adventure/systems/rpg/language_actions.py similarity index 100% rename from adventure/rpg_systems/language_actions.py rename to adventure/systems/rpg/language_actions.py diff --git a/adventure/rpg_systems/magic_actions.py b/adventure/systems/rpg/magic_actions.py similarity index 100% rename from adventure/rpg_systems/magic_actions.py rename to adventure/systems/rpg/magic_actions.py diff --git a/adventure/rpg_systems/movement_actions.py b/adventure/systems/rpg/movement_actions.py similarity index 100% rename from adventure/rpg_systems/movement_actions.py rename to adventure/systems/rpg/movement_actions.py diff --git a/adventure/sim_systems/__init__.py b/adventure/systems/sim/__init__.py similarity index 100% rename from adventure/sim_systems/__init__.py rename to adventure/systems/sim/__init__.py diff --git a/adventure/sim_systems/combat_actions.py b/adventure/systems/sim/combat_actions.py similarity index 100% rename from adventure/sim_systems/combat_actions.py rename to adventure/systems/sim/combat_actions.py diff --git a/adventure/sim_systems/environment_logic.yaml b/adventure/systems/sim/environment_logic.yaml similarity index 100% rename from adventure/sim_systems/environment_logic.yaml rename to adventure/systems/sim/environment_logic.yaml diff --git a/adventure/sim_systems/environment_triggers.py b/adventure/systems/sim/environment_triggers.py similarity index 100% rename from adventure/sim_systems/environment_triggers.py rename to adventure/systems/sim/environment_triggers.py diff --git a/adventure/sim_systems/hunger_actions.py b/adventure/systems/sim/hunger_actions.py similarity index 100% rename from adventure/sim_systems/hunger_actions.py rename to adventure/systems/sim/hunger_actions.py diff --git a/adventure/sim_systems/hunger_logic.yaml b/adventure/systems/sim/hunger_logic.yaml similarity index 100% rename from adventure/sim_systems/hunger_logic.yaml rename to adventure/systems/sim/hunger_logic.yaml diff --git a/adventure/sim_systems/hygiene_actions.py b/adventure/systems/sim/hygiene_actions.py similarity index 100% rename from adventure/sim_systems/hygiene_actions.py rename to adventure/systems/sim/hygiene_actions.py diff --git a/adventure/sim_systems/hygiene_logic.yaml b/adventure/systems/sim/hygiene_logic.yaml similarity index 100% rename from adventure/sim_systems/hygiene_logic.yaml rename to adventure/systems/sim/hygiene_logic.yaml diff --git a/adventure/sim_systems/mood_logic.yaml b/adventure/systems/sim/mood_logic.yaml similarity index 100% rename from adventure/sim_systems/mood_logic.yaml rename to adventure/systems/sim/mood_logic.yaml diff --git a/adventure/sim_systems/sleeping_actions.py b/adventure/systems/sim/sleeping_actions.py similarity index 100% rename from adventure/sim_systems/sleeping_actions.py rename to adventure/systems/sim/sleeping_actions.py diff --git a/adventure/sim_systems/sleeping_logic.yaml b/adventure/systems/sim/sleeping_logic.yaml similarity index 100% rename from adventure/sim_systems/sleeping_logic.yaml rename to adventure/systems/sim/sleeping_logic.yaml