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,11 +1,12 @@
|
||||
#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 {
|
||||
@ -15,7 +16,8 @@
|
||||
[objNull, ace_player] call FUNC(dev_switchUnitHandle);
|
||||
};
|
||||
#endif
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
}
|
||||
] call CBA_fnc_addEventHandler;
|
||||
|
||||
|
||||
#ifdef LOG_FRAG_INFO
|
||||
|
@ -16,4 +16,4 @@ class CfgPatches {
|
||||
|
||||
#include "CfgEventhandlers.hpp"
|
||||
#include "CfgAmmo.hpp"
|
||||
#include "ACE_Settings.hpp"
|
||||
#include "ACE_Settings.hpp"
|
@ -1,7 +1,7 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Lambda.Tiger
|
||||
* This function adds a round to be traced
|
||||
* This function adds a round to be traced
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Projectile <OBJECT>
|
||||
@ -55,7 +55,7 @@ if (_sidePlayer) then
|
||||
|
||||
if (!_addEHs) exitWith {};
|
||||
|
||||
// Add hitpart eventHandler
|
||||
// Add hitpart eventHandler
|
||||
_proj addEventHandler [
|
||||
"HitPart",
|
||||
{
|
||||
|
@ -2,12 +2,12 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: ACE-Team, Lambda.Tiger
|
||||
* This function will dump every ammo config that would generate ace_frag
|
||||
* This function will dump every ammo config that would generate ace_frag
|
||||
* fragements that could be fired from a weapon
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Log ammo types that wouldn't normall frag
|
||||
* 1: Only export ammo classes of classes referenced in cfgAmmo
|
||||
* 1: Only export ammo classes of classes referenced in cfgAmmo
|
||||
* and their submunitions.
|
||||
* 2: Force a CSV format
|
||||
*
|
||||
@ -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;
|
||||
@ -84,7 +85,7 @@ private _printCount = 0;
|
||||
if (_gC == 0) then {_warn = true;};
|
||||
private _fragCount = getNumber (_ammoConfig >> QGVAR(fragCount));
|
||||
if (_fragCount == 0) then {_fragCount = 200; _warn = true;};
|
||||
|
||||
|
||||
if (_warn) then {
|
||||
INC(_printCount);
|
||||
if (_csvFormat) then {
|
||||
|
@ -1,7 +1,8 @@
|
||||
#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
|
||||
* Per frame function to draw all dev traces
|
||||
*
|
||||
* Arguments:
|
||||
* none
|
||||
@ -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"];
|
||||
@ -37,7 +35,7 @@ if (GVAR(drawHitBox)) then {
|
||||
_deleteArr pushBack _x;
|
||||
continue;
|
||||
};
|
||||
|
||||
|
||||
{
|
||||
for "_i" from 1 to count _x -1 do
|
||||
{
|
||||
@ -46,7 +44,7 @@ if (GVAR(drawHitBox)) then {
|
||||
} forEach HB_DRAW_ARRS;
|
||||
|
||||
} forEach GVAR(dev_hitBoxes);
|
||||
|
||||
|
||||
for "_i" from 0 to count _deleteArr - 1 do
|
||||
{
|
||||
GVAR(dev_hitBoxes) deleteAt (_deleteArr#_i);
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Author: Lambda.Tiger
|
||||
* Add fired rounds to dev track.
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* None. Parameters inherited from EFUNC(common,firedEH)
|
||||
*
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Arguments:
|
||||
* 0: _dispAll <BOOL> - Display rounds that will never frag (power < 5).
|
||||
* Default value false
|
||||
* 1: _minFrgPowRng <FLOAT> - minimum range for sqrt power calculation
|
||||
* 1: _minFrgPowRng <FLOAT> - minimum range for sqrt power calculation
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -34,13 +34,13 @@ diag_log text "//****************** fragCalcDump Beg ******************//";
|
||||
// Processing ammo types
|
||||
{
|
||||
private _ammo = toLower configName _x;
|
||||
|
||||
|
||||
if (_ammo == "" || {_ammo in _processedCfgAmmos} ) then {continue};
|
||||
|
||||
|
||||
// calculating hit range
|
||||
_shouldFrag = [_ammo] call FUNC(shouldFrag);
|
||||
|
||||
|
||||
// Gunery equation
|
||||
private _c = getNumber (configFile >> "cfgAmmo" >> _ammo >> QGVAR(CHARGE));
|
||||
if (_c == 0) then {_c = 1;};
|
||||
@ -52,7 +52,7 @@ diag_log text "//****************** fragCalcDump Beg ******************//";
|
||||
if (_gC == 0) then {_gC = 2440;};
|
||||
private _fragCount = getNumber (configFile >> "cfgAmmo" >> _ammo >> QGVAR(fragCount));
|
||||
if (_fragCount == 0) then {_fragCount = 200;};
|
||||
|
||||
|
||||
private _velocity = 0.8 * _gC * sqrt (_c /(_m + _c * _k));
|
||||
// number of shrapnel to send a direction
|
||||
private _count = ceil (random (sqrt (_m / 1000)));
|
||||
@ -68,7 +68,7 @@ diag_log text "//****************** fragCalcDump Beg ******************//";
|
||||
diag_log text format [" Number frags: %1", _count];
|
||||
INC(_nPrinted);
|
||||
};
|
||||
|
||||
|
||||
_processedCfgAmmos pushBack _ammo;
|
||||
} forEach _allAmmoConfigs;
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
* Public: No
|
||||
*/
|
||||
params [
|
||||
["_posASL", [0,0,0], [[]], [2,3]],
|
||||
["_posASL", [0, 0, 0], [[]], [2,3]],
|
||||
["_color", "(1,0,0,0.5)", [""]]
|
||||
];
|
||||
|
||||
@ -30,7 +30,7 @@ if (count _posASL < 3) then
|
||||
|
||||
if (_color select [0,1] != "(") then
|
||||
{
|
||||
switch (toLower _color) do
|
||||
switch (toLower _color) do
|
||||
{
|
||||
case "blue": { _color = "(0,0,0.8,0.5)"; };
|
||||
case "black": { _color = "(1,1,1,0.5)"; };
|
||||
@ -46,7 +46,7 @@ private _clrStr = "#(argb,8,8,3)color" + _color;
|
||||
|
||||
private _sphere = "Sign_Sphere25cm_F" createVehicle [1,2,34];
|
||||
_sphere setObjectTexture [0, _clrStr];
|
||||
_sphere setPosASL _posASL;
|
||||
_sphere setPosASL _posASL;
|
||||
GVAR(dev_eventSpheres) pushBack _sphere;
|
||||
|
||||
_sphere;
|
@ -1,7 +1,7 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Lambda.Tiger
|
||||
* Handle for debug actions when switching units
|
||||
* Handle for debug actions when switching units
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Last unit <OBJECT>
|
||||
@ -37,7 +37,7 @@ _aID = _cVic addAction
|
||||
false, // hideOnUse
|
||||
"", // shortcut
|
||||
"true", // condition
|
||||
8
|
||||
8
|
||||
];
|
||||
|
||||
missionNamespace getVariable [QGVAR(dev_clearTraceAction), _aID];
|
@ -22,18 +22,20 @@ params [
|
||||
|
||||
if (isNull _obj) exitWith {};
|
||||
|
||||
// Grab the right hitBox
|
||||
private _box = [];
|
||||
if (_obj isKindOf "CAManBase") then {
|
||||
if (vehicle _obj == _obj) then {
|
||||
_box = 0 boundingBox _obj;
|
||||
_box = 0 boundingBox _obj;
|
||||
} else {
|
||||
_box = boundingBoxReal [_obj, "Geometry"];
|
||||
_box = boundingBoxReal [_obj, "Geometry"];
|
||||
};
|
||||
} else {
|
||||
_box = boundingBoxReal [_obj, "FireGeometry"];
|
||||
};
|
||||
_box params ["_lowP","_upP"];
|
||||
|
||||
// adjust with stance
|
||||
private _stance = stance _obj;
|
||||
switch (true) do {
|
||||
case (_stance isEqualTo "STAND"): {_upP set [2, 1.9];};
|
||||
@ -47,18 +49,19 @@ 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],
|
||||
[_p7#0,_p7#1,_p1#2],
|
||||
[_p7#0,_p1#1,_p1#2],
|
||||
[_p1#0,_p1#1,_p7#2],
|
||||
[_p1#0,_p7#1,_p7#2],
|
||||
[_p1#0, _p7#1, _p1#2],
|
||||
[_p7#0, _p7#1, _p1#2],
|
||||
[_p7#0, _p1#1, _p1#2],
|
||||
[_p1#0, _p1#1, _p7#2],
|
||||
[_p1#0, _p7#1, _p7#2],
|
||||
_lowP,
|
||||
[_p7#0,_p1#1,_p7#2]
|
||||
[_p7#0, _p1#1, _p7#2]
|
||||
];
|
||||
|
||||
_color = switch (side _obj) do {
|
||||
@ -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]};
|
||||
@ -47,7 +47,7 @@ GVAR(dev_trackLines) set [getObjectID _obj, [1, [getposATL _obj], _colorArray]];
|
||||
[_h] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
private _arr = GVAR(dev_trackLines) getOrDefault [(getObjectID _obj), -1];
|
||||
|
||||
|
||||
if (typeName _arr isEqualTo "SCALAR") exitWith {
|
||||
[_h] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
@ -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",
|
||||
{
|
||||
|
@ -10,7 +10,7 @@
|
||||
* 2: velocity of projectile <ARRAY>
|
||||
* 3: projectile cfgAmmo classname <STRING>
|
||||
* 4: getShotParents of projectile at EH <ARRAY>
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
@ -21,21 +21,23 @@
|
||||
*/
|
||||
TRACE_1("",_this);
|
||||
params [
|
||||
["_proj", objNull, [objNull]],
|
||||
["_posASL", [0,0,0], [[]], [3]],
|
||||
["_vel", [0,0,0] , [[]], [3]],
|
||||
["_proj", objNull, [objNull]],
|
||||
["_posASL", [0, 0, 0], [[]], [3]],
|
||||
["_vel", [0, 0, 0] , [[]], [3]],
|
||||
["_ammo", "", [""]],
|
||||
["_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 {
|
||||
if (_ammo isEqualTo "" || {_posASL isEqualTo [0, 0, 0] || _timeSince < ACE_FRAG_HOLDOFF}) exitWith {
|
||||
TRACE_3("timeExit",_timeSince,CBA_missionTime,GVAR(lastFragTime));
|
||||
};
|
||||
private _maxFrags = round linearConversion [0.1, 1.5, _timeSince, ACE_FRAG_COUNT_MIN, ACE_FRAG_COUNT_MAX, true];
|
||||
@ -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];
|
||||
@ -64,8 +66,4 @@ 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);
|
||||
};
|
@ -3,7 +3,7 @@
|
||||
* Author: Jaynus, NouberNou, Lambda.Tiger
|
||||
* This function creates fragments randomly spreading out from an explosion to
|
||||
* a maximum of 15
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Position of fragmenting projectile ASL <ARRAY>
|
||||
* 1: Velocity of the fragmenting projectile <ARRAY>
|
||||
@ -11,7 +11,7 @@
|
||||
* 3: Type of fragments to generate
|
||||
* 4: Remaining fragment budget <SCALAR>
|
||||
* 5: Shot parent <ARRAY>
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
@ -22,10 +22,10 @@
|
||||
*/
|
||||
|
||||
params [
|
||||
"_posASL",
|
||||
["_projVel", [0,0,0]],
|
||||
"_posASL",
|
||||
["_projVel", [0,0,0]],
|
||||
["_heightAGL", 2, [123]],
|
||||
["_fragType", [], [[]]],
|
||||
["_fragType", [], [[]]],
|
||||
["_fragCnt", 10, [123]],
|
||||
["_shotPrnt", [objNull, objNull], [[]], [2]]
|
||||
];
|
||||
@ -38,7 +38,7 @@ private _hMode = switch (true) do {
|
||||
default {"_mid"};
|
||||
};
|
||||
|
||||
private _type = if (count _fragType > 0 &&
|
||||
private _type = if (count _fragType > 0 &&
|
||||
{"ace_frag_tiny" isEqualTo (_fragType#0)}) then {
|
||||
QGVAR(def_tiny_)
|
||||
} else {
|
||||
@ -71,4 +71,4 @@ _fragSpawner addEventHandler [
|
||||
if (GVAR(dbgSphere)) then {
|
||||
[_posASL] call FUNC(dev_sphereDraw);
|
||||
};
|
||||
#endif
|
||||
#endif
|
@ -1,9 +1,9 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Jaynus, NouberNou, Lambda.Tiger
|
||||
* This function creates fragments targeted at specific entities, up to
|
||||
* a configured maximum
|
||||
*
|
||||
* This function creates fragments targeted at specific entities, up to
|
||||
* a configured maximum
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Position of fragmenting projectile ASL <ARRAY>
|
||||
* 1: Velocity of the fragmenting projectile <ARRAY>
|
||||
@ -12,9 +12,9 @@
|
||||
* 4: Types of fragments <ARRAY>
|
||||
* 5: A modified parameter used to calulate whether a framgent hits <SCALAR>
|
||||
* 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;
|
||||
@ -53,7 +53,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 (count _crew > 1) then {
|
||||
private _arr = [_x];
|
||||
{
|
||||
_arr pushBackUnique _x;
|
||||
@ -62,23 +62,22 @@ 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;
|
||||
|
||||
#ifdef DEBUG_MODE_DRAWFRAG
|
||||
[_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 {
|
||||
@ -111,12 +110,11 @@ private _fragCount = 0; // limit of # of fragments to _maxFrags
|
||||
};
|
||||
if (_count == 0) then {TRACE_2("fragments",_fragChance,_count); continue};
|
||||
|
||||
// Approximate offset to hit including speed & gravity
|
||||
// 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,9 +146,8 @@ private _fragCount = 0; // limit of # of fragments to _maxFrags
|
||||
default {"_far"};
|
||||
});
|
||||
};
|
||||
|
||||
TRACE_4("fragments",_fragSpawner,_fragChance,_distance,_locFragVel);
|
||||
|
||||
|
||||
// Create fragment
|
||||
private _vecDir = _posASL vectorFromTo _targetPos;
|
||||
private _fragObj = createVehicle [_fragSpawner, ASLtoATL _posASL, [], 0, "CAN_COLLIDE"];
|
||||
@ -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
|
@ -2,11 +2,11 @@
|
||||
/*
|
||||
* Author: Jaynus, NouberNou, Lambda.Tiger,
|
||||
* This function creates spalling if the hit slowed the speed down enough.
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* Arguments are the same as BI's "HitPart" EH:
|
||||
* https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HitPart
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
@ -30,7 +30,7 @@ params [
|
||||
|
||||
if (CBA_missionTime - GVAR(lastSpallTime) < ACE_FRAG_SPALL_HOLDOFF ||
|
||||
_lPosASL isEqualTo [0,0,0] ||
|
||||
{isNull _hitObj || {_hitObj isKindOf "man" ||
|
||||
{isNull _hitObj || {_hitObj isKindOf "man" ||
|
||||
{_ammo isEqualTo ""}}}) exitWith {
|
||||
TRACE_4("time/invldHit",CBA_missionTime,GVAR(lastSpallTime),_hitObj,_lPosASL);
|
||||
};
|
||||
@ -38,12 +38,12 @@ 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
|
||||
};
|
||||
|
||||
private _vel = if (alive _projectile) then {
|
||||
velocity _projectile;
|
||||
velocity _projectile;
|
||||
} else {
|
||||
[0, 0, 0]
|
||||
};
|
||||
@ -52,7 +52,7 @@ private _vel = if (alive _projectile) then {
|
||||
private _dV = vectorMagnitude _lVel - vectorMagnitude _vel;
|
||||
private _caliber = getNumber (configFile >> "cfgAmmo" >> _ammo >> "caliber");
|
||||
// scaled momentum change made on caliber-mass assumption ~sqrt(2)/20 * caliber ~= mass
|
||||
private _deltaMomentum = 0.0707 * _caliber * sqrt( _dV ) * GVAR(SpallIntensity);
|
||||
private _deltaMomentum = 0.0707 * _caliber * sqrt( _dV ) * GVAR(SpallIntensity);
|
||||
TRACE_3("found speed",_dV,_caliber,_deltaMomentum);
|
||||
|
||||
if (_deltaMomentum < 2) exitWith {
|
||||
@ -62,20 +62,22 @@ 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);
|
||||
};
|
||||
};
|
||||
// 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
|
||||
for "_i" from 1 to 20 do
|
||||
{
|
||||
private _nPos = _spallPos vectorAdd _unitStep;
|
||||
if (!lineIntersects [_spallPos, _nPos]) then {
|
||||
@ -93,7 +95,7 @@ if GVAR(dbgSphere) then {
|
||||
};
|
||||
#endif
|
||||
|
||||
private _spawnSize = switch (true) do
|
||||
private _spawnSize = switch (true) do
|
||||
{
|
||||
case (_deltaMomentum < 3): { "_spall_tiny" };
|
||||
case (_deltaMomentum < 5): { "_spall_small" };
|
||||
|
@ -3,16 +3,16 @@
|
||||
* Author: Jaynus, NouberNou, Lambda.Tiger
|
||||
* This function returns fragmentation parameters for a specific
|
||||
* ammo type.
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: _ammo <STRING> - cfgAmmo type of ammo to check
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* _ammoInfo <ARRAY>
|
||||
* 0: _fragRange - search range for fragments
|
||||
* 1: _fragVel - gurney equation calculated velocity
|
||||
* 2: _fragTypes - array of fragment types
|
||||
* 3: _fragCount - modified frag count used under assumptions
|
||||
* 3: _fragCount - modified frag count used under assumptions
|
||||
* of spherical fragmentation
|
||||
*
|
||||
* Example:
|
||||
@ -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;
|
||||
@ -37,7 +37,7 @@ if (isArray (configFile >> "cfgAmmo" >> _ammo >> QGVAR(CLASSES))) then {
|
||||
|
||||
/************ Gurney equation notes *****************//*
|
||||
* see https://en.wikipedia.org/wiki/Gurney_equations
|
||||
*
|
||||
*
|
||||
* GURNEY_K is the constant added to _m/_c
|
||||
* GURNEY_C = sqrt(2E)
|
||||
*
|
||||
@ -71,11 +71,11 @@ if (_warn) then {
|
||||
};
|
||||
|
||||
/********************** _ammoInfo format *************************//*
|
||||
* 0: _fragRange - search range for fragments, calculated with
|
||||
* 0: _fragRange - search range for fragments, calculated with
|
||||
* a 0.5% chance to hit as the minimum
|
||||
* 1: _fragVel - gurney equation calculated velocity
|
||||
* 2: _fragTypes - array of fragment types
|
||||
* 3: _fragCount - modified frag count used under assumptions
|
||||
* 3: _fragCount - modified frag count used under assumptions
|
||||
* of spherical fragmentation
|
||||
*/
|
||||
_ammoInfo = [
|
||||
|
@ -1,14 +1,14 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Lambda.Tiger
|
||||
* This function returns a classification of material type based
|
||||
* This function returns a classification of material type based
|
||||
* on the surface hit.
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: surfacetype <STRING> - either a cfgSurfaces path .bisurf filepath
|
||||
*
|
||||
* 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" };
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "..\script_component.hpp"
|
||||
/*
|
||||
* Author: Lambda.Tiger
|
||||
* Adds setting defined blacklisted rounds to blacklist
|
||||
* Adds setting defined blacklisted rounds to blacklist
|
||||
*
|
||||
* Arguments:
|
||||
* Mne
|
||||
@ -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,11 +1,12 @@
|
||||
#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
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* none
|
||||
*
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
* Arguments:
|
||||
* 0: _projectile <OBJECT> - The object created
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* 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,13 +38,16 @@ if (_shouldFrag && GVAR(enabled)) then {
|
||||
FUNC(doFrag),
|
||||
_this + [_ammo, _shotParents]
|
||||
] call CBA_fnc_execNextFrame;
|
||||
if (GVAR(reflectionsEnabled)) then {
|
||||
[_posASL, _ammo] call FUNC(doReflections);
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
private _shouldSpall = _ammo call FUNC(shouldSpall);
|
||||
if (GVAR(spallEnabled) && {_shouldSpall}) then
|
||||
if (GVAR(spallEnabled) && {_shouldSpall}) then
|
||||
{
|
||||
_projectile addEventHandler [
|
||||
"HitPart",
|
||||
|
@ -3,10 +3,10 @@
|
||||
* Author: Lambda.Tiger
|
||||
* This function checks whether an ammunition type should cause fragmentation
|
||||
* and whether any submunitions exist
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: _ammo <STRING> - cfgAmmo type of ammo to check
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* _shouldFrag Should the specific round fragment <BOOL>
|
||||
*
|
||||
@ -20,17 +20,17 @@ params ["_ammo"];
|
||||
|
||||
private _shouldFrag = GVAR(shouldFragCache) get _ammo;
|
||||
|
||||
if !(isNil "_shouldFrag") exitWith {_shouldFrag};
|
||||
if (!isNil "_shouldFrag") exitWith {_shouldFrag};
|
||||
|
||||
_shouldFrag = true;
|
||||
|
||||
private _skip = getNumber (configFile >> "cfgAmmo" >> _ammo >> QGVAR(skip));
|
||||
private _force = getNumber (configFile >> "cfgAmmo" >> _ammo >> QGVAR(force));
|
||||
private _explosive = getNumber (configFile >> "cfgAmmo" >> _ammo >> "explosive");
|
||||
private _indirectHit = getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirectHit");
|
||||
private _indirectRange = getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirectHitRange");
|
||||
private _indirectHit = getNumber (configFile >> "cfgAmmo" >> _ammo >> "indirectHit");
|
||||
private _indirectRange = getNumber (configFile >> "cfgAmmo" >> _ammo >> "indirectHitRange");
|
||||
|
||||
if (_skip == 1 || (_force == 0 && {_explosive < 0.5 || {_indirectHit < 3
|
||||
if (_skip == 1 || (_force == 0 && {_explosive < 0.5 || {_indirectHit < 3
|
||||
|| {_indirectRange < 5 && _indirectHit < _indirectRange}}})) then {
|
||||
TRACE_5("No frag",_ammo,_skip, _explosive, _indirectRange, _indirectHit);
|
||||
_shouldFrag = false;
|
||||
|
@ -2,13 +2,13 @@
|
||||
/*
|
||||
* Author: Lambda.Tiger
|
||||
* This function checks whether an ammunition type should cause spalling
|
||||
*
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: _ammo <STRING> - cfgAmmo type of ammo to check
|
||||
*
|
||||
*
|
||||
* Return Value:
|
||||
* Whether the round type would spall when hitting an object <BOOL>
|
||||
* Whether the round type would spall when hitting an object <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* ["B_556x45_Ball"] call ace_frag_fnc_shouldSpall;
|
||||
@ -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");
|
||||
|
@ -26,7 +26,7 @@ private _category = format ["ACE %1", localize LSTRING(Module_DisplayName)];
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(fragSimComplexity), "LIST",
|
||||
QGVAR(fragSimComplexity), "LIST",
|
||||
[LSTRING(FragMode), LSTRING(FragMode_Desc)],
|
||||
[_category, LSTRING(Frag)],
|
||||
[[2, 1, 0], [LSTRING(FragMode_Opt2),LSTRING(FragMode_Opt1),LSTRING(FragMode_Opt0)], 2],
|
||||
@ -34,7 +34,7 @@ private _category = format ["ACE %1", localize LSTRING(Module_DisplayName)];
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(atLeastOne), "CHECKBOX",
|
||||
QGVAR(atLeastOne), "CHECKBOX",
|
||||
[LSTRING(MinFrag), LSTRING(MinFrag_Desc)],
|
||||
[_category, LSTRING(Frag)],
|
||||
false,
|
||||
|
@ -24,7 +24,7 @@
|
||||
#define ACE_FRAG_COUNT_MIN 5
|
||||
#define ACE_FRAG_COUNT_MAX 50
|
||||
#define ACE_FRAG_HITPOINTS ["spine1","spine2","spine3","head","leftarm","leftarmroll","leftforearm","rightarm","rightarmroll","rightforearm","pelvis","leftupleg","leftuplegroll","leftlegroll","leftfoot","rightupleg","rightuplegroll","rightleg","rightlegroll","rightfoot"]
|
||||
#define ACE_FRAG_HITPOINTS_WEIGHTS
|
||||
#define ACE_FRAG_HITPOINTS_WEIGHTS
|
||||
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
#define __FADE_TIME 1
|
||||
|
@ -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