Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip attachment switch inside vehicles #1288

Merged
merged 1 commit into from
Feb 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions addons/accessory/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "script_component.hpp"

if (!hasInterface) exitWith {};

#include "XEH_PREP.sqf"

[ELSTRING(common,WeaponsCategory), "MRT_SwitchItemNextClass_R", [LSTRING(railNext), LSTRING(railNext_tooltip)], {
[1, "next"] call FUNC(switchAttachment) // return
}, {}, [DIK_L, [false, true, false]]] call CBA_fnc_addKeybind;

[ELSTRING(common,WeaponsCategory), "MRT_SwitchItemPrevClass_R", [LSTRING(railPrev), LSTRING(railPrev_tooltip)], {
[1, "prev"] call FUNC(switchAttachment) // return
}, {}, [DIK_L, [true, false, false]]] call CBA_fnc_addKeybind;

[ELSTRING(common,WeaponsCategory), "MRT_SwitchItemNextClass_O", [LSTRING(opticNext), LSTRING(opticNext_tooltip)], {
[2, "next"] call FUNC(switchAttachment) // return
}, {}, [DIK_SUBTRACT, [false, true, false]]] call CBA_fnc_addKeybind;

[ELSTRING(common,WeaponsCategory), "MRT_SwitchItemPrevClass_O", [LSTRING(opticPrev), LSTRING(opticPrev_tooltip)], {
[2, "prev"] call FUNC(switchAttachment) // return
}, {}, [DIK_SUBTRACT, [true, false, false]]] call CBA_fnc_addKeybind;
8 changes: 0 additions & 8 deletions addons/accessory/XEH_preInitClient.sqf

This file was deleted.

2 changes: 1 addition & 1 deletion addons/accessory/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ class Extended_PreStart_EventHandlers {

class Extended_PreInit_EventHandlers {
class ADDON {
clientInit = QUOTE(call COMPILE_FILE(XEH_preInitClient));
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
4 changes: 3 additions & 1 deletion addons/accessory/fnc_switchAttachment.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ private ["_currItem", "_switchItem"];
private _unit = call CBA_fnc_currentUnit;
private _cw = currentWeapon _unit;

if !(_unit call CBA_fnc_canUseWeapon) exitWith {false};

private _currWeaponType = call {
if (_cw == "") exitWith {_currItem = ""; -1};
if (_cw == primaryWeapon _unit) exitWith {_currItem = (primaryWeaponItems _unit) select _itemType; 0};
Expand All @@ -36,7 +38,7 @@ private _currWeaponType = call {
_currItem = "";
-1
};
if (_currWeaponType < 0) exitWith { false };
if (_currWeaponType < 0) exitWith {false};

#define __cfgWeapons configfile >> "CfgWeapons"
#define __currItem __cfgWeapons >> _currItem
Expand Down
2 changes: 2 additions & 0 deletions addons/accessory/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
#endif

#include "\x\cba\addons\main\script_macros.hpp"

#include "\a3\ui_f\hpp\defineDIKCodes.inc"