init commit, working save game
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
from json import load as json_load
|
||||
import os
|
||||
|
||||
class Map:
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
self.story = {}
|
||||
|
||||
def make_file(self, story:dict={}):
|
||||
for file in os.listdir(self.path):
|
||||
if file.endswith("json"):
|
||||
with open(f"{self.path}/{file}", "r") as f:
|
||||
filename = os.path.splitext(os.path.basename(file))[0]
|
||||
story[filename] = json_load(f)
|
||||
|
||||
self.story = story
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.__class__.__name__} | Story: {self.story}"
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self.story[key]
|
||||
Reference in New Issue
Block a user