You are viewing a potentially older version of this package. View all versions.
Brynzananas-Body_Model_Additions_API-1.3.0 icon

Body Model Additions API

Adds a system to load custom objects onto characters in game and in lobby. Model additions can require selected skins, skills, skins and skills or custom condition.

Date uploaded 2 weeks ago
Version 1.3.0
Download link Brynzananas-Body_Model_Additions_API-1.3.0.zip
Downloads 5823
Dependency string Brynzananas-Body_Model_Additions_API-1.3.0

This mod requires the following mods to function

RiskofThunder-HookGenPatcher-1.2.5 icon
RiskofThunder-HookGenPatcher

MMHOOK generation at runtime.

Preferred version: 1.2.5

README

How to use

Create a new "ModelPart" using its initialiser. 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.

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.

ModelPartInfo:

public class ModelPartInfo()
{
    public string bodyName = ""; //Body name of the charater you want to add model part to
    public GameObject gameObject = null; //Prefab of your model part
    public string inputString = ""; // string to find where to place your model part. If it's  "", then it will be placed alongside your body model
    public bool trueToChildLocatorFalseToFindString = true; // If "trueToChildLocatorFalseToFindString" is true: you input Child Locator transform name in inputString. if false: you input transform find string in inputString
    public SkinDef skinDef = null; // Skin condition. Checks for a selected skin if the value is not null
    public SkillDef skillDef = null; // Skill condition. Checks for a selected skill if the value is not null
    public ModelPart modelPartOverride = null; // Prevents other model part from from applying
    public CodeAfterApplying codeAfterApplying = null; // Void delegate to run after model part instantiation
    public CustomCondition customCondition = null; // Boolean delegate for a custom condition if it's not null
    public ModelPartLocation modelPartLocation = ModelPartLocation.All; // Pick where model part apepars: Lobby, Game or All
}

After you created your ModelPartInfo initialize your ModelPart using it:

new ModelPart(ModelPartInfo);

TODO

Add Child Locator with all bones to all display prefabs. Currently only Commando has one with "Head" and "Chest" bones

CHANGELOG

1.4.3

  • Added body name null checkers

  • Removed log debuggers

1.4.2

  • Properly removes deleted renderer infos from Character Model

1.4.1

  • Child Locator generator now generates missing transform pairs for objects that already have Child Locator coponent

  • Improved moment of parts addition

  • Added an event that invokes before applying model parts

1.4.0

  • Generates Child Locator with valid transform pair entries for all survivors display prefabs that do not have them

  • Added "skinName" field to MdelPart, allowing to make a skin requirement using a simple string of skinDef name instead of its scriptable object asset

1.3.0

  • Made a ModelPartInfo class for a friendlier ModelPart initialisation

1.2.0

  • Added the model parts addition method to Character Model Start method if Character Model doesn't have Model Skin Controller component

1.1.1

  • Added a "null check" for an instantiated object to prevent delegate from freaking

1.1.0

  • Added custom condition delegate and an option to use find string instead of child locator bone.

  • Added ActivePartsComponent output to CodeAfterInitialisation delegate.

  • Added a method that's just the ModelPart class initializer but a method

  • Added more null checks