2024-01-11 20:01:50 +00:00
|
|
|
#include "..\script_component.hpp"
|
2024-01-08 21:22:52 +00:00
|
|
|
/*
|
|
|
|
* Author: Lambda.Tiger
|
2024-02-15 02:07:19 +00:00
|
|
|
* This function checks whether an ammunition type should create fragments.
|
2024-01-13 06:35:22 +00:00
|
|
|
*
|
2024-01-08 21:22:52 +00:00
|
|
|
* Arguments:
|
2024-02-16 03:05:31 +00:00
|
|
|
* 0: Ammo classname <STRING>
|
2024-01-13 06:35:22 +00:00
|
|
|
*
|
2024-01-08 21:22:52 +00:00
|
|
|
* Return Value:
|
2024-07-17 02:45:41 +00:00
|
|
|
* An array containing <ARRAY>
|
|
|
|
* 0: Should the ammo class generate fragments <BOOL>
|
|
|
|
* 1: Should the ammo class create submunitions that may fragment <BOOL>
|
2024-01-08 21:22:52 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2024-03-29 00:33:56 +00:00
|
|
|
* "B_556x45_Ball" call ace_frag_fnc_shouldFrag
|
2024-01-08 21:22:52 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_ammo"];
|
|
|
|
|
|
|
|
private _shouldFrag = GVAR(shouldFragCache) get _ammo;
|
|
|
|
|
2024-01-13 06:35:22 +00:00
|
|
|
if (!isNil "_shouldFrag") exitWith {_shouldFrag};
|
2024-01-11 01:47:05 +00:00
|
|
|
|
2024-07-17 06:53:40 +00:00
|
|
|
_shouldFrag = true;
|
2024-01-08 21:22:52 +00:00
|
|
|
|
2024-01-16 00:47:06 +00:00
|
|
|
private _ammoConfig = configFile >> "CfgAmmo" >> _ammo;
|
|
|
|
private _skip = getNumber (_ammoConfig >> QGVAR(skip));
|
2024-02-16 03:05:31 +00:00
|
|
|
if (_skip == 1) then {
|
2024-07-17 06:53:40 +00:00
|
|
|
_shouldFrag = false;
|
2024-02-16 03:05:31 +00:00
|
|
|
TRACE_1("No frag: skip",_skip);
|
|
|
|
};
|
|
|
|
|
|
|
|
private _force = getNumber (_ammoConfig >> QGVAR(force));
|
2024-07-17 06:53:40 +00:00
|
|
|
if (_shouldFrag && !_force) then {
|
2024-02-16 03:05:31 +00:00
|
|
|
private _explosive = getNumber (_ammoConfig >> "explosive");
|
2024-07-17 06:53:40 +00:00
|
|
|
if (_explosive < 0.5) exitWith {
|
|
|
|
_shouldFrag = false;
|
2024-02-16 03:05:31 +00:00
|
|
|
TRACE_3("No frag: _explosive",_skip,_force,_explosive);
|
|
|
|
};
|
|
|
|
private _indirectHit = getNumber (_ammoConfig >> "indirectHit");
|
|
|
|
private _indirectRange = getNumber (_ammoConfig >> "indirectHitRange");
|
2024-07-17 06:53:40 +00:00
|
|
|
if (_indirectHit * sqrt(_indirectRange) < 35 || _indirectRange < 4.5) then {
|
|
|
|
_shouldFrag = false;
|
2024-02-16 03:05:31 +00:00
|
|
|
TRACE_5("No frag",_ammo,_skip,_explosive,_indirectRange,_indirectHit);
|
|
|
|
};
|
2024-01-08 21:22:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GVAR(shouldFragCache) set [_ammo, _shouldFrag];
|
|
|
|
|
2024-01-15 19:39:19 +00:00
|
|
|
_shouldFrag
|