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
|
|
|
*
|
2015-01-11 16:42:31 +00:00
|
|
|
* Argument:
|
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>
|
|
|
|
*
|
2015-01-11 16:42:31 +00:00
|
|
|
* Return value:
|
|
|
|
* 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
|
|
|
|
|
2015-03-06 04:32:47 +00:00
|
|
|
EXPLODE_1_PVT(_this,_unit);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-03-06 04:32:47 +00:00
|
|
|
private ["_target"];
|
|
|
|
_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 {
|
|
|
|
_unit playActionNow "Gear";
|
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-03-06 04:32:47 +00:00
|
|
|
[FUNC(displayAmmo), [_target], 1, 0.1] call EFUNC(common,waitAndExecute);
|