ACE3/addons/reload/functions/fnc_canCheckAmmo.sqf

45 lines
1.2 KiB
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
/*
* Author: CAA-Picard, johnb43
* Check if a unit can check the ammo of the target.
*
2016-06-18 09:50:41 +00:00
* Arguments:
* 0: Unit equipped with the weapon/CSW to check <OBJECT>
* 1: Unit checking ammo <OBJECT>
*
2016-06-18 09:50:41 +00:00
* Return Value:
* Can check ammo <BOOL>
2015-04-22 00:35:04 +00:00
*
* Example:
* [cursorObject, player] call ace_reload_fnc_canCheckAmmo
2015-04-22 00:35:04 +00:00
*
* Public: No
*/
params ["_target", "_player"];
2015-04-18 03:40:37 +00:00
// Static weapons
if (_target isKindOf "StaticWeapon") exitWith {
// No check ammo action on destroyed static weapons
if (!alive _target || {!([_player, _target] call EFUNC(interaction,canInteractWithVehicleCrew))}) exitWith {false};
if (currentMagazine _target != "") exitWith {true};
// Check for loaded magazines
(magazinesAmmoFull _target) findIf {_x select 2} != -1
};
// All other vehicles
if !(_target isKindOf "CAManBase") exitWith {false};
// For men
if (currentWeapon _target == "") exitWith {false};
// Check if their current magazine is a belt
if (getNumber (configFile >> "CfgMagazines" >> currentMagazine _target >> "ACE_isBelt") == 1) exitWith {true};
// Check for rocket launchers
if (currentWeapon _target == secondaryWeapon _target) exitWith {true};
false