ACE3/addons/frag/functions/fnc_shouldSpall.sqf
lambdatiger b6891b729d
formatting changes
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
2024-01-17 18:24:54 -06:00

34 lines
942 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: Lambda.Tiger
* This function checks whether an ammunition type should cause spalling.
*
* Arguments:
* 0: Type of ammo to check <STRING>
*
* Return Value:
* Whether the round type would spall when hitting an object <BOOL>
*
* Example:
* ["B_556x45_Ball"] call ace_frag_fnc_shouldSpall;
*
* Public: No
*/
params ["_ammo"];
private _shouldSpall = GVAR(shouldSpallCache) get _ammo;
if (!isNil "_shouldSpall") exitWith {_shouldSpall};
private _ammoConfig = configFile >> "CfgAmmo" >> _ammo;
private _caliber = getNumber (_ammoConfig >> "caliber");
private _explosive = getNumber (_ammoConfig >> "explosive");
private _indirectHit = getNumber (_ammoConfig >> "indirectHitRange");
_shouldSpall = _caliber * GVAR(spallIntensity) >= 2.5 || (_explosive >= 0.5 && _explosive * _indirectHit * GVAR(spallIntensity) >= 4);
GVAR(shouldSpallCache) set [_ammo, _shouldSpall];
_shouldSpall