diff --git a/deploy.py b/deploy.py
index e8a56a1..8577bf7 100644
--- a/deploy.py
+++ b/deploy.py
@@ -22,6 +22,7 @@ def rmfulldir(dirpath):
def update():
+ logging.info(f"checking for updates via git pull.")
pull = ["utils/git/bin/git.exe", "pull"]
subprocess.call(pull)
@@ -186,9 +187,6 @@ def prepare_images(data, config):
def build_xml_code(data, config):
- logging.info(f"copying filelist.xml")
- shutil.copy("./source/filelist.xml", "./build/filelist.xml")
-
logging.info(f"calculate the value that lets you use the songs n-times")
song_lengths = [OggVorbis(f"./build/music/{tape['identifier']}.ogg").info.length
for tape in data]
@@ -205,6 +203,7 @@ def build_xml_code(data, config):
j2env.globals.update(zip=zip)
# load the template file
+ template0 = j2env.get_template("./source/filelist_template.xml")
template1 = j2env.get_template("./source/sunken_tapes_template.xml")
if config["use_ita"]:
@@ -213,6 +212,10 @@ def build_xml_code(data, config):
template2 = j2env.get_template("./source/sunken_tapes_style_template.xml")
logging.info(f"rendering the xml files")
+ with open("./build/filelist.xml", "w+", encoding="utf8") as output_file:
+ # render the template
+ output_file.write(template0.render(config=config))
+
with open("./build/sunken_tapes.xml", "w+", encoding="utf8") as output_file:
# render the template
output_file.write(template1.render(tapes=data, config=config,
@@ -241,12 +244,17 @@ def deploy(config):
prepare_images(data, config)
build_xml_code(data, config)
- logging.info(f"removing the old installed mod directory {config['installdir'] + '/Mods/Sunken Tapes/'}")
- rmfulldir(config["installdir"] + "/Mods/Sunken Tapes/")
+ if config["override_workshop"]:
+ mod_directory = "Mods/Sunken Tapes via Installer/"
+ else:
+ mod_directory = "Mods/Sunken Tapes/"
+
+ logging.info(f"removing the old installed mod directory {config['installdir'] + mod_directory}")
+ rmfulldir(config["installdir"] + mod_directory)
logging.info(f"copying the new build")
if Path(config["installdir"]).is_dir():
- copy_tree("./build/", config["installdir"] + "/Mods/Sunken Tapes/")
+ copy_tree("./build/", config["installdir"] + mod_directory)
else:
raise FileNotFoundError(
f"{config['installdir']} does not exist. Set up the correct Barotrauma installation directory")
diff --git a/main.py b/main.py
index 5697c77..e7beb4f 100644
--- a/main.py
+++ b/main.py
@@ -82,10 +82,19 @@ def create_options_frame(container):
text='Buffs',
command=lambda: print(buffs.get()))
+ # Override Workshop checkbox
+ override_workshop = tk.StringVar()
+ override_workshop.set("0")
+ override_workshop_check = ttk.Checkbutton(
+ frame,
+ variable=override_workshop,
+ text='Override Workshop',
+ command=lambda: print(override_workshop.get()))
+
for widget in frame.winfo_children():
widget.pack(side="top", padx=3, pady=3, fill="x")
- return frame, use_ita, buffs
+ return frame, use_ita, buffs, override_workshop
def create_resolution_frame(container):
@@ -215,14 +224,15 @@ def create_main_window():
middle_frame = ttk.Frame(root)
install_frame, install_dir = create_install_frame(root)
- options_frame, use_ita, buffs = create_options_frame(middle_frame)
+ options_frame, use_ita, buffs, override_workshop = create_options_frame(middle_frame)
resolution_frame, width, height = create_resolution_frame(middle_frame)
config = {"installdir": install_dir,
"use_ita": use_ita,
"buffs": buffs,
+ "override_workshop": override_workshop,
"resolution_x": width,
- "resolution_y": height}
+ "resolution_y": height_workshop}
deploy_frame = create_deploy_frame(root, config)
diff --git a/source/filelist.xml b/source/filelist.xml
deleted file mode 100644
index ab92684..0000000
--- a/source/filelist.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/source/filelist_template.xml b/source/filelist_template.xml
new file mode 100644
index 0000000..5b5941d
--- /dev/null
+++ b/source/filelist_template.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/source/sunken_tapes_style_ita_template.xml b/source/sunken_tapes_style_ita_template.xml
index 7290b83..fe8f4a1 100644
--- a/source/sunken_tapes_style_ita_template.xml
+++ b/source/sunken_tapes_style_ita_template.xml
@@ -180,7 +180,7 @@
{% for tape in tapes %}
-
+
{% endfor %}
diff --git a/source/sunken_tapes_style_template.xml b/source/sunken_tapes_style_template.xml
index f4346db..7cb5d62 100644
--- a/source/sunken_tapes_style_template.xml
+++ b/source/sunken_tapes_style_template.xml
@@ -180,7 +180,7 @@
{% for tape in tapes %}
-
+
{% endfor %}
diff --git a/source/sunken_tapes_template.xml b/source/sunken_tapes_template.xml
index 529f23e..858eda1 100644
--- a/source/sunken_tapes_template.xml
+++ b/source/sunken_tapes_template.xml
@@ -12,8 +12,8 @@
-
-
+
+
@@ -22,7 +22,7 @@
-
+