ACE3/addons/csw/functions/fnc_reload_canUnloadMagazine.sqf
johnb432 56eae4060c
CSW - Improve function headers & comments (#10149)
Code formatting changes from 9234
2024-07-27 19:42:31 +02:00

34 lines
882 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Tests if unit can unload a magazine from a CSW.
*
* Arguments:
* 0: CSW <OBJECT>
* 1: Turret Path <ARRAY>
* 2: Player <OBJECT>
* 3: Carryable Magazine <STRING>
* 4: Vehicle Magazine <STRING>
*
* Return Value:
* <BOOL>
*
* Example:
* [cursorTarget, [0], player, "ACE_csw_100Rnd_127x99_mag_red", "200Rnd_127x99_mag_Tracer_Red"] call ace_csw_fnc_reload_canUnloadMagazine
*
* Public: No
*/
params ["_vehicle", "_turretPath", "_unit", "_carryMag", "_vehMag"];
// handle disassembled or deleted
if ((!alive _vehicle) || {(_vehicle distance _unit) > 5}) exitWith {false};
private _return = false;
{
_x params ["_xMag", "_xTurret", "_xAmmo"];
if ((_xMag == _vehMag) && {_xTurret isEqualTo _turretPath} && {_xAmmo > 0}) exitWith { _return = true };
} forEach (magazinesAllTurrets _vehicle);
_return