From ed1b865bbb41823c2cdbc3955090606c0c023f40 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Sun, 15 Dec 2019 17:34:04 +0100 Subject: [PATCH 1/2] Add Check ammo self interaction setting --- 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 fe1e9672e68..f6723510e09 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 f2b386ac37e..0a7fd80fbbb 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 3e1b95f9bf4..26f7f303ff4 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 b47cf6628db..9361d05015e 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 00000000000..2c8c03dccec --- /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 00000000000..297247f260c --- /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 + 2 // isGlobal +] call CBA_fnc_addSetting; diff --git a/addons/reload/stringtable.xml b/addons/reload/stringtable.xml index b5419ebbf29..f78d8676b7e 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 From c9846fa8891322042130195b1fc5e9ef43eba320 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Mon, 16 Dec 2019 00:21:22 +0100 Subject: [PATCH 2/2] Make showCheckAmmoSelf setting overridable --- addons/reload/initSettings.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/reload/initSettings.sqf b/addons/reload/initSettings.sqf index 297247f260c..bf692c20de4 100644 --- a/addons/reload/initSettings.sqf +++ b/addons/reload/initSettings.sqf @@ -5,5 +5,5 @@ [LSTRING(SettingShowCheckAmmoSelf), LSTRING(SettingShowCheckAmmoSelfDesc)], localize ELSTRING(common,ACEKeybindCategoryWeapons), false, // default value - 2 // isGlobal + 0 // isGlobal ] call CBA_fnc_addSetting;