From ef39e78db986c5c2c8a95002469f48b662db9525 Mon Sep 17 00:00:00 2001 From: lambdatiger Date: Thu, 28 Mar 2024 19:17:13 -0500 Subject: [PATCH] removed magic numbers and cached values preemptively (normally spallInfoCache is called later, but we pull the right config parameters so we might as well store them) --- addons/frag/functions/fnc_shouldSpall.sqf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/frag/functions/fnc_shouldSpall.sqf b/addons/frag/functions/fnc_shouldSpall.sqf index c545c88676..002bc53e49 100644 --- a/addons/frag/functions/fnc_shouldSpall.sqf +++ b/addons/frag/functions/fnc_shouldSpall.sqf @@ -23,10 +23,13 @@ if (!isNil "_shouldSpall") exitWith {_shouldSpall}; private _ammoConfig = configFile >> "CfgAmmo" >> _ammo; private _caliber = getNumber (_ammoConfig >> "caliber"); -private _explosive = getNumber (_ammoConfig >> "explosive"); +private _explosive = 1 min getNumber (_ammoConfig >> "explosive"); private _indirectHit = getNumber (_ammoConfig >> "indirectHitRange"); -_shouldSpall = _caliber * GVAR(spallIntensity) >= 2.5 || (_explosive >= 0.5 && {_explosive * _indirectHit * GVAR(spallIntensity) >= 4}); +// We need get this for fnc_getSpallInfo, so might as well cache it since we have it +GVAR(spallInfoCache) set [_ammo, [_caliber, _explosive, _indirectHit]]; + +_shouldSpall = _caliber * GVAR(spallIntensity) >= 1.25 * ACE_FRAG_SPALL_POWER_MIN || (_explosive >= 0.5 && {_indirectHit * GVAR(spallIntensity) >= 2 * ACE_FRAG_SPALL_POWER_MIN}); GVAR(shouldSpallCache) set [_ammo, _shouldSpall];