feat: v4.1.0 -- workshop-ready (logo, path discovery, docs)
Players install from Steam Workshop instead of install.sh, which failed on Windows (bash) and a Manjaro box (hard-coded Mods globs). Adds Logo + logo.png the uploader ships, tools/steam_paths.py reading Steam's libraryfolders.vdf (Flatpak/Snap/second disk/Windows), and README install tiers plus in-game publishing steps. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014TkQMhvEyoFqKzeCC69N6o
This commit is contained in:
+25
-15
@@ -8,23 +8,20 @@
|
||||
# against the player's actual installed game data, before the game is launched.
|
||||
#
|
||||
# Run: python3 tests/test_mod.py
|
||||
# The game install is found automatically, or set COSMOTEER_DATA to override.
|
||||
# The game install is found through Steam's own library list (tools/steam_paths.py),
|
||||
# or set COSMOTEER_DATA to override.
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
MOD_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, os.path.join(MOD_ROOT, "tools"))
|
||||
|
||||
import rules_parser
|
||||
import steam_paths
|
||||
|
||||
MOD_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
CANDIDATE_DATA_DIRS = [
|
||||
"/mnt/SSD4TB/SteamLibrary/steamapps/common/Cosmoteer/Data",
|
||||
os.path.expanduser("~/.local/share/Steam/steamapps/common/Cosmoteer/Data"),
|
||||
os.path.expanduser("~/.steam/steam/steamapps/common/Cosmoteer/Data"),
|
||||
]
|
||||
|
||||
# Component fields whose value names another component in the same part.
|
||||
COMPONENT_REF_FIELDS = {
|
||||
@@ -56,13 +53,8 @@ def check(condition, message):
|
||||
|
||||
|
||||
def find_data_dir():
|
||||
override = os.environ.get("COSMOTEER_DATA")
|
||||
if override:
|
||||
return override
|
||||
for path in CANDIDATE_DATA_DIRS:
|
||||
if os.path.isdir(path):
|
||||
return path
|
||||
return None
|
||||
"""Locate the installed game's Data folder via tools/steam_paths.py."""
|
||||
return steam_paths.find_data_dir()
|
||||
|
||||
|
||||
DATA = find_data_dir()
|
||||
@@ -745,6 +737,24 @@ def test_manifest_is_well_formed():
|
||||
)
|
||||
|
||||
|
||||
def test_manifest_declares_existing_logo():
|
||||
"""Steam Workshop shows the mod's Logo; the file must ship inside the mod
|
||||
folder, be a real PNG, and stay under Steam's 500 KB preview limit."""
|
||||
mod = rules_parser.parse_file(os.path.join(MOD_ROOT, "mod.rules"))
|
||||
logo = mod.get("Logo")
|
||||
check(logo is not None, "mod.rules is missing the 'Logo' field")
|
||||
if logo is None:
|
||||
return
|
||||
path = os.path.join(MOD_ROOT, logo.value.strip('"'))
|
||||
check(os.path.isfile(path), f"Logo file does not exist: {path}")
|
||||
if not os.path.isfile(path):
|
||||
return
|
||||
with open(path, "rb") as f:
|
||||
magic = f.read(8)
|
||||
check(magic == b"\x89PNG\r\n\x1a\n", f"Logo is not a PNG: {path}")
|
||||
check(os.path.getsize(path) < 500_000, "Logo must be under 500 KB for Workshop upload")
|
||||
|
||||
|
||||
def main():
|
||||
if DATA is None or not os.path.isdir(DATA):
|
||||
print("SKIP: Cosmoteer Data folder not found. Set COSMOTEER_DATA to run these tests.")
|
||||
|
||||
Reference in New Issue
Block a user