Lethal Company
You are viewing a potentially older version of this package. View Latest Version
Install

Details

Date Uploaded
19 hours ago
Downloads
160K
Size
39KB
Dependency string
Sniper1_1-MaterialAssetRestorerCore-2.0.0

MaterialAssetRestorerCore

Moon and interior devs are likely familiar with how poorly the certain assets rip when trying to design their levels. I made this tool to attempt to restore some at runtime. It can access materials both from within the vanilla prefabs and scenes. (My thread in the LC Modding Discord)

This mod works by searching through a moon after it is loaded to replace the broken ones from modded moons/interiors with the corresponding one from vanilla. API specs and example useage below.

NOTE: IN ORDER TO ACCESS VANILLA MATERIALS FROM SCENES, THEY ARE BRIEFLY LOADED DURING StartOfRound. FROM MY TESTING THIS DID NOT CAUSE MAJOR PERMANENT ISSUES.

API Docs For Devs

Create a json file (or multiple) with the format and in the direcotry shown below. Each json contains a list of MaterialSets. A MaterialSet is made up of a BaseMaterial, which is the name of the material in the vanilla game, and a ReplaceMaterial, which is the name of the material in your mod. Often these will likely be the same name, but they don't have to be. You must also specify either a PrefabName or a SceneName so that this tool knows where to look to find the BaseMaterial.

Additionally, the fields MaterialSource and MaterialDestination may be supplied but are optional. They accept the following options: Renderer (default if field ommitted), TerrainDetails, ParticleSystem and VFX (VFX must pair with VFX and is based on what is set in the visual effect component's "Asset Template" field in the Unity editor). The source and destination type is used to specify what type of thing you are attempting to pull out of and replace into, respectively.

{
    "MaterialSets": [
        {
            "BaseMaterial" : "gamematerial",
            "ReplaceMaterial" : "yourmaterial",
            "PrefabName" : "gameprefab",
            "MaterialSource" : "Renderer",
            "MaterialDestination" : "Renderer"
        },
        {
            "BaseMaterial" : "gamematerial",
            "ReplaceMaterial" : "yourmaterial",
            "SceneName" : "gamescene",
            "MaterialSource" : "ParticleSystem",
            "MaterialDestination" : "ParticleSystem"
        }
    ]
}

Project Heirarchy (NOTE: YOU MUST PLACE THE JSON FILE IN THE plugins/MaterialReplacements/ FOLDER FOR THIS TO WORK):

YourMod/
├── plugins/
│   └── MaterialReplacements/
|       └── YourJSON.json
├── README.md
├── manifest.json
├── icon.png
├── CHANGELOG.md (optional)
└── LICENSE.md (optional)

Example Usecase

WaterAssetRestorer

Before

Without

After

with

Credits

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.