Disable saving for web version
This commit is contained in:
13
data/save.py
13
data/save.py
@@ -55,7 +55,11 @@ class SaveData:
|
|||||||
self.money = money
|
self.money = money
|
||||||
|
|
||||||
|
|
||||||
def save(cat):
|
def save(cat, hide_web_message=False):
|
||||||
|
if os.path.exists("WEB_VERSION"):
|
||||||
|
if not hide_web_message:
|
||||||
|
print("Saving is disabled.")
|
||||||
|
return
|
||||||
currentjson = {}
|
currentjson = {}
|
||||||
data_dir = get_data_dir()
|
data_dir = get_data_dir()
|
||||||
hash_path = os.path.join(data_dir, "dont hurt cats.json")
|
hash_path = os.path.join(data_dir, "dont hurt cats.json")
|
||||||
@@ -74,7 +78,12 @@ def save(cat):
|
|||||||
json.dump(currentjson, f)
|
json.dump(currentjson, f)
|
||||||
|
|
||||||
|
|
||||||
def load(filepath, bypass_tamper_check=False, force_punish=False):
|
def load(
|
||||||
|
filepath, bypass_tamper_check=False, force_punish=False, hide_web_message=False
|
||||||
|
):
|
||||||
|
if os.path.exists("WEB_VERSION"):
|
||||||
|
if not hide_web_message:
|
||||||
|
print("Loading is disabled.")
|
||||||
punished = False
|
punished = False
|
||||||
data_dir = get_data_dir()
|
data_dir = get_data_dir()
|
||||||
hash_path = os.path.join(data_dir, "dont hurt cats.json")
|
hash_path = os.path.join(data_dir, "dont hurt cats.json")
|
||||||
|
|||||||
7
game.py
7
game.py
@@ -59,6 +59,7 @@ class Game:
|
|||||||
|
|
||||||
def new_game(self):
|
def new_game(self):
|
||||||
self.cat = shelter()
|
self.cat = shelter()
|
||||||
|
if not os.path.exists("WEB_VERSION"):
|
||||||
print("Saving...")
|
print("Saving...")
|
||||||
data.save.save(self.cat)
|
data.save.save(self.cat)
|
||||||
print("Save complete.")
|
print("Save complete.")
|
||||||
@@ -81,6 +82,10 @@ class Game:
|
|||||||
return
|
return
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
if os.path.exists("WEB_VERSION"):
|
||||||
|
print(
|
||||||
|
"This is a web version of Whiskerbound, saving/loading is disabled. As soon as you quit this page, your savefile is gone."
|
||||||
|
)
|
||||||
title()
|
title()
|
||||||
if os.path.exists("debug.json"):
|
if os.path.exists("debug.json"):
|
||||||
bypass_tamper_check = False
|
bypass_tamper_check = False
|
||||||
@@ -113,7 +118,7 @@ class Game:
|
|||||||
return
|
return
|
||||||
|
|
||||||
options = ["New Game", "Quit"]
|
options = ["New Game", "Quit"]
|
||||||
if os.path.exists("saves"):
|
if os.path.exists("saves") and not os.path.exists("WEB_VERSION"):
|
||||||
options.insert(0, "Load Game")
|
options.insert(0, "Load Game")
|
||||||
print("Welcome to Whiskerbound!")
|
print("Welcome to Whiskerbound!")
|
||||||
choice = ui.select("Please choose an option", choices=options)
|
choice = ui.select("Please choose an option", choices=options)
|
||||||
|
|||||||
Reference in New Issue
Block a user