ACE3/addons/frag/functions/fnc_addPfhRound.sqf

69 lines
2.2 KiB
Plaintext
Raw Normal View History

2016-05-30 16:37:03 +00:00
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
params ["_gun", "_type", "_round", ["_doFragTrack", false]];
2016-05-30 16:37:03 +00:00
if (!GVAR(enabled)) exitWith {};
//_enabled = getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(enabled));
//if (_enabled < 1) exitWith {};
2016-05-30 16:37:03 +00:00
if (_round in GVAR(blackList)) exitWith {
REM(GVAR(blackList),_round);
2016-05-30 16:37:03 +00:00
};
// Exit on max track
if ((count GVAR(objects)) > GVAR(maxTrack)) exitWith {};
2016-05-30 16:37:03 +00:00
if (
_gun == ACE_player ||
{(gunner _gun) == ACE_player} ||
{local _gun && {!(isPlayer (gunner _gun))} && {!(isPlayer _gun)}}
) then {
2016-05-30 16:37:03 +00:00
_doFragTrack = true;
};
private _doSpall = false;
if (GVAR(SpallEnabled)) then {
if (GVAR(spallIsTrackingCount) <= 0) then {
2016-05-30 16:37:03 +00:00
GVAR(spallHPData) = [];
};
if (GVAR(spallIsTrackingCount) > 5) then {
2016-05-30 16:37:03 +00:00
// ACE_player sideChat "LIMT!";
} else {
_doSpall = true;
INC(GVAR(spallIsTrackingCount));
2016-05-30 16:37:03 +00:00
};
};
// ACE_player sideChat format ["c: %1", GVAR(spallIsTrackingCount)];
2016-05-30 16:37:03 +00:00
if (GVAR(autoTrace)) then {
[ACE_player, _round, [1, 0, 0, 1]] call FUNC(addTrack);
2016-05-30 16:37:03 +00:00
};
// We only do the single track object check here.
// We should do an {!(_round in GVAR(objects))}
// But we leave that out here for optimization. So this cannot be a framework function
// Otherwise, it should only be added once and from the FiredEH
if (_doFragTrack && {alive _round}) then {
private _spallTrack = [];
private _spallTrackID = [];
2016-05-30 16:37:03 +00:00
private _args = [
_round, getPosASL _round, velocity _round, _type, diag_frameno, _gun, _doSpall, _spallTrack, _spallTrackID,
getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip)),
getNumber (configFile >> "CfgAmmo" >> _type >> "explosive"),
getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange"),
getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(force)),
getNumber (configFile >> "CfgAmmo" >> _type >> "indirecthit") * (sqrt (getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange")))
2016-05-30 16:37:03 +00:00
];
TRACE_1("Initializing track", _round);
GVAR(objects) pushBack _round;
GVAR(arguments) pushBack _args;
if (_doSpall) then {
2016-05-30 16:37:03 +00:00
[_round, 1, _spallTrack, _spallTrackID] call FUNC(spallTrack);
};
// ACE_player sideChat "WTF2";
};