ACE3/addons/rearm/functions/fnc_rearmSuccess.sqf

43 lines
1.2 KiB
Plaintext
Raw Normal View History

2015-08-15 16:43:13 +00:00
/*
* Author: GitHawk
* Rearms a vehicle.
2015-08-15 16:43:13 +00:00
*
* Arguments:
* 0: Params <ARRAY>
2016-02-27 20:05:19 +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>
2015-08-15 16:43:13 +00:00
*
* Return Value:
* None
*
* Example:
* [[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"
2016-02-01 19:21:20 +00:00
params [["_args", [objNull, objNull, [], 0, "", 0], [[]], [6]]];
2016-02-27 20:05:19 +00:00
_args params ["_vehicle", "_unit", "_turretPath", "_numMagazines", "_magazineClass", "_numRounds"];
2015-08-15 16:43:13 +00:00
2016-02-27 20:05:19 +00:00
//hint format ["Vehicle: %1\nTurretPath: %2\nNumMagazines: %3\nMagazine: %4\nNumRounds: %5", _vehicle, _turretPath, _numMagazines, _magazineClass, _numRounds];
2015-08-15 16:43:13 +00:00
2015-08-16 21:52:37 +00:00
if (local _unit) then {
[_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 {
2016-02-27 20:05:19 +00:00
private _turretOwnerID = _vehicle turretOwner _turretPath;
if (_turretOwnerID == 0) then {
2016-03-06 10:14:34 +00:00
[QGVAR(rearmSuccessLocalEH), _vehicle, _this] call EFUNC(common,objectEvent);
} else {
2016-03-06 10:14:34 +00:00
[QGVAR(rearmSuccessLocalEH), _turretOwnerID, _this] call EFUNC(common,targetEvent);
};
2015-08-15 16:43:13 +00:00
} else {
[_this, QFUNC(rearmSuccess), 1] call EFUNC(common,execRemoteFnc);
};