2024-01-11 20:01:50 +00:00
|
|
|
#include "..\script_component.hpp"
|
2024-01-08 21:22:52 +00:00
|
|
|
/*
|
|
|
|
* Author: Lambda.Tiger
|
2024-01-18 00:20:47 +00:00
|
|
|
* This function checks whether an ammunition type should cause spalling.
|
2024-01-08 21:22:52 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2024-01-18 00:24:54 +00:00
|
|
|
* 0: Type of ammo to check <STRING>
|
2024-01-13 06:35:22 +00:00
|
|
|
*
|
2024-01-08 21:22:52 +00:00
|
|
|
* Return Value:
|
2024-01-13 06:35:22 +00:00
|
|
|
* Whether the round type would spall when hitting an object <BOOL>
|
2024-01-08 21:22:52 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* ["B_556x45_Ball"] call ace_frag_fnc_shouldSpall;
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_ammo"];
|
|
|
|
|
2024-01-15 05:08:37 +00:00
|
|
|
private _shouldSpall = GVAR(shouldSpallCache) get _ammo;
|
2024-01-08 21:22:52 +00:00
|
|
|
|
2024-01-13 06:35:22 +00:00
|
|
|
if (!isNil "_shouldSpall") exitWith {_shouldSpall};
|
2024-01-08 21:22:52 +00:00
|
|
|
|
2024-01-16 00:47:06 +00:00
|
|
|
private _ammoConfig = configFile >> "CfgAmmo" >> _ammo;
|
|
|
|
private _caliber = getNumber (_ammoConfig >> "caliber");
|
|
|
|
private _explosive = getNumber (_ammoConfig >> "explosive");
|
|
|
|
private _indirectHit = getNumber (_ammoConfig >> "indirectHitRange");
|
2024-01-08 21:22:52 +00:00
|
|
|
|
2024-02-15 02:15:38 +00:00
|
|
|
_shouldSpall = _caliber * GVAR(spallIntensity) >= 2.5 || (_explosive >= 0.5 && {_explosive * _indirectHit * GVAR(spallIntensity) >= 4});
|
2024-01-10 23:39:46 +00:00
|
|
|
|
2024-01-15 05:08:37 +00:00
|
|
|
GVAR(shouldSpallCache) set [_ammo, _shouldSpall];
|
2024-01-08 21:22:52 +00:00
|
|
|
|
2024-01-15 19:39:19 +00:00
|
|
|
_shouldSpall
|