Big refactoring, still really a WIP, but I need to get this committed

This commit is contained in:
Patrick Marsee 2022-12-26 14:08:57 -05:00
parent 9251886638
commit f3db901918
21 changed files with 91 additions and 19 deletions

4
.gitignore vendored
View file

@ -6,4 +6,8 @@ gameshell.geany
gameexpr.py
game.py
solution.txt
bin
lib
lib64
pyvenv.cfg

19
pyproject.toml Normal file
View file

@ -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"
]

View file

@ -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 <me@cheesewatergames.net>
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

View file

@ -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

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@
ruamel.yaml

View file

@ -0,0 +1 @@
gameshell

View file

@ -0,0 +1,6 @@
if __name__ == "__main__":
from . import main
from . import gamebase
sh = main.GameShell(gamebase.GameBase())
sh.menuMode()
sh.run()

View file

@ -0,0 +1,6 @@
if __name__ == "__main__":
from . import main
from . import gamebase
sh = main.GameShell(gamebase.GameBase())
sh.menuMode()
sh.run()

View file

@ -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

View file

@ -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):

View file

@ -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

View file

@ -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]