ACE3/addons/winddeflection/functions/fnc_handleFired.sqf

36 lines
1.6 KiB
Plaintext
Raw Normal View History

2015-03-12 05:28:33 +00:00
/*
* Author: Glowbal, Ruthberg
2016-02-06 21:36:20 +00:00
* Handles wind deflection for projectiles. Called from the unified fired EH only for players on foot and their vehicles if required by settings.
*
2015-03-12 05:28:33 +00:00
* Arguments:
2016-02-06 21:36:20 +00:00
* None. Parameters inherited from EFUNC(common,firedEH)
*
2015-03-12 05:28:33 +00:00
* Return Value:
* None
*
2015-03-12 05:28:33 +00:00
* Example:
2015-04-05 19:08:55 +00:00
* [clientFiredBIS-XEH] call ace_advanced_ballistics_fnc_handleFired
2015-03-12 05:28:33 +00:00
*
* Public: No
*/
#include "script_component.hpp"
2016-02-06 21:36:20 +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);
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && {_projectile isKindOf "BulletBase" && {_unit isKindOf "Man"}}) exitWith {false};
2016-07-24 04:08:40 +00:00
if (!((_projectile isKindOf "BulletBase") || {_projectile isKindOf "GrenadeBase"})) exitWith {false};
if (_unit distance ACE_player > 2000) exitWith {false};
private _abort = false;
if (!local _unit && {_projectile isKindOf "BulletBase"}) then {
private _ammoCount = (_unit ammo _muzzle) + 1;
private _tracersEvery = getNumber(configFile >> "CfgMagazines" >> _magazine >> "tracersEvery");
private _lastRoundsTracer = getNumber(configFile >> "CfgMagazines" >> _magazine >> "lastRoundsTracer");
_abort = _ammoCount > _lastRoundsTracer && {_tracersEvery == 0 || {(_ammoCount - _lastRoundsTracer) % _tracersEvery != 0}};
};
if (_abort) exitWith {false};
2016-02-07 00:00:42 +00:00
GVAR(trackedBullets) pushBack [_projectile, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")];