2017-04-11 15:33:56 +00:00
|
|
|
/*
|
|
|
|
* Author: Jaynus, NouberNou
|
|
|
|
* Starts tracking a round that will frag.
|
|
|
|
* Should only be called once per round.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Shooter <OBJECT>
|
|
|
|
* 1: Ammo classname <STRING>
|
|
|
|
* 2: Projectile <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
2017-06-08 13:31:51 +00:00
|
|
|
* None
|
2017-04-11 15:33:56 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player, "handGrenade", bullet] call ace_frag_fnc_addPfhRound
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2016-05-30 16:37:03 +00:00
|
|
|
//#define DEBUG_MODE_FULL
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2017-04-11 15:33:56 +00:00
|
|
|
params ["_gun", "_type", "_round"];
|
|
|
|
TRACE_3("addPfhRound",_gun,_type,_round);
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2017-04-11 15:33:56 +00:00
|
|
|
if (!GVAR(enabled)) exitWith {TRACE_1("setting disabled",_this);};
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2017-04-11 15:33:56 +00:00
|
|
|
if (!alive _round) exitWith {TRACE_1("round dead?",_this);};
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-10-26 22:16:31 +00:00
|
|
|
if (_round in GVAR(blackList)) exitWith {
|
2017-04-11 15:33:56 +00:00
|
|
|
TRACE_1("round in blackList",_this);
|
2016-10-26 22:16:31 +00:00
|
|
|
REM(GVAR(blackList),_round);
|
2016-05-30 16:37:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Exit on max track
|
2017-04-11 15:33:56 +00:00
|
|
|
if ((count GVAR(objects)) >= GVAR(maxTrack)) exitWith {TRACE_1("maxTrack limit",count GVAR(objects));};
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-10-26 22:16:31 +00:00
|
|
|
private _doSpall = false;
|
|
|
|
if (GVAR(SpallEnabled)) then {
|
|
|
|
if (GVAR(spallIsTrackingCount) <= 0) then {
|
2016-05-30 16:37:03 +00:00
|
|
|
GVAR(spallHPData) = [];
|
|
|
|
};
|
2016-10-26 22:16:31 +00:00
|
|
|
if (GVAR(spallIsTrackingCount) > 5) then {
|
2017-04-11 15:33:56 +00:00
|
|
|
TRACE_1("At Spall Limit",GVAR(spallIsTrackingCount));
|
2016-05-30 16:37:03 +00:00
|
|
|
} else {
|
|
|
|
_doSpall = true;
|
2016-10-26 22:16:31 +00:00
|
|
|
INC(GVAR(spallIsTrackingCount));
|
2016-05-30 16:37:03 +00:00
|
|
|
};
|
2017-04-11 15:33:56 +00:00
|
|
|
TRACE_2("",_doSpall,GVAR(spallIsTrackingCount));
|
2016-05-30 16:37:03 +00:00
|
|
|
};
|
|
|
|
|
2017-04-11 15:33:56 +00:00
|
|
|
#ifdef DRAW_FRAG_INFO
|
|
|
|
[ACE_player, _round, [0, 1, 0, 1]] call FUNC(dev_addTrack);
|
|
|
|
#endif
|
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
|
2017-04-11 15:33:56 +00:00
|
|
|
if (alive _round) then {
|
2016-10-26 22:16:31 +00:00
|
|
|
private _spallTrack = [];
|
|
|
|
private _spallTrackID = [];
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-10-26 22:16:31 +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;
|
|
|
|
|
2016-10-26 22:16:31 +00:00
|
|
|
if (_doSpall) then {
|
2016-05-30 16:37:03 +00:00
|
|
|
[_round, 1, _spallTrack, _spallTrackID] call FUNC(spallTrack);
|
|
|
|
};
|
|
|
|
};
|