BUTR / BUTR/Bannerlord.ButterLib
Hotkeys with custom category not working?
- Dominant language
- C#
- Stars
- 28
- Forks
- 9
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
Hi, I'm working on converting all my cheat hotkeys to ButterLib's hotkey implementation.
Unfortunately I am unable to create a custom hotkey category. Whenever I try to set a custom category, the hotkeys do not show up or the game freezes on opening the options menu.
I was trying to do something like this:
```
public class SubModule : MBSubModuleBase
{
protected override void OnBeforeInitialModuleScreenSetAsRoot()
{
base.OnBeforeInitialModuleScreenSetAsRoot();
var manager = HotKeyManager.CreateWithOwnCategory("BannerlordCheats", "Cheats");
manager.Add();
manager.Build();
}
...
}
```
```
public class AddMoneyHotkey : HotKeyBase
{
public AddMoneyHotkey() : base(nameof(AddMoneyHotkey))
{
this.Category = "Cheats";
this.DisplayName = "Add 1.000 Gold";
this.DefaultKey = InputKey.F10;
this.Description = "...";
this.Predicate = () => ScreenManager.TopScreen is GauntletInventoryScreen;
}
protected override string DisplayName { get; }
protected override string Description { get; }
protected override InputKey DefaultKey { get; }
protected override string Category { get; }
...
}
```
Am I missing something?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing HotKeyManager.CreateWithOwnCategory, HotKeyManager.Build, and the HotKeyBase category properties used in the reported SubModule and AddMoneyHotkey examples. Reproduce the custom category setup, check whether the hotkeys appear in the options menu without freezing, and confirm that the custom category works as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100