ONI Agent Bridge - initial mod implementation
This commit is contained in:
61
scripts/build_mod.sh
Normal file
61
scripts/build_mod.sh
Normal file
@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the ONI Agent Bridge Mod
|
||||
# Requires: mono-complete (for mcs compiler)
|
||||
# Requires: ONI game installed to get reference DLLs
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
MOD_DIR="$PROJECT_DIR/mod"
|
||||
OUTPUT_DIR="$MOD_DIR/bin"
|
||||
|
||||
ONI_PATH="${ONI_PATH:-}"
|
||||
if [ -z "$ONI_PATH" ]; then
|
||||
for candidate in \
|
||||
"$HOME/.steam/steam/steamapps/common/OxygenNotIncluded" \
|
||||
"$HOME/.local/share/Steam/steamapps/common/OxygenNotIncluded" \
|
||||
"/c/Program Files (x86)/Steam/steamapps/common/OxygenNotIncluded" \
|
||||
"/mnt/c/Program Files (x86)/Steam/steamapps/common/OxygenNotIncluded"; do
|
||||
MANAGED="$candidate/OxygenNotIncluded_Data/Managed"
|
||||
if [ -d "$MANAGED" ]; then
|
||||
ONI_PATH="$MANAGED"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -z "$ONI_PATH" ]; then
|
||||
echo "[!] ONI installation not found."
|
||||
echo " Set ONI_PATH to the Managed directory:"
|
||||
echo ' export ONI_PATH="/path/to/OxygenNotIncluded_Data/Managed"'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[Build] ONI: $ONI_PATH"
|
||||
|
||||
for dll in "$ONI_PATH/Assembly-CSharp.dll" "$ONI_PATH/UnityEngine.dll" \
|
||||
"$ONI_PATH/UnityEngine.CoreModule.dll" "$ONI_PATH/0Harmony.dll"; do
|
||||
if [ ! -f "$dll" ]; then echo "[!] Missing: $dll"; exit 1; fi
|
||||
done
|
||||
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
REFS=""
|
||||
for dll in "$ONI_PATH/Assembly-CSharp.dll" "$ONI_PATH/UnityEngine.dll" \
|
||||
"$ONI_PATH/UnityEngine.CoreModule.dll" "$ONI_PATH/0Harmony.dll"; do
|
||||
REFS="$REFS -reference:\"$dll\""
|
||||
done
|
||||
if [ -f "$ONI_PATH/Assembly-CSharp-firstpass.dll" ]; then
|
||||
REFS="$REFS -reference:\"$ONI_PATH/Assembly-CSharp-firstpass.dll\""
|
||||
fi
|
||||
|
||||
echo "[Build] Compiling..."
|
||||
eval mcs -target:library -out:"$OUTPUT_DIR/ONIAgentBridge.dll" $REFS -recurse:"$MOD_DIR/*.cs"
|
||||
|
||||
echo "[Build] SUCCESS: $OUTPUT_DIR/ONIAgentBridge.dll"
|
||||
echo ""
|
||||
echo "Install (Linux):"
|
||||
echo " MOD_DIR=~/.config/unity3d/Klei/OxygenNot\\ Included/mods/local/ONIAgentBridge"
|
||||
echo " mkdir -p \"\$MOD_DIR\""
|
||||
echo " cp $OUTPUT_DIR/ONIAgentBridge.dll $MOD_DIR/mod_info.yaml \"\$MOD_DIR/\""
|
||||
echo " # Then enable mod in ONI > Mods > ONI Agent Bridge"
|
||||
Reference in New Issue
Block a user