Skip to content
This repository was archived by the owner on Jan 24, 2023. It is now read-only.

Commit 4464aa0

Browse files
committed
Made hotkeys configurable.
1 parent f707dfa commit 4464aa0

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

ReModCE/Components/FlyComponent.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ internal class FlyComponent : ModComponent
3030
private Vector3 _originalGravity;
3131
private ConfigValue<bool> EnableFlyHotkey;
3232
private ConfigValue<bool> FlyViewpointBased;
33+
private ConfigValue<KeyCode> FlyHotkey;
3334

3435
private ReMenuButton _flySpeedButton;
3536

@@ -55,6 +56,12 @@ public FlyComponent()
5556
"Whether to use Player/Viewpoint Transform as forward/right vectors.");
5657
FlyViewpointBased.OnValueChanged += () => _viewpointFlyingToggle?.Toggle(FlyViewpointBased);
5758

59+
FlyHotkey = new ConfigValue<KeyCode>(
60+
nameof(FlyHotkey),
61+
KeyCode.F,
62+
"Fly Hotkey",
63+
"Hotkey to toggle fly mode.");
64+
5865
RiskyFunctionsManager.Instance.OnRiskyFunctionsChanged += allowed =>
5966
{
6067
if (_flyToggle != null)
@@ -204,7 +211,7 @@ private void HandleHotkeys()
204211
{
205212
if (!EnableFlyHotkey) return;
206213

207-
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.F))
214+
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(FlyHotkey))
208215
{
209216
if (!_flyEnabled)
210217
{

ReModCE/Components/HighlightsComponent.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ internal class HighlightsComponent : ModComponent
2020
private ConfigValue<Color> FriendsColor;
2121
private ConfigValue<Color> OthersColor;
2222
private ConfigValue<bool> ESPEnabled;
23+
private ConfigValue<KeyCode> ESPHotkey;
2324

2425
private ReMirroredWingToggle _espMirroredToggle;
2526
private ReMenuToggle _espToggle;
@@ -34,6 +35,8 @@ public HighlightsComponent()
3435
ESPEnabled = new ConfigValue<bool>(nameof(ESPEnabled), false);
3536
ESPEnabled.OnValueChanged += () => _espToggle.Toggle(ESPEnabled);
3637

38+
ESPHotkey = new ConfigValue<KeyCode>(nameof(ESPHotkey), KeyCode.E);
39+
3740
RiskyFunctionsManager.Instance.OnRiskyFunctionsChanged += allowed =>
3841
{
3942
if (_espToggle != null)
@@ -117,7 +120,7 @@ private void HighlightPlayer(Player player, bool highlighted)
117120

118121
public override void OnUpdate()
119122
{
120-
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.E))
123+
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(ESPHotkey))
121124
{
122125
ESPEnabled.SetValue(!ESPEnabled);
123126
}

ReModCE/Components/ThirdPersonComponent.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,15 @@ internal class ThirdPersonComponent : ModComponent
2525
private ConfigValue<bool> EnableThirdpersonHotkey;
2626
private ReMenuToggle _hotkeyToggle;
2727

28+
private ConfigValue<KeyCode> ThirdpersonHotkey;
29+
2830
public ThirdPersonComponent()
2931
{
3032
EnableThirdpersonHotkey = new ConfigValue<bool>(nameof(EnableThirdpersonHotkey), true);
3133
EnableThirdpersonHotkey.OnValueChanged += () => _hotkeyToggle.Toggle(EnableThirdpersonHotkey);
34+
35+
ThirdpersonHotkey = new ConfigValue<KeyCode>(nameof(ThirdpersonHotkey), KeyCode.T);
36+
3237
RiskyFunctionsManager.Instance.OnRiskyFunctionsChanged += allowed =>
3338
{
3439
if (!allowed)
@@ -84,7 +89,7 @@ private void HandleHotkeys()
8489
{
8590
if (!EnableThirdpersonHotkey) return;
8691

87-
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.T))
92+
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(ThirdpersonHotkey))
8893
{
8994
var mode = _cameraSetup;
9095
if (++mode > ThirdPersonMode.Front)

0 commit comments

Comments
 (0)