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

Weather - More permissive wind info indicator + auto-enabling when throwing grenades #9820

Merged
merged 8 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
3 changes: 3 additions & 0 deletions addons/advanced_throwing/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
{
Expand Down
6 changes: 6 additions & 0 deletions addons/advanced_throwing/functions/fnc_exitThrowMode.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
9 changes: 9 additions & 0 deletions addons/advanced_throwing/functions/fnc_prepare.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
params ["_unit"];
TRACE_1("params",_unit);

// Temporarily enable wind info, to aid in throwing smoke grenades effectively
if (
GVAR(enableTempWindInfo) &&
{!(missionNamespace getVariable [QEGVAR(weather,WindInfo), false])}
) 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);
Expand Down
8 changes: 8 additions & 0 deletions addons/advanced_throwing/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
10 changes: 10 additions & 0 deletions addons/advanced_throwing/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@
<Portuguese>Permite que arremessáveis fixados em objetos sejam pegos.</Portuguese>
<Czech>Zapíná schopnost zvednutí předmětů z objektů ke kterým jsou připnuté.</Czech>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_EnableTempWindInfo_DisplayName">
<English>Show Temporary Wind Info</English>
<German>Zeige temporäre Windinformationen</German>
<Italian>Mostra informazioni sul vento temporaneamente</Italian>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_EnableTempWindInfo_Description">
<English>Temporarily display Wind Info while throwing, to aid in placing smoke grenades effectively.</English>
<German>Zeige während des werfens Windinformationen an, um Rauchgranaten effektiver zu platzieren.</German>
<Italian>Mostra le informazioni sul vento durante il lancio di granate, facilitando il piazzamento ottimale di fumogeni.</Italian>
</Key>
<Key ID="STR_ACE_Advanced_Throwing_Prepare">
<English>Prepare/Change Throwable</English>
<Spanish>Preparar/Cambiar objetos lanzables</Spanish>
Expand Down
5 changes: 3 additions & 2 deletions addons/weather/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#include "script_component.hpp"

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};
mrschick marked this conversation as resolved.
Show resolved Hide resolved

// Statement
[] call FUNC(displayWindInfo);
Expand All @@ -15,7 +16,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};
mrschick marked this conversation as resolved.
Show resolved Hide resolved

// Statement
[] call FUNC(displayWindInfo);
Expand Down
5 changes: 4 additions & 1 deletion addons/weather/functions/fnc_displayWindInfo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ 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"]] call EFUNC(common,canInteractWith)) && !(objectParent ACE_Player isKindOf "StaticWeapon")}
) exitWith {
TRACE_1("Ending Wind Info PFEH",GVAR(WindInfo));
GVAR(WindInfo) = false;
(["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
Expand Down