don't do 'playerInventoryChanged' just because ammo decreased after firing

This commit is contained in:
commy2 2016-05-14 19:50:08 +02:00
parent c5275813a4
commit e4c86a8af5

View File

@ -334,6 +334,7 @@ GVAR(OldPlayerVehicle) = vehicle objNull;
GVAR(OldPlayerTurret) = [objNull] call FUNC(getTurretIndex); GVAR(OldPlayerTurret) = [objNull] call FUNC(getTurretIndex);
GVAR(OldPlayerWeapon) = currentWeapon objNull; GVAR(OldPlayerWeapon) = currentWeapon objNull;
GVAR(OldPlayerInventory) = []; GVAR(OldPlayerInventory) = [];
GVAR(OldPlayerInventoryNoAmmo) = [];
GVAR(OldPlayerVisionMode) = currentVisionMode objNull; GVAR(OldPlayerVisionMode) = currentVisionMode objNull;
GVAR(OldCameraView) = ""; GVAR(OldCameraView) = "";
GVAR(OldVisibleMap) = false; GVAR(OldVisibleMap) = false;
@ -385,7 +386,19 @@ GVAR(OldIsCamera) = false;
if !(_data isEqualTo GVAR(OldPlayerInventory)) then { if !(_data isEqualTo GVAR(OldPlayerInventory)) then {
// Raise ACE event locally // Raise ACE event locally
GVAR(OldPlayerInventory) = _data; GVAR(OldPlayerInventory) = _data;
["playerInventoryChanged", [ACE_player, _data]] call FUNC(localEvent);
// we don't want to trigger this just because your ammo counter decreased.
_data = + GVAR(OldPlayerInventory);
(_data param [0, []]) set [4, primaryWeaponMagazine ACE_player];
(_data param [0, []]) set [5, nil];
(_data param [1, []]) set [4, secondaryWeaponMagazine ACE_player];
(_data param [1, []]) set [5, nil];
(_data param [2, []]) set [4, handgunMagazine ACE_player];
(_data param [2, []]) set [5, nil];
if !(_data isEqualTo GVAR(OldPlayerInventoryNoAmmo)) then {
GVAR(OldPlayerInventoryNoAmmo) = _data;
["playerInventoryChanged", [ACE_player, GVAR(OldPlayerInventory)]] call FUNC(localEvent);
};
}; };
// "playerVisionModeChanged" event // "playerVisionModeChanged" event