2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-08-07 14:43:06 +00:00
|
|
|
* Author: KoffeinFlummi, esteldunedain
|
2015-01-11 16:42:31 +00:00
|
|
|
* Adjusts the flight path of the bullet according to the zeroing
|
|
|
|
*
|
2015-02-10 04:22:10 +00:00
|
|
|
* Argument:
|
2015-05-08 18:36:24 +00:00
|
|
|
* 0: unit - Object the event handler is assigned to <OBJECT>
|
|
|
|
* 1: weapon - Fired weapon <STRING>
|
|
|
|
* 2: muzzle - Muzzle that was used <STRING>
|
|
|
|
* 3: mode - Current mode of the fired weapon <STRING>
|
|
|
|
* 4: ammo - Ammo used <STRING>
|
|
|
|
* 5: magazine - magazine name which was used <STRING>
|
|
|
|
* 6: projectile - Object of the projectile that was shot <OBJECT>
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
2015-02-10 04:22:10 +00:00
|
|
|
* Return value:
|
2015-01-11 16:42:31 +00:00
|
|
|
* None
|
2015-02-10 04:22:10 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
2015-01-16 12:15:14 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-07 14:43:06 +00:00
|
|
|
private ["_adjustment", "_weaponIndex", "_zeroing", "_adjustment"];
|
2015-02-10 02:00:40 +00:00
|
|
|
|
2015-08-08 19:17:03 +00:00
|
|
|
params ["_unit", "", "", "", "", "", "_projectile"];
|
2015-08-07 14:43:06 +00:00
|
|
|
|
|
|
|
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
|
2015-05-09 18:02:22 +00:00
|
|
|
|
2015-05-08 18:36:24 +00:00
|
|
|
_adjustment = _unit getVariable [QGVAR(Adjustment), []];
|
|
|
|
if (_adjustment isEqualTo []) exitWith {};
|
2015-02-10 02:00:40 +00:00
|
|
|
|
2015-02-12 14:57:55 +00:00
|
|
|
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
2015-02-10 04:22:10 +00:00
|
|
|
if (_weaponIndex < 0) exitWith {};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-02-10 04:22:10 +00:00
|
|
|
_zeroing = _adjustment select _weaponIndex;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-08-07 14:43:06 +00:00
|
|
|
if (_zeroing isEqualTo [0, 0, 0]) exitWith {};
|
2015-05-08 18:36:24 +00:00
|
|
|
|
2015-02-10 04:22:10 +00:00
|
|
|
// Convert zeroing from mils to degrees
|
2015-05-08 18:36:24 +00:00
|
|
|
_zeroing = _zeroing vectorMultiply 0.05625;
|
2015-08-08 19:17:03 +00:00
|
|
|
_zeroing params ["_elevation", "_windage", "_zero"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-08-07 14:43:06 +00:00
|
|
|
[_projectile, _elevation, _elevation + _zero, 0] call EFUNC(common,changeProjectileDirection);
|