2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: KoffeinFlummi and 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:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Weapon <STRING>
|
|
|
|
* 3: Muzzle <STRING>
|
|
|
|
* 4: Magazine <STRING>
|
|
|
|
* 5: Ammo <STRING>
|
|
|
|
* 6: Projectile <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-02-10 04:22:10 +00:00
|
|
|
private ["_unit", "_adjustment", "_weapon", "_projectile", "_weaponIndex", "_zeroing", "_adjustment"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_unit = _this select 0;
|
2015-02-10 02:00:40 +00:00
|
|
|
|
2015-02-10 04:22:10 +00:00
|
|
|
// Exit if the unit doesn't have any adjusment variable
|
2015-02-10 02:00:40 +00:00
|
|
|
_adjustment = _unit getVariable QGVAR(Adjustment);
|
|
|
|
if (isNil "_adjustment") exitWith {};
|
|
|
|
|
2015-02-10 04:22:10 +00:00
|
|
|
// Exit if the unit isn't a player
|
2015-02-10 02:00:40 +00:00
|
|
|
if !([_unit] call EFUNC(common,isPlayer)) exitWith {};
|
|
|
|
|
2015-02-10 04:22:10 +00:00
|
|
|
_weapon = _this select 1;
|
|
|
|
_projectile = _this select 5;
|
2015-01-11 16:42:31 +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-02-10 04:22:10 +00:00
|
|
|
// Convert zeroing from mils to degrees
|
2015-01-16 12:15:14 +00:00
|
|
|
_zeroing = [_zeroing, {_this * 0.05625}] call EFUNC(common,map);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-02-10 04:22:10 +00:00
|
|
|
[_projectile, _zeroing select 0, _zeroing select 1, 0] call EFUNC(common,changeProjectileDirection);
|