zombietextures/build.sh

70 lines
1.9 KiB
Bash

#!/bin/bash
# Get the current user. This assumes you are running the script as the desired user.
USER=$(whoami)
echo $mapname
echo $bspname
#build the image
python timeatbuild.py
#move the build image
mv overlay_datetime_image.png textures/zombietextures_dev/overlay_datetime_image.png
# Loop through all .map files in the current directory
#for mapfile in *.map; do
# # The base name without extension can be derived using 'basename'
# base=$(basename "$mapfile" .map)
#
# # Convert .map to .bsp
# q3map2 -game xonotic -meta -patchmeta "$mapfile"
#
# # Ensure the .bsp file exists before converting to .obj
# if [[ -f "$base.bsp" ]]; then
# q3map2 -game xonotic -convert -format obj "$base.bsp"
# else
# echo "Error: $base.bsp does not exist!"
# fi
#done
for mapfile in *.map; do
q3map2 -game xonotic -convert -format obj -patchmeta -subdivisions 4 -readmap $mapfile
done
#move the map
mv *obj maps/
mv *mtl maps/
for mtl_file in maps/*mtl; do
sed -i '/newmtl textures\/zombietextures_dev\/tiles01_pink_clip/a d 0.0' "$mtl_file"
done
for mtl_file in maps/*mtl; do
sed -i '/newmtl textures\/zombietextures_tnhl\/fence01/a d 0.9' "$mtl_file"
done
for mtl_file in maps/*mtl; do
sed -i '/newmtl textures\/zombietextures_tnhl\/grate01/a d 0.9' "$mtl_file"
done
for mtl_file in maps/*mtl; do
sed -i '/newmtl textures\/zombietextures_tnhl\/grate02/a d 0.9' "$mtl_file"
done
for mtl_file in maps/*mtl; do
sed -i '/newmtl textures\/zombietextures_tnhl\/rail01/a d 0.9' "$mtl_file"
done
#delete bloat
#rm *srf
# Define the destination directory
DEST_DIR="/home/$USER/.xonotic/data/"
# Delete and copy zombietextures.pk3dir
if [ -d "../assets" ]; then
if [ -d "${DEST_DIR}zombietextures.pk3dir" ]; then
rm -r "${DEST_DIR}zombietextures.pk3dir"
fi
cp -r ../assets ${DEST_DIR}zombietextures.pk3dir
else
echo "Folder zombietextures.pk3dir not found!"
fi