From 3e52ce29812b715f4f808b9310533995ab294399 Mon Sep 17 00:00:00 2001 From: lambdatiger Date: Sat, 2 Mar 2024 19:17:38 -0600 Subject: [PATCH] doFragRandom was always being called and spawning at least 5 fragments even when the fragment budget of 50 was reached. Fixed variable name (AGL instead of ATL). --- addons/frag/functions/fnc_doFrag.sqf | 4 ++-- addons/frag/functions/fnc_doFragRandom.sqf | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/addons/frag/functions/fnc_doFrag.sqf b/addons/frag/functions/fnc_doFrag.sqf index 8d0840fa08..cf91985186 100644 --- a/addons/frag/functions/fnc_doFrag.sqf +++ b/addons/frag/functions/fnc_doFrag.sqf @@ -17,7 +17,7 @@ * * Public: No */ - +#define ACE_FRAG_MIN_FRAG_BUDGET_FOR_RANDOM 3 TRACE_1("begin doFrag",_this); params ["_posASL", "_velocity", "_ammo", "_shotParents"]; @@ -56,6 +56,6 @@ if (GVAR(fragSimComplexity) != 1 && _fragRange > 3) then { _maxFragCount = _maxFragCount - ([_posASL, _fragVel, _fragRange, _maxFragCount, _fragTypes, _modFragCount, _shotParents] call FUNC(doFragTargeted)); }; -if (GVAR(fragSimComplexity) > 0) then { +if (GVAR(fragSimComplexity) > 0 && _maxFragCount >= ACE_FRAG_MIN_FRAG_BUDGET_FOR_RANDOM) then { [_posASL, _velocity, _heightATL, _fragTypes, _maxFragCount, _shotParents] call FUNC(doFragRandom); }; diff --git a/addons/frag/functions/fnc_doFragRandom.sqf b/addons/frag/functions/fnc_doFragRandom.sqf index fa7e63bbe1..f276c8edce 100644 --- a/addons/frag/functions/fnc_doFragRandom.sqf +++ b/addons/frag/functions/fnc_doFragRandom.sqf @@ -1,7 +1,8 @@ #include "..\script_component.hpp" /* * Author: Jaynus, NouberNou, Lambda.Tiger - * This function creates fragments randomly spreading out from an explosion to a maximum of 15. + * This function creates fragments randomly spreading out from an explosion. + * This function will spawn 5, 10, or 15 fragments depending on the * * Arguments: * 0: Position (posASL) of fragmenting projectile @@ -20,13 +21,13 @@ * Public: No */ -params ["_posASL", "_fragVelocity", "_heightAGL", "_fragType", "_maxFragCount", "_shotParents"]; -TRACE_6("doFragRandom",_posASL,_fragVelocity,_heightAGL,_fragType,_maxFragCount,_shotParents); +params ["_posASL", "_fragVelocity", "_heightATL", "_fragType", "_maxFragCount", "_shotParents"]; +TRACE_6("doFragRandom",_posASL,_fragVelocity,_heightATL,_fragType,_maxFragCount,_shotParents); // See CfgAmmoFragSpawner for different frag types private _hMode = switch (true) do { - case (_heightAGL > 10): {"_top"}; - case (_heightAGL > 5): {"_hi"}; + case (_heightATL > 10): {"_top"}; + case (_heightATL > 5): {"_hi"}; default {"_mid"}; };