#!/usr/bin/env bash # ABOUT ME # Installs the Auto Radiator mod into Cosmoteer's user Mods folder. # # Why it exists: Cosmoteer loads mods from the user profile directory, which on # a Proton install lives deep inside the Steam compatdata prefix and is awkward # to find by hand. This script locates it, validates the mod against the # installed game data first, and copies only the files the game needs. # # Usage: ./install.sh install (validates first) # ./install.sh --uninstall remove the installed copy set -euo pipefail MOD_ID="auto_radiator" SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" find_mods_dir() { # A Cosmoteer profile folder is named after the Steam ID, so glob for it. local candidates=( "$HOME"/.local/share/Steam/steamapps/compatdata/799600/pfx/drive_c/users/steamuser/"Saved Games"/Cosmoteer/*/Mods /mnt/*/SteamLibrary/steamapps/compatdata/799600/pfx/drive_c/users/steamuser/"Saved Games"/Cosmoteer/*/Mods "$HOME"/"Saved Games"/Cosmoteer/*/Mods "$HOME"/Documents/"My Games"/Cosmoteer/*/Mods ) for path in "${candidates[@]}"; do [ -d "$path" ] && printf '%s\n' "$path" && return 0 done return 1 } MODS_DIR="${COSMOTEER_MODS_DIR:-$(find_mods_dir || true)}" if [ -z "$MODS_DIR" ]; then echo "Could not find the Cosmoteer Mods folder." >&2 echo "Set COSMOTEER_MODS_DIR to it and run again." >&2 exit 1 fi TARGET="$MODS_DIR/$MOD_ID" if [ "${1:-}" = "--uninstall" ]; then rm -rf "$TARGET" echo "Removed $TARGET" exit 0 fi echo "Validating against installed game data..." python3 "$SOURCE_DIR/tests/test_mod.py" echo echo "Installing to $TARGET" rm -rf "$TARGET" mkdir -p "$TARGET" cp "$SOURCE_DIR/mod.rules" "$TARGET/" cp -r "$SOURCE_DIR/components" "$TARGET/" echo "Done. Enable \"Auto Radiator\" in the game's Mods menu."