mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
#1119 - Manually sync ammo globably on belt reload.
This commit is contained in:
parent
89d19e817c
commit
ddbb6ab2bb
@ -18,6 +18,11 @@ if !(hasInterface) exitWith {};
|
|||||||
{false},
|
{false},
|
||||||
[19, [false, true, false]], false] call cba_fnc_addKeybind;
|
[19, [false, true, false]], false] call cba_fnc_addKeybind;
|
||||||
|
|
||||||
|
["setAmmoSync", {
|
||||||
|
//To propagate the setAmmo change, do it on all clients
|
||||||
|
PARAMS_3(_unit,_weapon,_ammo);
|
||||||
|
_unit setAmmo [_weapon, _ammo];
|
||||||
|
}] call EFUNC(common,addEventhandler);
|
||||||
|
|
||||||
// Listen for attempts to link ammo
|
// Listen for attempts to link ammo
|
||||||
["linkedAmmo", {
|
["linkedAmmo", {
|
||||||
@ -45,7 +50,7 @@ if !(hasInterface) exitWith {};
|
|||||||
|
|
||||||
// Add the ammo
|
// Add the ammo
|
||||||
_ammoAdded = _ammoMissing min (_magazine select 1);
|
_ammoAdded = _ammoMissing min (_magazine select 1);
|
||||||
_receiver setAmmo [currentWeapon _receiver, _ammoCount + _ammoAdded];
|
["setAmmoSync", [_receiver, (currentWeapon _receiver), (_ammoCount + _ammoAdded)]] call EFUNC(common,globalEvent);
|
||||||
|
|
||||||
if ((_magazine select 1) - _ammoAdded > 0) then {
|
if ((_magazine select 1) - _ammoAdded > 0) then {
|
||||||
["returnedAmmo", [_giver], [_giver,_receiver,[_magazineType,(_magazine select 1) - _ammoAdded]]] call EFUNC(common,targetEvent);
|
["returnedAmmo", [_giver], [_giver,_receiver,[_magazineType,(_magazine select 1) - _ammoAdded]]] call EFUNC(common,targetEvent);
|
||||||
|
Loading…
Reference in New Issue
Block a user