2015-08-15 16:43:13 +00:00
|
|
|
/*
|
|
|
|
* Author: GitHawk
|
2015-08-18 00:32:10 +00:00
|
|
|
* Rearms a vehicle.
|
2015-08-15 16:43:13 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-18 00:32:10 +00:00
|
|
|
* 0: Params <ARRAY>
|
|
|
|
* 0: Target <OBJECT>
|
|
|
|
* 1: Unit <OBJECT>
|
|
|
|
* 2: Turret Path <ARRAY>
|
|
|
|
* 3: Number of magazines <NUMBER>
|
|
|
|
* 4: Magazine Classname <STRING>
|
|
|
|
* 5: Number of rounds <NUMBER>
|
2015-08-15 16:43:13 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-08-18 15:38:50 +00:00
|
|
|
* [[vehicle, player, [-1], 2, "5000Rnd_762x51_Belt", 500]] call ace_rearm_fnc_rearmSuccess
|
2015-08-15 16:43:13 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-18 16:09:37 +00:00
|
|
|
private ["_dummy", "_weaponSelect", "_turretOwnerID"];
|
2016-02-01 19:21:20 +00:00
|
|
|
params [["_args", [objNull, objNull, [], 0, "", 0], [[]], [6]]];
|
2015-08-18 00:32:10 +00:00
|
|
|
_args params ["_target", "_unit", "_turretPath", "_numMagazines", "_magazineClass", "_numRounds"];
|
2015-08-15 16:43:13 +00:00
|
|
|
|
2015-08-18 00:32:10 +00:00
|
|
|
//hint format ["Target: %1\nTurretPath: %2\nNumMagazines: %3\nMagazine: %4\nNumRounds: %5", _target, _turretPath, _numMagazines, _magazineClass, _numRounds];
|
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
|
|
|
};
|
|
|
|
|
2015-08-18 16:09:37 +00:00
|
|
|
if (isServer) then {
|
|
|
|
_turretOwnerID = _target turretOwner _turretPath;
|
2015-08-19 15:33:32 +00:00
|
|
|
if (_turretOwnerID == 0) then {
|
2015-08-20 17:51:22 +00:00
|
|
|
[_this, QFUNC(rearmSuccessLocal), _target] call EFUNC(common,execRemoteFnc);
|
2015-08-19 15:33:32 +00:00
|
|
|
} else {
|
|
|
|
EGVAR(common,remoteFnc) = [_this, QFUNC(rearmSuccessLocal), 0];
|
|
|
|
_turretOwnerID publicVariableClient QEGVAR(common,remoteFnc);
|
|
|
|
};
|
2015-08-15 16:43:13 +00:00
|
|
|
} else {
|
2015-08-20 17:51:22 +00:00
|
|
|
[_this, QFUNC(rearmSuccess), 1] call EFUNC(common,execRemoteFnc);
|
2015-08-18 00:32:10 +00:00
|
|
|
};
|