2015-08-15 16:43:13 +00:00
|
|
|
/*
|
|
|
|
* Author: GitHawk
|
2017-06-08 16:47:52 +00:00
|
|
|
* Rearms a vehicle, after progress bar finishes, pass args to machine where turret is local.
|
2015-08-15 16:43:13 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2017-06-08 16:47:52 +00:00
|
|
|
* 0: Vehicle <OBJECT>
|
|
|
|
* 1: Unit <OBJECT>
|
|
|
|
* 2: Turret Path <ARRAY>
|
|
|
|
* 3: Number of magazines <NUMBER>
|
|
|
|
* 4: Magazine Classname <STRING>
|
|
|
|
* 5: Number of rounds <NUMBER>
|
|
|
|
* 6: Pylon Index <NUMBER>
|
2015-08-15 16:43:13 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2017-06-08 16:47:52 +00:00
|
|
|
* [vehicle, player, [-1], 2, "5000Rnd_762x51_Belt", 500, -1] call ace_rearm_fnc_rearmSuccess
|
2015-08-15 16:43:13 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2017-09-29 19:53:25 +00:00
|
|
|
params ["_vehicle", "_unit", "_turretPath", "_numMagazines", "_magazineClass", "_numRounds", "_pylon"];
|
2017-06-08 16:47:52 +00:00
|
|
|
TRACE_7("rearmSuccess",_vehicle,_unit,_turretPath,_numMagazines,_magazineClass,_numRounds,_pylon);
|
2015-08-15 16:43:13 +00:00
|
|
|
|
2015-08-16 21:52:37 +00:00
|
|
|
if (local _unit) then {
|
2015-08-20 17:51:22 +00:00
|
|
|
[_unit, true, true] call FUNC(dropAmmo);
|
2015-08-16 21:52:37 +00:00
|
|
|
};
|
|
|
|
|
2017-06-08 16:47:52 +00:00
|
|
|
if (!alive _vehicle) exitWith {WARNING("vehicle dead/null");};
|
|
|
|
|
2015-08-18 16:09:37 +00:00
|
|
|
if (isServer) then {
|
2016-02-27 20:05:19 +00:00
|
|
|
private _turretOwnerID = _vehicle turretOwner _turretPath;
|
2015-08-19 15:33:32 +00:00
|
|
|
if (_turretOwnerID == 0) then {
|
2017-05-18 16:13:31 +00:00
|
|
|
[QGVAR(rearmSuccessLocalEH), _this, [_vehicle]] call CBA_fnc_targetEvent;
|
2015-08-19 15:33:32 +00:00
|
|
|
} else {
|
2017-05-18 16:13:31 +00:00
|
|
|
[QGVAR(rearmSuccessLocalEH), _this, _turretOwnerID] call CBA_fnc_ownerEvent;
|
2015-08-19 15:33:32 +00:00
|
|
|
};
|
2015-08-15 16:43:13 +00:00
|
|
|
} else {
|
2017-07-10 15:17:44 +00:00
|
|
|
[QGVAR(rearmSuccessEH), _this] call CBA_fnc_serverEvent;
|
2015-08-18 00:32:10 +00:00
|
|
|
};
|