Sprites update WIP

master
Jaka Perovšek 2021-12-17 17:13:02 +01:00
parent 73ff7da0ca
commit 9331c61ad1
51 changed files with 115 additions and 28 deletions

View File

@ -141,13 +141,21 @@ def fetch_and_cut_song(tape, ffmpeg_version):
sys.exit()
def assemble_png_image(tapes, icons=False):
if icons:
img_names = [f"./source/images/{tape['identifier']}_icon.png" for tape in tapes]
else:
def assemble_png_images(tapes, outfile: str, resize=None):
img_names = [f"./source/images/{tape['identifier']}.png" for tape in tapes]
images = [Image.open(x) for x in img_names]
if resize is not None:
for i, (im, tape) in enumerate(zip(images, tapes)):
im.thumbnail((128, 82), Image.ANTIALIAS)
if resize == (64, 41) and tape["icon_resize"] == "blur":
im.thumbnail(resize, Image.ANTIALIAS)
else:
im.thumbnail(resize, Image.NEAREST)
images[i] = im
widths, heights = zip(*(i.size for i in images))
columns = int((len(images))**0.5)
@ -163,10 +171,7 @@ def assemble_png_image(tapes, icons=False):
y_offset = max(heights) * math.floor(i / columns)
new_im.paste(im, (x_offset, y_offset))
if icons:
new_im.save("./build/icons.png")
else:
new_im.save("./build/covers.png")
new_im.save(f"./build/{outfile}.png")
def prepare_music(data):
@ -196,12 +201,13 @@ def prepare_music(data):
def prepare_images(data, config):
logging.info(f"assembling covers and icons into png files")
assemble_png_image(data)
assemble_png_image(data, icons=True)
assemble_png_images(data, "covers")
assemble_png_images(data, "icons", resize=(64, 41))
assemble_png_images(data, "sprites", resize=(33, 21))
logging.info(f"copying other images")
shutil.copy("./source/images/boombox.png", "./build/boombox.png")
shutil.copy("./source/images/boombox_icon.png", "./build/boombox_icon.png")
shutil.copy("./source/images/players_icons.png", "./build/players_icons.png")
shutil.copy("./source/images/players_sprites.png", "./build/players_sprites.png")
shutil.copy("./source/images/PreviewImage.png", "./build/PreviewImage.png")

View File

