changed default arguments, check isKindOf to "CAManBase"

This commit is contained in:
lambdatiger
2024-01-17 20:50:20 -06:00
parent 183d9f0ac6
commit df884dc4bc
5 changed files with 42 additions and 43 deletions

View File

@ -23,8 +23,8 @@
params [ params [
"_projectile", "_projectile",
["_addProjectileEventHandlers", true, [true]], ["_addProjectileEventHandlers", true],
["_isSidePlayer", true, [true]] ["_isSidePlayer", true]
]; ];
if (_isSidePlayer) then { if (_isSidePlayer) then {

View File

@ -5,11 +5,10 @@
* as handling some of the performance optimizations. * as handling some of the performance optimizations.
* *
* Arguments: * Arguments:
* 0: Projectile that's fragmenting <OBJECT> * 0: ASL position of projectile. <ARRAY>
* 1: ASL position of projectile <ARRAY> * 1: Velocity of projectile <ARRAY>
* 2: Velocity of projectile <ARRAY> * 2: Projectile CfgAmmo classname <STRING>
* 3: Projectile cfgAmmo classname <STRING> * 3: getShotParents of projectile at EH <ARRAY>
* 4: getShotParents of projectile at EH <ARRAY>
* *
* Return Value: * Return Value:
* None * None
@ -21,11 +20,10 @@
*/ */
TRACE_1("begin doFrag",_this); TRACE_1("begin doFrag",_this);
params [ params [
"", "_posASL",
["_posASL", [0, 0, 0], [[]], [3]], "_velocity",
["_velocity", [0, 0, 0] , [[]], [3]], "_ammo",
["_ammo", "", [""]], "_shotParents"
["_shotParents", [objNull, objNull], [[]]]
]; ];
// Don't let a single object cause all fragmentation events // 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 // Check normal round timeout and adjust _max frags
private _timeSinceLastFrag = CBA_missionTime - GVAR(lastFragTime); 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)); 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]; private _maxFragCount = round linearConversion [0.1, 1.5, _timeSinceLastFrag, ACE_FRAG_COUNT_MIN, ACE_FRAG_COUNT_MAX, true];

View File

@ -5,12 +5,12 @@
* a maximum of 15. * a maximum of 15.
* *
* Arguments: * Arguments:
* 0: Position of fragmenting projectile ASL <ARRAY> * 0: Position of fragmenting projectile ASL. <ARRAY>
* 1: Velocity of the fragmenting projectile <ARRAY> * 1: Velocity of the fragmenting projectile. <ARRAY>
* 2: Height (AGL) of the fragmenting projectile <SCALAR> * 2: Height (AGL) of the fragmenting projectile. <NUMBER>
* 3: Type of fragments to generate <ARRAY> * 3: Type of fragments to generate. <ARRAY>
* 4: Remaining fragment budget <SCALAR> * 4: Remaining fragment budget. <NUMBER>
* 5: Shot parents <ARRAY> * 5: Shot parents. <ARRAY>
* *
* Return Value: * Return Value:
* None * None
@ -22,15 +22,15 @@
*/ */
params [ params [
"_posASL", "_posASL",
["_fragVelocity", [0,0,0]], "_fragVelocity",
["_heightAGL", 2, [123]], "_heightAGL",
["_fragType", [], [[]]], "_fragType",
["_maxFragCount", 10, [123]], "_maxFragCount",
["_shotParents", [objNull, objNull], [[]], [2]] "_shotParents",
]; ];
TRACE_6("doFragRandom",_posASL,_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 { private _hMode = switch (true) do {
case (_heightAGL > 10): {"_top"}; case (_heightAGL > 10): {"_top"};
case (_heightAGL > 5): {"_hi"}; case (_heightAGL > 5): {"_hi"};

View File

@ -24,12 +24,12 @@
params [ params [
"_posASL", "_posASL",
["_fragVelocity", 800, [123]], "_fragVelocity",
["_fragRange", 50, [123]], "_fragRange",
["_maxFrags", 20, [123]], "_maxFrags",
["_fragTypes", [], [[]]], "_fragTypes",
["_modFragCount", 1, [123]], "_modFragCount",
["_shotParents", [objNull, objNull], [[]], [2]] "_shotParents",
]; ];
TRACE_5("fnc_doFragTargeted",_posASL,_fragRange,_maxFrags,_fragTypes,_modFragCount); 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 // grab crews and add them in so that targets stay approx. sorted by distance
{ {
private _crew = crew _x; private _crew = crew _x;
if (count _crew > 1) then { if (_crew isNotEqualTo []) then {
private _arr = [_x]; private _arr = [_x];
{ {
_arr pushBackUnique _x; _arr pushBackUnique _x;
@ -83,8 +83,8 @@ private _totalFragCount = 0;
private _isPerson = _target isKindOf "CAManBase"; private _isPerson = _target isKindOf "CAManBase";
if (_isPerson) then { if (_isPerson) then {
switch (stance _target) do { switch (stance _target) do {
case ("STAND"): {_height = 1.9; _crossSectionArea = 1.5;}; case "STAND": {_height = 1.9; _crossSectionArea = 1.5;};
case ("CROUCH"): {_height = 1.2; _crossSectionArea = 1;}; case "CROUCH": {_height = 1.2; _crossSectionArea = 1;};
default {_crossSectionArea = 0.75;}; default {_crossSectionArea = 0.75;};
}; };
} else { } else {

View File

@ -15,23 +15,24 @@
* *
* Public: No * Public: No
*/ */
TRACE_1("doSpall",_this); TRACE_1("doSpall",_this);
params [ params [
"_projectile", "_projectile",
["_objectHit", objNull], "_objectHit",
["_lastPosASL", [0, 0, 0]], "_lastPosASL",
["_lastVelocity", [0, 0, 0]], "_lastVelocity",
["_surfaceNorm", [0, 0, 0]], "_surfaceNorm",
["_surfaceType", ""], "_surfaceType",
["_ammo", "", [""]], "_ammo",
["_shotParents", [objNull, objNull], [[]]], "_shotParents",
["_vectorUp", [0,0,1]] "_vectorUp",
]; ];
if (CBA_missionTime < GVAR(nextSpallAllowTime)|| if (CBA_missionTime < GVAR(nextSpallAllowTime)||
_lastPosASL isEqualTo [0,0,0] || _lastPosASL isEqualTo [0,0,0] ||
{_ammo isEqualTo "" || {!isNull _objectHit && {_ammo isEqualTo "" || {!isNull _objectHit &&
{objectHit isKindOf "man"}}}) exitWith { {objectHit isKindOf "CAManBase"}}}) exitWith {
TRACE_4("time/invldHit",CBA_missionTime,GVAR(nextSpallAllowTime),_objectHit,_lastPosASL); TRACE_4("time/invldHit",CBA_missionTime,GVAR(nextSpallAllowTime),_objectHit,_lastPosASL);
}; };