From 7f62067a7b89e18ccaa4aa8a0788672e26441a86 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Wed, 18 Dec 2019 18:30:53 +0100 Subject: [PATCH] Add Wipe glasses self interaction (#7307) --- AUTHORS.txt | 1 + addons/goggles/CfgVehicles.hpp | 14 ++++++++++++++ addons/goggles/XEH_PREP.hpp | 1 + addons/goggles/XEH_postInit.sqf | 12 ++++++------ addons/goggles/XEH_preInit.sqf | 2 ++ addons/goggles/config.cpp | 1 + .../goggles/functions/fnc_canWipeGlasses.sqf | 18 ++++++++++++++++++ addons/goggles/initSettings.sqf | 8 ++++++++ addons/goggles/stringtable.xml | 17 +++++++++++++++++ 9 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 addons/goggles/CfgVehicles.hpp create mode 100644 addons/goggles/functions/fnc_canWipeGlasses.sqf create mode 100644 addons/goggles/initSettings.sqf diff --git a/AUTHORS.txt b/AUTHORS.txt index 26979b22ea..37f79efcc2 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -148,6 +148,7 @@ Tonic Tourorist Tuupertunut Valentin Torikian +veteran29 voiper VyMajoris(W-Cephei) Winter diff --git a/addons/goggles/CfgVehicles.hpp b/addons/goggles/CfgVehicles.hpp new file mode 100644 index 0000000000..c9cdf70293 --- /dev/null +++ b/addons/goggles/CfgVehicles.hpp @@ -0,0 +1,14 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class GVAR(wipeGlasses) { + displayName = CSTRING(WipeGlasses); + condition = QUOTE(GVAR(showClearGlasses) && {call FUNC(canWipeGlasses)}); + statement = QUOTE(call FUNC(clearGlasses)); + }; + }; + }; + }; +}; diff --git a/addons/goggles/XEH_PREP.hpp b/addons/goggles/XEH_PREP.hpp index ba198439b5..fdbb4f9fef 100644 --- a/addons/goggles/XEH_PREP.hpp +++ b/addons/goggles/XEH_PREP.hpp @@ -17,6 +17,7 @@ PREP(isGogglesVisible); PREP(isInRotorWash); // general +PREP(canWipeGlasses); PREP(clearGlasses); PREP(getExplosionIndex); diff --git a/addons/goggles/XEH_postInit.sqf b/addons/goggles/XEH_postInit.sqf index a1a7c53460..7e4c038ae5 100644 --- a/addons/goggles/XEH_postInit.sqf +++ b/addons/goggles/XEH_postInit.sqf @@ -3,12 +3,12 @@ if (!hasInterface) exitWith {}; ["ACE3 Common", QGVAR(wipeGlasses), localize LSTRING(WipeGlasses), { - if (GVAR(effects) != 2) exitWith {false}; //Can only wipe if full effects setting is set - if (!GETVAR(ace_player,ACE_isUnconscious,false)) exitWith { - call FUNC(clearGlasses); - true - }; - false + // Conditions: specific + if !(call FUNC(canWipeGlasses)) exitWith {false}; + + call FUNC(clearGlasses); + + true }, {false}, [20, [true, true, false]], false] call CBA_fnc_addKeybind; diff --git a/addons/goggles/XEH_preInit.sqf b/addons/goggles/XEH_preInit.sqf index b47cf6628d..9361d05015 100644 --- a/addons/goggles/XEH_preInit.sqf +++ b/addons/goggles/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/goggles/config.cpp b/addons/goggles/config.cpp index 5ef19a3640..5d0d8bbaf1 100644 --- a/addons/goggles/config.cpp +++ b/addons/goggles/config.cpp @@ -16,6 +16,7 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" #define COMBAT_GOGGLES ACE_Overlay = QPATHTOF(textures\HUD\CombatGoggles.paa); \ ACE_OverlayCracked = QPATHTOF(textures\HUD\CombatGogglesCracked.paa); \ diff --git a/addons/goggles/functions/fnc_canWipeGlasses.sqf b/addons/goggles/functions/fnc_canWipeGlasses.sqf new file mode 100644 index 0000000000..e6dc89b3ce --- /dev/null +++ b/addons/goggles/functions/fnc_canWipeGlasses.sqf @@ -0,0 +1,18 @@ +#include "script_component.hpp" +/* + * Author: veteran29 + * Checks if player can wipe goggles. + * + * Arguments: + * None + * + * Return Value: + * Can wipe goggles + * + * Example: + * [] call ace_goggles_fnc_canWipeGlasses + * + * Public: No + */ + +GVAR(effects) == 2 && {!GETVAR(ACE_player,ACE_isUnconscious,false)} // return diff --git a/addons/goggles/initSettings.sqf b/addons/goggles/initSettings.sqf new file mode 100644 index 0000000000..1ecd1c01e8 --- /dev/null +++ b/addons/goggles/initSettings.sqf @@ -0,0 +1,8 @@ +[ + QGVAR(showClearGlasses), + "CHECKBOX", + [LSTRING(SettingShowClearGlasses), LSTRING(SettingShowClearGlasses)], + localize LSTRING(SettingsName), + false, // default value + 0 // isGlobal +] call CBA_fnc_addSetting; diff --git a/addons/goggles/stringtable.xml b/addons/goggles/stringtable.xml index dfcfc7a868..ba0c60c1da 100644 --- a/addons/goggles/stringtable.xml +++ b/addons/goggles/stringtable.xml @@ -14,6 +14,19 @@ Óculos Lunettes + + ACE Goggles + ACE Schutzbrille + ACE Occhiali + ACE 護目鏡 + ACE 护目镜 + ACE ゴーグル + ACE 고글 + ACE Gogle + ACE Очки + ACE Óculos + ACE Lunettes + Show Goggle Effects in Third Person Brilleneffekt in dritter Person anzeigen @@ -85,5 +98,9 @@ 染色 + 影響 Cor + Efeitos + + Show Wipe Goggles self interaction + Pokaż interakcję Wyczyść Gogle +