Skip to content

Commit b59d8c0

Browse files
committed
feat(control-blocking): check if weapon wheel is currently active, if so, disable control actions
1 parent 475cf53 commit b59d8c0

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

MenuAPI/Menu.cs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ public struct ButtonPressHandler(Control control, Menu.ControlPressCheckType pre
585585
{
586586
// The control to listen for.
587587
internal Control control = control;
588-
// The type.
588+
// The type.
589589
internal ControlPressCheckType pressType = pressType;
590590
// The function to call when the control is triggered.
591591
internal Action<Menu, Control> function = function;
@@ -927,12 +927,19 @@ public void RemoveMenuItem(MenuItem item)
927927
ClampPageIndex();
928928
}
929929

930+
private static bool IsWeaponWheelActive => IsHudComponentActive(19);
931+
930932
/// <summary>
931933
/// Triggers the <see cref="ItemSelectedEvent(MenuItem, int)"/> event function.
932934
/// </summary>
933935
/// <param name="index"></param>
934936
public void SelectItem(int index)
935937
{
938+
if (IsWeaponWheelActive)
939+
{
940+
return;
941+
}
942+
936943
var items = ActiveItems;
937944

938945
if (index > -1 && items.Count - 1 >= index)
@@ -947,7 +954,7 @@ public void SelectItem(int index)
947954
/// <param name="index"></param>
948955
public void SelectItem(MenuItem item)
949956
{
950-
if (item == null)
957+
if (item == null || IsWeaponWheelActive)
951958
{
952959
return;
953960
}
@@ -979,6 +986,11 @@ public void SelectItem(MenuItem item)
979986
/// </summary>
980987
public void GoBack()
981988
{
989+
if (IsWeaponWheelActive)
990+
{
991+
return;
992+
}
993+
982994
PlaySoundFrontend(-1, "BACK", "HUD_FRONTEND_DEFAULT_SOUNDSET", false);
983995
CloseMenu();
984996
ParentMenu?.OpenMenu();
@@ -1012,7 +1024,7 @@ public void OpenMenu()
10121024
/// </summary>
10131025
public void GoUp()
10141026
{
1015-
if (!Visible || Size < 2)
1027+
if (!Visible || Size < 2 || IsWeaponWheelActive)
10161028
{
10171029
return;
10181030
}
@@ -1047,7 +1059,7 @@ public void GoUp()
10471059
/// </summary>
10481060
public void GoDown()
10491061
{
1050-
if (!Visible || Size < 2)
1062+
if (!Visible || Size < 2 || IsWeaponWheelActive)
10511063
{
10521064
return;
10531065
}
@@ -1081,7 +1093,7 @@ public void GoDown()
10811093
/// </summary>
10821094
public void GoLeft()
10831095
{
1084-
if (!MenuController.AreMenuButtonsEnabled)
1096+
if (!MenuController.AreMenuButtonsEnabled || IsWeaponWheelActive)
10851097
{
10861098
return;
10871099
}
@@ -1109,7 +1121,7 @@ public void GoLeft()
11091121
/// </summary>
11101122
public void GoRight()
11111123
{
1112-
if (!MenuController.AreMenuButtonsEnabled)
1124+
if (!MenuController.AreMenuButtonsEnabled || IsWeaponWheelActive)
11131125
{
11141126
return;
11151127
}

0 commit comments

Comments
 (0)