2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-02-14 06:39:01 +00:00
|
|
|
* Author: commy2
|
2016-02-06 20:20:30 +00:00
|
|
|
* Adjust the grenades throwing direction and speed to the selected throwing mode. Called from the unified fired EH only for CAManBase
|
2015-02-14 06:39:01 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2016-02-06 20:20:30 +00:00
|
|
|
* None. Parameters inherited from EFUNC(common,firedEH)
|
2015-02-14 06:39:01 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-13 20:36:58 +00:00
|
|
|
* None
|
2015-02-14 06:39:01 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [clientFiredBIS-XEH] call ace_grenades_fnc_throwGrenade
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-14 09:06:47 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2016-02-06 20:20:30 +00:00
|
|
|
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
|
|
|
|
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (_weapon != "Throw") exitWith {};
|
|
|
|
|
2015-09-01 21:56:25 +00:00
|
|
|
// http://feedback.arma3.com/view.php?id=12340
|
|
|
|
if (isNull _projectile) then {
|
|
|
|
_projectile = nearestObject [_unit, _ammo];
|
|
|
|
};
|
|
|
|
|
2016-01-06 21:42:02 +00:00
|
|
|
private _config = configFile >> "CfgAmmo" >> _ammo;
|
|
|
|
|
2015-09-03 00:55:40 +00:00
|
|
|
// handle special grenades
|
2015-09-01 21:19:49 +00:00
|
|
|
if (local _unit) then {
|
2016-01-06 21:42:02 +00:00
|
|
|
if (getNumber (_config >> QGVAR(flashbang)) == 1) then {
|
|
|
|
private _fuzeTime = getNumber (_config >> "explosionTime");
|
2015-09-01 21:19:49 +00:00
|
|
|
|
2016-02-03 23:53:24 +00:00
|
|
|
[FUNC(flashbangThrownFuze), [_projectile], _fuzeTime] call EFUNC(common,waitAndExecute);
|
2015-09-01 21:19:49 +00:00
|
|
|
};
|
2015-09-01 21:56:25 +00:00
|
|
|
};
|
2015-09-01 21:19:49 +00:00
|
|
|
|
2016-01-06 21:42:02 +00:00
|
|
|
if (getNumber (_config >> QGVAR(flare)) == 1) then {
|
|
|
|
private _fuzeTime = getNumber (_config >> "explosionTime");
|
|
|
|
private _timeToLive = getNumber (_config >> "timeToLive");
|
|
|
|
private _color = getArray (_config >> QGVAR(color));
|
|
|
|
private _intensity = _color deleteAt 3;
|
2015-09-01 21:19:49 +00:00
|
|
|
|
2015-09-01 21:56:25 +00:00
|
|
|
[FUNC(flare), [_projectile, _color, _intensity, _timeToLive], _fuzeTime, 0] call EFUNC(common,waitAndExecute);
|
2015-09-01 21:19:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// handle throw modes
|
|
|
|
if (_unit != ACE_player) exitWith {};
|
|
|
|
|
2016-01-06 21:42:02 +00:00
|
|
|
private _mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (_mode != 0) then {
|
2016-01-06 21:42:02 +00:00
|
|
|
private _velocity = velocity _projectile;
|
2015-02-14 06:39:01 +00:00
|
|
|
|
|
|
|
switch (_mode) do {
|
|
|
|
//high throw
|
2015-09-01 21:19:49 +00:00
|
|
|
case 1 : {
|
2015-02-14 06:39:01 +00:00
|
|
|
_velocity = [
|
|
|
|
0.5 * (_velocity select 0),
|
|
|
|
0.5 * (_velocity select 1),
|
|
|
|
[0, 0, 0] distance (_velocity vectorMultiply 0.5)
|
|
|
|
];
|
|
|
|
};
|
|
|
|
//precise throw
|
2015-09-01 21:19:49 +00:00
|
|
|
case 2 : {
|
2015-02-14 06:39:01 +00:00
|
|
|
_velocity = (_unit weaponDirection _weapon) vectorMultiply (vectorMagnitude _velocity);
|
|
|
|
};
|
|
|
|
//roll grande
|
2015-09-01 21:19:49 +00:00
|
|
|
case 3 : {
|
2015-02-14 06:39:01 +00:00
|
|
|
//@todo
|
|
|
|
};
|
|
|
|
//drop grenade
|
2015-09-01 21:19:49 +00:00
|
|
|
case 4 : {
|
2015-02-14 06:39:01 +00:00
|
|
|
_velocity = [0, 0, 0];
|
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
2015-02-14 06:39:01 +00:00
|
|
|
_projectile setVelocity _velocity;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|