@ -3,10 +3,12 @@
<contentpackage name="{{ config['name'] }}" path="Mods/{{ config['name'] }}/filelist.xml" corepackage="false" gameversion="0.15.12.0" {% if config['slug'] == "Sunken Tapes" %}steamworkshopid="2616577901"{% endif %}>
<Item file="Mods/{{ config['name'] }}/{{ config['slug'] }}.xml" />
<UIStyle file="Mods/{{ config['name'] }}/{{ config['slug'] }}_style.xml" />
<None file="Mods/{{ config['name'] }}/PreviewImage.png" />
<None file="Mods/{{ config['name'] }}/icons.png" />
<None file="Mods/{{ config['name'] }}/covers.png" />
<None file="Mods/{{ config['name'] }}/boombox.png" />
<None file="Mods/{{ config['name'] }}/boombox_icon.png" />{% for tape in tapes %}
<None file="Mods/{{ config['name'] }}/sprites.png" />
<None file="Mods/{{ config['name'] }}/players_icons.png" />
<None file="Mods/{{ config['name'] }}/players_sprites.png" />{% for tape in tapes %}
<None file="Mods/{{ config['name'] }}/music/{{ tape["identifier"] }}.ogg" />
<None file="Mods/{{ config['name'] }}/music/{{ tape["identifier"] }}-walkman.ogg" />{% endfor %}
<None file="Mods/{{ config['name'] }}/sound_effects/boombox_insert_cassette.ogg" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -0,0 +1,19 @@
from PIL import Image
from pathlib import Path
print(dir(Image))
size = 33, 21
#size = 64, 41
size_intermediate = 128, 82
for infile in Path('./').glob("*.png"):
if "icon" not in str(infile) and "sprite" not in str(infile):
try:
outfile = infile.with_name(infile.name.replace(".png", "_sprite.png"))
im = Image.open(infile)
im.thumbnail(size_intermediate, Image.ANTIALIAS)
im.thumbnail(size, Image.NEAREST)
im.save(outfile, "PNG")
except IOError:
print(f"cannot create thumbnail for {infile}")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -24,9 +24,9 @@
<RequiredItem identifier="fpgacircuit" />
</Fabricate>
<Upgrade gameversion="0.9.2.0" scale="0.5" />
<InventoryIcon texture="Mods/{{ config['name'] }}/boombox_icon.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" />
<InventoryIcon texture="Mods/{{ config['name'] }}/players_icons.png" sourcerect="0,64,64,64" origin="0.5,0.5" />
<Sprite texture="Mods/{{ config['name'] }}/players_sprites.png" sourcerect="0,0,139,93" depth="0.55" origin="0.5,0.5" />
<Body width="139" height="93" />
<LightComponent LightColor="0.0,0.85,0.0,0.7" range="4" powerconsumption="0" blinkfrequency="0" IsOn="false" canbeselected="false">
</LightComponent>
<CustomInterface canbeselected="true" drawhudwhenequipped="true" allowuioverlap="true">
@ -78,11 +78,9 @@
<RequiredItem identifier="fpgacircuit" />
</Fabricate>
<Upgrade gameversion="0.9.2.0" scale="0.5" />
<InventoryIcon texture="Mods/{{ config['name'] }}/boombox_icon.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.0,0.85,0.0,0.7" range="4" powerconsumption="0" blinkfrequency="0" IsOn="false" canbeselected="false">
</LightComponent>
<InventoryIcon texture="Mods/{{ config['name'] }}/players_icons.png" sourcerect="0,0,64,64" origin="0.5,0.5" />
<Sprite texture="Mods/{{ config['name'] }}/players_sprites.png" sourcerect="139,0,51,33" depth="0.55" origin="0.5,0.5" />
<Body width="51" height="33" />
<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">
@ -97,20 +95,40 @@
</StatusEffect>
</TickBox>
</CustomInterface>
<Holdable slots="RightHand,LeftHand,Any" holdpos="5,-65" holdangle="0" aimpos="5,-65" handle1="0,30" handle2="0,30" swingamount="25,8" swingspeed="0.5" swingwhenusing="true" msg="ItemMsgPickupSelect">
<Holdable slots="RightHand,LeftHand,Any" holdpos="5,-75" holdangle="0" aimpos="5,-65" handle1="-15,15" handle2="-15,15" swingamount="25,8" swingspeed="0.5" swingwhenusing="true" msg="ItemMsgPickupSelect">
<StatusEffect type="OnBroken" target="This">
<Remove />
</StatusEffect>
</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" >
<ItemContainer itempos="3,-3" hideitems="false" drawinventory="true" capacity="1" maxstacksize="1" slotsperrow="1" iteminterval="0,0" itemrotation="180" canbeselected="false" containedspritedepth="0.6">
<StatusEffect type="OnUse" targettype="Contained" >
<Use />
</StatusEffect>
<StatusEffect type="OnContained" targettype="This">
<SpawnItem identifiers="{% if config['slug'] != "sunken_tapes" %}{{ config["slug"] }}-{% endif %}walkman-background" spawnposition="ThisInventory" />
</StatusEffect>
<Containable items="cassette">
</Containable>
</ItemContainer>
</Item>
<!-- Walkman background -->
<Item name="Walkman background sprite" identifier="{% if config['slug'] != "sunken_tapes" %}{{ config["slug"] }}-{% endif %}walkman-background" Tags="cassette" category="Misc">
<Sprite texture="Mods/{{ config['name'] }}/players_sprites.png" sourcerect="139,66,28,12" depth="0.6" origin="0.5,0.5" />
<Body width="28" height="12" />
<InventoryIcon texture="Content/Items/Electricity/signalcomp.png" sourcerect="0,160,4,4" origin="0.5,0.5" />
<ItemComponent>
<StatusEffect type="OnNotContained" targettype="This">
<Remove />
</StatusEffect>
<StatusEffect type="OnContained" targettype="This">
<Conditional hastag="!eq walkman" targetcontainer="true" />
<Remove />
</StatusEffect>
</ItemComponent>
</Item>
<!-- Cassette Tapes -->
{% for tape in tapes %}
@ -130,8 +148,8 @@
<RequiredItem identifier="fpgacircuit" />
</Fabricate>
<InventoryIcon texture="Mods/{{ config['name'] }}/icons.png" sourcerect="{{ 64 * positions[loop.index0]['column'] }},{{ 41 * positions[loop.index0]['row'] }},64,41" origin="0.5,0.5" />
<Sprite texture="Mods/{{ config['name'] }}/icons.png" sourcerect="{{ 64 * positions[loop.index0]['column'] }},{{ 41 * positions[loop.index0]['row'] }},64,41" depth="0.6" origin="0.5,0.5" />
<Body width="48" height="48" />
<Sprite texture="Mods/{{ config['name'] }}/sprites.png" sourcerect="{{ 33 * positions[loop.index0]['column'] }},{{ 21 * positions[loop.index0]['row'] }},33,21" depth="0.6" origin="0.5,0.5" />
<Body width="33" height="21" />
<Throwable slots="Any,RightHand,LeftHand" holdpos="5,-65" holdangle="0" handle1="0,1" throwforce="4.0" aimpos="35,-10" msg="Aim to throw">
<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" />

