Clarified trace statements and corrected format and spelling

This commit is contained in:
lambdatiger 2024-03-02 22:28:41 -06:00
parent 5915d0ee64
commit 4c905fed42
3 changed files with 13 additions and 13 deletions

View File

@ -46,7 +46,7 @@ _fragSpawner setVelocity _fragVelocity;
_fragSpawner setShotParents _shotParents;
#ifdef DEBUG_MODE_FULL
systemChat ("fragging, id: " + getObjectID _proj);
systemChat ("frag random objectID: " + getObjectID _proj);
#endif
#ifdef DEBUG_MODE_DRAW
_fragSpawner addEventHandler [

View File

@ -38,8 +38,8 @@ if (_fragTypes isEqualTo []) then {
];
};
// Post 2.18 change - uncomment line 41, remove line 43, 50-55, 64-66, and change lines 57 & 169 from _targets to _objects
// private _objects = [ASLToAGL _posASL, _fragRange, _fragRange, 0, false, _fragRange] nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], false, true, true];
// Post 2.18 change - uncomment line 41, and remove lines 43, 50-55, 64-66
// private _targets = [ASLToAGL _posASL, _fragRange, _fragRange, 0, false, _fragRange] nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], false, true, true];
private _objects = (ASLToAGL _posASL) nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], _fragRange];
if (_objects isEqualTo []) exitWith {
TRACE_2("No nearby targets",_posASL,_fragRange);
@ -56,12 +56,14 @@ private _targets = [];
TRACE_3("Targets found",_posASL,_fragRange,count _targets);
// limit number of fragments per direction (2D) to 10 using _fragArcs
// limit number of fragments per direction (2D) to _fragsPerFragArc using _fragArcs
private _fragArcs = createHashMap;
private _fragsPerFragArc = _modFragCount * ACE_FRAG_FRAGS_PER_ARC_CONSTANT;
private _totalFragCount = 0;
{ // Begin of forEach iterating on _targets
// Ignore dead units, curators and spectators
if (!alive _x || {getNumber ((configOf _x) >> "isPlayableLogic") == 1}) then {
TRACE_1("dead or logic",_x);
continue;
};
private _target = _x;
@ -106,14 +108,14 @@ private _totalFragCount = 0;
parseNumber (GVAR(atLeastOne) || {random 1 < _fragChance});
};
if (_fragCount == 0) then {
TRACE_2("fragments",_fragChance,_fragCount);
TRACE_2("no fragments",_fragChance,_fragCount);
continue;
};
// handle limiting fragments per degree arc
private _dir = floor (_posASL getDir _target);
private _fragPerArc = _fragArcs getOrDefault [_dir, 0];
if (_fragPerArc > 10) then {
if (_fragPerArc > _fragsPerFragArc) then {
continue;
} else {
_fragArcs set [_dir, _fragPerArc + _fragCount];
@ -169,7 +171,7 @@ private _totalFragCount = 0;
} forEach _targets;
#ifdef DEBUG_MODE_FULL
systemChat ("fragCount cnt: " + str _totalFragCount);
TRACE_1("fragCount",_totalFragCount);
systemChat ("targeted frag count: " + str _totalFragCount);
TRACE_1("targeted frag count",_totalFragCount);
#endif
_totalFragCount

View File

@ -16,7 +16,7 @@
*/
#define ACE_FRAG_SOUNDENVIRON_STR_LEN 12
#define ACE_FRAG_SOUNDGIT_STR_LEN 8
#define ACE_FRAG_SOUNDHIT_STR_LEN 8
#define ACE_FRAG_MATERIAL_SEARCH_LEN 10
params ["_surfType"];
@ -24,9 +24,7 @@ params ["_surfType"];
private _material = GVAR(spallMaterialCache) get _surfType;
TRACE_2("materialCache",_surfType,_material);
if (!isNil "_material") exitWith {
_material
};
if (!isNil "_material") exitWith {_material};
// Use 'soundEnviron' or 'soundHit' to extract approx material
private _surfaceConfig = configFile >> "CfgSurfaces" >> _surfType;
if (isClass _surfaceConfig) then {
@ -39,7 +37,7 @@ if (isClass _surfaceConfig) then {
_surfFileText = _surfFileText regexReplace ["[^a-z0-9]", ""];
private _idx = ACE_FRAG_SOUNDENVIRON_STR_LEN + (_surfFileText find "soundenviron");
if (_surfFileText select [_idx, 5] isEqualTo "empty") then {
_idx = ACE_FRAG_SOUNDGIT_STR_LEN + (_surfFileText find "soundhit");
_idx = ACE_FRAG_SOUNDHIT_STR_LEN + (_surfFileText find "soundhit");
};
_material = _surfFileText select [_idx, ACE_FRAG_MATERIAL_SEARCH_LEN];
};