38 lines
949 B
C#
38 lines
949 B
C#
using HarmonyLib;
|
|
using System;
|
|
|
|
namespace CustomCosmeticLoader.Patches
|
|
{
|
|
[HarmonyPatch(typeof(MarbleController))]
|
|
[HarmonyPatch("ApplyMyCosmetics")]
|
|
internal class MarbleControllerApplyMyCosmeticsPatch
|
|
{
|
|
private static Cosmetic mirageSkin = null;
|
|
|
|
[HarmonyPostfix]
|
|
static void Postfix(MarbleController __instance)
|
|
{
|
|
if (mirageSkin == null)
|
|
{
|
|
// We hijack one skin (Mirage) since it's one of the basic skins with no animations/different UVs/etc
|
|
foreach (Cosmetic skin in CosmeticManager.Skins)
|
|
{
|
|
if (skin.Id == "Swirl_M")
|
|
{
|
|
mirageSkin = skin;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (mirageSkin == null) //whut
|
|
return;
|
|
}
|
|
|
|
MarbleHolder mHolder = __instance.MHolder;
|
|
string actualSkinId = mHolder.CosmeticSet.skin;
|
|
mHolder.SetMarble(mirageSkin);
|
|
// Setting the skin id here allows others in multiplayer/replays to see your normal skin
|
|
mHolder.CosmeticSet.skin = actualSkinId;
|
|
}
|
|
}
|
|
}
|