From cd4d2a9cf6ce6af0da26ea8743e23fdea9b84476 Mon Sep 17 00:00:00 2001 From: lambdatiger Date: Tue, 16 Jul 2024 22:03:15 -0500 Subject: [PATCH] Fixed calls for shouldFrag and got rid of old initRound.sfq (maybe back after 2.18) --- addons/frag/functions/fnc_dev_debugAmmo.sqf | 2 +- .../frag/functions/fnc_dev_fragCalcDump.sqf | 2 +- addons/frag/functions/fnc_initRound.sqf | 84 ------------------- 3 files changed, 2 insertions(+), 86 deletions(-) delete mode 100644 addons/frag/functions/fnc_initRound.sqf diff --git a/addons/frag/functions/fnc_dev_debugAmmo.sqf b/addons/frag/functions/fnc_dev_debugAmmo.sqf index 7fc6b20388..fae388f1b8 100644 --- a/addons/frag/functions/fnc_dev_debugAmmo.sqf +++ b/addons/frag/functions/fnc_dev_debugAmmo.sqf @@ -75,7 +75,7 @@ private _printCount = 0; _processedCfgAmmos pushBack _ammo; private _ammoConfig = configFile >> "CfgAmmo" >> _ammo; - private _shouldFrag = _ammo call FUNC(shouldFrag); + _ammo call FUNC(shouldFrag) params ["_shouldFrag"]; if (_shouldFrag || _logAll) then { diff --git a/addons/frag/functions/fnc_dev_fragCalcDump.sqf b/addons/frag/functions/fnc_dev_fragCalcDump.sqf index c72d096f78..3812273b3c 100644 --- a/addons/frag/functions/fnc_dev_fragCalcDump.sqf +++ b/addons/frag/functions/fnc_dev_fragCalcDump.sqf @@ -31,7 +31,7 @@ diag_log text "//****************** fragCalcDump Beg ******************//"; continue; }; - private _shouldFrag = _ammo call FUNC(shouldFrag); + _ammo call FUNC(shouldFrag) params ["_shouldFrag"]; if (_shouldFrag || _logAll) then { private _fragInfo = _ammo call FUNC(getFragInfo); _fragInfo params ["_fragRange", "_fragMaxVelocity", "", "_modifiedFragCount"]; diff --git a/addons/frag/functions/fnc_initRound.sqf b/addons/frag/functions/fnc_initRound.sqf deleted file mode 100644 index eef4488df4..0000000000 --- a/addons/frag/functions/fnc_initRound.sqf +++ /dev/null @@ -1,84 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: Lambda.Tiger - * This function adds projectile explode and hitPart event handlers and is - * intended to be called from an projectile config init event handler. - * - * Arguments: - * 0: The projectile to be initialized - * - * Return Value: - * None - * - * Example: - * _projectile call ace_frag_fnc_initRound - * - * Public: No - */ - -TRACE_1("ACE_Frag rndInit",_this); -if (!isServer) exitWith {}; -params ["_projectile"]; - -private _ammo = typeOf _projectile; -if (_ammo isEqualTo "" || {isNull _projectile} || - {_projectile getVariable [QGVAR(blacklisted), false]}) exitWith { - TRACE_2("bad ammo or projectile, or blackList",_ammo,_projectile); -}; - -if (GVAR(enabled) && {_ammo call FUNC(shouldFrag)}) then { - _projectile addEventHandler [ - "Explode", - { - params ["_projectile", "_posASL", "_velocity"]; - - if (_projectile getVariable [QGVAR(blacklisted), false]) exitWith { - TRACE_2("projectile blackisted",typeOf _projectile,_projectile); - }; - - private _shotParents = _projectile getVariable [QGVAR(shotParent), getShotParents _projectile]; - private _ammo = typeOf _projectile; - // wait for frag damage to kill units before spawning fragments - [ - FUNC(doFrag), - [_posASL, _velocity, _ammo, _shotParents] - ] call CBA_fnc_execNextFrame; - if (GVAR(reflectionsEnabled)) then { - [_posASL, _ammo] call FUNC(doReflections); - }; - } - ]; -}; - -if (GVAR(spallEnabled) && {_ammo call FUNC(shouldSpall)}) then { - _projectile addEventHandler [ - "HitPart", - { - params ["_projectile", "_hitObject", "", "_posASL", "_velocity", "_surfNorm", "", "", "_surfType"]; - - if (_projectile getVariable [QGVAR(blacklisted), false]) exitWith { - TRACE_2("projectile blackisted",typeOf _projectile,_projectile); - }; - - // starting v2.18 it may be faster to use the instigator parameter, the same as the second entry shotParents, to recreate _shotParent - // The "explode" EH does not get the same parameter - private _shotParent = getShotParents _projectile; - private _ammo = typeOf _projectile; - private _vectorUp = vectorUp _projectile; - /* - * Wait a frame to see what happens to the round, may result in - * multiple hits / slowdowns getting shunted to the first hit - */ - [ - FUNC(doSpall), - [_projectile, _hitObject, _posASL, _velocity, _surfNorm, _surfType, _ammo, _shotParent, _vectorUp] - ] call CBA_fnc_execNextFrame; - } - ]; -}; -#ifdef DEBUG_MODE_DRAW -if (GVAR(debugOptions) && {_ammo call FUNC(shouldFrag) || {_ammo call FUNC(shouldSpall)}}) then { - [_projectile, "red", true] call FUNC(dev_trackObj); -}; -#endif -TRACE_1("initExit",_ammo);