QGVAR all reload events

This commit is contained in:
jonpas 2016-05-24 20:51:10 +02:00
parent 30b15ee3d3
commit da4c08fb6c
3 changed files with 8 additions and 8 deletions

View File

@ -27,7 +27,7 @@ if (!hasInterface) exitWith {};
}] call CBA_fnc_addEventHandler;
// Listen for attempts to link ammo
["ace_linkedAmmo", {
[QGVAR(linkedAmmo), {
params ["_receiver", "_giver", "_magazine"];
private _magazineType = currentMagazine _receiver;
@ -35,7 +35,7 @@ if (!hasInterface) exitWith {};
// Return the magazine if it's the wrong type
if (_magazineType != (_magazine select 0)) exitWith {
["ace_returnedAmmo", [_giver,_receiver,_magazine], [_giver]] call CBA_fnc_targetEvent;
[QGVAR(returnedAmmo), [_giver,_receiver,_magazine], [_giver]] call CBA_fnc_targetEvent;
};
private _ammoCount = _receiver ammo currentWeapon _receiver;
@ -43,7 +43,7 @@ if (!hasInterface) exitWith {};
// Return the magazine if the belt is full or empty
if ((_ammoCount == 0) || _ammoMissing == 0) exitWith {
["ace_returnedAmmo", [_giver,_receiver,_magazine], [_giver]] call CBA_fnc_targetEvent;
[QGVAR(returnedAmmo), [_giver,_receiver,_magazine], [_giver]] call CBA_fnc_targetEvent;
};
// Add the ammo
@ -51,12 +51,12 @@ if (!hasInterface) exitWith {};
[QGVAR(syncAmmo), [_receiver, currentWeapon _receiver, _ammoCount + _ammoAdded]] call CBA_fnc_globalEvent;
if ((_magazine select 1) - _ammoAdded > 0) then {
["ace_returnedAmmo", [_giver, _receiver, [_magazineType, (_magazine select 1) - _ammoAdded]], [_giver]] call CBA_fnc_targetEvent;
[QGVAR(returnedAmmo), [_giver, _receiver, [_magazineType, (_magazine select 1) - _ammoAdded]], [_giver]] call CBA_fnc_targetEvent;
};
}] call CBA_fnc_addEventHandler;
// Listen for returned magazines
["ace_returnedAmmo", {
[QGVAR(returnedAmmo), {
params ["_receiver", "", "_magazine"];
TRACE_2("returnedAmmo EH",_receiver,_magazine);

View File

@ -24,6 +24,6 @@ class CfgPatches {
class ACE_newEvents {
setAmmoSync = QGVAR(syncAmmo);
returnedAmmo = "ace_returnedAmmo";
linkedAmmo = "ace_linkedAmmo";
returnedAmmo = QGVAR(returnedAmmo);
linkedAmmo = QGVAR(linkedAmmo);
};

View File

@ -46,7 +46,7 @@ private _onFinish = {
(_this select 0) params ["_player", "_target", "_magazine"];
// Raise event on remote unit
["ace_linkedAmmo", [_target, _player, _magazine], [_target]] call CBA_fnc_targetEvent;
[QGVAR(linkedAmmo), [_target, _player, _magazine], [_target]] call CBA_fnc_targetEvent;
};
private _onFailure = {