From df884dc4bc6fb6e46c1c122a94b2087d3d18a2fb Mon Sep 17 00:00:00 2001 From: lambdatiger Date: Wed, 17 Jan 2024 20:50:20 -0600 Subject: [PATCH] changed default arguments, check isKindOf to "CAManBase" --- addons/frag/functions/fnc_dev_addRound.sqf | 4 ++-- addons/frag/functions/fnc_doFrag.sqf | 20 ++++++++-------- addons/frag/functions/fnc_doFragRandom.sqf | 24 ++++++++++---------- addons/frag/functions/fnc_doFragTargeted.sqf | 18 +++++++-------- addons/frag/functions/fnc_doSpall.sqf | 19 ++++++++-------- 5 files changed, 42 insertions(+), 43 deletions(-) diff --git a/addons/frag/functions/fnc_dev_addRound.sqf b/addons/frag/functions/fnc_dev_addRound.sqf index cdc21164ab..64d78e2759 100644 --- a/addons/frag/functions/fnc_dev_addRound.sqf +++ b/addons/frag/functions/fnc_dev_addRound.sqf @@ -23,8 +23,8 @@ params [ "_projectile", - ["_addProjectileEventHandlers", true, [true]], - ["_isSidePlayer", true, [true]] + ["_addProjectileEventHandlers", true], + ["_isSidePlayer", true] ]; if (_isSidePlayer) then { diff --git a/addons/frag/functions/fnc_doFrag.sqf b/addons/frag/functions/fnc_doFrag.sqf index 3ade288f5a..7a42b23ce8 100644 --- a/addons/frag/functions/fnc_doFrag.sqf +++ b/addons/frag/functions/fnc_doFrag.sqf @@ -5,11 +5,10 @@ * as handling some of the performance optimizations. * * Arguments: - * 0: Projectile that's fragmenting - * 1: ASL position of projectile - * 2: Velocity of projectile - * 3: Projectile cfgAmmo classname - * 4: getShotParents of projectile at EH + * 0: ASL position of projectile. + * 1: Velocity of projectile + * 2: Projectile CfgAmmo classname + * 3: getShotParents of projectile at EH * * Return Value: * None @@ -21,11 +20,10 @@ */ TRACE_1("begin doFrag",_this); params [ - "", - ["_posASL", [0, 0, 0], [[]], [3]], - ["_velocity", [0, 0, 0] , [[]], [3]], - ["_ammo", "", [""]], - ["_shotParents", [objNull, objNull], [[]]] + "_posASL", + "_velocity", + "_ammo", + "_shotParents" ]; // Don't let a single object cause all fragmentation events @@ -37,7 +35,7 @@ _shotParentVic setVariable [QGVAR(obj_nextFragTime), CBA_missionTime + ACE_FRAG_ // Check normal round timeout and adjust _max frags private _timeSinceLastFrag = CBA_missionTime - GVAR(lastFragTime); -if (_ammo isEqualTo "" || {_posASL isEqualTo [0, 0, 0] || _timeSinceLastFrag < ACE_FRAG_HOLDOFF}) exitWith { +if (_timeSinceLastFrag < ACE_FRAG_HOLDOFF || {_posASL isEqualTo [0, 0, 0] || _ammo isEqualTo ""}) exitWith { TRACE_3("timeExit",_timeSinceLastFrag,CBA_missionTime,GVAR(lastFragTime)); }; private _maxFragCount = round linearConversion [0.1, 1.5, _timeSinceLastFrag, ACE_FRAG_COUNT_MIN, ACE_FRAG_COUNT_MAX, true]; diff --git a/addons/frag/functions/fnc_doFragRandom.sqf b/addons/frag/functions/fnc_doFragRandom.sqf index 6ffaa663b0..20964cf862 100644 --- a/addons/frag/functions/fnc_doFragRandom.sqf +++ b/addons/frag/functions/fnc_doFragRandom.sqf @@ -5,12 +5,12 @@ * a maximum of 15. * * Arguments: - * 0: Position of fragmenting projectile ASL - * 1: Velocity of the fragmenting projectile - * 2: Height (AGL) of the fragmenting projectile - * 3: Type of fragments to generate - * 4: Remaining fragment budget - * 5: Shot parents + * 0: Position of fragmenting projectile ASL. + * 1: Velocity of the fragmenting projectile. + * 2: Height (AGL) of the fragmenting projectile. + * 3: Type of fragments to generate. + * 4: Remaining fragment budget. + * 5: Shot parents. * * Return Value: * None @@ -22,15 +22,15 @@ */ params [ "_posASL", - ["_fragVelocity", [0,0,0]], - ["_heightAGL", 2, [123]], - ["_fragType", [], [[]]], - ["_maxFragCount", 10, [123]], - ["_shotParents", [objNull, objNull], [[]], [2]] + "_fragVelocity", + "_heightAGL", + "_fragType", + "_maxFragCount", + "_shotParents", ]; TRACE_6("doFragRandom",_posASL,_fragVelocity,_heightAGL,_fragType,_maxFragCount,_shotParents); -// See cfgAmmoFragSpawner for different frag types +// See CfgAmmoFragSpawner for different frag types private _hMode = switch (true) do { case (_heightAGL > 10): {"_top"}; case (_heightAGL > 5): {"_hi"}; diff --git a/addons/frag/functions/fnc_doFragTargeted.sqf b/addons/frag/functions/fnc_doFragTargeted.sqf index 8257b4fd21..4d9d9e15a9 100644 --- a/addons/frag/functions/fnc_doFragTargeted.sqf +++ b/addons/frag/functions/fnc_doFragTargeted.sqf @@ -24,12 +24,12 @@ params [ "_posASL", - ["_fragVelocity", 800, [123]], - ["_fragRange", 50, [123]], - ["_maxFrags", 20, [123]], - ["_fragTypes", [], [[]]], - ["_modFragCount", 1, [123]], - ["_shotParents", [objNull, objNull], [[]], [2]] + "_fragVelocity", + "_fragRange", + "_maxFrags", + "_fragTypes", + "_modFragCount", + "_shotParents", ]; TRACE_5("fnc_doFragTargeted",_posASL,_fragRange,_maxFrags,_fragTypes,_modFragCount); @@ -52,7 +52,7 @@ if (_objects isEqualTo []) exitWith { // grab crews and add them in so that targets stay approx. sorted by distance { private _crew = crew _x; - if (count _crew > 1) then { + if (_crew isNotEqualTo []) then { private _arr = [_x]; { _arr pushBackUnique _x; @@ -83,8 +83,8 @@ private _totalFragCount = 0; private _isPerson = _target isKindOf "CAManBase"; if (_isPerson) then { switch (stance _target) do { - case ("STAND"): {_height = 1.9; _crossSectionArea = 1.5;}; - case ("CROUCH"): {_height = 1.2; _crossSectionArea = 1;}; + case "STAND": {_height = 1.9; _crossSectionArea = 1.5;}; + case "CROUCH": {_height = 1.2; _crossSectionArea = 1;}; default {_crossSectionArea = 0.75;}; }; } else { diff --git a/addons/frag/functions/fnc_doSpall.sqf b/addons/frag/functions/fnc_doSpall.sqf index 4a069c5117..15b8b8c614 100644 --- a/addons/frag/functions/fnc_doSpall.sqf +++ b/addons/frag/functions/fnc_doSpall.sqf @@ -15,23 +15,24 @@ * * Public: No */ + TRACE_1("doSpall",_this); params [ "_projectile", - ["_objectHit", objNull], - ["_lastPosASL", [0, 0, 0]], - ["_lastVelocity", [0, 0, 0]], - ["_surfaceNorm", [0, 0, 0]], - ["_surfaceType", ""], - ["_ammo", "", [""]], - ["_shotParents", [objNull, objNull], [[]]], - ["_vectorUp", [0,0,1]] + "_objectHit", + "_lastPosASL", + "_lastVelocity", + "_surfaceNorm", + "_surfaceType", + "_ammo", + "_shotParents", + "_vectorUp", ]; if (CBA_missionTime < GVAR(nextSpallAllowTime)|| _lastPosASL isEqualTo [0,0,0] || {_ammo isEqualTo "" || {!isNull _objectHit && - {objectHit isKindOf "man"}}}) exitWith { + {objectHit isKindOf "CAManBase"}}}) exitWith { TRACE_4("time/invldHit",CBA_missionTime,GVAR(nextSpallAllowTime),_objectHit,_lastPosASL); };