Merge pull request #3797 from acemod/add-backwards-compat-inventoryChanged

Add backwards compatability for InventoryChanged
This commit is contained in:
commy2 2016-05-16 16:39:12 +02:00
commit 0e2cafcbba
4 changed files with 11 additions and 7 deletions

View File

@ -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

View File

@ -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"},

View File

@ -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 {[
"",

View File

@ -45,10 +45,12 @@ GVAR(surfaceCacheIsDust) = false;
GVAR(OldGlasses) = "<null>";
["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);