From 32055401d3be3b0d38bb173d58d773559c5b437a Mon Sep 17 00:00:00 2001 From: Glowbal Date: Mon, 16 May 2016 00:09:53 +0200 Subject: [PATCH 1/3] Add backwards compatability for InventoryChanged The output of `getUnitLoadout` is different as `getAllGear`. Using a different format in the event would mean that any eventhandler depending on the inventory output would now be broken. --- addons/common/XEH_postInit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 2b5637a78f..82cf0da2ea 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -385,7 +385,7 @@ GVAR(OldIsCamera) = false; if !(_data isEqualTo GVAR(OldPlayerInventory)) then { // Raise ACE event locally GVAR(OldPlayerInventory) = _data; - ["playerInventoryChanged", [ACE_player, _data]] call FUNC(localEvent); + ["playerInventoryChanged", [ACE_player, [ACE_player, false] call FUNC(getAllGear) ]] call FUNC(localEvent); }; // "playerVisionModeChanged" event From cac7b9c0c36e7ad18c2a8e52e5e93f4a6d92dd19 Mon Sep 17 00:00:00 2001 From: commy2 Date: Mon, 16 May 2016 15:15:51 +0200 Subject: [PATCH 2/3] optional param to skip deprecated warning --- addons/common/functions/fnc_getAllGear.sqf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/common/functions/fnc_getAllGear.sqf b/addons/common/functions/fnc_getAllGear.sqf index 716793f7bd..cebcc489f1 100644 --- a/addons/common/functions/fnc_getAllGear.sqf +++ b/addons/common/functions/fnc_getAllGear.sqf @@ -33,9 +33,11 @@ */ #include "script_component.hpp" -ACE_DEPRECATED("ace_common_fnc_getAllGear","3.7.0","getUnitLoadout"); +params ["_unit", ["_showDeprecated", true]]; -params ["_unit"]; +if (_showDeprecated) then { + ACE_DEPRECATED("ace_common_fnc_getAllGear","3.7.0","getUnitLoadout"); +}; if (isNull _unit) exitWith {[ "", From 473149b8ca2da3a7cea3029316b44f413a04bf04 Mon Sep 17 00:00:00 2001 From: commy2 Date: Mon, 16 May 2016 15:22:37 +0200 Subject: [PATCH 3/3] revert changes from other PR to make it compatible --- addons/common/functions/fnc_assignedItemFix.sqf | 4 ++-- addons/goggles/XEH_postInit.sqf | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/common/functions/fnc_assignedItemFix.sqf b/addons/common/functions/fnc_assignedItemFix.sqf index 3f454f83ff..18dd6b4e0c 100644 --- a/addons/common/functions/fnc_assignedItemFix.sqf +++ b/addons/common/functions/fnc_assignedItemFix.sqf @@ -29,9 +29,9 @@ GVAR(AssignedItemsShownItems) = [ ]; ["playerInventoryChanged", { - params ["_unit", "_assignedItems"]; + params ["_unit"]; - _assignedItems = _assignedItems param [9, ["","","","","",""]]; // ["ItemMap","ItemGPS","ItemRadio","ItemCompass","ItemWatch","NVGoggles"] + private _assignedItems = getUnitLoadout _unit param [9, ["","","","","",""]]; // ["ItemMap","ItemGPS","ItemRadio","ItemCompass","ItemWatch","NVGoggles"] GVAR(AssignedItemsShownItems) = [ !((_assignedItems select 0) isEqualTo "") && {getText (configFile >> "CfgWeapons" >> _assignedItems select 0 >> "ACE_hideItemType") != "map"}, diff --git a/addons/goggles/XEH_postInit.sqf b/addons/goggles/XEH_postInit.sqf index 3a038ed923..37edd7184b 100644 --- a/addons/goggles/XEH_postInit.sqf +++ b/addons/goggles/XEH_postInit.sqf @@ -45,10 +45,12 @@ GVAR(surfaceCacheIsDust) = false; GVAR(OldGlasses) = ""; ["playerInventoryChanged", { - private _currentGlasses = (_this select 1) param [7, ""]; + params ["_unit"]; + + private _currentGlasses = goggles _unit; if (GVAR(OldGlasses) != _currentGlasses) then { - ["GlassesChanged", [ACE_player, _currentGlasses]] call EFUNC(common,localEvent); + ["GlassesChanged", [_unit, _currentGlasses]] call EFUNC(common,localEvent); GVAR(OldGlasses) = _currentGlasses; }; }] call EFUNC(common,addEventHandler);