mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
AvatarScaleMod
This commit is contained in:
parent
c8cf2afd87
commit
214b05ff8e
7 changed files with 250 additions and 90 deletions
37
AvatarScale/Main.cs
Normal file
37
AvatarScale/Main.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using MelonLoader;
|
||||
|
||||
namespace NAK.AvatarScaleMod;
|
||||
|
||||
public class AvatarScaleMod : MelonMod
|
||||
{
|
||||
internal const string ParameterName = "AvatarScale";
|
||||
internal const float MinimumHeight = 0.25f;
|
||||
internal const float MaximumHeight = 2f;
|
||||
|
||||
public static readonly MelonPreferences_Category Category =
|
||||
MelonPreferences.CreateCategory(nameof(AvatarScaleMod));
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryEnabled =
|
||||
Category.CreateEntry("Enabled", true, description: "Should there be persistant avatar scaling? This only works properly on supported avatars.");
|
||||
|
||||
public static readonly MelonPreferences_Entry<float> HiddenAvatarScale =
|
||||
Category.CreateEntry("Last Avatar Scale", -1f, is_hidden: true);
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
ApplyPatches(typeof(HarmonyPatches.PlayerSetupPatches));
|
||||
}
|
||||
|
||||
void ApplyPatches(Type type)
|
||||
{
|
||||
try
|
||||
{
|
||||
HarmonyInstance.PatchAll(type);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LoggerInstance.Msg($"Failed while patching {type.Name}!");
|
||||
LoggerInstance.Error(e);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue