2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2020-04-09 01:52:54 +00:00
|
|
|
/*
|
|
|
|
* Author: mharis001
|
|
|
|
* Checks if the given unit can repack magazines of the given type.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Magazine <STRING>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Can Repack Magazine <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [_unit, _magazine] call ace_magazinerepack_fnc_canRepackMagazine
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_unit", "_magazine"];
|
|
|
|
|
2024-08-20 22:24:58 +00:00
|
|
|
// Exit if repack is disabled for this magazine.
|
|
|
|
if (getNumber (configFile >> "CfgMagazines" >> _magazine >> "ace_disableRepacking") == 1) exitWith {false};
|
|
|
|
|
2020-04-09 01:52:54 +00:00
|
|
|
private _maxAmmoCount = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count");
|
|
|
|
|
|
|
|
{
|
|
|
|
_x params ["_magazineType", "_ammoCount", "_isLoaded"];
|
|
|
|
|
|
|
|
_magazineType == _magazine // Magazine is of given type
|
|
|
|
&& {_ammoCount > 0 && {_ammoCount < _maxAmmoCount}} // Is a partial magazine
|
2021-10-12 17:54:50 +00:00
|
|
|
&& {!_isLoaded || {GVAR(repackLoadedMagazines) && {[_unit, _magazineType] call CBA_fnc_canAddItem}}} // In inventory or can be moved into it
|
2020-04-09 01:52:54 +00:00
|
|
|
} count magazinesAmmoFull _unit > 1
|