2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-01-14 09:06:47 +00:00
|
|
|
* Author: commy2
|
|
|
|
*
|
|
|
|
* Adjust the grenades throwing direction and speed to the selected throwing mode.
|
|
|
|
*
|
|
|
|
* Argument:
|
|
|
|
* input from "Fired" eventhandler
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* Nothing
|
|
|
|
*/
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-14 09:06:47 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
private ["_unit", "_weapon", "_projectile", "_mode", "_fuzeTime"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_unit = _this select 0;
|
|
|
|
_weapon = _this select 1;
|
|
|
|
_projectile = _this select 6;
|
|
|
|
|
2015-01-14 09:06:47 +00:00
|
|
|
if (_unit != ACE_player) exitWith {};
|
2015-01-11 16:42:31 +00:00
|
|
|
if (_weapon != "Throw") exitWith {};
|
|
|
|
|
2015-01-14 09:06:47 +00:00
|
|
|
_mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (_mode != 0) then {
|
|
|
|
private "_velocity";
|
|
|
|
|
|
|
|
_velocity = velocity _projectile;
|
|
|
|
|
|
|
|
switch (_mode) do {
|
|
|
|
//high throw
|
2015-01-14 09:06:47 +00:00
|
|
|
case 1 : {
|
2015-01-11 16:42:31 +00:00
|
|
|
_velocity = [
|
2015-01-14 09:06:47 +00:00
|
|
|
0.5 * (_velocity select 0),
|
|
|
|
0.5 * (_velocity select 1),
|
|
|
|
[0, 0, 0] distance (_velocity vectorMultiply 0.5)
|
2015-01-11 16:42:31 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
//precise throw
|
2015-01-14 09:06:47 +00:00
|
|
|
case 2 : {
|
2015-01-11 16:42:31 +00:00
|
|
|
_velocity = (_unit weaponDirection _weapon) vectorMultiply (vectorMagnitude _velocity);
|
|
|
|
};
|
|
|
|
//roll grande
|
2015-01-14 09:06:47 +00:00
|
|
|
case 3 : {
|
2015-01-11 16:42:31 +00:00
|
|
|
//@todo
|
|
|
|
};
|
|
|
|
//drop grenade
|
2015-01-14 09:06:47 +00:00
|
|
|
case 4 : {
|
2015-01-11 16:42:31 +00:00
|
|
|
_velocity = [0, 0, 0];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
_projectile setVelocity _velocity;
|
|
|
|
};
|
|
|
|
|
2015-01-14 09:06:47 +00:00
|
|
|
if (typeOf _projectile == "ACE_G_M84") then {
|
|
|
|
// _fuzeTime = (configFile >> "CfgAmmo" >> typeOf _projectile >> "fuseDistance");
|
|
|
|
_fuzeTime = (configFile >> "CfgAmmo" >> typeOf _projectile >> "explosionTime"); //@toDo pretty sure this should be explosionTime not fuseDistance
|
|
|
|
[FUNC(flashbangThrownFuze), 0, [_projectile, (time + _fuzeTime)]] call CBA_fnc_addPerFrameHandler;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|