REPOSdk
Tools for mod developers.
模組介紹 作者原文
REPOSdk Documentation
REPOSdk is a lightweight modding helper library for the game REPO, built using BepInEx and Harmony. It provides utilities for interacting with core gameplay elements such as the player controller, health system, camera, and UI. This documentation covers all publicly accessible methods in the Sdk static class.
🧰 Core API: Sdk Class
All functionality is exposed via static methods in the Sdk class. No instantiation is required.
🕹️ Player & Avatar Interaction
GetControllerObject() → GameObject
Returns the primary Controller GameObject that manages player input and state.
⚠️ Ensure the player is loaded before calling this method.
GetController() → PlayerController
Retrieves the PlayerController component attached to the controller object.
GetAvatarController() → GameObject
Returns the in-game player avatar GameObject (the visible character model controlled by the player).
GetHealthComponent() → PlayerHealth
Fetches the PlayerHealth component from the player avatar, allowing access to health-related functionality.
Damage(int amount)
Inflicts damage on the player by the specified amount.
Parameters:
amount (int): The number of health points to subtract.
Behavior:
Calls Hurt(amount, false) on the player’s health component.
Safety:
If the player avatar is not found (e.g., during loading screens), logs a warning:
"Failed to take damage! Player not in game!"
📷 Camera Control
🟡 Beta Warning: Camera manipulation features are marked as!BETA! and may be unstable in future game updates.
GetGameCamera() → Camera
Returns the main gameplay camera (Camera Main).
UnlockGameCamera()
Disables the game’s built-in camera control scripts:
Disables CameraPosition on the "Position" GameObject.
Disables CameraAim on the "Aim" GameObject.
Use this to freely manipulate the main camera via external mods or custom logic.
FixGameCamera()
Re-enables the game’s native camera control systems, restoring default behavior.
InitNewCamera(string name = "NewCamera", Transform parent = null)
Creates a new GameObject with a Camera component.
Parameters:
name: Name of the new camera GameObject (default: "NewCamera").
parent: Optional parent Transform to attach the camera to.
Side Effect:
Automatically registers the new camera in the internal camera list via InsertCameraToList().
⚠️ This camera is not automatically activated. Use SetupCamera() to switch to it.
SetupCamera(Camera camera)
Activates a custom camera and hides the default UI render layer.
Effects:
Enables the provided camera.
Deactivates the "Canvas" GameObject (GetGameRenderObject().SetActive(false)), which typically contains HUD elements.
Use Case: Full-screen custom camera views (e.g., cutscenes, debug views).
ResetGameCamera()
Restores the original game camera and UI:
Reactivates the "Canvas" GameObject (restoring HUD).
Disables all cameras previously added via InitNewCamera().
InsertCameraToList(Camera camera)
Registers a Camera instance into the internal tracking list.
Used internally by InitNewCamera(), but exposed for advanced use.
RemoveCameraFromList(Camera camera)
Removes a camera from the internal list.
Useful for cleanup (e.g., when destroying custom cameras).
🖼️ UI & Rendering
GetHUD() → GameObject
Returns the root HUD GameObject, typically containing health bars, ammo counters, etc.
GetGameRenderObject() → GameObject
Returns the "Canvas" GameObject — the root UI render layer in Unity.
This is the object toggled on/off when switching to a custom camera via SetupCamera().
📌 Usage Notes
All GameObject.Find(...) calls assume standard scene structure. If the game updates object names, these methods may fail.
Camera-related methods do not adjust culling masks, layers, or post-processing by default — handle those separately if needed.
The internal cameras collection is not thread-safe. Avoid concurrent access from multiple threads.
Always verify object existence (e.g., GetAvatarController()!= null) before performing critical operations.
✅ Example: Custom Camera Cutsc
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。
下面這些內容需要先安裝,否則該模組不會生效: