This commit is contained in:
DavidOnTop 2024-01-22 19:25:38 +01:00
parent d2176afff9
commit ecb2998462
No known key found for this signature in database
GPG key ID: FAB914DDC2F180EB
4 changed files with 53 additions and 12 deletions

View file

@ -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 <module> <key>");
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<Speed>();
AddModule<JumpHeight>();
AddModule<InstantDmg>();
AddModule<SwimSpeed>();
}
private void AddModule<T>() where T : Module, new() {