mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Use getOrDefaultCall
This commit is contained in:
parent
6b828593eb
commit
e8283c30a0
@ -20,16 +20,11 @@
|
||||
|
||||
params ["_ammo"];
|
||||
|
||||
private _ammoInfo = GVAR(spallInfoCache) get _ammo;
|
||||
GVAR(spallInfoCache) getOrDefaultCall [_ammo, {
|
||||
private _ammoConfig = configFile >> "CfgAmmo" >> _ammo;
|
||||
private _caliber = getNumber (_ammoConfig >> "caliber");
|
||||
private _explosive = 1 min getNumber (_ammoConfig >> "explosive");
|
||||
private _indirectHit = getNumber (_ammoConfig >> "indirectHitRange");
|
||||
|
||||
if (!isNil "_ammoInfo") exitWith {_ammoInfo};
|
||||
|
||||
private _ammoConfig = configFile >> "CfgAmmo" >> _ammo;
|
||||
private _caliber = getNumber (_ammoConfig >> "caliber");
|
||||
private _explosive = 1 min getNumber (_ammoConfig >> "explosive");
|
||||
private _indirectHit = getNumber (_ammoConfig >> "indirectHitRange");
|
||||
_ammoInfo = [_caliber, _explosive, _indirectHit];
|
||||
|
||||
GVAR(spallInfoCache) set [_ammo, _ammoInfo];
|
||||
|
||||
_ammoInfo
|
||||
[_caliber, _explosive, _indirectHit]
|
||||
}, true]
|
||||
|
@ -17,20 +17,8 @@
|
||||
|
||||
params ["_ammo"];
|
||||
|
||||
private _shouldSpall = GVAR(shouldSpallCache) get _ammo;
|
||||
GVAR(shouldSpallCache) getOrDefaultCall [_ammo, {
|
||||
(_ammo call FUNC(getSpallInfo)) params ["_caliber", "_explosive", "_indirectHit"];
|
||||
|
||||
if (!isNil "_shouldSpall") exitWith {_shouldSpall};
|
||||
|
||||
private _ammoConfig = configFile >> "CfgAmmo" >> _ammo;
|
||||
private _caliber = getNumber (_ammoConfig >> "caliber");
|
||||
private _explosive = 1 min getNumber (_ammoConfig >> "explosive");
|
||||
private _indirectHit = getNumber (_ammoConfig >> "indirectHitRange");
|
||||
|
||||
// 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];
|
||||
|
||||
_shouldSpall
|
||||
(_caliber * GVAR(spallIntensity) >= 1.25 * ACE_FRAG_SPALL_POWER_MIN) || {_explosive >= 0.5 && {_indirectHit * GVAR(spallIntensity) >= 2 * ACE_FRAG_SPALL_POWER_MIN}}
|
||||
}, true]
|
||||
|
Loading…
Reference in New Issue
Block a user