Add a first-party MDL mod-build system and reorganize modding/ under src/

modding/mods/ holds message edits as plain JSON (type, index, language,
plus only the changed fields - a long body can live in a sibling .txt to
avoid escaping in JSON), so mod authoring is reviewable in git instead of
living only in hacked's GUI. mdlp (modding/src/mdlp/, its own Docker image
mdlp-image/) turns them into the same mod folder/zip hacked's own Save
produces, reusing hacked's ss1/edit, ss1/world and ss1/content/text
packages via a go.mod replace - no GUI/GLFW/GTK needed. `make mods`
builds every mod into dist/mods/<name>/, scoped per-mod so it never
touches hacked's own build output; `make` (no target) now builds both.

Fixes a bug this surfaced: hacked's FileLocation.AbsolutePathFrom
silently writes into the current directory instead of the given output
folder when passed a relative path (the GUI never hits this since its
folder picker is always absolute) - mdlp now resolves its own paths
up front.

res/run-mods.sh/.bat are new companion launchers to run.sh/.bat: they
pass every dist/mods/*/mod folder to the engine as a separate absolute
argument, since ProcessModDirectory() only scans one directory level
deep. Wired into `make dist`/`dist-win` only, not the release archives.

modding/hacked/, its patches, sqweek-dialog/, its patches, and the new
mdlp/ move under modding/src/, separating source from the surrounding
Docker/script scaffolding; all path references updated to match.

NOTICE.txt gains a section for hacked's distributed build, listing hacked
(New BSD), sqweek/dialog (ISC - corrected from a wrong "New BSD" note),
and hacked's other direct Go dependencies.
This commit is contained in:
ml
2026-09-26 15:41:56 +02:00
parent c0952898ae
commit 389abd7de7
24 changed files with 839 additions and 35 deletions
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# Pushes the mdlp-image - already built locally with ./mdlp-image.sh, and
# ideally verified with ./mdlp-run-image.sh - to a container registry, so CI
# or other machines can reuse it without rebuilding the whole toolchain.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
ROOT="$(pwd)"
fail() { echo "PREFLIGHT FAIL: $*" >&2; exit 1; }
command -v docker >/dev/null 2>&1 \
|| fail "docker not found in PATH"
[ -f "$ROOT/../registry.env" ] \
|| fail "../registry.env not found - copy ../registry.env.example to ../registry.env and fill in your registry credentials"
# shellcheck disable=SC1091
source "$ROOT/../registry.env"
: "${REGISTRY:?registry.env must set REGISTRY}"
: "${REGISTRY_USER:?registry.env must set REGISTRY_USER}"
: "${REGISTRY_PASSWORD:?registry.env must set REGISTRY_PASSWORD}"
MDLP_REGISTRY_IMAGE="${MDLP_REGISTRY_IMAGE:-questshock/mdlp}"
VERSION="$(<"$ROOT/mdlp-image/VERSION")"
[ -n "$VERSION" ] || fail "mdlp-image/VERSION is empty"
docker image inspect "$MDLP_REGISTRY_IMAGE:$VERSION" >/dev/null 2>&1 \
|| fail "$MDLP_REGISTRY_IMAGE:$VERSION not found locally - run ./mdlp-image.sh first"
echo "== Logging in to $REGISTRY =="
echo "$REGISTRY_PASSWORD" | docker login "$REGISTRY" -u "$REGISTRY_USER" --password-stdin
echo "== Pushing $MDLP_REGISTRY_IMAGE:$VERSION and :latest =="
docker push "$MDLP_REGISTRY_IMAGE:$VERSION"
docker push "$MDLP_REGISTRY_IMAGE:latest"
echo "== Done =="
echo "Image: $MDLP_REGISTRY_IMAGE:$VERSION"