From f3db90191838f8d2354fd1b780feb92cb58c39e0 Mon Sep 17 00:00:00 2001 From: Patrick Marsee Date: Mon, 26 Dec 2022 14:08:57 -0500 Subject: [PATCH] Big refactoring, still really a WIP, but I need to get this committed --- .gitignore | 4 ++++ pyproject.toml | 19 +++++++++++++++++ src/gameshell.egg-info/PKG-INFO | 10 +++++++++ src/gameshell.egg-info/SOURCES.txt | 21 +++++++++++++++++++ src/gameshell.egg-info/dependency_links.txt | 1 + src/gameshell.egg-info/requires.txt | 1 + src/gameshell.egg-info/top_level.txt | 1 + src/gameshell/__init__.py | 6 ++++++ src/gameshell/__main__.py | 6 ++++++ gamebase.py => src/gameshell/gamebase.py | 12 +++++------ gameevents.py => src/gameshell/gameevents.py | 0 gamegui.py => src/gameshell/gamegui.py | 0 gamelocus.py => src/gameshell/gamelocus.py | 0 gamemap.py => src/gameshell/gamemap.py | 4 ++-- .../gameshell/gamesequence.py | 0 gamethings.py => src/gameshell/gamethings.py | 17 ++++++++------- gameutil.py => src/gameshell/gameutil.py | 0 locusdemo.py => src/gameshell/locusdemo.py | 0 gameshell.py => src/gameshell/main.py | 8 +++---- shell.py => src/gameshell/shell.py | 0 tile.py => src/gameshell/tile.py | 0 21 files changed, 91 insertions(+), 19 deletions(-) create mode 100644 pyproject.toml create mode 100644 src/gameshell.egg-info/PKG-INFO create mode 100644 src/gameshell.egg-info/SOURCES.txt create mode 100644 src/gameshell.egg-info/dependency_links.txt create mode 100644 src/gameshell.egg-info/requires.txt create mode 100644 src/gameshell.egg-info/top_level.txt create mode 100644 src/gameshell/__init__.py create mode 100644 src/gameshell/__main__.py rename gamebase.py => src/gameshell/gamebase.py (97%) rename gameevents.py => src/gameshell/gameevents.py (100%) rename gamegui.py => src/gameshell/gamegui.py (100%) rename gamelocus.py => src/gameshell/gamelocus.py (100%) rename gamemap.py => src/gameshell/gamemap.py (97%) rename gamesequence.py => src/gameshell/gamesequence.py (100%) rename gamethings.py => src/gameshell/gamethings.py (98%) rename gameutil.py => src/gameshell/gameutil.py (100%) rename locusdemo.py => src/gameshell/locusdemo.py (100%) rename gameshell.py => src/gameshell/main.py (97%) rename shell.py => src/gameshell/shell.py (100%) rename tile.py => src/gameshell/tile.py (100%) diff --git a/.gitignore b/.gitignore index 5e33ec1..8edcdd2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,8 @@ gameshell.geany gameexpr.py game.py solution.txt +bin +lib +lib64 +pyvenv.cfg diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..86cdd6a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,19 @@ +[project] +name = "gameshell" +version = "0.0.2" +authors = [ + { name="Patrick Marsee", email="me@cheesewatergames.net" }, +] +description = "A game engine for text adventures." +readme = "README.md" +license = { file="LICENSE" } +requires-python = ">=3.10" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: GNU General Public License v3.0", + "Operating System :: OS Independent", +] +dependencies = [ + "ruamel.yaml" +] + diff --git a/src/gameshell.egg-info/PKG-INFO b/src/gameshell.egg-info/PKG-INFO new file mode 100644 index 0000000..ff9a2f4 --- /dev/null +++ b/src/gameshell.egg-info/PKG-INFO @@ -0,0 +1,10 @@ +Metadata-Version: 2.1 +Name: gameshell +Version: 0.0.2 +Summary: A game engine for text adventures. +Author-email: Patrick Marsee +Classifier: Programming Language :: Python :: 3 +Classifier: License :: OSI Approved :: GNU General Public License v3.0 +Classifier: Operating System :: OS Independent +Requires-Python: >=3.10 +Description-Content-Type: text/markdown diff --git a/src/gameshell.egg-info/SOURCES.txt b/src/gameshell.egg-info/SOURCES.txt new file mode 100644 index 0000000..8237e4a --- /dev/null +++ b/src/gameshell.egg-info/SOURCES.txt @@ -0,0 +1,21 @@ +pyproject.toml +src/gameshell/__init__.py +src/gameshell/__main__.py +src/gameshell/gamebase.py +src/gameshell/gameevents.py +src/gameshell/gameexpr.py +src/gameshell/gamegui.py +src/gameshell/gamelocus.py +src/gameshell/gamemap.py +src/gameshell/gamesequence.py +src/gameshell/gamethings.py +src/gameshell/gameutil.py +src/gameshell/locusdemo.py +src/gameshell/main.py +src/gameshell/shell.py +src/gameshell/tile.py +src/gameshell.egg-info/PKG-INFO +src/gameshell.egg-info/SOURCES.txt +src/gameshell.egg-info/dependency_links.txt +src/gameshell.egg-info/requires.txt +src/gameshell.egg-info/top_level.txt \ No newline at end of file diff --git a/src/gameshell.egg-info/dependency_links.txt b/src/gameshell.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/gameshell.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/src/gameshell.egg-info/requires.txt b/src/gameshell.egg-info/requires.txt new file mode 100644 index 0000000..58d3608 --- /dev/null +++ b/src/gameshell.egg-info/requires.txt @@ -0,0 +1 @@ +ruamel.yaml diff --git a/src/gameshell.egg-info/top_level.txt b/src/gameshell.egg-info/top_level.txt new file mode 100644 index 0000000..a859017 --- /dev/null +++ b/src/gameshell.egg-info/top_level.txt @@ -0,0 +1 @@ +gameshell diff --git a/src/gameshell/__init__.py b/src/gameshell/__init__.py new file mode 100644 index 0000000..7ac5d86 --- /dev/null +++ b/src/gameshell/__init__.py @@ -0,0 +1,6 @@ +if __name__ == "__main__": + from . import main + from . import gamebase + sh = main.GameShell(gamebase.GameBase()) + sh.menuMode() + sh.run() diff --git a/src/gameshell/__main__.py b/src/gameshell/__main__.py new file mode 100644 index 0000000..7ac5d86 --- /dev/null +++ b/src/gameshell/__main__.py @@ -0,0 +1,6 @@ +if __name__ == "__main__": + from . import main + from . import gamebase + sh = main.GameShell(gamebase.GameBase()) + sh.menuMode() + sh.run() diff --git a/gamebase.py b/src/gameshell/gamebase.py similarity index 97% rename from gamebase.py rename to src/gameshell/gamebase.py index 2a88e9c..3554244 100644 --- a/gamebase.py +++ b/src/gameshell/gamebase.py @@ -2,18 +2,18 @@ import re as _re import heapq as _hq -import gamemap as _gm -import gameevents as _ge +from . import gamemap as _gm +from . import gameevents as _ge import random as _ra import os as _os import sys as _sys import pickle as _pi import ruamel.yaml as _yaml import textwrap as _tw -import gamethings as _gt -import gamelocus as _gl -import gamesequence as _gs -import gameutil as _gu +from . import gamethings as _gt +from . import gamelocus as _gl +from . import gamesequence as _gs +from . import gameutil as _gu class GameError(RuntimeError): pass diff --git a/gameevents.py b/src/gameshell/gameevents.py similarity index 100% rename from gameevents.py rename to src/gameshell/gameevents.py diff --git a/gamegui.py b/src/gameshell/gamegui.py similarity index 100% rename from gamegui.py rename to src/gameshell/gamegui.py diff --git a/gamelocus.py b/src/gameshell/gamelocus.py similarity index 100% rename from gamelocus.py rename to src/gameshell/gamelocus.py diff --git a/gamemap.py b/src/gameshell/gamemap.py similarity index 97% rename from gamemap.py rename to src/gameshell/gamemap.py index 2c4be4e..e6903fb 100644 --- a/gamemap.py +++ b/src/gameshell/gamemap.py @@ -3,8 +3,8 @@ import re import heapq import ruamel.yaml import math as _mt -import gamethings as _gt -import gamelocus as _gl +from . import gamethings as _gt +from . import gamelocus as _gl from ruamel.yaml.comments import CommentedMap class Singleton(object): diff --git a/gamesequence.py b/src/gameshell/gamesequence.py similarity index 100% rename from gamesequence.py rename to src/gameshell/gamesequence.py diff --git a/gamethings.py b/src/gameshell/gamethings.py similarity index 98% rename from gamethings.py rename to src/gameshell/gamethings.py index ae615c7..cd3304e 100644 --- a/gamethings.py +++ b/src/gameshell/gamethings.py @@ -586,17 +586,20 @@ class Door(Thing): description = "The {0} is unlocked.".format(name) else: if locked: - description += " It is locked.".format(name) + description += " It is locked." else: - description += " It is unlocked.".format(name) - super(Door, self).__init__('d', name, x, y, description, 1) - self.passable = not locked + description += " It is unlocked." + flags = 1 + if locked: + flags = 0 + super(Door, self).__init__('d', name, x, y, description, flags) self.key = key self.graphic = graphic def lock(self, key = None): if key == self.key: - self.passable = not self.passable + self.flags ^= 1 + #self.passable = not self.passable if self.descBase == None: if self.passable: self.description = "The {0} is unlocked.".format(self.name) @@ -604,9 +607,9 @@ class Door(Thing): self.description = "The {0} is locked.".format(self.name) else: if self.passable: - self.description += " It is unlocked.".format(self.name) + self.description += " It is unlocked." else: - self.description += " It is locked.".format(self.name) + self.description += " It is locked." return True return False diff --git a/gameutil.py b/src/gameshell/gameutil.py similarity index 100% rename from gameutil.py rename to src/gameshell/gameutil.py diff --git a/locusdemo.py b/src/gameshell/locusdemo.py similarity index 100% rename from locusdemo.py rename to src/gameshell/locusdemo.py diff --git a/gameshell.py b/src/gameshell/main.py similarity index 97% rename from gameshell.py rename to src/gameshell/main.py index bb394f6..2fe66ac 100644 --- a/gameshell.py +++ b/src/gameshell/main.py @@ -1,16 +1,16 @@ # gameshell.py -from shell import Shell -from gamebase import GameBase +from .shell import Shell +from .gamebase import GameBase import sys as _sys import os as _os #import re import heapq #import gamemap -import gameevents +from . import gameevents import textwrap as _tw from shutil import get_terminal_size as _gts -import gameutil as _gu +from . import gameutil as _gu #import random TERM_SIZE = _gts()[0] diff --git a/shell.py b/src/gameshell/shell.py similarity index 100% rename from shell.py rename to src/gameshell/shell.py diff --git a/tile.py b/src/gameshell/tile.py similarity index 100% rename from tile.py rename to src/gameshell/tile.py