ACE3/addons/reload/functions/fnc_checkAmmo.sqf

43 lines
971 B
Plaintext
Raw Normal View History

/*
2015-03-24 04:18:00 +00:00
* Author: commy2 and esteldunedain
* Count the ammo of the currently loaded magazine or count rifle grenades. Play animation and display message.
2015-03-06 04:32:47 +00:00
*
2016-06-18 09:50:41 +00:00
* Arguments:
2015-03-06 04:32:47 +00:00
* 0: Player <OBJECT>
* 1: Target. Optional, if not suplied the player counts his personal or static weapon ammo <OBJECT>
*
2016-06-18 09:50:41 +00:00
* Return Value:
* None
*
* Example:
* [bob, kevin] call ace_reload_fnc_checkAmmo
*
* Public: No
*/
2015-01-16 01:25:41 +00:00
#include "script_component.hpp"
#define COUNT_BARS 12
2016-01-06 21:42:02 +00:00
params ["_unit"];
2016-01-06 21:42:02 +00:00
private _target = vehicle _unit;
2015-03-06 04:32:47 +00:00
if (count _this > 1) then {
_target = _this select 1;
} else {
2015-03-06 04:32:47 +00:00
// If the unit is on foot, count it's own ammo
if (_unit == _target) exitWith {};
2015-03-06 04:32:47 +00:00
// If it's mounted on a movile weapon, count it's own ammo
if !(_target isKindOf "StaticWeapon") then {
_target = _unit;
};
2015-03-06 04:32:47 +00:00
};
if (_unit == _target) then {
2016-07-13 09:00:31 +00:00
[_unit, "Gear", 1] call EFUNC(common,doGesture);
};
[FUNC(displayAmmo), [_target], 1, 0.1] call CBA_fnc_waitAndExecute;