Fix hash debug menu+bypass hash in debug+new debug config system+shop+base for inventory system+what am i forgetting
This commit is contained in:
44
game.py
44
game.py
@@ -1,9 +1,11 @@
|
||||
from data.cat import Cat
|
||||
from systems.ui import clear, title
|
||||
from systems.world import shelter, house
|
||||
from systems.world import shelter, house, shop
|
||||
import systems.ui as ui
|
||||
import data.save
|
||||
import data.text
|
||||
import os
|
||||
import json
|
||||
|
||||
|
||||
class Game:
|
||||
@@ -62,24 +64,46 @@ class Game:
|
||||
print("Save complete.")
|
||||
self.game_loop()
|
||||
|
||||
# TODO: Add shop, make food buyable and add money system
|
||||
def game_loop(self):
|
||||
ui.current_cat = self.cat
|
||||
while True:
|
||||
match ui.select("Please choose an option", ["Go to your house", "Options"]):
|
||||
match ui.select(
|
||||
"Please choose an option",
|
||||
["Go to your house", "Go to the shop", "Options"],
|
||||
):
|
||||
case "Go to your house":
|
||||
house(self.cat)
|
||||
case "Go to the shop":
|
||||
shop(self.cat)
|
||||
case "Options":
|
||||
if self.options_menu():
|
||||
return
|
||||
|
||||
def run(self):
|
||||
if os.path.exists("ENABLE DEBUG"):
|
||||
with open("ENABLE DEBUG", "r") as f:
|
||||
file = f.read().strip()
|
||||
if file:
|
||||
self.cat = data.save.load(file)
|
||||
self.game_loop()
|
||||
print(f"{self.cat.name} says bye")
|
||||
return
|
||||
if os.path.exists("debug.json"):
|
||||
bypass_tamper_check = False
|
||||
debug_config = None
|
||||
with open("debug.json", "r") as f:
|
||||
content = f.read()
|
||||
if content.strip():
|
||||
debug_config = json.loads(content)
|
||||
if debug_config:
|
||||
if debug_config.get("bypass_tamper_check", None):
|
||||
if (
|
||||
debug_config["bypass_tamper_check"]
|
||||
== data.text.BYPASS_TAMPER_CHECK_MESSAGE
|
||||
):
|
||||
bypass_tamper_check = True
|
||||
if debug_config.get("auto_load_savefile", None):
|
||||
self.cat = data.save.load(
|
||||
debug_config["auto_load_savefile"],
|
||||
bypass_tamper_check=bypass_tamper_check,
|
||||
)
|
||||
self.game_loop()
|
||||
print(f"{self.cat.name} says bye")
|
||||
return
|
||||
|
||||
title()
|
||||
options = ["New Game", "Quit"]
|
||||
if os.path.exists("saves"):
|
||||
|
||||
Reference in New Issue
Block a user