2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: commy2 and esteldunedain
|
2015-01-11 16:42:31 +00:00
|
|
|
* 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:
|
2015-01-11 16:42:31 +00:00
|
|
|
* Nothing
|
|
|
|
*/
|
2015-01-16 01:25:41 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
#define COUNT_BARS 12
|
|
|
|
|
2016-01-06 21:42:02 +00:00
|
|
|
params ["_unit"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2016-01-06 21:42:02 +00:00
|
|
|
private _target = vehicle _unit;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-03-06 04:32:47 +00:00
|
|
|
if (count _this > 1) then {
|
|
|
|
_target = _this select 1;
|
|
|
|
} else {
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-03-06 04:32:47 +00:00
|
|
|
// If the unit is on foot, count it's own ammo
|
|
|
|
if (_unit == _target) exitWith {};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
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-01-11 16:42:31 +00:00
|
|
|
};
|
2015-03-06 04:32:47 +00:00
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-03-21 13:23:36 +00:00
|
|
|
if (_unit == _target) then {
|
2016-07-13 09:00:31 +00:00
|
|
|
[_unit, "Gear", 1] call EFUNC(common,doGesture);
|
2015-03-21 13:23:36 +00:00
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2016-05-22 13:27:24 +00:00
|
|
|
[FUNC(displayAmmo), [_target], 1, 0.1] call CBA_fnc_waitAndExecute;
|