mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Attempt to clean up formatting onall files
This commit is contained in:
parent
a589f904cf
commit
fbcf196402
@ -1,12 +1,13 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
["CBA_settingsInitialized", {
|
||||
[
|
||||
"CBA_settingsInitialized",
|
||||
{
|
||||
if (isServer) then {
|
||||
[] call FUNC(initBlackList);
|
||||
[] call FUNC(initMaterialCache);
|
||||
};
|
||||
|
||||
|
||||
#ifdef DEBUG_MODE_DRAW
|
||||
if (hasInterface && GVAR(debugOptions)) then {
|
||||
private _h = [LINKFUNC(dev_drawTrace), 0] call CBA_fnc_addPerFrameHandler;
|
||||
@ -15,7 +16,8 @@
|
||||
[objNull, ace_player] call FUNC(dev_switchUnitHandle);
|
||||
};
|
||||
#endif
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
}
|
||||
] call CBA_fnc_addEventHandler;
|
||||
|
||||
|
||||
#ifdef LOG_FRAG_INFO
|
||||
|
@ -30,6 +30,7 @@ if (_csvFormat) then {
|
||||
diag_log text format ["ammo,gurney_c,gurney_m,gurney_k,gurney_gC,fragTypes,fragCount,Inheritance"];
|
||||
};
|
||||
|
||||
// Gather all configs, either those that could be created from firing or all classes
|
||||
private _allAmmoConfigs = [];
|
||||
if (_onlyShotAmmoTypes) then {
|
||||
private _searchFunc = {
|
||||
@ -61,7 +62,7 @@ if (_onlyShotAmmoTypes) then {
|
||||
|
||||
private _processedCfgAmmos = [];
|
||||
private _printCount = 0;
|
||||
{
|
||||
{ // Begin forEach to check each ammo type
|
||||
private _ammo = _x;
|
||||
if (_ammo != "" && {!(_ammo in _processedCfgAmmos)}) then {
|
||||
_processedCfgAmmos pushBack _ammo;
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
#define HB_DRAW_ARRS [[3 , 2 , 1 , 5 , 6 , 7 , 3 , 0 , 4 , 5], [0, 1], [2, 6], [7, 4]]
|
||||
/*
|
||||
* Author: Lambda.Tiger
|
||||
* Per frame function to draw all dev traces
|
||||
@ -16,7 +17,6 @@
|
||||
|
||||
private _deleteArr = [];
|
||||
{
|
||||
// leave if trace is not to be drawn
|
||||
if (count (_y#1) > 1) then
|
||||
{
|
||||
for "_j" from 1 to count (_y#1) - 1 do
|
||||
@ -27,8 +27,6 @@ private _deleteArr = [];
|
||||
} forEach GVAR(dev_trackLines);
|
||||
|
||||
if (GVAR(drawHitBox)) then {
|
||||
|
||||
#define HB_DRAW_ARRS [[3,2,1,5,6,7,3,0,4,5],[0,1],[2,6],[7,4]]
|
||||
_deleteArr = [];
|
||||
{
|
||||
_y params ["_obj", "_pts", "_color"];
|
||||
|
@ -22,6 +22,7 @@ params [
|
||||
|
||||
if (isNull _obj) exitWith {};
|
||||
|
||||
// Grab the right hitBox
|
||||
private _box = [];
|
||||
if (_obj isKindOf "CAManBase") then {
|
||||
if (vehicle _obj == _obj) then {
|
||||
@ -34,6 +35,7 @@ if (_obj isKindOf "CAManBase") then {
|
||||
};
|
||||
_box params ["_lowP","_upP"];
|
||||
|
||||
// adjust with stance
|
||||
private _stance = stance _obj;
|
||||
switch (true) do {
|
||||
case (_stance isEqualTo "STAND"): {_upP set [2, 1.9];};
|
||||
@ -47,9 +49,10 @@ if (GVAR(dbgSphere) && {_addSphere && {vehicle _obj isEqualTo _obj}}) then {
|
||||
_centerSphere disableCollisionWith vehicle _obj;
|
||||
_centerSphere attachTo [_obj, _obj worldToModel _centerPoint];
|
||||
};
|
||||
|
||||
// create an optimized outline
|
||||
private _p1 = _upP;
|
||||
private _p7 = _lowP;
|
||||
|
||||
private _points =[
|
||||
_upP,
|
||||
[_p1#0, _p7#1, _p1#2],
|
||||
@ -66,6 +69,5 @@ _color = switch (side _obj) do {
|
||||
case resistance: {[0, 1, 0, 1]};
|
||||
default {[0, 0, 1, 1]};
|
||||
};
|
||||
//TRACE_3("box params", _obj, _points, _color);
|
||||
|
||||
GVAR(dev_hitBoxes) set [getObjectID _obj, [_obj, _points, _color]];
|
@ -22,8 +22,8 @@ params [
|
||||
["_isProj", false, [false]]
|
||||
];
|
||||
TRACE_4("devDraw",_this,_obj,_color,_isProj);
|
||||
// track round on each frame
|
||||
// Create entry in position array from hashmap
|
||||
|
||||
// pick color and add it to the array
|
||||
private _colorArray = switch (toLower _color) do {
|
||||
case "purple": {[0.8, 0, 0.8, 1]};
|
||||
case "blue": {[0, 0, 0.8, 1]};
|
||||
@ -61,10 +61,9 @@ GVAR(dev_trackLines) set [getObjectID _obj, [1, [getposATL _obj], _colorArray]];
|
||||
[_obj]
|
||||
] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
// Projectile eventhandlers that add spheres and points for more accurate round tracking
|
||||
if (!_isProj) exitWith {};
|
||||
|
||||
|
||||
// Add hitpart eventHandler
|
||||
_obj addEventHandler [
|
||||
"HitPart",
|
||||
{
|
||||
@ -78,7 +77,6 @@ _obj addEventHandler [
|
||||
}
|
||||
];
|
||||
|
||||
// Add explode eventHandler
|
||||
_obj addEventHandler [
|
||||
"Explode",
|
||||
{
|
||||
@ -92,7 +90,6 @@ _obj addEventHandler [
|
||||
}
|
||||
];
|
||||
|
||||
// Add deflected eventHandler
|
||||
_obj addEventHandler [
|
||||
"Deflected",
|
||||
{
|
||||
|
@ -28,12 +28,14 @@ params [
|
||||
["_shotParents", [objNull, objNull], [[]]]
|
||||
];
|
||||
|
||||
// Check for vehicle holdoff timeout
|
||||
private _shotParentVic = _shotParents#0;
|
||||
if (_shotParentVic getVariable [QGVAR(nextFragTime), -1] > CBA_missionTime) exitWith {
|
||||
TRACE_1("vehicleTimeExit",_shotParentVic);
|
||||
};
|
||||
_shotParentVic setVariable [QGVAR(nextFragTime), CBA_missionTime + ACE_FRAG_HOLDOFF_VEHICLE];
|
||||
|
||||
// Check normal round timeout and adjust _max frags
|
||||
private _timeSince = CBA_missionTime - GVAR(lastFragTime);
|
||||
if (_ammo isEqualTo "" || {_posASL isEqualTo [0, 0, 0] || _timeSince < ACE_FRAG_HOLDOFF}) exitWith {
|
||||
TRACE_3("timeExit",_timeSince,CBA_missionTime,GVAR(lastFragTime));
|
||||
@ -44,14 +46,14 @@ TRACE_3("",_timeSince,CBA_missionTime,_maxFrags);
|
||||
|
||||
private _ammoArr = [_ammo] call FUNC(getFragInfo);
|
||||
_ammoArr params ["_fragRange", "_fragVel", "_fragTypes", "_modFragCount"];
|
||||
|
||||
// For low frag rounds limit the # of frags
|
||||
if (_modFragCount < 10) then {
|
||||
_maxFrags = _modFragCount*4;
|
||||
GVAR(lastFragTime) = CBA_missionTime - 0.1;
|
||||
} else {
|
||||
GVAR(lastFragTime) = CBA_missionTime;
|
||||
};
|
||||
|
||||
// Offset for ground clearance
|
||||
private _heightAGL = (ASLToAGL _posASL)#2;
|
||||
if (_heightAGL < 0.25) then {
|
||||
_posASL = _posASL vectorAdd [0, 0, 0.25];
|
||||
@ -65,7 +67,3 @@ if (_fragRange > 3 && _timeSince > ACE_FRAG_HOLDOFF*1.5 && GVAR(fragSimComplexit
|
||||
if (_timeSince > 0.2 && {GVAR(fragSimComplexity) > 0}) then {
|
||||
[_posASL, _vel, _heightAGL, _fragTypes, _maxFrags, _shotParents] call FUNC(doFragRandom);
|
||||
};
|
||||
|
||||
if (GVAR(reflectionsEnabled)) then {
|
||||
[_posASL, _shellType] call FUNC(doReflections);
|
||||
};
|
@ -14,7 +14,7 @@
|
||||
* 6: Shot parent <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
* Number of fragments created <SCALAR>
|
||||
*
|
||||
* Example:
|
||||
* [getPosASL _proj, velocity _proj, 50, 50, [], 1, [player, player]] call ace_frag_fnc_doFragTargeted;
|
||||
@ -62,13 +62,13 @@ if (_objects isEqualTo []) exitWith {
|
||||
_objects set [_forEachIndex, _arr];
|
||||
};
|
||||
} forEach _objects;
|
||||
_objects = flatten _objects; // flatten out sub arrays
|
||||
_objects = flatten _objects;
|
||||
TRACE_3("Targets found", _posASL, _fragRange, count _objects);
|
||||
|
||||
// limit number of fragments per direction (2D) to 10 using _fragArcs
|
||||
private _fragArcs = createHashMap;
|
||||
private _fragCount = 0; // limit of # of fragments to _maxFrags
|
||||
{
|
||||
private _fragCount = 0;
|
||||
{ // Begin of forEach iterating on _objects
|
||||
if (!alive _x) then {continue};
|
||||
private _target = _x;
|
||||
|
||||
@ -76,9 +76,8 @@ private _fragCount = 0; // limit of # of fragments to _maxFrags
|
||||
[_target, false] call FUNC(dev_trackHitBox);
|
||||
#endif
|
||||
|
||||
// Calculate volume and height of target
|
||||
private _vol = 1.5;
|
||||
private _height = 0;
|
||||
// Estimate volume and height of target
|
||||
private _height = 0.5;
|
||||
private _crossSectionArea = 1;
|
||||
private _isPerson = _target isKindOf "CAManBase";
|
||||
if (_isPerson) then {
|
||||
@ -86,24 +85,24 @@ private _fragCount = 0; // limit of # of fragments to _maxFrags
|
||||
switch (true) do {
|
||||
case (_stance isEqualTo "STAND"): {_height = 1.9; _crossSectionArea = 1.5;};
|
||||
case (_stance isEqualTo "CROUCH"): {_height = 1.2; _crossSectionArea = 1;};
|
||||
default {_height = 0.5; _crossSectionArea = 0.75;};
|
||||
default {_crossSectionArea = 0.75;};
|
||||
};
|
||||
} else {
|
||||
private _boxParams = boundingBoxReal [_target, "FireGeometry"];
|
||||
_boxParams params ["_pointA", "_pointB"];
|
||||
private _dims = _pointB vectorDiff _pointA;
|
||||
_vol = (_dims#0) * (_dims#1) * (_dims#2);
|
||||
_crossSectionArea = (_dims#1)*(_dims#2);
|
||||
if (_dims#0 * _dims#1 * _dims#2 <= 0.5) then {continue};
|
||||
_crossSectionArea = _dims#1 * _dims#2;
|
||||
_height = _dims#2;
|
||||
};
|
||||
|
||||
if (_vol <= 0.5) then {continue}; // too small => exit
|
||||
|
||||
|
||||
|
||||
private _distance = _target distance _posASL;
|
||||
|
||||
// calculate chance to be hit by a fragment
|
||||
private _fragChance = _crossSectionArea*_modFragCount/(_distance^2);
|
||||
private _fragChance = _crossSectionArea * _modFragCount / _distance^2;
|
||||
private _count = if (_fragChance > 1) then {
|
||||
3 min (floor _fragChance);
|
||||
} else {
|
||||
@ -114,9 +113,8 @@ private _fragCount = 0; // limit of # of fragments to _maxFrags
|
||||
// Approximate offset to hit including speed & gravity
|
||||
private _locFragVel = _fragVel * (1 - random 0.5);
|
||||
private _tof = _distance / _locFragVel;
|
||||
private _targetPos = (velocity _target vectorMultiply _tof) vectorAdd [0, 0, 9.81 / 2 * _tof ^ 2];
|
||||
|
||||
// handle limiting fragments per dewgree arc
|
||||
// handle limiting fragments per degree arc
|
||||
private _dir = floor (_posASL getDir _target);
|
||||
private _fragPerArc = _fragArcs getOrDefault [_dir, 0];
|
||||
if (_fragPerArc > 10) then {
|
||||
@ -125,13 +123,14 @@ private _fragCount = 0; // limit of # of fragments to _maxFrags
|
||||
_fragArcs set [_dir, _fragPerArc + _count];
|
||||
};
|
||||
|
||||
// actual target pos for fragment to hit
|
||||
// target pos for fragment to hit
|
||||
private _targetPos = (velocity _target vectorMultiply _tof) vectorAdd [0, 0, 9.81 / 2 * _tof ^ 2];
|
||||
if _isPerson then {
|
||||
private _hitPoint = selectRandom ACE_FRAG_HITPOINTS;
|
||||
private _hitPointPos = _target selectionPosition [_hitPoint, "HitPoints", "AveragePoint"];
|
||||
_targetPos = _target modelToWorldWorld _hitPointPos;
|
||||
_targetPos = _target modelToWorldWorld _hitPointPos vectorAdd _targetPos;
|
||||
} else {
|
||||
_targetPos = getPosASL _target vectorAdd [
|
||||
_targetPos = _targetPos vectorAdd getPosASL _target vectorAdd [
|
||||
-0.5 + random 1,
|
||||
-0.5 + random 1,
|
||||
(0.1 + random 0.4) * _height
|
||||
@ -147,7 +146,6 @@ private _fragCount = 0; // limit of # of fragments to _maxFrags
|
||||
default {"_far"};
|
||||
});
|
||||
};
|
||||
|
||||
TRACE_4("fragments",_fragSpawner,_fragChance,_distance,_locFragVel);
|
||||
|
||||
// Create fragment
|
||||
@ -169,8 +167,9 @@ private _fragCount = 0; // limit of # of fragments to _maxFrags
|
||||
break
|
||||
};
|
||||
} forEach _objects;
|
||||
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
systemChat ("fragCount cnt: " + str _fragCount);
|
||||
#endif
|
||||
TRACE_1("fragCount",_fragCount);
|
||||
#endif
|
||||
_fragCount
|
@ -38,7 +38,7 @@ if (CBA_missionTime - GVAR(lastSpallTime) < ACE_FRAG_SPALL_HOLDOFF ||
|
||||
private _material = [_surfaceType] call FUNC(getMaterialInfo);
|
||||
if (_material isEqualTo "ground") then {
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
systemChat "ground spall"; // really shouldn't happen
|
||||
systemChat "ground spall";
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -62,7 +62,6 @@ if (_deltaMomentum < 2) exitWith {
|
||||
|
||||
private _lVelUnit = vectorNormalized _lVel;
|
||||
private _unitStep = _lVelUnit vectorMultiply 0.05;
|
||||
private _spallPos = +_lPosASL;
|
||||
|
||||
if (terrainIntersectASL [_lPosASL vectorAdd _unitStep, _lPosASL]) exitWith {
|
||||
TRACE_3("terrainIntersect",_lPosASL,_unitStep,_lPosASL);
|
||||
@ -70,11 +69,14 @@ if (terrainIntersectASL [_lPosASL vectorAdd _unitStep, _lPosASL]) exitWith {
|
||||
// Passed all exitWiths
|
||||
GVAR(lastSpallTime) = CBA_missionTime;
|
||||
|
||||
// check for less than 30 between norm and projectile (120 of 90 deg offset)
|
||||
if (120 > acos ((vectorNormalized _lVelUnit) vectorDotProduct _sNorm)) then {
|
||||
/*
|
||||
* Improve performance of finding otherside of object on shallow angle
|
||||
* impacts. 120 degrees due to 90 degree offset with _lVelUnit into object.
|
||||
*/
|
||||
private _spallPos = +_lPosASL;
|
||||
if (120 > acos ( _lVelUnit vectorDotProduct _sNorm)) then {
|
||||
_spallPos = _spallPos vectorAdd (_unitStep vectorMultiply 5);
|
||||
};
|
||||
|
||||
for "_i" from 1 to 20 do
|
||||
{
|
||||
private _nPos = _spallPos vectorAdd _unitStep;
|
||||
|
@ -25,7 +25,7 @@ params ["_ammo"];
|
||||
|
||||
private _ammoInfo = GVAR(fragInfoCache) get _ammo;
|
||||
|
||||
if !(isNil "_ammoInfo") exitWith {_ammoInfo};
|
||||
if (!isNil "_ammoInfo") exitWith {_ammoInfo};
|
||||
|
||||
private _fragTypes = [];
|
||||
private _warn = false;
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 0: surfacetype <STRING> - either a cfgSurfaces path .bisurf filepath
|
||||
*
|
||||
* Return Value:
|
||||
* _material <STRING> - Material categories as expanded on in line 43 below
|
||||
* _material <STRING> - Material categories as expanded on in line 44 below
|
||||
*
|
||||
* Example:
|
||||
* [_surfaceType] call ace_frag_fnc_getFragInfo;
|
||||
@ -21,12 +21,15 @@ params ["_surfType"];
|
||||
private _material = GVAR(spallMaterialCache) get _surfType;
|
||||
|
||||
TRACE_2("materialCache",_surfType,_material);
|
||||
if !(isNil "_material") exitWith {
|
||||
if (!isNil "_material") exitWith {
|
||||
_material
|
||||
};
|
||||
|
||||
// Use 'soundEnviron' or 'soundHit' to extract approx material
|
||||
if (isClass (configFile >> "CfgSurfaces" >> _surfType)) then {
|
||||
_material = getText (configFile >> "CfgSurfaces" >> _surfType >> "soundEnviron");
|
||||
if (_material isEqualTo "" || {_material isEqualTo "empty"}) then {
|
||||
_material = getText (configFile >> "CfgSurfaces" >> _surfType >> "soundhit");
|
||||
};
|
||||
} else { // Messy way when a surface isn't added to cfgSurfaces
|
||||
private _surfFileText = tolower preprocessFile _surfType;
|
||||
_surfFileText = _surfFileText regexReplace ["[^a-z0-9]", ""];
|
||||
@ -38,7 +41,6 @@ if (isClass (configFile >> "CfgSurfaces" >> _surfType)) then {
|
||||
};
|
||||
TRACE_1("materialSubString",_material);
|
||||
|
||||
|
||||
_material = switch (true) do {
|
||||
case ("dirt" in _material);
|
||||
case ("grass" in _material): { "ground" };
|
||||
|
@ -21,13 +21,14 @@ if (!ADDON) then {
|
||||
[FUNC(initBlackList), [], 1] call CBA_fnc_waitAndExecute;
|
||||
};
|
||||
|
||||
// could improve text parsing
|
||||
// could improve text parsing of CBA setting string
|
||||
private _convArray = parseSimpleArray GVAR(BlackList);
|
||||
|
||||
if (count _convArray == 0 ) exitWith {
|
||||
TRACE_1("Empty blacklist", _convArray);
|
||||
};
|
||||
|
||||
// Add CBA setting blacklist to blacklist and log errors
|
||||
private _errors = 0;
|
||||
private _items = count _convArray;
|
||||
for "_i" from 0 to _items - 1 do {
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Lambda.Tiger
|
||||
* For performance, we load a bunch of vanilla materials preemptively
|
||||
* For performance, we load a bunch of vanilla materials preemptively into
|
||||
* the spall material cache
|
||||
*
|
||||
* Arguments:
|
||||
* none
|
||||
|
@ -30,7 +30,7 @@ if (_shouldFrag && GVAR(enabled)) then {
|
||||
_projectile addEventHandler [
|
||||
"Explode",
|
||||
{
|
||||
params ["_proj"];
|
||||
params ["_proj", "_posASL"];
|
||||
private _shotParents = getShotParents _proj;
|
||||
private _ammo = typeOf _proj;
|
||||
// wait for frag damage to kill units before spawning fragments
|
||||
@ -38,6 +38,9 @@ if (_shouldFrag && GVAR(enabled)) then {
|
||||
FUNC(doFrag),
|
||||
_this + [_ammo, _shotParents]
|
||||
] call CBA_fnc_execNextFrame;
|
||||
if (GVAR(reflectionsEnabled)) then {
|
||||
[_posASL, _ammo] call FUNC(doReflections);
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ params ["_ammo"];
|
||||
|
||||
private _shouldFrag = GVAR(shouldFragCache) get _ammo;
|
||||
|
||||
if !(isNil "_shouldFrag") exitWith {_shouldFrag};
|
||||
if (!isNil "_shouldFrag") exitWith {_shouldFrag};
|
||||
|
||||
_shouldFrag = true;
|
||||
|
||||
|
@ -20,7 +20,7 @@ params ["_ammo"];
|
||||
|
||||
private _shouldSpall = GVAR(spallRoundCache) get _ammo;
|
||||
|
||||
if !(isNil "_shouldSpall") exitWith {_shouldSpall};
|
||||
if (!isNil "_shouldSpall") exitWith {_shouldSpall};
|
||||
|
||||
private _caliber = getNumber (configFile >> "CfgAmmo" >> _ammo >> "caliber");
|
||||
private _explosive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosive");
|
||||
|
@ -253,7 +253,7 @@
|
||||
<Korean>(SP 전용) 임무 / 편집자가 다시 시작해야합니다. SP 게임 모드에서만 파편화 및 탄환파편의 시각적 추적을 가능하게 합니다.</Korean>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Frag_EnableDebugTrace">
|
||||
<English>(Local only) Frag/Spall Debug Tracing</English>
|
||||
<English>(SP only) Frag/Spall Debug Tracing</English>
|
||||
<Spanish>(Solo SP) Seguimiento de depuración de Fragmentación/Astillamiento </Spanish>
|
||||
<Polish>(Tylko SP) Wizualny debug odł./odpr.</Polish>
|
||||
<Czech>(Pouze SP) Debug sledování Frag/Úlomků</Czech>
|
||||
@ -269,7 +269,7 @@
|
||||
<Chinese>(僅在單人模式) 碎片/剝落除錯追蹤</Chinese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Frag_EnableDebugTrace_Desc">
|
||||
<English>(Local only) Requires a mission/editor restart. Enables visual tracing of fragmentation and spalling rounds in SP game mode only.</English>
|
||||
<English>(SP only) Requires a mission/editor restart. Enables visual tracing of fragmentation and spalling rounds in SP game mode only.</English>
|
||||
<Spanish>(Solo SP) Requiere un reinicio misión/editor. Permite el seguimiento visual de la fragmentación y astillamientos de los proyectiles en modo SP.</Spanish>
|
||||
<Polish>(Tylko SP) Wymaga restartu misji/edytora. Aktywuje wizualne śledzenie odłamków oraz odprysków w trybie gry Single Player.</Polish>
|
||||
<German>(nur SP) Splitter-/Explosions-Debugging</German>
|
||||
|
Loading…
Reference in New Issue
Block a user