From f852a3ab2d00f9c4d161cd0097c521c7374c6a90 Mon Sep 17 00:00:00 2001 From: lambdatiger Date: Mon, 8 Jan 2024 21:41:31 -0600 Subject: [PATCH] Added a config defined holdoff per vehicle fragmenting for performance --- addons/frag/functions/fnc_doFrag.sqf | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/addons/frag/functions/fnc_doFrag.sqf b/addons/frag/functions/fnc_doFrag.sqf index 574723ce7f..ad84f8aefc 100644 --- a/addons/frag/functions/fnc_doFrag.sqf +++ b/addons/frag/functions/fnc_doFrag.sqf @@ -19,25 +19,34 @@ * * Public: No */ - params ["_args", ["_isSubMunit", false, [false]]]; _args params [ ["_proj", objNull, [objNull]], ["_posASL", [0,0,0], [[]], [3]], ["_vel", [0,0,0] , [[]], [3]] ]; +TRACE_3("",_proj,_posASL,_vel); + +private _shotParents = getShotParents _proj; +private _shotParentVic = _shotParents#0; +if (_shotParentVic getVariable [QGVAR(nextFragTime), -1] < CBA_missionTime) exitWith { + TRACE_1("vehicleTimeExit",_shotParentVic); +}; +_shotParentVic setVariable [QGVAR(nextFragTime), CBA_missionTime + ACE_FRAG_HOLDOFF]; private _timeSince = CBA_missionTime - GVAR(lastFragTime); -if (isNull _proj || {_posASL isEqualTo [0,0,0] || _timeSince < 0.2}) exitWith {}; +if (isNull _proj || {_posASL isEqualTo [0,0,0] || _timeSince < 0.2}) exitWith { + TRACE_3("timeExit",_timeSince,CBA_missionTime,GVAR(lastFragTime)); +}; GVAR(lastFragTime) = CBA_missionTime; -private _maxFrags = round (linearConversion [0.1, 1.5, _timeSince, MAX_FRAG_COUNT_MIN, MAX_FRAG_COUNT_MAX, true]); +private _maxFrags = round (linearConversion [0.1, 1.5, _timeSince, ACE_FRAG_COUNT_MIN, ACE_FRAG_COUNT_MAX, true]); +TRACE_3("",_timeSince,CBA_missionTime,_maxFrags); + private _ammo = typeOf _proj; private _ammoArr = [_ammo] call FUNC(fragInfo); _ammoArr params ["_fragRange", "_fragVel", "_fragTypes", "_modFragCount"]; -private _shotParents = getShotParents _proj; - private _heightAGL = (ASLToAGL _posASL)#2; if (_heightAGL < 0.25) then { _posASL = _posASL vectorAdd [0, 0, 0.25];