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
+3 -3
View File
@@ -1,9 +1,9 @@
# Build environment for modding/hacked/ (vendored from
# Build environment for modding/src/hacked/ (vendored from
# https://github.com/inkyblackness/hacked, see ../README.md). Fetches the Go
# toolchain and this module's dependencies once, here, at image-build time, so
# ../hacked-build-run-image.sh can compile fully offline afterward. Rebuild
# with ../hacked-build-image.sh whenever a version below changes, or whenever
# ../hacked/go.mod or go.sum changes (its dependencies are baked into the
# ../src/hacked/go.mod or go.sum changes (its dependencies are baked into the
# image's module cache).
FROM ubuntu:22.04
@@ -40,7 +40,7 @@ ENV GOPATH=/opt/go
# container never needs network access to build it. Only go.mod/go.sum are
# copied in for this - not the rest of the source - so editing hacked's own
# .go files doesn't invalidate this layer's cache.
COPY hacked/go.mod hacked/go.sum /tmp/hacked-deps/
COPY src/hacked/go.mod src/hacked/go.sum /tmp/hacked-deps/
RUN cd /tmp/hacked-deps && go mod download && rm -rf /tmp/hacked-deps
COPY hacked-build-image/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
+7 -7
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Compiles modding/hacked/ for Linux and Windows (amd64), entirely offline -
# every Go module dependency was already fetched into the build-image at
# image-build time (see Dockerfile). Baked into the image at
# Compiles modding/src/hacked/ for Linux and Windows (amd64), entirely
# offline - every Go module dependency was already fetched into the
# build-image at image-build time (see Dockerfile). Baked into the image at
# /usr/local/bin/build-hacked.sh (see Dockerfile's CMD) - run via
# ../hacked-build-run-image.sh, which bind-mounts modding/ at /workspace, not
# directly.
@@ -29,12 +29,12 @@ echo "== Preparing scratch, patched copies of hacked/ and sqweek-dialog/ =="
# scratch copies must keep that same relative layout.
rm -rf "$SCRATCH_DIR"
mkdir -p "$SCRATCH_DIR"
cp -a "$MODDING_ROOT/hacked" "$HACKED_SRC"
cp -a "$MODDING_ROOT/sqweek-dialog" "$DIALOG_SRC"
for p in "$MODDING_ROOT"/hacked-patches/*.patch; do
cp -a "$MODDING_ROOT/src/hacked" "$HACKED_SRC"
cp -a "$MODDING_ROOT/src/sqweek-dialog" "$DIALOG_SRC"
for p in "$MODDING_ROOT"/src/hacked-patches/*.patch; do
patch -p1 -d "$HACKED_SRC" < "$p"
done
for p in "$MODDING_ROOT"/sqweek-dialog-patches/*.patch; do
for p in "$MODDING_ROOT"/src/sqweek-dialog-patches/*.patch; do
patch -p1 -d "$DIALOG_SRC" < "$p"
done