Fix isCosmeticMenu setting
This commit is contained in:
parent
2c43db37b5
commit
6f7cf91d86
2 changed files with 25 additions and 3 deletions
25
Patches/CosmeticPanelPatches.cs
Normal file
25
Patches/CosmeticPanelPatches.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using HarmonyLib;
|
||||
using System;
|
||||
|
||||
namespace CustomCosmeticLoader.Patches
|
||||
{
|
||||
/*
|
||||
* Override the marble cosmetic to be the hijacked marble if configured to appear in cosmetic menu.
|
||||
*/
|
||||
[HarmonyPatch(typeof(CosmeticPanel), nameof(CosmeticPanel.SelectCosmetic), new Type[] { typeof(Cosmetic), typeof(CosmeticType), typeof(bool) })]
|
||||
internal class CosmeticPanelSelectCosmeticPatch
|
||||
{
|
||||
static void Postfix(CosmeticType ctype)
|
||||
{
|
||||
if (!Config.enabled)
|
||||
return;
|
||||
|
||||
if (ctype == CosmeticType.Skin && Config.inCosmeticMenu && Config.skinNameToHijack != "*")
|
||||
{
|
||||
MarbleHolder holder = CosmeticPanel.cosmHolder;
|
||||
holder.SetMarble(Shared.SkinToHijack);
|
||||
Shared.ApplyCustomTexture(holder.currentMarble);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,9 +33,6 @@ namespace CustomCosmeticLoader.Patches
|
|||
if (marbleObject.Id != Config.skinNameToHijack && Config.skinNameToHijack != "*")
|
||||
return;
|
||||
|
||||
if (!Config.inCosmeticMenu && __instance == CosmeticPanel.cosmHolder)
|
||||
return;
|
||||
|
||||
MarbleController controller = MarbleHolderValues.MbcField.GetValue(__instance) as MarbleController;
|
||||
if (controller == null)
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue