Added walkman placeholder

master
Jaka Perovšek 2021-11-28 00:45:25 +01:00
parent e10a3cfa72
commit 02d25f8cd9
2 changed files with 101 additions and 5 deletions

View File

@ -127,6 +127,18 @@ def fetch_and_cut_song(tape, ffmpeg_version):
"or download the latest release version manually.")
sys.exit()
walkman = ["./utils/ffmpeg-" + ffmpeg_version + "-full_build/bin/ffmpeg.exe",
"-i", f"./build/music/{tape['identifier']}.ogg",
"-af", f"highpass=f=300,lowpass=f=12000",
f"./build/music/{tape['identifier']}-walkman.ogg"]
try:
subprocess.call(walkman)
except FileNotFoundError:
print("ffmpeg not in utils directory. Run python install_dependencies.py "
"or download the latest release version manually.")
sys.exit()
def assemble_png_image(tapes, icons=False):
if icons:
@ -167,7 +179,7 @@ def prepare_music(data):
logging.info("downloading and cutting the songs")
for i, tape in enumerate(data):
if not os.path.exists(f"./build/music/{tape['identifier']}.ogg"):
if not (os.path.exists(f"./build/music/{tape['identifier']}.ogg") or os.path.exists(f"./build/music/{tape['identifier']}-walkman.ogg")):
logging.info(f"{i + 1}/{len(data)} Downloading: {tape['name']}")
fetch_and_cut_song(tape, ffmpeg_version)
else:

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
{% if config['slug'] != "sunken_tapes" %}<!--This mod is based on Sunken Tapes. See https://git.kompot.si/jaka/barotrauma-sunken-tapes and https://steamcommunity.com/sharedfiles/filedetails/?id=2616577901 for the source material and code generator.-->{% else %}<!--Code licensed under GPLv3 and generated with a script available at https://git.kompot.si/jaka/barotrauma-sunken-tapes-->{% endif %}
<Items>
<Item name="Boombox" cargocontaineridentifier="metalcrate" identifier="{% if config['slug'] != "sunken_tapes" %}{{ config["slug"] }}-{% endif %}boombox" category="Equipment" Tags="mediumitem,boombox" scale="0.5" description="" price="850" impactsoundtag="impact_metal_light" isshootable="true">
<Item name="Boombox" cargocontaineridentifier="metalcrate" identifier="{% if config['slug'] != "sunken_tapes" %}{{ config["slug"] }}-{% endif %}boombox" category="Equipment" Tags="mediumitem,boombox,sunken-tapes-player" scale="0.5" description="" price="850" impactsoundtag="impact_metal_light" isshootable="true">
<PreferredContainer primary="abandonedcrewcab" spawnprobability="0.1"/>
<PreferredContainer primary="outpostcrewcabinet" spawnprobability="0.1"/>
<Price baseprice="500" soldeverywhere="false">
@ -54,7 +54,71 @@
</StatusEffect>
</TickBox>
</CustomInterface>
<Holdable slots="RightHand,LeftHand" selectkey="Use" pickkey="Select" attachable="false" aimable="false" holdpos="5,-65" holdangle="0" aimpos="5,30" handle1="0,30" handle2="0,30" swingamount="20,5" swingspeed="0.5" swingwhenusing="true" msg="ItemMsgPickUpUse">
<Holdable slots="RightHand,LeftHand" selectkey="Use" pickkey="Select" attachable="false" aimable="false" holdpos="5,-65" holdangle="0" aimpos="5,30" handle1="0,30" handle2="0,30" swingamount="25,7" swingspeed="0.5" swingwhenusing="true" msg="ItemMsgPickUpUse">
</Holdable>
<ItemContainer hideitems="true" drawinventory="true" capacity="1" maxstacksize="1" slotsperrow="6" itempos="0,0" iteminterval="0,0" itemrotation="0" canbeselected="false" containedspritedepth="0.79">
<StatusEffect type="OnUse" targettype="Contained" >
<Use />
</StatusEffect>
<Containable items="cassette">
</Containable>
</ItemContainer>
</Item>
<Item name="Walkman" cargocontaineridentifier="metalcrate" identifier="{% if config['slug'] != "sunken_tapes" %}{{ config["slug"] }}-{% endif %}walkman" category="Equipment" Tags="smallitem,walkman,sunken-tapes-player" scale="0.5" description="" price="450" impactsoundtag="impact_metal_light" isshootable="true">
<PreferredContainer primary="abandonedcrewcab" spawnprobability="0.1"/>
<PreferredContainer primary="outpostcrewcabinet" spawnprobability="0.1"/>
<Price baseprice="450" soldeverywhere="false">
<Price locationtype="outpost" multiplier="1" minavailable="1" />
<Price locationtype="city" multiplier="0.7" minavailable="1"/>
<Price locationtype="research" multiplier="1.5" sold="false"/>
<Price locationtype="military" multiplier="1.5" sold="false"/>
<Price locationtype="mine" multiplier="1.5" sold="false"/>
</Price>
<Upgrade gameversion="0.9.2.0" scale="0.5" />
<InventoryIcon texture="Mods/{{ config['name'] }}/icons.png" sourcerect="0,0,64,64" origin="0.5,0.5" />
<Sprite texture="Mods/{{ config['name'] }}/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>
<CustomInterface canbeselected="true" drawhudwhenequipped="true" allowuioverlap="true">
<GuiFrame relativesize="0.10,0.07" anchor="CenterLeft" pivot="BottomLeft" relativeoffset="0.006,-0.05" style="ItemUI" />
<TickBox text="Play">
<StatusEffect type="OnUse" targettype="This" IsOn="true">
<Conditional IsOn="false" />
<sound file="Mods/{{ config['name'] }}/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" />
<Conditional condition="gt 25.0" />
<RequiredItem items="cassette" type="Contained" />
<sound file="Content/Sounds/FireSmall.ogg" type="OnUse" range="1000" loop="true" volume="1.0" />
</StatusEffect>
<StatusEffect type="OnUse" targettype="Contained" comparison="And">
<Conditional condition="lte 25.0" />
<Conditional condition="gt 10.0" />
<RequiredItem items="cassette" type="Contained" />
<sound file="Content/Sounds/FireSmall.ogg" type="OnUse" range="1000" loop="true" volume="1.0" />
</StatusEffect>
<StatusEffect type="OnUse" targettype="Contained">
<Conditional condition="lte 10.0" />
<RequiredItem items="cassette" type="Contained" />
<sound file="Content/Sounds/FireSmall.ogg" type="OnUse" range="1000" loop="true" volume="1.0" />
</StatusEffect-->
{% for tape in tapes %}
<StatusEffect type="OnUse" targettype="Contained" condition="-{{ condition_delta[loop.index0] }}">
<RequiredItem items="{% if config['slug'] != "sunken_tapes" %}{{ config["slug"] }}-{% endif %}cassette-{{ tape.identifier }}" type="Contained" />
<SpawnItem identifiers="{% if config['slug'] != "sunken_tapes" %}{{ config["slug"] }}-{% endif %}song-walkman-{{ tape.identifier }}" spawnposition="ContainedInventory" />
</StatusEffect>{% endfor %}
<StatusEffect type="OnSecondaryUse" targettype="This" IsOn="false" >
<Conditional IsOn="true" />
<sound file="Mods/{{ config['name'] }}/sound_effects/boombox_play_cassette.ogg" type="OnUse" range="500" volume="1.0" />
<Use />
</StatusEffect>
</TickBox>
</CustomInterface>
<Holdable slots="RightHand,LeftHand,Any" selectkey="Use" pickkey="Select" attachable="false" aimable="false" holdpos="5,-65" holdangle="0" aimpos="5,-65" handle1="0,30" handle2="0,30" swingamount="25,8" swingspeed="0.5" swingwhenusing="true" msg="ItemMsgPickUpUse">
</Holdable>
<ItemContainer hideitems="true" drawinventory="true" capacity="1" maxstacksize="1" slotsperrow="6" itempos="0,0" iteminterval="0,0" itemrotation="0" canbeselected="false" containedspritedepth="0.79">
<StatusEffect type="OnUse" targettype="Contained" >
@ -112,7 +176,7 @@
<InventoryIcon texture="Mods/{{ config['name'] }}/icons.png" sourcerect="0,{{ loop.index0*41 + 64 }},64,41" origin="0.5,0.5" />
<Sprite texture="Mods/{{ config['name'] }}/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">
<Throwable slots="Any,RightHand,LeftHand" holdpos="5,-65" holdangle="0" handle1="0,1" throwforce="4.0" aimpos="35,-10" msg="ItemMsgPickUpSelect">
<StatusEffect type="OnImpact" target="This" Condition="-5.0" disabledeltatime="true">
<sound file="Mods/{{ config['name'] }}/sound_effects/cassette_drop.ogg" range="500" volume="1.0" />
</StatusEffect>
@ -125,7 +189,7 @@
<Use />
</StatusEffect>
<StatusEffect type="OnContained" targettype="This">
<Conditional hastag="!eq boombox" targetcontainer="true" />
<Conditional hastag="!eq sunken-tapes-player" targetcontainer="true" />
<Use />
</StatusEffect>
<StatusEffect type="OnUse" targettype="Contained">
@ -165,6 +229,26 @@
</ItemComponent>
</Item>
<Item name="Song (Walkman): {{ tape.name }}" identifier="{% if config['slug'] != "sunken_tapes" %}{{ config["slug"] }}-{% endif %}song-walkman-{{ tape.identifier }}" Tags="song" category="Misc">
<Sprite texture="Content/Items/Electricity/signalcomp.png" depth="0.8" sourcerect="0,160,4,4" origin="0.5,0.5" />
<Body width="48" height="48" />
<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/{{ config['name'] }}/music/{{ tape.identifier }}-walkman.ogg" type="OnUse" range="200" loop="true" volume="1.0" />
</StatusEffect>{% if tape.buffs %}
<StatusEffect type="Always" target="NearbyCharacters" range="200">{% for buff in tape.buffs %}
{% if buff == "psychosis" %}<Affliction identifier="{{ buff }}" strength= "{{ '%0.4f' % (tape.buff_multiplier*(delta + 0.1)*0.5) }}" />{% else %}<Affliction identifier="{{ buff }}" strength= "{{ '%0.4f' % (tape.buff_multiplier*(delta*4 + 1)*0.5) }}" />{% endif %}{% endfor %}
</StatusEffect>{% endif %}
<StatusEffect type="OnNotContained" targettype="This">
<Remove />
</StatusEffect>
<StatusEffect type="OnUse" targettype="This">
<Remove />
</StatusEffect>
</ItemComponent>
</Item>
{% endfor %}
</Items>