ScalerCore
Scaling library for shrink and grow mods in R.E.P.O. Handles physics, audio, NavMesh, animation, colliders, and sync. Enemies, players, valuables, items, carts, doors. Vehicles stay drivable and pocke
截圖 共 1 張
模組介紹 作者原文
ScalerCore
A scaling library for R.E.P.O. modders. Handles the hard parts of scaling game objects -- physics, audio, animation, colliders, NavMesh, multiplayer sync -- so you don't have to.
A note from Vippy
After way too long of a break, I'm finally back and working on these again:D Every one of my mods just got a full pass: bugs fixed, reports read, a few things I'd always meant to do. New builds and fixes land in Vippy's Discord before they hit, so come hang out. Thanks for sticking around.
v1.0.0: the API is stable. Growth is a first-class direction now, not just shrinking: enemies, players, and props grow as well as shrink, with the audio, reach, mass, and physics that sells the size. Grown enemies cap their physical footprint so they still fit the level, voices pitch with an intelligibility floor, and grown players hold items at arm's length. The public surface (ScaleManager, ScaleOptions, IScaleHandler) is stable for the 1.x line.
If you're building a mod that changes the size of things (shrink rays, growth potions, whatever), ScalerCore gives you a clean API and takes care of the edge cases.
This is a library, not a standalone mod. End users don't need to interact with it directly. If you're a player, you probably got here because a mod like ShrinkerGun: COMPRESSOR depends on it.
For modders building size-changing mechanics. If you're looking for a shrink ray, check out ShrinkerGun: COMPRESSOR which is built on ScalerCore.
Installation
Reference the API at compile time via NuGet (runtime stays, so exclude it from your output to avoid double-loading the DLL):
Then declare the runtime dependency: add Vippy-ScalerCore- to your manifest.json, and a hard dependency in your plugin:
[BepInDependency("Vippy.ScalerCore", BepInDependency.DependencyFlags.HardDependency)]
(Prefer a direct DLL reference? You can still ` ScalerCore.dll with Private="false"`. The NuGet package just adds the typed API and IntelliSense.)
ScalerCore automatically attaches ScaleController components to all enemies, players, valuables, items, carts, vehicles, cosmetic boxes, dead Semibot heads, the shop radio, and doors at runtime via Harmony patches. You don't need to add them yourself.
Quick Start
using ScalerCore;
// Shrink with default options (40% scale)
ScaleManager.Apply(targetGameObject);
// Shrink with custom options
var opts = ScaleOptions.Default;
opts.Factor = 0.5f;
opts.Duration = 60f;
ScaleManager.Apply(targetGameObject, opts);
// Restore with animation
ScaleManager.Restore(targetGameObject);
// Restore instantly (for bonk/damage reactions)
ScaleManager.RestoreImmediate(targetGameObject);
// Check state
bool tiny = ScaleManager.IsScaled(targetGameObject);
ScaleManager.Apply is host-authoritative. The host calls it, and RPCs propagate to all clients automatically. Late-joining players receive the current state on connect.
How It Works
ScalerCore attaches a ScaleController (a MonoBehaviourPunCallbacks) to every enemy, player, valuable, item, and door. On the first scale operation, the controller:
- Resolves a handler via ScaleHandlerRegistry based on what the object is
- Applies the target scale with a smooth animation (back-out easing for players, linear interpolation for objects)
- Adjusts physics (mass, grab force, collider radius), audio pitch, and NavMesh speed
- Syncs state to all clients via Photon RPCs
- Force-applies the target scale every LateUpdate to fight game code that resets localScale
Built-in handlers cover enemies, players, valuables, items, carts, and doors.
Custom Handlers
Implement IScaleHandler and register it with a predicate:
using ScalerCore;
using ScalerCore.Handlers;
public class MyBossHandler: IScaleHandler
{
public void Setup(ScaleController ctrl)
{
// Cache components, set ScaleTarget if the visual root
// is different from the physics root
}
public void OnScale(ScaleController ctrl)
{
// Called when the object is scaled down
}
publi
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。
下面這些內容需要先安裝,否則該模組不會生效: