From 0ba55d7c8cc9a8db400dc4d6d10e56d650fc7c1f Mon Sep 17 00:00:00 2001 From: DazedAnon Date: Tue, 14 Jul 2026 12:58:19 -0500 Subject: [PATCH] Initial Commit --- .gitattributes | 11 ++++++++++ .gitignore | 47 ++++++++++++++++++++++++++++++++++++++++++ IdleSpectator/Main.cs | 38 ++++++++++++++++++++++++++++++++++ IdleSpectator/mod.json | 7 +++++++ README.md | 31 ++++++++++++++++++++++++++++ scripts/verify-nml.sh | 45 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 179 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 IdleSpectator/Main.cs create mode 100644 IdleSpectator/mod.json create mode 100644 README.md create mode 100755 scripts/verify-nml.sh diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..b907dfb --- /dev/null +++ b/.gitattributes @@ -0,0 +1,11 @@ +* text=auto eol=lf + +*.cs text eol=lf +*.json text eol=lf +*.md text eol=lf +*.sh text eol=lf +*.mdc text eol=lf + +*.png binary +*.dll binary +*.pdb binary diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b185a43 --- /dev/null +++ b/.gitignore @@ -0,0 +1,47 @@ +# Cursor / local agent config (machine-specific; do not publish) +.cursor/ + +# Build / IDE +bin/ +obj/ +out/ +[Bb]uild/ +[Dd]ebug/ +[Rr]elease/ +*.userconfig +*.user +*.suo +*.userosscache +*.sln.docstates +.vs/ +.idea/ +*.DotSettings.user +*.rsuser + +# Compiled artifacts (NML compiles from source; keep repo source-only) +*.dll +*.pdb +*.mdb +*.exe +*.cache +*.ilk +*.ncb +*.opendb +*.ipch + +# OS junk +.DS_Store +Thumbs.db +desktop.ini +*~ + +# Logs / temp +*.log +*.tmp +*.temp +/tmp/ + +# Local tooling (portable SDKs, decomp dumps, etc.) +.dotnet/ +.local/ +*.decompiled.cs diff --git a/IdleSpectator/Main.cs b/IdleSpectator/Main.cs new file mode 100644 index 0000000..0d50df5 --- /dev/null +++ b/IdleSpectator/Main.cs @@ -0,0 +1,38 @@ +using UnityEngine; +using NeoModLoader.api; +using NeoModLoader.services; + +namespace IdleSpectator; + +/// +/// Phase 1 entry point: prove NeoModLoader loads this mod. +/// Camera / WorldLog / MoveCamera work belongs in a later phase. +/// +public class ModClass : MonoBehaviour, IMod +{ + private ModDeclare _declare; + private GameObject _gameObject; + + public ModDeclare GetDeclaration() + { + return _declare; + } + + public GameObject GetGameObject() + { + return _gameObject; + } + + public string GetUrl() + { + return ""; + } + + public void OnLoad(ModDeclare pModDecl, GameObject pGameObject) + { + _declare = pModDecl; + _gameObject = pGameObject; + // OnLoad -> Awake -> OnEnable -> Start -> Update + LogService.LogInfo($"[{pModDecl.Name}]: Hello World!"); + } +} diff --git a/IdleSpectator/mod.json b/IdleSpectator/mod.json new file mode 100644 index 0000000..65e54fc --- /dev/null +++ b/IdleSpectator/mod.json @@ -0,0 +1,7 @@ +{ + "name": "IdleSpectator", + "author": "dazed", + "version": "0.1.0", + "description": "Phase 1 Hello World - AFK camera spectator coming later.", + "GUID": "com.dazed.idlespectator" +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..54b7803 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# IdleSpectator + +WorldBox NeoModLoader mod: AFK camera spectator (Phase 1 Hello World is working). + +## Layout + +- `IdleSpectator/` - mod source (`mod.json`, `Main.cs`) loaded by NML +- `scripts/verify-nml.sh` - checks that the Hello World line appears in Player.log + +## Game API notes (for later spectator work) + +Useful real types (not placeholders): `MoveCamera`, `WorldLog` / `WorldLogMessage`, `WarManager`, `BattleKeeperManager`, `Actor`, `MapBox` (`locatePosition`, `locateAndFollow`). + +## Deploy + +Symlink the mod into the game Mods folder (already done on this machine): + +```bash +ln -sfn "$(pwd)/IdleSpectator" \ + "$HOME/.local/share/Steam/steamapps/common/worldbox/Mods/IdleSpectator" +``` + +Requires NeoModLoader in `worldbox_Data/StreamingAssets/mods/` and **Experimental Mode** enabled in Settings. + +## Verify + +```bash +./scripts/verify-nml.sh +``` + +Look for: `[NML]: [IdleSpectator]: Hello World!` diff --git a/scripts/verify-nml.sh b/scripts/verify-nml.sh new file mode 100755 index 0000000..d64ea05 --- /dev/null +++ b/scripts/verify-nml.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# Verify IdleSpectator Phase 1 load after Experimental Mode is enabled. +set -euo pipefail + +GAME="/home/dazed/.local/share/Steam/steamapps/common/worldbox" +LOG="/home/dazed/.config/unity3d/mkarpenko/WorldBox/Player.log" +NML="$GAME/worldbox_Data/StreamingAssets/mods/NeoModLoader.dll" +MOD="$GAME/Mods/IdleSpectator" + +echo "== Preflight ==" +[[ -f "$NML" ]] && echo "OK NeoModLoader.dll" || { echo "MISSING NML"; exit 1; } +[[ -e "$MOD/mod.json" ]] && echo "OK IdleSpectator mod.json" || { echo "MISSING mod"; exit 1; } +[[ -e "$MOD/Main.cs" ]] && echo "OK IdleSpectator Main.cs" || { echo "MISSING Main.cs"; exit 1; } + +echo +echo "Enable Experimental Mode in WorldBox Settings (bottom of the list)," +echo "then fully restart the game. This script waits for the Hello World log." +echo + +if [[ ! -f "$LOG" ]]; then + echo "Waiting for Player.log (launch the game)..." +fi + +deadline=$((SECONDS + 300)) +while (( SECONDS < deadline )); do + if [[ -f "$LOG" ]] && rg -q "IdleSpectator.*Hello World|\\[IdleSpectator\\]: Hello World" "$LOG"; then + echo + echo "SUCCESS: Hello World found in Player.log" + rg -i "IdleSpectator|NeoModLoader|Experimental mode is enabled|Hello World" "$LOG" | tail -40 + exit 0 + fi + if [[ -f "$LOG" ]] && rg -q "Experimental mode is enabled|Attempting to load.*NeoModLoader" "$LOG"; then + echo "NML activity detected; still waiting for IdleSpectator Hello World..." + rg -i "NeoModLoader|IdleSpectator|Experimental|Attempting to load|error|exception" "$LOG" | tail -20 + fi + sleep 2 +done + +echo "TIMEOUT: no Hello World within 5 minutes." +echo "Check: Experimental Mode on, then full restart." +if [[ -f "$LOG" ]]; then + echo "--- recent log matches ---" + rg -i "mod|experimental|NML|IdleSpectator|error" "$LOG" | tail -40 || true +fi +exit 1