added option to have a different mod name for custom installation
parent
8bca8b4f5e
commit
78f911ab41
20
deploy.py
20
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")
|
||||
|
|
16
main.py
16
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)
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<contentpackage name="Sunken Tapes" path="Mods/Sunken Tapes/filelist.xml" gameversion="0.9.1.0" corepackage="false">
|
||||
<Item file="Mods/Sunken Tapes/sunken_tapes.xml" />
|
||||
<UIStyle file="Mods/Sunken Tapes/sunken_tapes_style.xml" />
|
||||
</contentpackage>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<contentpackage name="Sunken Tapes{% if config['override_workshop'] %} via Installer{% endif %}" path="Mods/Sunken Tapes{% if config['override_workshop'] %} via Installer{% endif %}/filelist.xml" gameversion="0.14.9.1" {% if config['override_workshop'] %}steamworkshopid="2616577901" {% endif &}corepackage="false">
|
||||
<Item file="Mods/Sunken Tapes{% if config['override_workshop'] %} via Installer{% endif %}/sunken_tapes.xml" />
|
||||
<UIStyle file="Mods/Sunken Tapes{% if config['override_workshop'] %} via Installer{% endif %}/sunken_tapes_style.xml" />
|
||||
</contentpackage>
|
|
@ -180,7 +180,7 @@
|
|||
</TitleText>
|
||||
{% for tape in tapes %}
|
||||
<sunken_tapes_cover_{{ tape.identifier }} color="255,255,255,255" textcolor="0,0,0,255">
|
||||
<Sprite name="sunken_tapes_cover_{{ tape.identifier }}" texture="Mods/Sunken Tapes/covers.png" size="0.0, 0.0" sourcerect="0,{{ loop.index0*328 }},512,328" origin="0.5,0.5" compress="false" tile="false"/>
|
||||
<Sprite name="sunken_tapes_cover_{{ tape.identifier }}" texture="Mods/Sunken Tapes{% if config['override_workshop'] %} via Installer{% endif %}/covers.png" size="0.0, 0.0" sourcerect="0,{{ loop.index0*328 }},512,328" origin="0.5,0.5" compress="false" tile="false"/>
|
||||
</sunken_tapes_cover_{{ tape.identifier }}>{% endfor %}
|
||||
|
||||
<ita_document1 color="255,255,255,255" textcolor="0,0,0,255">
|
||||
|
|
|
@ -180,7 +180,7 @@
|
|||
</TitleText>
|
||||
{% for tape in tapes %}
|
||||
<sunken_tapes_cover_{{ tape.identifier }} color="255,255,255,255" textcolor="0,0,0,255">
|
||||
<Sprite name="sunken_tapes_cover_{{ tape.identifier }}" texture="Mods/Sunken Tapes/covers.png" size="0.0, 0.0" sourcerect="0,{{ loop.index0*328 }},512,328" origin="0.5,0.5" compress="false" tile="false"/>
|
||||
<Sprite name="sunken_tapes_cover_{{ tape.identifier }}" texture="Mods/Sunken Tapes{% if config['override_workshop'] %} via Installer{% endif %}/covers.png" size="0.0, 0.0" sourcerect="0,{{ loop.index0*328 }},512,328" origin="0.5,0.5" compress="false" tile="false"/>
|
||||
</sunken_tapes_cover_{{ tape.identifier }}>{% endfor %}
|
||||
|
||||
<InnerGlow color="255,255,255,204" hovercolor="255,255,255,204" selectedcolor="255,255,255,204">
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
<Price locationtype="mine" multiplier="1.5" sold="false"/>
|
||||
</Price>
|
||||
<Upgrade gameversion="0.9.2.0" scale="0.5" />
|
||||
<InventoryIcon texture="Mods/Sunken Tapes/icons.png" sourcerect="0,0,64,64" origin="0.5,0.5" />
|
||||
<Sprite texture="Mods/Sunken Tapes/boombox.png" sourcerect="0,0,100,60" depth="0.55" origin="0.5,0.5" />
|
||||
<InventoryIcon texture="Mods/Sunken Tapes{% if config['override_workshop'] %} via Installer{% endif %}/icons.png" sourcerect="0,0,64,64" origin="0.5,0.5" />
|
||||
<Sprite texture="Mods/Sunken Tapes{% if config['override_workshop'] %} via Installer{% endif %}/boombox.png" sourcerect="0,0,100,60" depth="0.55" origin="0.5,0.5" />
|
||||
<Body width="100" height="60" />
|
||||
<LightComponent LightColor="0.78,0.04,0.235,0.59" range="10" powerconsumption="0" blinkfrequency="1" IsOn="false" canbeselected="false">
|
||||
</LightComponent>
|
||||
|
@ -22,7 +22,7 @@
|
|||
<TickBox text="Play">
|
||||
<StatusEffect type="OnUse" targettype="This" IsOn="true">
|
||||
<Conditional IsOn="false" />
|
||||
<sound file="Mods/Sunken Tapes/sound_effects/boombox_play_cassette.ogg" type="OnUse" range="500" volume="1.0" />
|
||||
<sound file="Mods/Sunken Tapes{% if config['override_workshop'] %} via Installer{% endif %}/sound_effects/boombox_play_cassette.ogg" type="OnUse" range="500" volume="1.0" />
|
||||
</StatusEffect>
|
||||
<!--StatusEffect type="OnUse" targettype="Contained" comparison="And">
|
||||
<Conditional condition="lte 50.0" />
|
||||
|
@ -49,7 +49,7 @@
|
|||
|
||||
<StatusEffect type="OnSecondaryUse" targettype="This" IsOn="false" >
|
||||
<Conditional IsOn="true" />
|
||||
<sound file="Mods/Sunken Tapes/sound_effects/boombox_play_cassette.ogg" type="OnUse" range="500" volume="1.0" />
|
||||
<sound file="Mods/Sunken Tapes{% if config['override_workshop'] %} via Installer{% endif %}/sound_effects/boombox_play_cassette.ogg" type="OnUse" range="500" volume="1.0" />
|
||||
<Use />
|
||||
</StatusEffect>
|
||||
</TickBox>
|
||||
|
@ -109,12 +109,12 @@
|
|||
<Price baseprice="{{ tape.price }}" soldeverywhere="false">{% for location in ["outpost", "city", "research", "military", "mine"] %}
|
||||
<Price locationtype="{{ location }}" multiplier="{{ tape.multipliers[loop.index0] }}" sold="{{ tape.sold[loop.index0] }}" minavailable="1" />{% endfor %}
|
||||
</Price>
|
||||
<InventoryIcon texture="Mods/Sunken Tapes/icons.png" sourcerect="0,{{ loop.index0*41 + 64 }},64,41" origin="0.5,0.5" />
|
||||
<Sprite texture="Mods/Sunken Tapes/icons.png" sourcerect="0,{{ loop.index0*41 + 64 }},64,41" depth="0.6" origin="0.5,0.5" />
|
||||
<InventoryIcon texture="Mods/Sunken Tapes{% if config['override_workshop'] %} via Installer{% endif %}/icons.png" sourcerect="0,{{ loop.index0*41 + 64 }},64,41" origin="0.5,0.5" />
|
||||
<Sprite texture="Mods/Sunken Tapes{% if config['override_workshop'] %} via Installer{% endif %}/icons.png" sourcerect="0,{{ loop.index0*41 + 64 }},64,41" depth="0.6" origin="0.5,0.5" />
|
||||
<Body width="48" height="48" />
|
||||
<Throwable slots="Any,RightHand,LeftHand" holdpos="0,0" handle1="0,0" throwforce="4.0" aimpos="35,-10" msg="ItemMsgPickUpSelect">
|
||||
<StatusEffect type="OnImpact" target="This" Condition="-5.0" disabledeltatime="true">
|
||||
<sound file="Mods/Sunken Tapes/sound_effects/cassette_drop.ogg" range="500" volume="1.0" />
|
||||
<sound file="Mods/Sunken Tapes{% if config['override_workshop'] %} via Installer{% endif %}/sound_effects/cassette_drop.ogg" range="500" volume="1.0" />
|
||||
</StatusEffect>
|
||||
</Throwable>
|
||||
<CustomInterface canbeselected="false" drawhudwhenequipped="true" allowuioverlap="true">
|
||||
|
@ -151,7 +151,7 @@
|
|||
<InventoryIcon texture="Content/Items/Electricity/signalcomp.png" sourcerect="0,160,4,4" origin="0.5,0.5" />
|
||||
<ItemComponent>
|
||||
<StatusEffect type="Always" target="This">
|
||||
<sound file="Mods/Sunken Tapes/music/{{ tape.identifier }}.ogg" type="OnUse" range="1000" loop="true" volume="1.0" />
|
||||
<sound file="Mods/Sunken Tapes{% if config['override_workshop'] %} via Installer{% endif %}/music/{{ tape.identifier }}.ogg" type="OnUse" range="1000" loop="true" volume="1.0" />
|
||||
</StatusEffect>{% if tape.buffs %}
|
||||
<StatusEffect type="Always" target="NearbyCharacters" range="1000">{% for buff in tape.buffs %}
|
||||
{% if buff == "psychosis" %}<Affliction identifier="{{ buff }}" strength= "{{ '%0.4f' % (delta + 0.1) }}" />{% else %}<Affliction identifier="{{ buff }}" strength= "{{ '%0.4f' % (delta*4 + 1) }}" />{% endif %}{% endfor %}
|
||||
|
|
Loading…
Reference in New Issue