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).

This commit is contained in:
lambdatiger 2024-03-02 19:17:38 -06:00
parent 3cb07e8323
commit 3e52ce2981
2 changed files with 8 additions and 7 deletions

View File

@ -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);
};

View File

@ -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 <ARRAY>
@ -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"};
};