mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
8763184b6a
* Dragon work cleanup remove unused p3ds add pos_gunner_dir/pos_gunner to static add [csw] prefix to arsenal version add sight interaction icons * Update fnc_staticWeaponInit_unloadExtraMags.sqf * ace_rearm compat allows pulling carry mags out of rearm trucks * Update fnc_ai_handleFired.sqf * Re-add 3den attributes * cleanup and move A2 staticweapon strings to ace_csw
53 lines
1.5 KiB
Plaintext
53 lines
1.5 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: PabstMirror
|
|
* Gets magazines that the player is carrying that can be loaded into the static weapon
|
|
*
|
|
* Arguments:
|
|
* 0: Vehicle <OBJECT>
|
|
* 1: Player <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* Mags <ARRAY>
|
|
* [Carry Magazine <STRING>, Turret Path <ARRAY>, Ammo Needed <NUMBER>]
|
|
*
|
|
* Example:
|
|
* [cursorObject, player] call ace_csw_fnc_reload_getLoadableMagazines
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_vehicle", "_player"];
|
|
|
|
private _carriedMagazines = [];
|
|
|
|
{
|
|
if (isClass (configFile >> QGVAR(groups) >> _x)) then {
|
|
_carriedMagazines pushBackUnique _x;
|
|
};
|
|
} forEach (magazines _player);
|
|
|
|
if (_carriedMagazines isEqualTo []) exitWith { [] }; // fast exit if no carry mags
|
|
|
|
private _loadInfo = [];
|
|
private _return = [];
|
|
// Go through turrets and find weapons that we could reload
|
|
{
|
|
private _turretPath = _x;
|
|
{
|
|
private _weapon = _x;
|
|
{
|
|
private _carryMag = _x;
|
|
private _carryGroup = configFile >> QGVAR(groups) >> _carryMag;
|
|
{
|
|
if (((getNumber (_carryGroup >> _x)) == 1) && {_loadInfo = [_vehicle, _turretPath, _carryMag, _player] call FUNC(reload_canLoadMagazine); _loadInfo select 0}) exitWith {
|
|
_return pushBack [_carryMag, _turretPath, _loadInfo];
|
|
};
|
|
} forEach ([_weapon] call CBA_fnc_compatibleMagazines);
|
|
} forEach _carriedMagazines;
|
|
} forEach (_vehicle weaponsTurret _turretPath);
|
|
} forEach (allTurrets _vehicle);
|
|
// Note: these nested forEach's looks terrible, but most only have one element
|
|
|
|
_return
|