From ead5105070b4358ad9b8a8648e8d82b844466e73 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Wed, 18 Dec 2019 18:31:08 +0100 Subject: [PATCH] Add Check ammo self interaction setting (#7306) --- addons/reload/CfgVehicles.hpp | 11 ++++++++++ addons/reload/XEH_PREP.hpp | 1 + addons/reload/XEH_postInit.sqf | 2 +- addons/reload/XEH_preInit.sqf | 2 ++ .../reload/functions/fnc_canCheckAmmoSelf.sqf | 20 +++++++++++++++++++ addons/reload/initSettings.sqf | 9 +++++++++ addons/reload/stringtable.xml | 8 ++++++++ 7 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 addons/reload/functions/fnc_canCheckAmmoSelf.sqf create mode 100644 addons/reload/initSettings.sqf diff --git a/addons/reload/CfgVehicles.hpp b/addons/reload/CfgVehicles.hpp index fe1e9672e6..f6723510e0 100644 --- a/addons/reload/CfgVehicles.hpp +++ b/addons/reload/CfgVehicles.hpp @@ -1,6 +1,17 @@ class CfgVehicles { class Man; class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class GVAR(checkAmmo) { + displayName = CSTRING(checkAmmo); + condition = QUOTE(GVAR(showCheckAmmoSelf) && {_player call FUNC(canCheckAmmoSelf)}); + statement = QUOTE(call FUNC(checkAmmo)); + exceptions[] = {"isNotInside", "isNotSwimming", "isNotSitting"}; + }; + }; + }; + class ACE_Actions { class ACE_Weapon { class GVAR(LinkBelt) { diff --git a/addons/reload/XEH_PREP.hpp b/addons/reload/XEH_PREP.hpp index f2b386ac37..0a7fd80fbb 100644 --- a/addons/reload/XEH_PREP.hpp +++ b/addons/reload/XEH_PREP.hpp @@ -1,5 +1,6 @@ PREP(canCheckAmmo); +PREP(canCheckAmmoSelf); PREP(getAmmoToLinkBelt); PREP(checkAmmo); PREP(displayAmmo); diff --git a/addons/reload/XEH_postInit.sqf b/addons/reload/XEH_postInit.sqf index 3e1b95f9bf..26f7f303ff 100644 --- a/addons/reload/XEH_postInit.sqf +++ b/addons/reload/XEH_postInit.sqf @@ -8,7 +8,7 @@ if (!hasInterface) exitWith {}; // Conditions: canInteract if !([ACE_player, vehicle ACE_player, ["isNotInside", "isNotSwimming", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !(ACE_player call CBA_fnc_canUseWeapon || {(vehicle ACE_player) isKindOf "StaticWeapon"}) exitWith {false}; + if !(ACE_player call FUNC(canCheckAmmoSelf)) exitWith {false}; // Ignore if controlling UAV (blocks radar keybind) if (!isNull (ACE_controlledUAV param [0, objNull])) exitWith {false}; diff --git a/addons/reload/XEH_preInit.sqf b/addons/reload/XEH_preInit.sqf index b47cf6628d..9361d05015 100644 --- a/addons/reload/XEH_preInit.sqf +++ b/addons/reload/XEH_preInit.sqf @@ -6,4 +6,6 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +#include "initSettings.sqf" + ADDON = true; diff --git a/addons/reload/functions/fnc_canCheckAmmoSelf.sqf b/addons/reload/functions/fnc_canCheckAmmoSelf.sqf new file mode 100644 index 0000000000..2c8c03dcce --- /dev/null +++ b/addons/reload/functions/fnc_canCheckAmmoSelf.sqf @@ -0,0 +1,20 @@ +#include "script_component.hpp" +/* + * Author: veteran29 + * Check if the player can check his own ammo. + * + * Arguments: + * 0: Player + * + * Return Value: + * Can check ammo + * + * Example: + * [cursorObject] call ace_reload_fnc_canCheckAmmoSelf + * + * Public: No + */ + +params ["_player"]; + +_player call CBA_fnc_canUseWeapon && {!((vehicle _player) isKindOf "StaticWeapon")} diff --git a/addons/reload/initSettings.sqf b/addons/reload/initSettings.sqf new file mode 100644 index 0000000000..bf692c20de --- /dev/null +++ b/addons/reload/initSettings.sqf @@ -0,0 +1,9 @@ + +[ + QGVAR(showCheckAmmoSelf), + "CHECKBOX", + [LSTRING(SettingShowCheckAmmoSelf), LSTRING(SettingShowCheckAmmoSelfDesc)], + localize ELSTRING(common,ACEKeybindCategoryWeapons), + false, // default value + 0 // isGlobal +] call CBA_fnc_addSetting; diff --git a/addons/reload/stringtable.xml b/addons/reload/stringtable.xml index b5419ebbf2..f78d8676b7 100644 --- a/addons/reload/stringtable.xml +++ b/addons/reload/stringtable.xml @@ -33,6 +33,14 @@ 在重新装填时检查新弹匣上的弹药. 在重新裝填時檢查新彈匣上的彈藥. + + Always show check ammo self interaction + Zawsze pokazuj interakcję od sprawdzania amunicji + + + Shows check ammo self interaction even when not in static weapons. + Pokazuje interakcję od sprawdzania amunicji poza bronią statyczną. + Check Ammo Munition prüfen