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)

This commit is contained in:
lambdatiger 2024-03-28 19:17:13 -05:00
parent 5bab127a5a
commit ef39e78db9

View File

@ -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];