ACE3/addons/frag/functions/fnc_getSpallInfo.sqf

36 lines
948 B
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
/*
* Author: Lambda.Tiger
* This function returns spalling parameters for a specific ammo type.
*
* Arguments:
* 0: Ammo classname <STRING>
*
* Return Value:
* _ammoInfo <ARRAY>
* 0: Caliber <NUMBER>
* 1: What part of the hit damage is from ballistic vs explosive energy (1 for all explosive) <NUMBER>
* 2: Indirect hit damage <NUMBER>
*
* Example:
2024-03-29 00:33:56 +00:00
* "B_556x45_Ball" call ace_frag_fnc_getSpallInfo
*
* Public: No
*/
params ["_ammo"];
private _ammoInfo = GVAR(spallInfoCache) get _ammo;
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");
2024-01-18 00:52:55 +00:00
_ammoInfo = [_caliber, _explosive, _indirectHit];
GVAR(spallInfoCache) set [_ammo, _ammoInfo];
2024-01-15 19:39:19 +00:00
_ammoInfo