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