#!/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)" MOD_DIR="$SCRIPT_DIR/mod" OUTPUT_DIR="$MOD_DIR/bin" # Find ONI installation ONI_PATH="${ONI_PATH:-}" if [ -z "$ONI_PATH" ]; then # Common paths for candidate in \ "$HOME/.local/share/Steam/steamapps/common/OxygenNotIncluded" \ "$HOME/Library/Application Support/Steam/steamapps/common/OxygenNotIncluded" \ "/c/Program Files (x86)/Steam/steamapps/common/OxygenNotIncluded" \ "/mnt/c/Program Files (x86)/Steam/steamapps/common/OxygenNotIncluded"; do if [ -d "$candidate" ]; then ONI_PATH="$candidate" break fi done fi if [ -z "$ONI_PATH" ]; then echo "[!] ONI installation not found. Set ONI_PATH environment variable." echo " export ONI_PATH=/path/to/OxygenNotIncluded" exit 1 fi echo "[Build] ONI path: $ONI_PATH" # Check required DLLs GAME_DLLS=( "$ONI_PATH/Assembly-CSharp.dll" "$ONI_PATH/Assembly-CSharp-firstpass.dll" "$ONI_PATH/UnityEngine.dll" "$ONI_PATH/UnityEngine.CoreModule.dll" "$ONI_PATH/0Harmony.dll" ) for dll in "${GAME_DLLS[@]}"; do if [ ! -f "$dll" ]; then echo "[!] Required DLL not found: $dll" exit 1 fi done echo "[Build] Found all required DLLs" mkdir -p "$OUTPUT_DIR" # Compile mcs -target:library \ -out:"$OUTPUT_DIR/ONIAgentBridge.dll" \ -reference:"$ONI_PATH/Assembly-CSharp.dll" \ -reference:"$ONI_PATH/Assembly-CSharp-firstpass.dll" \ -reference:"$ONI_PATH/UnityEngine.dll" \ -reference:"$ONI_PATH/UnityEngine.CoreModule.dll" \ -reference:"$ONI_PATH/0Harmony.dll" \ -recurse:"$MOD_DIR/*.cs" echo "[Build] Compilation successful!" echo "[Build] Output: $OUTPUT_DIR/ONIAgentBridge.dll" echo "" echo "To install: copy $OUTPUT_DIR/ONIAgentBridge.dll and $MOD_DIR/mod_info.yaml" echo " to your ONI mods/local/ONIAgentBridge/ directory"