Skip to content

Commit

Permalink
chore: update SetupKeybindCallbacks (#30)
Browse files Browse the repository at this point in the history
Release-as: 1.4.6
  • Loading branch information
Hypick122 committed Mar 16, 2024
1 parent 45bd1da commit 8bedb4f
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions BetterShotgun/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,20 @@ private void Awake()

public void SetupKeybindCallbacks()
{
InputActionsInstance.ReloadKey.AddBinding($"<keyboard>/{SyncConfig.Default.ReloadKeybind.Value}");

if (SyncConfig.Default.ReloadKeybind.Value.Replace("<keyboard>/", "").ToLower() != "e")
try
{
if (SyncConfig.Default.ReloadKeybind.Value.ToLower() != "e")
{
InputActionsInstance.ReloadKey.AddBinding($"<keyboard>/{SyncConfig.Default.ReloadKeybind.Value}");
InputActionsInstance.ReloadKey.performed += OnReloadKeyPressed;
Log.LogInfo(
$"ReloadKeybind is started using the {InputActionsInstance.ReloadKey.GetBindingDisplayString()} key");
}
}
catch (Exception e)

Check failure on line 70 in BetterShotgun/Plugin.cs

View workflow job for this annotation

GitHub Actions / Build

The type or namespace name 'Exception' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 70 in BetterShotgun/Plugin.cs

View workflow job for this annotation

GitHub Actions / Build

The type or namespace name 'Exception' could not be found (are you missing a using directive or an assembly reference?)
{
Log.LogInfo($"Start ReloadKeybind with key {InputActionsInstance.ReloadKey.GetBindingDisplayString()}");
InputActionsInstance.ReloadKey.performed += OnReloadKeyPressed;
Log.LogError("An error occurred while binding ReloadKeybind");
Log.LogError(e);
}
}

Expand Down

0 comments on commit 8bedb4f

Please sign in to comment.