#!/usr/bin/env bash # Assemble the shippable, drop-in "Institution" mod into this repo. # # The Institution suite's code lives in SEPARATE sibling repos (rimworld-core, -contraband, -policing, # -corrections, -gangs, -ward) as independent projects/DLLs -- that is what keeps it modular and splittable. For DISTRIBUTION # they are vendored into ONE mod folder (this repo) with one About.xml and a settings shim that toggles # each layer. This script rebuilds the sibling DLLs clean (no self-test) and copies them + Contraband's # Defs in here, so the repo is a complete installable mod. # # To split back into separate mods later: stop running this, and ship each sibling repo as its own mod # (their About.xml files still exist). Nothing in the code changes. # # Usage: Tools/package.sh (assumes siblings at ../rimworld-) set -euo pipefail HERE="$(cd "$(dirname "$0")/.." && pwd)" SIB="$(dirname "$HERE")" CORE="$SIB/rimworld-core" CB="$SIB/rimworld-contraband" POL="$SIB/rimworld-policing" COR="$SIB/rimworld-corrections" GANGS="$SIB/rimworld-gangs" WARD="$SIB/rimworld-ward" command -v dotnet >/dev/null || { echo "dotnet not on PATH" >&2; exit 1; } echo "==> building the engine + feature DLLs (clean, no self-test)" dotnet build "$CORE/Source/Core/Core.csproj" -c Release -v q --nologo dotnet build "$POL/Source/Policing/Policing.csproj" -c Release -v q --nologo dotnet build "$COR/Source/Corrections/Corrections.csproj" -c Release -v q --nologo dotnet build "$CB/Source/Contraband/Contraband.csproj" -c Release -v q --nologo dotnet build "$GANGS/Source/Gangs/Gangs.csproj" -c Release -v q --nologo dotnet build "$WARD/Source/Ward/Ward.csproj" -c Release -v q --nologo echo "==> vendoring DLLs into Assemblies/" mkdir -p "$HERE/Assemblies" rm -f "$HERE/Assemblies/"*.dll # clear old layout dotnet build "$HERE/Source/Institution/Institution.csproj" -c Release -v q --nologo # (re-)emit Institution.dll here cp "$CORE/Assemblies/InstitutionCore.dll" "$HERE/Assemblies/" cp "$CB/Assemblies/Contraband.dll" "$HERE/Assemblies/" cp "$POL/Assemblies/InstitutionPolicing.dll" "$HERE/Assemblies/" cp "$COR/Assemblies/InstitutionCorrections.dll" "$HERE/Assemblies/" cp "$GANGS/Assemblies/InstitutionGangs.dll" "$HERE/Assemblies/" cp "$WARD/Assemblies/Ward.dll" "$HERE/Assemblies/" echo "==> vendoring the feature content" for d in Defs Patches Languages Textures; do rm -rf "$HERE/$d" [[ -e "$CB/$d" ]] && cp -r "$CB/$d" "$HERE/$d" done # Policing + Corrections ship defs of their own (crime thoughts; corrections hediffs/jobs/interaction # modes/thoughts/regime/marker); merge them into the same Defs/ tree. for M in "$POL" "$COR"; do if [[ -e "$M/Defs" ]]; then mkdir -p "$HERE/Defs" cp -r "$M/Defs/." "$HERE/Defs/" fi done # Corrections ships a texture (the security marker); vendor it so the aggregate isn't magenta. if [[ -e "$COR/Textures" ]]; then mkdir -p "$HERE/Textures" cp -r "$COR/Textures/." "$HERE/Textures/" fi # Ward ships defs (interaction mode, hediffs, treatment station, room role), its own textures, AND a # Patches/ dir -- the Rim Disorders integration that marks disorders treatable (conditional, so it # no-ops without that mod). Miss the Patches/ and treatment silently does nothing to the illness. All # its files are *_Ward*.xml or under a Ward/ texture subdir, so nothing collides with the others. if [[ -e "$WARD/Defs" ]]; then mkdir -p "$HERE/Defs" cp -r "$WARD/Defs/." "$HERE/Defs/" fi if [[ -e "$WARD/Textures" ]]; then mkdir -p "$HERE/Textures" cp -r "$WARD/Textures/." "$HERE/Textures/" fi if [[ -e "$WARD/Patches" ]]; then mkdir -p "$HERE/Patches" cp -r "$WARD/Patches/." "$HERE/Patches/" fi echo "==> done. Assemblies:" ls -1 "$HERE/Assemblies/" | sed 's/^/ /' echo "The repo is now a complete drop-in Institution mod (Core bundled). Requires only Harmony."