View File

@ -2,6 +2,7 @@
name: Blank Tape
source: ./source/original_audio/blank.ogg
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -20,6 +21,7 @@
end: -1
volume: 0
note: ""
icon_resize: blur
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -39,6 +41,7 @@
end: -1
volume: 0
note: ""
icon_resize: blur
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -58,6 +61,7 @@
end: -1
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.04
@ -77,6 +81,7 @@
end: -1
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -96,6 +101,7 @@
end: -1
volume: 0
note: ""
icon_resize: blur
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -116,6 +122,7 @@
end: 00:06:50
volume: 2
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -136,6 +143,7 @@
end: 00:02:49
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -155,6 +163,7 @@
end: 00:04:32
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -174,6 +183,7 @@
end: -1
volume: 3
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -193,6 +203,7 @@
end: -1
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -214,6 +225,7 @@
end: -1
volume: 3
note: ""
icon_resize: blur
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -234,6 +246,7 @@
end: -1
volume: 3
note: ""
icon_resize: blur
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -254,6 +267,7 @@
end: 00:04:18
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -274,6 +288,7 @@
end: 00:02:45
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -294,6 +309,7 @@
end: 00:03:20
volume: 6
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -314,6 +330,7 @@
end: 00:02:33
volume: 6
note: ""
icon_resize: blur
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -334,6 +351,7 @@
end: -1
volume: 6
note: ""
icon_resize: blur
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -354,6 +372,7 @@
end: -1
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -374,6 +393,7 @@
end: -1
volume: 6
note: ""
icon_resize: blur
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -394,6 +414,7 @@
end: 00:05:51
volume: 3
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -414,6 +435,7 @@
end: -1
volume: 3
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -434,6 +456,7 @@
end: -1
volume: 6
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.02
@ -454,6 +477,7 @@
end: -1
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -475,6 +499,7 @@
end: 00:02:35
volume: 2
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -495,6 +520,7 @@
end: 00:04:08.8
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -515,6 +541,7 @@
end: -1
volume: 3
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -533,6 +560,7 @@
end: -1
volume: 10
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -553,6 +581,7 @@
end: -1
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -573,6 +602,7 @@
end: -1
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -581,7 +611,7 @@
price: 450
multipliers: [1, 1, 1, 1, 1] # outpost, city, research, military, mine
sold: [false, true, false, false, false] # outpost, city, research, military, mine
no_of_uses: 6
no_of_uses: 6 # post-processing
buffs: False
buff_multiplier: 0.5
@ -589,6 +619,7 @@
name: Inka - Schritte (08080 remix)
source: ./source/original_audio/schritte_08080.ogg
note: Anžiček remix
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -608,6 +639,7 @@
end: -1
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -622,6 +654,7 @@
name: Neznani Rock Fotri
source: ./source/original_audio/wacky_tape.ogg
note: Made by a broken cassette player
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -636,6 +669,7 @@
name: 08080 - Minor Threat
source: ./source/original_audio/08080_minor_threat.ogg
note: Original song by 08080
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.04
@ -652,6 +686,7 @@
name: 08080 - Canyon's Joyride
source: ./source/original_audio/08080_canyons_joyride.ogg
note: Original song by 08080
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.03
@ -672,6 +707,7 @@
end: -1
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -691,6 +727,7 @@
end: -1
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -710,6 +747,7 @@
end: -1
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.05
@ -730,6 +768,7 @@
end: 00:06:46
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: outpostcrewcabinet
probability: 0.02
@ -748,6 +787,7 @@
end: -1
volume: 12
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.03
@ -768,6 +808,7 @@
end: -1
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.04
@ -788,6 +829,7 @@
end: -1
volume: 0
note: ""
icon_resize: sharp
spawn:
- location: abandonedcrewcab
probability: 0.04