Removed jump height

Added changable ragdoll button
Minor edits
This commit is contained in:
SDraw 2023-09-19 11:26:43 +03:00
parent 0fccd9e892
commit 6f9a278694
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
21 changed files with 59 additions and 86 deletions

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace ml_prm
@ -10,6 +9,7 @@ namespace ml_prm
public enum ModSetting
{
Hotkey = 0,
HotkeyKey,
VelocityMultiplier,
MovementDrag,
AngularDrag,
@ -26,6 +26,7 @@ namespace ml_prm
}
public static bool Hotkey { get; private set; } = true;
public static KeyCode HotkeyKey { get; private set; } = KeyCode.R;
public static float VelocityMultiplier { get; private set; } = 2f;
public static float MovementDrag { get; private set; } = 2f;
public static float AngularDrag { get; private set; } = 2f;
@ -41,6 +42,7 @@ namespace ml_prm
public static bool JumpRecover { get; private set; } = false;
static public event Action<bool> HotkeyChange;
static public event Action<KeyCode> HotkeyKeyChange;
static public event Action<float> VelocityMultiplierChange;
static public event Action<float> MovementDragChange;
static public event Action<float> AngularDragChange;
@ -60,26 +62,31 @@ namespace ml_prm
internal static void Init()
{
ms_category = MelonLoader.MelonPreferences.CreateCategory("PRM", null, true);
ms_category = MelonLoader.MelonPreferences.CreateCategory("PRM", "Player Ragdoll Mod");
ms_entries = new List<MelonLoader.MelonPreferences_Entry>()
{
ms_category.CreateEntry(ModSetting.Hotkey.ToString(), Hotkey),
ms_category.CreateEntry(ModSetting.VelocityMultiplier.ToString(), VelocityMultiplier),
ms_category.CreateEntry(ModSetting.MovementDrag.ToString(), MovementDrag),
ms_category.CreateEntry(ModSetting.AngularDrag.ToString(), AngularDrag),
ms_category.CreateEntry(ModSetting.Gravity.ToString(), Gravity),
ms_category.CreateEntry(ModSetting.PointersReaction.ToString(), PointersReaction),
ms_category.CreateEntry(ModSetting.IgnoreLocal.ToString(), IgnoreLocal),
ms_category.CreateEntry(ModSetting.CombatReaction.ToString(), CombatReaction),
ms_category.CreateEntry(ModSetting.AutoRecover.ToString(), AutoRecover),
ms_category.CreateEntry(ModSetting.RecoverDelay.ToString(), RecoverDelay),
ms_category.CreateEntry(ModSetting.Slipperiness.ToString(), Slipperiness),
ms_category.CreateEntry(ModSetting.Bounciness.ToString(), Bounciness),
ms_category.CreateEntry(ModSetting.ViewVelocity.ToString(), ViewVelocity),
ms_category.CreateEntry(ModSetting.JumpRecover.ToString(), JumpRecover)
ms_category.CreateEntry(ModSetting.Hotkey.ToString(), Hotkey, null, null, true),
ms_category.CreateEntry(ModSetting.HotkeyKey.ToString(), HotkeyKey, "Hotkey"),
ms_category.CreateEntry(ModSetting.VelocityMultiplier.ToString(), VelocityMultiplier, null, null, true),
ms_category.CreateEntry(ModSetting.MovementDrag.ToString(), MovementDrag, null, null, true),
ms_category.CreateEntry(ModSetting.AngularDrag.ToString(), AngularDrag, null, null, true),
ms_category.CreateEntry(ModSetting.Gravity.ToString(), Gravity, null, null, true),
ms_category.CreateEntry(ModSetting.PointersReaction.ToString(), PointersReaction, null, null, true),
ms_category.CreateEntry(ModSetting.IgnoreLocal.ToString(), IgnoreLocal, null, null, true),
ms_category.CreateEntry(ModSetting.CombatReaction.ToString(), CombatReaction, null, null, true),
ms_category.CreateEntry(ModSetting.AutoRecover.ToString(), AutoRecover, null, null, true),
ms_category.CreateEntry(ModSetting.RecoverDelay.ToString(), RecoverDelay, null, null, true),
ms_category.CreateEntry(ModSetting.Slipperiness.ToString(), Slipperiness, null, null, true),
ms_category.CreateEntry(ModSetting.Bounciness.ToString(), Bounciness, null, null, true),
ms_category.CreateEntry(ModSetting.ViewVelocity.ToString(), ViewVelocity, null, null, true),
ms_category.CreateEntry(ModSetting.JumpRecover.ToString(), JumpRecover, null, null, true)
};
ms_entries[(int)ModSetting.HotkeyKey].OnEntryValueChangedUntyped.Subscribe(OnMelonSettingSave_HotkeyKey);
Hotkey = (bool)ms_entries[(int)ModSetting.Hotkey].BoxedValue;
HotkeyKey = (KeyCode)ms_entries[(int)ModSetting.HotkeyKey].BoxedValue;
VelocityMultiplier = Mathf.Clamp((float)ms_entries[(int)ModSetting.VelocityMultiplier].BoxedValue, 1f, 50f);
MovementDrag = Mathf.Clamp((float)ms_entries[(int)ModSetting.MovementDrag].BoxedValue, 0f, 50f);
AngularDrag = Mathf.Clamp((float)ms_entries[(int)ModSetting.AngularDrag].BoxedValue, 0f, 50f);
@ -95,6 +102,15 @@ namespace ml_prm
JumpRecover = (bool)ms_entries[(int)ModSetting.JumpRecover].BoxedValue;
}
static void OnMelonSettingSave_HotkeyKey(object p_oldValue, object p_newValue)
{
if(p_newValue is KeyCode)
{
HotkeyKey = (KeyCode)p_newValue;
HotkeyKeyChange?.Invoke(HotkeyKey);
}
}
public static void SetSetting(ModSetting p_settings, object p_value)
{
switch(p_settings)