From e4b0273c3acc563ba0937c45fed6d252159d81dd Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sun, 3 Mar 2024 01:54:47 +0100 Subject: [PATCH 1/8] More permissive displaying of Wind Info --- addons/weather/XEH_postInit.sqf | 4 ++-- addons/weather/functions/fnc_displayWindInfo.sqf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/weather/XEH_postInit.sqf b/addons/weather/XEH_postInit.sqf index 51350226e1a..dc5ed63e7b9 100644 --- a/addons/weather/XEH_postInit.sqf +++ b/addons/weather/XEH_postInit.sqf @@ -4,7 +4,7 @@ GVAR(WindInfo) = false; ["ACE3 Common", QGVAR(WindInfoKey), localize LSTRING(WindInfoKeyToggle), { // Conditions: canInteract - if !([ACE_player, ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, ACE_player, ["isNotDragging", "isNotCarrying", "isNotSitting", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Statement [] call FUNC(displayWindInfo); @@ -15,7 +15,7 @@ GVAR(WindInfo) = false; ["ACE3 Common", QGVAR(WindInfoKey_hold), localize LSTRING(WindInfoKeyHold), { // Conditions: canInteract - if !([ACE_player, ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, ACE_player, ["isNotDragging", "isNotCarrying", "isNotSitting", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Statement [] call FUNC(displayWindInfo); diff --git a/addons/weather/functions/fnc_displayWindInfo.sqf b/addons/weather/functions/fnc_displayWindInfo.sqf index 23a87ecbf4f..c98f216090e 100644 --- a/addons/weather/functions/fnc_displayWindInfo.sqf +++ b/addons/weather/functions/fnc_displayWindInfo.sqf @@ -35,7 +35,7 @@ TRACE_1("Starting Wind Info PFEH",GVAR(WindInfo)); disableSerialization; params ["", "_pfID"]; - if ((!GVAR(WindInfo)) || {!([ACE_player, ACE_player, []] call EFUNC(common,canInteractWith))}) exitWith { + if ((!GVAR(WindInfo)) || {!([ACE_player, ACE_player, ["notOnMap", "isNotDragging", "isNotCarrying", "isNotSitting", "isNotInside"]] call EFUNC(common,canInteractWith))}) exitWith { TRACE_1("Ending Wind Info PFEH",GVAR(WindInfo)); GVAR(WindInfo) = false; (["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; From 63af20f55c6905b30151c7fc3e8285687af0bcb9 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sun, 3 Mar 2024 02:01:38 +0100 Subject: [PATCH 2/8] Temporary Wind Info while throwing Grenades --- addons/advanced_throwing/XEH_postInit.sqf | 3 +++ addons/advanced_throwing/functions/fnc_exitThrowMode.sqf | 6 ++++++ addons/advanced_throwing/functions/fnc_prepare.sqf | 6 ++++++ addons/weather/XEH_postInit.sqf | 1 + 4 files changed, 16 insertions(+) diff --git a/addons/advanced_throwing/XEH_postInit.sqf b/addons/advanced_throwing/XEH_postInit.sqf index 96b0fbb09b4..1fc9400e996 100644 --- a/addons/advanced_throwing/XEH_postInit.sqf +++ b/addons/advanced_throwing/XEH_postInit.sqf @@ -7,6 +7,9 @@ GVAR(ammoEventHandlers) = createHashMap; // Exit on HC if (!hasInterface) exitWith {}; +// Temporary Wind Info indication +GVAR(tempWindInfo) = false; + // Ammo/Magazines look-up hash for correctness of initSpeed GVAR(ammoMagLookup) = call CBA_fnc_createNamespace; { diff --git a/addons/advanced_throwing/functions/fnc_exitThrowMode.sqf b/addons/advanced_throwing/functions/fnc_exitThrowMode.sqf index 744a6d7aae3..3b88564eaee 100644 --- a/addons/advanced_throwing/functions/fnc_exitThrowMode.sqf +++ b/addons/advanced_throwing/functions/fnc_exitThrowMode.sqf @@ -53,6 +53,12 @@ _unit setVariable [QGVAR(dropDistance), DROP_DISTANCE_DEFAULT]; // Remove controls hint (check if ever enabled is inside the function) call EFUNC(interaction,hideMouseHint); +// Hide wind info after throw, if it was temporarily enabled for the throw +if (GVAR(tempWindInfo)) then { + EGVAR(weather,WindInfo) = false; + GVAR(tempWindInfo) = false; +}; + // Remove throw action [_unit, "DefaultAction", _unit getVariable [QGVAR(throwAction), -1]] call EFUNC(common,removeActionEventHandler); diff --git a/addons/advanced_throwing/functions/fnc_prepare.sqf b/addons/advanced_throwing/functions/fnc_prepare.sqf index 070870879b1..4701c7634a6 100644 --- a/addons/advanced_throwing/functions/fnc_prepare.sqf +++ b/addons/advanced_throwing/functions/fnc_prepare.sqf @@ -18,6 +18,12 @@ params ["_unit"]; TRACE_1("params",_unit); +// Temporarily enable wind info, to aid in throwing smoke grenades effectively +if (!EGVAR(weather,WindInfo)) then { + [] call EFUNC(weather,displayWindInfo); + GVAR(tempWindInfo) = true; +}; + // Select next throwable if one already in hand if (_unit getVariable [QGVAR(inHand), false]) exitWith { TRACE_1("inHand",_unit); diff --git a/addons/weather/XEH_postInit.sqf b/addons/weather/XEH_postInit.sqf index dc5ed63e7b9..cfc49e19985 100644 --- a/addons/weather/XEH_postInit.sqf +++ b/addons/weather/XEH_postInit.sqf @@ -1,6 +1,7 @@ #include "script_component.hpp" GVAR(WindInfo) = false; + ["ACE3 Common", QGVAR(WindInfoKey), localize LSTRING(WindInfoKeyToggle), { // Conditions: canInteract From ec17c24bebf16b2a917197bcb012f488f660a724 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sun, 3 Mar 2024 16:04:54 +0100 Subject: [PATCH 3/8] Add Temporary Wind Info Setting --- addons/advanced_throwing/functions/fnc_prepare.sqf | 2 +- addons/advanced_throwing/initSettings.inc.sqf | 8 ++++++++ addons/advanced_throwing/stringtable.xml | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/addons/advanced_throwing/functions/fnc_prepare.sqf b/addons/advanced_throwing/functions/fnc_prepare.sqf index 4701c7634a6..a1b3bdeb8d1 100644 --- a/addons/advanced_throwing/functions/fnc_prepare.sqf +++ b/addons/advanced_throwing/functions/fnc_prepare.sqf @@ -19,7 +19,7 @@ params ["_unit"]; TRACE_1("params",_unit); // Temporarily enable wind info, to aid in throwing smoke grenades effectively -if (!EGVAR(weather,WindInfo)) then { +if (GVAR(enableTempWindInfo) && {!EGVAR(weather,WindInfo)}) then { [] call EFUNC(weather,displayWindInfo); GVAR(tempWindInfo) = true; }; diff --git a/addons/advanced_throwing/initSettings.inc.sqf b/addons/advanced_throwing/initSettings.inc.sqf index d4ebe149185..d8396637c57 100644 --- a/addons/advanced_throwing/initSettings.inc.sqf +++ b/addons/advanced_throwing/initSettings.inc.sqf @@ -40,3 +40,11 @@ private _category = format ["ACE %1", localize LSTRING(Category)]; true, 1 ] call CBA_fnc_addSetting; + +[ + QGVAR(enableTempWindInfo), "CHECKBOX", + [LSTRING(EnableTempWindInfo_DisplayName), LSTRING(EnableTempWindInfo_Description)], + _category, + true, + 0 +] call CBA_fnc_addSetting; diff --git a/addons/advanced_throwing/stringtable.xml b/addons/advanced_throwing/stringtable.xml index ec2354a2c03..a79fe7d0a4c 100644 --- a/addons/advanced_throwing/stringtable.xml +++ b/addons/advanced_throwing/stringtable.xml @@ -185,6 +185,16 @@ Permite que arremessáveis fixados em objetos sejam pegos. Zapíná schopnost zvednutí předmětů z objektů ke kterým jsou připnuté. + + Show Temporary Wind Info + Zeige temporäre Windinformationen + Mostra informazioni sul vento temporaneamente + + + Temporarily display Wind Info while throwing, to aid in placing smoke grenades effectively. + Zeige während des werfens Windinformationen an, um Rauchgranaten effektiver zu platzieren. + Mostra le informazioni sul vento durante il lancio di granate, facilitando il piazzamento ottimale di fumogeni. + Prepare/Change Throwable Preparar/Cambiar objetos lanzables From 8b6de7b8040ab94b1bc62dc0d33f45d10d8afbf0 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sun, 3 Mar 2024 16:05:36 +0100 Subject: [PATCH 4/8] Safer reading of EGVAR from addon that may not be loaded --- addons/advanced_throwing/functions/fnc_prepare.sqf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/advanced_throwing/functions/fnc_prepare.sqf b/addons/advanced_throwing/functions/fnc_prepare.sqf index a1b3bdeb8d1..7926c2c8649 100644 --- a/addons/advanced_throwing/functions/fnc_prepare.sqf +++ b/addons/advanced_throwing/functions/fnc_prepare.sqf @@ -19,7 +19,10 @@ params ["_unit"]; TRACE_1("params",_unit); // Temporarily enable wind info, to aid in throwing smoke grenades effectively -if (GVAR(enableTempWindInfo) && {!EGVAR(weather,WindInfo)}) then { +if ( + GVAR(enableTempWindInfo) && + {!(missionNamespace getVariable [QEGVAR(weather,WindInfo), false])} +) then { [] call EFUNC(weather,displayWindInfo); GVAR(tempWindInfo) = true; }; From d1aad3c1ecd5b576abafab044f5ede8134be0117 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Mon, 4 Mar 2024 14:41:29 +0100 Subject: [PATCH 5/8] Show Wind Info only in Static Vehicles --- addons/weather/functions/fnc_displayWindInfo.sqf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/weather/functions/fnc_displayWindInfo.sqf b/addons/weather/functions/fnc_displayWindInfo.sqf index c98f216090e..3b0a5410f22 100644 --- a/addons/weather/functions/fnc_displayWindInfo.sqf +++ b/addons/weather/functions/fnc_displayWindInfo.sqf @@ -35,7 +35,10 @@ TRACE_1("Starting Wind Info PFEH",GVAR(WindInfo)); disableSerialization; params ["", "_pfID"]; - if ((!GVAR(WindInfo)) || {!([ACE_player, ACE_player, ["notOnMap", "isNotDragging", "isNotCarrying", "isNotSitting", "isNotInside"]] call EFUNC(common,canInteractWith))}) exitWith { + if ( + (!GVAR(WindInfo)) || + {!(objectParent ACE_Player isKindOf "StaticWeapon") && !([ACE_player, ACE_player, ["notOnMap", "isNotDragging", "isNotCarrying", "isNotSitting"]] call EFUNC(common,canInteractWith))} + ) exitWith { TRACE_1("Ending Wind Info PFEH",GVAR(WindInfo)); GVAR(WindInfo) = false; (["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; From a76d07cde9f50e1729b3626a3d3700b4a10d5b04 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Mon, 4 Mar 2024 16:44:32 +0100 Subject: [PATCH 6/8] Improve Exclusion Check Co-Authored-By: Grim <69561145+LinkIsGrim@users.noreply.github.com> --- addons/weather/functions/fnc_displayWindInfo.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/weather/functions/fnc_displayWindInfo.sqf b/addons/weather/functions/fnc_displayWindInfo.sqf index 3b0a5410f22..7c604e97f42 100644 --- a/addons/weather/functions/fnc_displayWindInfo.sqf +++ b/addons/weather/functions/fnc_displayWindInfo.sqf @@ -37,7 +37,7 @@ TRACE_1("Starting Wind Info PFEH",GVAR(WindInfo)); if ( (!GVAR(WindInfo)) || - {!(objectParent ACE_Player isKindOf "StaticWeapon") && !([ACE_player, ACE_player, ["notOnMap", "isNotDragging", "isNotCarrying", "isNotSitting"]] call EFUNC(common,canInteractWith))} + {!([ACE_player, ACE_player, ["notOnMap", "isNotDragging", "isNotCarrying", "isNotSitting"]] call EFUNC(common,canInteractWith)) && !(objectParent ACE_Player isKindOf "StaticWeapon")} ) exitWith { TRACE_1("Ending Wind Info PFEH",GVAR(WindInfo)); GVAR(WindInfo) = false; From c5d1985c3e4981086802987cff4a5eca32e85c8a Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Tue, 5 Mar 2024 10:33:54 +0100 Subject: [PATCH 7/8] Improve Abort Checks on Keybind Statements Co-Authored-By: Grim <69561145+LinkIsGrim@users.noreply.github.com> --- addons/weather/XEH_postInit.sqf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/weather/XEH_postInit.sqf b/addons/weather/XEH_postInit.sqf index cfc49e19985..98909dc2d40 100644 --- a/addons/weather/XEH_postInit.sqf +++ b/addons/weather/XEH_postInit.sqf @@ -6,6 +6,7 @@ GVAR(WindInfo) = false; { // Conditions: canInteract if !([ACE_player, ACE_player, ["isNotDragging", "isNotCarrying", "isNotSitting", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !(isNull objectParent ACE_player || {objectParent ACE_player isKindOf "StaticWeapon"}) exitWith {false}; // Statement [] call FUNC(displayWindInfo); @@ -17,6 +18,7 @@ GVAR(WindInfo) = false; { // Conditions: canInteract if !([ACE_player, ACE_player, ["isNotDragging", "isNotCarrying", "isNotSitting", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !(isNull objectParent ACE_player || {objectParent ACE_player isKindOf "StaticWeapon"}) exitWith {false}; // Statement [] call FUNC(displayWindInfo); From 5ce527f26b89705ada29dd1b5a089149aeaa82b6 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Wed, 6 Mar 2024 13:29:05 +0100 Subject: [PATCH 8/8] Raise eyePos when inside Static Weapon --- addons/weather/functions/fnc_displayWindInfo.sqf | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/addons/weather/functions/fnc_displayWindInfo.sqf b/addons/weather/functions/fnc_displayWindInfo.sqf index 7c604e97f42..aeb7d580ae9 100644 --- a/addons/weather/functions/fnc_displayWindInfo.sqf +++ b/addons/weather/functions/fnc_displayWindInfo.sqf @@ -35,9 +35,12 @@ TRACE_1("Starting Wind Info PFEH",GVAR(WindInfo)); disableSerialization; params ["", "_pfID"]; + // Allow wind indicator inside static weapons + private _playerInStaticWeapon = objectParent ACE_Player isKindOf "StaticWeapon"; + if ( (!GVAR(WindInfo)) || - {!([ACE_player, ACE_player, ["notOnMap", "isNotDragging", "isNotCarrying", "isNotSitting"]] call EFUNC(common,canInteractWith)) && !(objectParent ACE_Player isKindOf "StaticWeapon")} + {!([ACE_player, ACE_player, ["notOnMap", "isNotDragging", "isNotCarrying", "isNotSitting"]] call EFUNC(common,canInteractWith)) && !(_playerInStaticWeapon)} ) exitWith { TRACE_1("Ending Wind Info PFEH",GVAR(WindInfo)); GVAR(WindInfo) = false; @@ -48,12 +51,18 @@ TRACE_1("Starting Wind Info PFEH",GVAR(WindInfo)); //Keeps the display open: (["RscWindIntuitive"] call BIS_fnc_rscLayer) cutRsc ["RscWindIntuitive", "PLAIN", 1, false]; + private _playerEyePos = eyePos ACE_Player; + if (_playerInStaticWeapon) then { + // Raise eyePos by 1 meter if player is in a static weapon, to prevent wind from being blocked by the open vehicle + _playerEyePos = _playerEyePos vectorAdd [0, 0, 1]; + }; + private _windSpeed = if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { // With wind gradient - [eyePos ACE_player, true, true, true] call FUNC(calculateWindSpeed); + [_playerEyePos, true, true, true] call FUNC(calculateWindSpeed); } else { // Without wind gradient - [eyePos ACE_player, false, true, true] call FUNC(calculateWindSpeed); + [_playerEyePos, false, true, true] call FUNC(calculateWindSpeed); };