Body Model Additions API
Adds a system for developers to load custom objects onto characters in game and in lobby. Model additions can require selected skins, skills, skins and skills or custom condition.
模組介紹 作者原文
How to use
Create a new Scriptable Object "ModelPartDef". You need to input a body name and an object you want to add to the body. You can input bone name of the Child Locator or find string to place object there, skin and skill required for object to be spawned, existing ModelPart to override it, delegate to run after model part instantiating, delegate for custom condition. You can subscribe to "beforeApplyingEvent" event that invokes before applying model parts.
After you created yout model part def run "Register" method or add it to "modelParsDefs" list
This can also add new skinned objects that deform with the main armature if you change bones to match main armature using a delegate. (No example yet sorry!)
CodeAfterApplying delegate gives you your object as "modelObject", ChildLocator of the body (make sure to null check it before using it), CharacterModel of the body and ActiveBodyParts component.
If you are gonna add components in this delegate please add them to the components list in the ActivePartsComponent component from the given delegate.
CustomCondition gives you CharacterModel of your body.
ModelPartDef:
ModelPartDef modelPartDef = ScriptableObject.CreateInstance()
modelPartDef.bodyName = ""; //Body name of the charater you want to add model part to
modelPartDef.gameObject = null; //Prefab of your model part
modelPartDef.inputString = ""; // string to find where to place your model part. If it's "", then it will be placed alongside your body model
modelPartDef.trueToChildLocatorFalseToFindString = true; // If "trueToChildLocatorFalseToFindString" is true: you input Child Locator transform name in inputString. if false: you input transform find string in inputString
modelPartDef.skinDef = null; // Skin condition. Checks for a selected skin if the value is not null
modelPartDef.position = Vector.zero; //Place instantiated gameObjected
modelPartDef.rotation = Vector.zero; //Rotate instantiated gameObjected
modelPartDef.scale = Vector.one; //Scale instantiated gameObjected
modelPartDef.skinName = ""; // String skin condition by its name if skinDef condition is null.
modelPartDef.skillDef = null; // Skill condition. Checks for a selected skill if the value is not null
modelPartDef.modelPartOverride = null; // Prevents other model part from from applying
modelPartDef.CodeAfterApplying codeAfterApplying = null; // Void delegate to run after model part instantiation
modelPartDef.CustomCondition customCondition = null; // Boolean delegate for a custom condition if it's not null
modelPartDef.ModelPartLocation modelPartLocation = ModelPartLocation.All; // Pick where model part appears: Lobby, Game or All
After you created your ModelPartDef run "Register" method:
modelPartDef.Register();
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。
下面這些內容需要先安裝,否則該模組不會生效: