Files
CHOMPStation2/tools/github-actions/nanomap-renderer-invoker.sh
CHOMPStation2 95a4a5c1dd [MIRROR] Adds Juke Build (#9006)
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com>
Co-authored-by: Kashargul <KashL@t-online.de>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
2024-09-24 02:30:54 +02:00

40 lines
1003 B
Bash
Executable File

#!/bin/bash
BASEDIR=$PWD
#Put directories to get maps from here. One per line.
mapdirs=(
"maps/southern_sun"
)
#DO NOT TOUCH THIS VARIABLE. It will automatically fill with any maps in mapdirs that are form MAPNAME-n.dmm where n is the z level.
map_files=()
#Fill up mapfiles list
for mapdir in ${mapdirs[@]}; do
echo "Scanning $mapdir..."
FULLMAPDIR=$BASEDIR/$mapdir
map_files+=($FULLMAPDIR/*-*[0-9].dmm)
done
#Print full map list
echo "Full map list:"
for map in ${map_files[@]}; do
echo $map
done
printf "\n\n\n"
echo "Rendering maps..."
#Render maps to initial images
~/dmm-tools minimap "${map_files[@]}"
cd data/minimaps
printf "\n\n\n"
echo "Starting image resizing..."
#Resize images to proper size and move them to the correct place
for map in ./*.png; do
j=$(echo $map | sed -n "s/^\.\/\(.*\)-\([0-9]*\)\-1.png$/\1_nanomap_z\2.png/p")
echo "Resizing $map and moving to icons/_nanomaps/$j"
convert $map -resize 2240x2240 "$BASEDIR/icons/_nanomaps/$j"
done