Reformatted for readability and optimized first if statement

This commit is contained in:
lambdatiger 2024-01-08 21:55:02 -06:00
parent c3f04596c0
commit 02dd35f63f

View File

@ -14,23 +14,23 @@
* *
* Public: No * Public: No
*/ */
params ["_projectile"]; params [
["_projectile", objNull, [objNull]]
];
private _ammo = typeOf _projectile; private _ammo = typeOf _projectile;
if (isNil "_ammo" || if (_ammo isEqualTo "" || {isNull _projectile}) exitWith {
{_ammo isEqualTo "" ||
{isNil "_projectile" ||
{isNull _projectile}}}) exitWith {
TRACE_2("bad ammo or projectile",_ammo,_projectile); TRACE_2("bad ammo or projectile",_ammo,_projectile);
}; };
private _shouldFrag = _ammo call FUNC(shouldFrag); private _shouldFrag = _ammo call FUNC(shouldFrag);
_shouldFrag params ["_doFrag"]; _shouldFrag params ["_doFrag"];
if (_doFrag) then { if (_doFrag) then {
// wait for frag damage to kill units before spawning fragments // wait for frag damage to kill units before spawning fragments
_projectile addEventHandler ["Explode", { _projectile addEventHandler [
"Explode",
{
if (isServer) then { if (isServer) then {
[FUNC(doFrag), [_this]] call CBA_fnc_execNextFrame; [FUNC(doFrag), [_this]] call CBA_fnc_execNextFrame;
} else { } else {