2015-08-18 00:32:10 +00:00
|
|
|
/*
|
|
|
|
* Author: GitHawk, Jonpas
|
|
|
|
* Get rearm return value.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2016-02-27 20:05:19 +00:00
|
|
|
* 0: Vehicle <OBJECT>
|
2015-08-18 14:20:11 +00:00
|
|
|
* 1: Magazine Classname <STRING>
|
2015-08-18 00:32:10 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-18 14:20:11 +00:00
|
|
|
* Return Value <ARRAY>
|
|
|
|
* 0: Can Rearm <BOOL>
|
|
|
|
* 1: TurretPath <ARRAY>
|
2016-02-01 19:05:53 +00:00
|
|
|
* 2: Number of current magazines in turret path <NUMBER>
|
2015-08-18 00:32:10 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2016-05-12 12:55:40 +00:00
|
|
|
* [tank, "500Rnd_127x99_mag_Tracer_Red"] call ace_rearm_fnc_getNeedRearmMagazines
|
2015-08-18 00:32:10 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2016-05-12 12:55:40 +00:00
|
|
|
params [
|
|
|
|
["_vehicle", objNull, [objNull]],
|
|
|
|
["_magazineClass", "", [""]]
|
|
|
|
];
|
2015-08-18 00:32:10 +00:00
|
|
|
|
2016-02-27 19:31:07 +00:00
|
|
|
private _return = [false, [], 0];
|
2015-08-18 00:32:10 +00:00
|
|
|
{
|
2016-02-27 20:05:19 +00:00
|
|
|
private _magazines = [_vehicle, _x] call FUNC(getVehicleMagazines);
|
2015-08-18 00:32:10 +00:00
|
|
|
|
|
|
|
if (_magazineClass in _magazines) then {
|
2016-02-27 20:05:19 +00:00
|
|
|
private _currentMagazines = {_x == _magazineClass} count (_vehicle magazinesTurret _x);
|
2015-08-18 00:32:10 +00:00
|
|
|
|
2016-02-27 20:05:19 +00:00
|
|
|
if ((_vehicle magazineTurretAmmo [_magazineClass, _x]) < getNumber (configFile >> "CfgMagazines" >> _magazineClass >> "count")) exitWith {
|
2016-02-01 19:05:53 +00:00
|
|
|
_return = [true, _x, _currentMagazines];
|
2015-08-18 00:32:10 +00:00
|
|
|
};
|
|
|
|
|
2016-02-27 20:05:19 +00:00
|
|
|
if (_currentMagazines < ([_vehicle, _x, _magazineClass] call FUNC(getMaxMagazines))) exitWith {
|
2016-02-01 19:05:53 +00:00
|
|
|
_return = [true, _x, _currentMagazines];
|
2015-08-18 00:32:10 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
if (_return select 0) exitWith {};
|
2016-05-12 12:55:40 +00:00
|
|
|
false
|
|
|
|
} count REARM_TURRET_PATHS;
|
2015-08-18 00:32:10 +00:00
|
|
|
|
|
|
|
_return
|