Skip to content

Commit

Permalink
Linking belt refactoring (#5206)
Browse files Browse the repository at this point in the history
* Linking belt refatoring

startLinking belt now uses canLinkBelt so if condition needs to be changed then you can do it on one position.

* Fixed requested change

Fixed requested change
  • Loading branch information
Phyma authored and PabstMirror committed May 27, 2017
1 parent 7509c62 commit 5145b89
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions addons/reload/functions/fnc_startLinkingBelt.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,10 @@ params ["_player", "_target"];
if (vehicle _target != _target) exitWith {false};

private _magazineType = currentMagazine _target;
private _magazineCfg = configFile >> "CfgMagazines" >> _magazineType;

if (getNumber (_magazineCfg >> "ACE_isBelt") == 0) exitWith {false};
private _canLink = [_player, _target] call FUNC(canLinkBelt);

// Check if the ammo is not empty or full
private _ammoCount = _target ammo currentWeapon _target;

// Exit if the belt is full or empty
if ((_ammoCount == 0) || (getNumber (_magazineCfg >> "count") - _ammoCount) == 0) exitWith {false};
if ( !_canLink ) exitWith {} ;

// Check if the player has any of the same same magazines
// Calculate max ammo it can link
Expand Down

0 comments on commit 5145b89

Please sign in to comment.