#!/usr/bin/env bash # ONI Agent - Auto Repair Script # Detects game connection issues and attempts to restart the Mod bridge. set -euo pipefail CONFIG_PATH="$(dirname "$0")/../config.json" HOST=$(python3 -c "import json; print(json.load(open('$CONFIG_PATH'))['modHost'])") PORT=$(python3 -c "import json; print(json.load(open('$CONFIG_PATH'))['modPort'])") TIMEOUT=$(python3 -c "import json; print(json.load(open('$CONFIG_PATH'))['timeout'])") check_health() { curl -sf --max-time "$TIMEOUT" "http://$HOST:$PORT/health" > /dev/null 2>&1 } echo "[ONI Agent] Checking Mod connection..." if check_health; then echo "[OK] Mod is running on $HOST:$PORT" exit 0 else echo "[!] Cannot reach Mod at $HOST:$PORT" echo " Make sure Oxygen Not Included is running with the ONI Agent Bridge mod enabled." echo " Steps:" echo " 1. Launch Oxygen Not Included" echo " 2. Enable 'ONI Agent Bridge' mod in the Mod menu" echo " 3. Load a save or start a new game" echo " 4. Run this script again" exit 1 fi