diff --git a/CruelMan/Modules/ModuleManager.cs b/CruelMan/Modules/ModuleManager.cs index aa90678..b31a8df 100644 --- a/CruelMan/Modules/ModuleManager.cs +++ b/CruelMan/Modules/ModuleManager.cs @@ -9,6 +9,22 @@ namespace CruelMan.Modules { public void Awake() { instance = this; AddModules(); + new Terminal.ConsoleCommand($"cmbind", "binds a module to a key", delegate (Terminal.ConsoleEventArgs args) { + if (args.Args.Length < 2) { + args.Context.AddString("Usage: cmbind "); + return; + } + string module = args.Args[1]; + string key = args.Args[2]; + foreach (Module m in modules) { + if (m.Command == module.ToLower()) { + m.bind = (KeyCode)System.Enum.Parse(typeof(KeyCode), key); + args.Context.AddString($"Bound {module} to {key}"); + return; + } + } + args.Context.AddString($"Module {module} not found"); + }); } public void Update() { @@ -27,6 +43,7 @@ namespace CruelMan.Modules { AddModule(); AddModule(); AddModule(); + AddModule(); } private void AddModule() where T : Module, new() { diff --git a/CruelMan/Modules/Modules/AddStamina.cs b/CruelMan/Modules/Modules/AddStamina.cs index b36b792..d13f217 100644 --- a/CruelMan/Modules/Modules/AddStamina.cs +++ b/CruelMan/Modules/Modules/AddStamina.cs @@ -9,25 +9,17 @@ namespace CruelMan.Modules { public override ModuleType Type => ModuleType.Stats; protected override void Init() { - AddSetting(); AddSetting(); AddSetting(); } protected override void OnDisable() {} protected override void OnEnable() {} protected override void OnUpdate() { - if (GetSetting().Value) { - FieldInfo fi = typeof(Player).GetField("m_stamina", BindingFlags.NonPublic | BindingFlags.Instance); - fi.SetValue(Player.m_localPlayer, GetSetting().Value); - } + FieldInfo fi = typeof(Player).GetField("m_stamina", BindingFlags.NonPublic | BindingFlags.Instance); + fi.SetValue(Player.m_localPlayer, GetSetting().Value); } } - public class NoChange : BooleanSetting { - public override string Name => "No Change"; - public override string Description => "Prevents stamina from changing"; - } - public class Stamina : NumberSetting { public override string Name => "Stamina"; public override string Description => "The amount of stamina to add"; diff --git a/CruelMan/Modules/Modules/SwimSpeed.cs b/CruelMan/Modules/Modules/SwimSpeed.cs new file mode 100644 index 0000000..8aa653a --- /dev/null +++ b/CruelMan/Modules/Modules/SwimSpeed.cs @@ -0,0 +1,33 @@ +using CruelMan.Modules.Settings; + +namespace CruelMan.Modules { + public class SwimSpeed : Module { + public override string Name => "Swim Speed"; + public override string Command => "swimspeed"; + public override string Description => "Sets the swim speed of the player"; + public override ModuleType Type => ModuleType.Movement; + public float oldSpeed = 0f; + + protected override void Init() { + AddSetting(); + } + + protected override void OnEnable() { + oldSpeed = Player.m_localPlayer.m_swimSpeed; + } + protected override void OnDisable() { + Player.m_localPlayer.m_swimSpeed = oldSpeed; + } + protected override void OnUpdate() { + Player.m_localPlayer.m_swimSpeed = GetSetting().Value; + } + } + + public class SSpeed : NumberSetting { + public override string Name => "Speed"; + public override string Description => "The speed to set the player to"; + public override float Min {get;set;} = 0; + public override float Max {get;set;} = 100; + public override float Value {get;set;} = 0; + } +} diff --git a/CruelMan/UI/MainUI.cs b/CruelMan/UI/MainUI.cs index 219f88a..20618df 100644 --- a/CruelMan/UI/MainUI.cs +++ b/CruelMan/UI/MainUI.cs @@ -10,7 +10,7 @@ namespace CruelMan.UI { public List openSettings = null; public Module openSettingsModule = null; - public Rect settingsWindow = new Rect(140, 10, 220, 600); + public Rect settingsWindow = new Rect(880, 10, 220, 600); public Rect ModuleMovementWindow = new Rect(10, 10, 200, 500); public Rect ModuleStatsWindow = new Rect(220, 10, 200, 500); @@ -22,7 +22,6 @@ namespace CruelMan.UI { return; } - // windowRect = GUI.Window(0, windowRect, MainWindow, "CruelMan"); ModuleMovementWindow = GUI.Window(0, ModuleMovementWindow, MainWindow, "Movement"); ModuleStatsWindow = GUI.Window(1, ModuleStatsWindow, MainWindow, "Stats"); ModuleCombatWindow = GUI.Window(2, ModuleCombatWindow, MainWindow, "Combat");