ACE3/addons/rearm/functions/fnc_canRearm.sqf

33 lines
896 B
Plaintext
Raw Normal View History

2015-08-15 16:43:13 +00:00
/*
* Author: GitHawk, Jonpas
* Check if a unit can rearm.
2015-08-15 16:43:13 +00:00
*
* Arguments:
2016-02-27 20:05:19 +00:00
* 0: Vehicle <OBJECT>
* 1: Unit <OBJECT>
2015-08-15 16:43:13 +00:00
*
* Return Value:
* Can Rearm <BOOL>
2015-08-15 16:43:13 +00:00
*
* Example:
2016-02-27 20:05:19 +00:00
* [tank, player] call ace_rearm_fnc_canRearm
2015-08-15 16:43:13 +00:00
*
* Public: No
*/
#include "script_component.hpp"
params [
["_vehicle", objNull, [objNull]],
["_unit", objNull, [objNull]]
];
2015-08-15 16:43:13 +00:00
Merge branch 'rearm_supply' of https://github.com/GitHawk/ACE3 into GitHawk-rearm_supply Conflicts: addons/attach/functions/fnc_getChildrenAttachActions.sqf addons/common/functions/fnc_dumpArray.sqf addons/common/functions/fnc_removeAllEventHandlers.sqf addons/common/functions/fnc_removeEventHandler.sqf addons/common/functions/fnc_serverEvent.sqf addons/common/functions/fnc_waitUntilAndExecute.sqf addons/explosives/functions/fnc_scriptedExplosive.sqf addons/finger/config.cpp addons/frag/config.cpp addons/interact_menu/functions/fnc_handlePlayerChanged.sqf addons/laser/functions/fnc_laserOn.sqf addons/laser/functions/fnc_seekerFindLaserSpot.sqf addons/laser/functions/fnc_unitTurretCanLockLaser.sqf addons/laser/functions/fnc_vanillaLaserSeekerHandler.sqf addons/laser_selfdesignate/functions/fnc_findLaserSource.sqf addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf addons/main/config.cpp addons/main/script_mod.hpp addons/map/functions/fnc_flashlightGlow.sqf addons/maptools/functions/fnc_addLineMarker.sqf addons/maptools/functions/fnc_canDraw.sqf addons/maptools/functions/fnc_cancelDrawing.sqf addons/maptools/functions/fnc_copyMapReceiveMarkers.sqf addons/maptools/functions/fnc_copyMapRemoteSend.sqf addons/maptools/functions/fnc_copyMapStart.sqf addons/maptools/functions/fnc_handleKeyDown.sqf addons/maptools/functions/fnc_handleMouseZChanged.sqf addons/maptools/functions/fnc_removeLineMarker.sqf addons/maptools/functions/fnc_updateLineMarker.sqf addons/missileguidance/functions/fnc_checkLos.sqf addons/missileguidance/functions/fnc_checkSeekerAngle.sqf addons/overheating/CfgWeapons.hpp addons/overheating/functions/fnc_swapBarrelCallback.sqf addons/rearm/XEH_postInit.sqf addons/rearm/XEH_respawn.sqf addons/rearm/functions/fnc_canRearm.sqf addons/rearm/functions/fnc_dropAmmo.sqf addons/rearm/functions/fnc_getMaxMagazines.sqf addons/rearm/functions/fnc_grabAmmo.sqf addons/rearm/functions/fnc_pickUpAmmo.sqf addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf addons/rearm/functions/fnc_rearmEntireVehicleSuccessLocal.sqf addons/rearm/functions/fnc_rearmSuccess.sqf addons/rearm/functions/fnc_rearmSuccessLocal.sqf addons/rearm/functions/fnc_storeAmmo.sqf addons/repair/functions/fnc_useItem.sqf addons/tagging/CfgVehicles.hpp addons/ui/ACE_UI.hpp optionals/tracers/config.cpp
2017-05-17 23:21:11 +00:00
if (!alive _vehicle) exitWith {false};
2016-02-27 20:05:19 +00:00
if (GVAR(level) == 0 || {isNull _unit} || {!(_unit isKindOf "CAManBase")} || {!local _unit} || {_vehicle distance _unit > REARM_ACTION_DISTANCE} || {_vehicle getVariable [QGVAR(disabled), false]}) exitWith {false};
2016-02-27 20:05:19 +00:00
private _dummy = _unit getVariable [QGVAR(dummy), objNull];
if (isNull _dummy) exitwith {false};
2016-02-27 20:05:19 +00:00
private _magazineClass = _dummy getVariable QGVAR(magazineClass);
if (isNil "_magazineClass") exitWith {false};
2015-08-15 16:43:13 +00:00
2016-02-27 20:05:19 +00:00
([_vehicle, _magazineClass] call FUNC(getNeedRearmMagazines)) select 0