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 gameexpr.py
game.py game.py
solution.txt 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 re as _re
import heapq as _hq import heapq as _hq
import gamemap as _gm from . import gamemap as _gm
import gameevents as _ge from . import gameevents as _ge
import random as _ra import random as _ra
import os as _os import os as _os
import sys as _sys import sys as _sys
import pickle as _pi import pickle as _pi
import ruamel.yaml as _yaml import ruamel.yaml as _yaml
import textwrap as _tw import textwrap as _tw
import gamethings as _gt from . import gamethings as _gt
import gamelocus as _gl from . import gamelocus as _gl
import gamesequence as _gs from . import gamesequence as _gs
import gameutil as _gu from . import gameutil as _gu
class GameError(RuntimeError): class GameError(RuntimeError):
pass pass

View file

@ -3,8 +3,8 @@ import re
import heapq import heapq
import ruamel.yaml import ruamel.yaml
import math as _mt import math as _mt
import gamethings as _gt from . import gamethings as _gt
import gamelocus as _gl from . import gamelocus as _gl
from ruamel.yaml.comments import CommentedMap from ruamel.yaml.comments import CommentedMap
class Singleton(object): class Singleton(object):

View file

@ -586,17 +586,20 @@ class Door(Thing):
description = "The {0} is unlocked.".format(name) description = "The {0} is unlocked.".format(name)
else: else:
if locked: if locked:
description += " It is locked.".format(name) description += " It is locked."
else: else:
description += " It is unlocked.".format(name) description += " It is unlocked."
super(Door, self).__init__('d', name, x, y, description, 1) flags = 1
self.passable = not locked if locked:
flags = 0
super(Door, self).__init__('d', name, x, y, description, flags)
self.key = key self.key = key
self.graphic = graphic self.graphic = graphic
def lock(self, key = None): def lock(self, key = None):
if key == self.key: if key == self.key:
self.passable = not self.passable self.flags ^= 1
#self.passable = not self.passable
if self.descBase == None: if self.descBase == None:
if self.passable: if self.passable:
self.description = "The {0} is unlocked.".format(self.name) 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) self.description = "The {0} is locked.".format(self.name)
else: else:
if self.passable: if self.passable:
self.description += " It is unlocked.".format(self.name) self.description += " It is unlocked."
else: else:
self.description += " It is locked.".format(self.name) self.description += " It is locked."
return True return True
return False return False

View file

@ -1,16 +1,16 @@
# gameshell.py # gameshell.py
from shell import Shell from .shell import Shell
from gamebase import GameBase from .gamebase import GameBase
import sys as _sys import sys as _sys
import os as _os import os as _os
#import re #import re
import heapq import heapq
#import gamemap #import gamemap
import gameevents from . import gameevents
import textwrap as _tw import textwrap as _tw
from shutil import get_terminal_size as _gts from shutil import get_terminal_size as _gts
import gameutil as _gu from . import gameutil as _gu
#import random #import random
TERM_SIZE = _gts()[0] TERM_SIZE = _gts()[0]