miuu-custom-cosmetic-loader/Patches/MarbleControllerPatches.cs

30 lines
735 B
C#
Raw Normal View History

2023-08-26 17:59:50 -04:00
using HarmonyLib;
using System;
using UnityEngine;
2023-08-26 17:59:50 -04:00
namespace CustomCosmeticLoader.Patches
{
2023-09-02 23:19:35 -04:00
[HarmonyPatch(typeof(MarbleController), nameof(MarbleController.ApplyMyCosmetics))]
2023-08-26 17:59:50 -04:00
internal class MarbleControllerApplyMyCosmeticsPatch
{
[HarmonyPostfix]
static void Postfix(MarbleController __instance)
{
if (!Config.enabled)
return;
2023-09-03 02:06:53 -04:00
if (Config.skinNameToHijack == "*")
return;
2023-09-03 02:06:53 -04:00
if (Shared.SkinToHijack == null)
return;
2023-08-26 17:59:50 -04:00
MarbleHolder mHolder = __instance.MHolder;
string actualSkinId = mHolder.CosmeticSet.skin;
2023-09-03 02:06:53 -04:00
mHolder.SetMarble(Shared.SkinToHijack);
2023-08-26 17:59:50 -04:00
// Setting the skin id here allows others in multiplayer/replays to see your normal skin
mHolder.CosmeticSet.skin = actualSkinId;
}
}
}