mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Frag - Cleanup and Performance (#5010)
* Frag - Cleanup and Performance * Add dots
This commit is contained in:
parent
f44da354d5
commit
8d43b899e6
@ -65,7 +65,6 @@ if (_amountOfMagazines > 0) exitWith {
|
||||
private _velVec = _vectorAmmo vectorMultiply _speed;
|
||||
_projectile setVectorDir _velVec;
|
||||
_projectile setVelocity _velVec;
|
||||
// [ACE_player, _projectile, [1,0,0,1]] call EFUNC(frag,addTrack); // visual debuging from ace_frag
|
||||
} else {
|
||||
_projectile setDamage 1;
|
||||
};
|
||||
|
@ -25,20 +25,13 @@ class ACE_Settings {
|
||||
displayName = CSTRING(MaxTrack);
|
||||
description = CSTRING(MaxTrack_Desc);
|
||||
typeName = "SCALAR";
|
||||
value = 500;
|
||||
value = 10;
|
||||
};
|
||||
class GVAR(maxTrackPerFrame) {
|
||||
category = CSTRING(Module_DisplayName);
|
||||
displayName = CSTRING(MaxTrackPerFrame);
|
||||
description = CSTRING(MaxTrackPerFrame_Desc);
|
||||
typeName = "SCALAR";
|
||||
value = 50;
|
||||
};
|
||||
class GVAR(enableDebugTrace) {
|
||||
category = CSTRING(Module_DisplayName);
|
||||
displayName = CSTRING(EnableDebugTrace);
|
||||
description = CSTRING(EnableDebugTrace_Desc);
|
||||
typeName = "BOOL";
|
||||
value = 0;
|
||||
value = 10;
|
||||
};
|
||||
};
|
||||
|
@ -7,19 +7,17 @@ PREP(spallTrack);
|
||||
|
||||
// * Other */
|
||||
PREP(addBlackList);
|
||||
PREP(addTrack);
|
||||
PREP(drawTraces);
|
||||
PREP(removeTrack);
|
||||
PREP(dev_addTrack);
|
||||
PREP(dev_drawTraces);
|
||||
PREP(spallHP);
|
||||
PREP(startTracing);
|
||||
PREP(stopTracing);
|
||||
PREP(trackTrace);
|
||||
PREP(dev_startTracing);
|
||||
PREP(dev_stopTracing);
|
||||
PREP(dev_trackTrace);
|
||||
|
||||
// New tracking mechanisms
|
||||
PREP(masterPFH);
|
||||
PREP(pfhRound);
|
||||
PREP(addPfhRound);
|
||||
PREP(removePfhRound); // THIS SHOULD ABE USED SPARINGLY
|
||||
|
||||
// Explosive Reflection
|
||||
PREP(findReflections);
|
||||
|
@ -1,11 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (GVAR(enableDebugTrace) && {!isMultiplayer}) then {
|
||||
GVAR(traceFrags) = true;
|
||||
GVAR(autoTrace) = true;
|
||||
};
|
||||
|
||||
if (isServer) then {
|
||||
GVAR(lastFragTime) = -1;
|
||||
[QGVAR(frag_eh), {_this call FUNC(frago);}] call CBA_fnc_addEventHandler;
|
||||
};
|
||||
|
||||
@ -24,6 +20,13 @@ if (isServer) then {
|
||||
// Cache for ammo type configs
|
||||
GVAR(cacheRoundsTypesToTrack) = [false] call CBA_fnc_createNamespace;
|
||||
|
||||
#ifdef DEBUG_ENABLED_FRAG
|
||||
|
||||
// Debug stuff:
|
||||
|
||||
#ifdef DRAW_FRAG_INFO
|
||||
[] call FUNC(dev_startTracing);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
[true, true, 30] call FUNC(dev_debugAmmo);
|
||||
#endif
|
||||
|
@ -6,23 +6,18 @@ PREP_RECOMPILE_START;
|
||||
#include "XEH_PREP.hpp"
|
||||
PREP_RECOMPILE_END;
|
||||
|
||||
GVAR(replacedBisArtyWrapper) = true;
|
||||
GVAR(blackList) = [];
|
||||
GVAR(traceFrags) = false;
|
||||
|
||||
GVAR(totalFrags) = 0;
|
||||
|
||||
GVAR(spallHPData) = [];
|
||||
GVAR(spallIsTrackingCount) = 0;
|
||||
|
||||
GVAR(autoTrace) = false;
|
||||
GVAR(traceID) = -1;
|
||||
GVAR(traces) = [];
|
||||
GVAR(tracesStarted) = false;
|
||||
|
||||
GVAR(lastIterationIndex) = 0;
|
||||
GVAR(objects) = [];
|
||||
GVAR(objectTypes) = [];
|
||||
GVAR(arguments) = [];
|
||||
|
||||
ADDON = true;
|
||||
|
@ -1,5 +1,21 @@
|
||||
/*
|
||||
* Author: Jaynus, NouberNou
|
||||
* Adds a round to the blacklist (will be ignored).
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Projectile <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [bullet] call ace_frag_fnc_addBlackList
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_round"];
|
||||
TRACE_1("addBlackList",_round);
|
||||
|
||||
GVAR(blackList) pushBack _round;
|
||||
|
@ -1,27 +1,38 @@
|
||||
/*
|
||||
* Author: Jaynus, NouberNou
|
||||
* Starts tracking a round that will frag.
|
||||
* Should only be called once per round.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Shooter <OBJECT>
|
||||
* 1: Ammo classname <STRING>
|
||||
* 2: Projectile <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [player, "handGrenade", bullet] call ace_frag_fnc_addPfhRound
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_gun", "_type", "_round", ["_doFragTrack", false]];
|
||||
params ["_gun", "_type", "_round"];
|
||||
TRACE_3("addPfhRound",_gun,_type,_round);
|
||||
|
||||
if (!GVAR(enabled)) exitWith {};
|
||||
if (!GVAR(enabled)) exitWith {TRACE_1("setting disabled",_this);};
|
||||
|
||||
//_enabled = getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(enabled));
|
||||
//if (_enabled < 1) exitWith {};
|
||||
if (!alive _round) exitWith {TRACE_1("round dead?",_this);};
|
||||
|
||||
if (_round in GVAR(blackList)) exitWith {
|
||||
TRACE_1("round in blackList",_this);
|
||||
REM(GVAR(blackList),_round);
|
||||
};
|
||||
|
||||
// Exit on max track
|
||||
if ((count GVAR(objects)) > GVAR(maxTrack)) exitWith {};
|
||||
|
||||
if (
|
||||
_gun == ACE_player ||
|
||||
{(gunner _gun) == ACE_player} ||
|
||||
{local _gun && {!(isPlayer (gunner _gun))} && {!(isPlayer _gun)}}
|
||||
) then {
|
||||
_doFragTrack = true;
|
||||
};
|
||||
if ((count GVAR(objects)) >= GVAR(maxTrack)) exitWith {TRACE_1("maxTrack limit",count GVAR(objects));};
|
||||
|
||||
private _doSpall = false;
|
||||
if (GVAR(SpallEnabled)) then {
|
||||
@ -29,23 +40,23 @@ if (GVAR(SpallEnabled)) then {
|
||||
GVAR(spallHPData) = [];
|
||||
};
|
||||
if (GVAR(spallIsTrackingCount) > 5) then {
|
||||
// ACE_player sideChat "LIMT!";
|
||||
TRACE_1("At Spall Limit",GVAR(spallIsTrackingCount));
|
||||
} else {
|
||||
_doSpall = true;
|
||||
INC(GVAR(spallIsTrackingCount));
|
||||
};
|
||||
TRACE_2("",_doSpall,GVAR(spallIsTrackingCount));
|
||||
};
|
||||
// ACE_player sideChat format ["c: %1", GVAR(spallIsTrackingCount)];
|
||||
|
||||
if (GVAR(autoTrace)) then {
|
||||
[ACE_player, _round, [1, 0, 0, 1]] call FUNC(addTrack);
|
||||
};
|
||||
#ifdef DRAW_FRAG_INFO
|
||||
[ACE_player, _round, [0, 1, 0, 1]] call FUNC(dev_addTrack);
|
||||
#endif
|
||||
|
||||
// We only do the single track object check here.
|
||||
// We should do an {!(_round in GVAR(objects))}
|
||||
// But we leave that out here for optimization. So this cannot be a framework function
|
||||
// Otherwise, it should only be added once and from the FiredEH
|
||||
if (_doFragTrack && {alive _round}) then {
|
||||
if (alive _round) then {
|
||||
private _spallTrack = [];
|
||||
private _spallTrackID = [];
|
||||
|
||||
@ -64,5 +75,4 @@ if (_doFragTrack && {alive _round}) then {
|
||||
if (_doSpall) then {
|
||||
[_round, 1, _spallTrack, _spallTrackID] call FUNC(spallTrack);
|
||||
};
|
||||
// ACE_player sideChat "WTF2";
|
||||
};
|
||||
|
@ -1,10 +1,5 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (GVAR(autoTrace)) then {
|
||||
[] call FUNC(startTracing);
|
||||
};
|
||||
|
||||
// setAccTime 0.05;
|
||||
params ["_origin", "_obj", ["_color", [1, 0, 0, 1]]];
|
||||
|
||||
private _positions = [];
|
||||
@ -13,4 +8,4 @@ _positions pushBack [getPos _obj, _objSpd];
|
||||
private _data = [_origin, typeOf _origin, typeOf _obj, _objSpd, _positions, _color];
|
||||
|
||||
private _index = GVAR(traces) pushBack _data;
|
||||
[DFUNC(trackTrace), 0, [_obj, _index, CBA_missionTime]] call CBA_fnc_addPerFrameHandler;
|
||||
[DFUNC(dev_trackTrace), 0, [_obj, _index, CBA_missionTime]] call CBA_fnc_addPerFrameHandler;
|
@ -1,11 +1,10 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
{
|
||||
private _positions = _x select 4;
|
||||
private _color = _x select 5;
|
||||
_x params ["", "", "", "", "_positions", "_color"];
|
||||
private _index = 0;
|
||||
private _max = count _positions;
|
||||
private _lastSpd = [];
|
||||
// private _lastSpd = [];
|
||||
private _lastPos = [];
|
||||
while {_index < _max} do {
|
||||
_data1 = _positions select _index;
|
||||
@ -17,7 +16,7 @@
|
||||
|
||||
drawLine3D [_pos1, _pos2, _color];
|
||||
_lastPos = _pos2;
|
||||
_lastSpd = _data1 select 1;
|
||||
// _lastSpd = _data1 select 1;
|
||||
};
|
||||
// drawIcon3D ["", [1,0,0,1], _lastPos, 0, 0, 0, format ["%1m/s", _lastSpd], 1, 0.05, "RobotoCondensed"];
|
||||
} forEach GVAR(traces);
|
8
addons/frag/functions/fnc_dev_startTracing.sqf
Normal file
8
addons/frag/functions/fnc_dev_startTracing.sqf
Normal file
@ -0,0 +1,8 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (GVAR(tracesStarted)) exitWith {};
|
||||
|
||||
INFO("Starting Trace Drawing");
|
||||
|
||||
GVAR(tracesStarted) = true;
|
||||
GVAR(traceID) = [LINKFUNC(dev_drawTraces), 0, []] call CBA_fnc_addPerFrameHandler;
|
@ -1,5 +1,8 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!GVAR(tracesStarted)) exitWith {};
|
||||
|
||||
INFO("Ending Trace Drawing");
|
||||
|
||||
GVAR(tracesStarted) = false;
|
||||
[GVAR(traceID)] call CBA_fnc_removePerFrameHandler;
|
@ -99,9 +99,9 @@ for "_i" from 1 to _spallCount do {
|
||||
_fragment setPosASL _spallPos;
|
||||
_fragment setVelocity _spallFragVect;
|
||||
|
||||
if (GVAR(traceFrags)) then {
|
||||
[ACE_player, _fragment, [1, 0.5, 0, 1]] call FUNC(addTrack);
|
||||
};
|
||||
#ifdef DRAW_FRAG_INFO
|
||||
[ACE_player, _fragment, [1, 0.5, 0, 1]] call FUNC(dev_addTrack);
|
||||
#endif
|
||||
};
|
||||
|
||||
_spread = 5 + (random 5);
|
||||
@ -122,7 +122,7 @@ for "_i" from 1 to _spallCount do {
|
||||
_fragment setPosASL _spallPos;
|
||||
_fragment setVelocity _spallFragVect;
|
||||
|
||||
if (GVAR(traceFrags)) then {
|
||||
[ACE_player, _fragment, [1, 0, 0, 1]] call FUNC(addTrack);
|
||||
};
|
||||
#ifdef DRAW_FRAG_INFO
|
||||
[ACE_player, _fragment, [1, 0, 0, 1]] call FUNC(dev_addTrack);
|
||||
#endif
|
||||
};
|
||||
|
@ -50,6 +50,14 @@ if (isNil "_shouldAdd") then {
|
||||
};
|
||||
|
||||
if (_shouldAdd) then {
|
||||
TRACE_3("Running Frag Tracking",_unit,_ammo,_projectile);
|
||||
// firedMan will have nil "_gunner", so just check _unit; for firedVehicle we want to check _gunner
|
||||
private _localShooter = if (isNil "_gunner") then {local _unit} else {local _gunner};
|
||||
TRACE_4("",_localShooter,_unit,_ammo,_projectile);
|
||||
if (!_localShooter) exitWith {};
|
||||
|
||||
// Skip if less than 0.5 second from last shot
|
||||
if ((CBA_missionTime - (_unit getVariable [QGVAR(lastTrack), -1])) < 0.5) exitWith {};
|
||||
_unit setVariable [QGVAR(lastTrack), CBA_missionTime];
|
||||
|
||||
[_unit, _ammo, _projectile] call FUNC(addPfhRound);
|
||||
};
|
||||
|
@ -1,17 +1,35 @@
|
||||
//fnc_frago.sqf
|
||||
// #define DEBUG_MODE_FULL
|
||||
/*
|
||||
* Author: Jaynus, NouberNou
|
||||
* Server func to create the fragmentation for a round.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Last Position (ASL) <ARRAY>
|
||||
* 1: Velocity <ARRAY>
|
||||
* 2: Ammo Classname <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [[], [], "handGrenade"] call ace_frag_fnc_frago
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define FRAG_VEC_VAR 0.004
|
||||
|
||||
#define MAX_FRAG_COUNT 50
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
BEGIN_COUNTER(frago);
|
||||
// _startTime = diag_tickTime;
|
||||
|
||||
params ["_round", "_lastPos", "_lastVel", "_shellType", "_firedFrame", "_gun"];
|
||||
params ["_lastPos", "_lastVel", "_shellType"];
|
||||
TRACE_3("frago",_lastPos,_lastVel,_shellType);
|
||||
|
||||
// Limit max frag count if there was a recent frag
|
||||
private _maxFrags = round (MAX_FRAG_COUNT * linearConversion [0.1, 1.5, (CBA_missionTime - GVAR(lastFragTime)), 0.1, 1, true]);
|
||||
TRACE_2("",_maxFrags,CBA_missionTime - GVAR(lastFragTime));
|
||||
GVAR(lastFragTime) = CBA_missionTime;
|
||||
|
||||
private _fragTypes = [
|
||||
QGVAR(tiny), QGVAR(tiny), QGVAR(tiny),
|
||||
@ -28,12 +46,6 @@ if (isArray (configFile >> "CfgAmmo" >> _shellType >> QGVAR(CLASSES))) then {
|
||||
_warn = true;
|
||||
};
|
||||
|
||||
private _isArmed = true;
|
||||
if (!isNil "_gun") then {
|
||||
private _fuseDist = getNumber(configFile >> "CfgAmmo" >> _shellType >> "fuseDistance");
|
||||
_isArmed = ((getPosASL _gun) distance _lastPos > _fuseDist);
|
||||
};
|
||||
|
||||
private _indirectHitRange = getNumber(configFile >> "CfgAmmo" >> _shellType >> "indirecthitrange");
|
||||
private _fragRange = 20 * _indirectHitRange * 4;
|
||||
// _c = 185; // grams of comp-b
|
||||
@ -69,38 +81,26 @@ if ((_atlPos select 2) < 0.5) then {
|
||||
_lastPos vectorAdd [0, 0, 0.5];
|
||||
};
|
||||
|
||||
// _manObjects = _atlPos nearEntities ["CaManBase", _fragRange];
|
||||
|
||||
// setAccTime 0.01;
|
||||
|
||||
//_objects = nearestObjects [_atlPos, ["AllVehicles"], _fragRange]; // Not sure if tracking "ReammoBox" is required, if so revert this change for _objects
|
||||
private _objects = _atlPos nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], _fragRange];
|
||||
|
||||
// _objects = _manObjects;
|
||||
// Add unique crews in faster way
|
||||
{
|
||||
{
|
||||
_objects pushBackUnique _x;
|
||||
} forEach (crew _x);
|
||||
} forEach _objects;
|
||||
TRACE_2("",_fragRange,count _objects);
|
||||
|
||||
private _fragCount = 0;
|
||||
|
||||
private _fragArcs = [];
|
||||
_fragArcs set [360, 0];
|
||||
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
ACE_player sideChat format ["_fragRange: %1", _fragRange];
|
||||
ACE_player sideChat format ["_objects: %1", _objects];
|
||||
#endif
|
||||
|
||||
private _doRandom = true;
|
||||
if (_isArmed && {!(_objects isEqualTo [])}) then {
|
||||
if (!(_objects isEqualTo [])) then {
|
||||
if (GVAR(reflectionsEnabled)) then {
|
||||
[_lastPos, _shellType] call FUNC(doReflections);
|
||||
};
|
||||
{
|
||||
//if (random(1) > 0.5) then {
|
||||
private _target = _x;
|
||||
if (alive _target) then {
|
||||
(boundingBox _target) params ["_boundingBoxA", "_boundingBoxB"];
|
||||
@ -108,7 +108,7 @@ if (_isArmed && {!(_objects isEqualTo [])}) then {
|
||||
private _cubic = ((abs (_boundingBoxA select 0)) + (_boundingBoxB select 0)) * ((abs (_boundingBoxA select 1)) + (_boundingBoxB select 1)) * ((abs (_boundingBoxA select 2)) + (_boundingBoxB select 2));
|
||||
|
||||
if (_cubic <= 1) exitWith {};
|
||||
_doRandom = true;
|
||||
// _doRandom = true;
|
||||
|
||||
private _targetVel = velocity _target;
|
||||
private _targetPos = getPosASL _target;
|
||||
@ -125,7 +125,7 @@ if (_isArmed && {!(_objects isEqualTo [])}) then {
|
||||
|
||||
private _dir = floor (_baseVec call CBA_fnc_vectDir);
|
||||
private _currentCount = RETDEF(_fragArcs select _dir,0);
|
||||
if (_currentCount < 20) then {
|
||||
if (_currentCount < 10) then {
|
||||
private _count = ceil (random (sqrt (_m / 1000)));
|
||||
private _vecVar = FRAG_VEC_VAR;
|
||||
if (!(_target isKindOf "Man")) then {
|
||||
@ -144,29 +144,28 @@ if (_isArmed && {!(_objects isEqualTo [])}) then {
|
||||
private _fp = _fragPower - (random (_fragPowerRandom));
|
||||
private _vel = _vec vectorMultiply _fp;
|
||||
|
||||
private _fragType = round (random ((count _fragTypes) - 1));
|
||||
private _fragObj = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
|
||||
// diag_log text format ["fp: %1 %2", _fp, typeOf _fragObj];
|
||||
private _fragObj = (selectRandom _fragTypes) createVehicleLocal [0,0,10000];
|
||||
// TRACE_4("targeted",_fp, typeOf _fragObj,_lastPos vectorDistance _targetPos,typeOf _x);
|
||||
_fragObj setPosASL _lastPos;
|
||||
_fragObj setVectorDir _vec;
|
||||
_fragObj setVelocity _vel;
|
||||
if (GVAR(traceFrags)) then {
|
||||
INC(GVAR(totalFrags));
|
||||
[ACE_player, _fragObj, [1,0,0,1]] call FUNC(addTrack);
|
||||
};
|
||||
#ifdef DRAW_FRAG_INFO
|
||||
[ACE_player, _fragObj, [1,0,0,1]] call FUNC(dev_addTrack);
|
||||
#endif
|
||||
INC(_fragCount);
|
||||
INC(_currentCount);
|
||||
};
|
||||
_fragArcs set [_dir, _currentCount];
|
||||
};
|
||||
};
|
||||
//};
|
||||
if (_fragCount > MAX_FRAG_COUNT) exitWith {};
|
||||
if (_fragCount > _maxFrags) exitWith {};
|
||||
} forEach _objects;
|
||||
if (_fragCount > MAX_FRAG_COUNT) exitWith {};
|
||||
private _randomCount = ((ceil ((MAX_FRAG_COUNT - _fragCount) * 0.1)) max 0) + 20;
|
||||
TRACE_1("targeted",_fragCount);
|
||||
if (_fragCount > _maxFrags) exitWith {};
|
||||
private _randomCount = ceil ((_maxFrags - _fragCount) * 0.35);
|
||||
TRACE_1("",_randomCount);
|
||||
private _sectorSize = 360 / (_randomCount max 1);
|
||||
// _doRandom = false;
|
||||
|
||||
if (_doRandom) then {
|
||||
for "_i" from 1 to _randomCount do {
|
||||
// Distribute evenly
|
||||
@ -178,24 +177,19 @@ if (_isArmed && {!(_objects isEqualTo [])}) then {
|
||||
|
||||
_vel = _vec vectorMultiply _fp;
|
||||
|
||||
_fragType = round (random ((count _fragTypes) - 1));
|
||||
_fragObj = (_fragTypes select _fragType) createVehicleLocal [0, 0, 10000];
|
||||
_fragObj = (selectRandom _fragTypes) createVehicleLocal [0, 0, 10000];
|
||||
_fragObj setPosASL _lastPos;
|
||||
_fragObj setVectorDir _vec;
|
||||
_fragObj setVelocity _vel;
|
||||
|
||||
if (GVAR(traceFrags)) then {
|
||||
INC(GVAR(totalFrags));
|
||||
[ACE_player, _fragObj, [1,0.5,0,1]] call FUNC(addTrack);
|
||||
};
|
||||
#ifdef DRAW_FRAG_INFO
|
||||
[ACE_player, _fragObj, [1,0.5,0,1]] call FUNC(dev_addTrack);
|
||||
#endif
|
||||
INC(_fragCount);
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
// #ifdef DEBUG_MODE_FULL
|
||||
// ACE_player sideChat format["total frags: %1", GVAR(totalFrags)];
|
||||
// ACE_player sideChat format["tracks: %1", (count GVAR(trackedObjects))];
|
||||
// #endif
|
||||
// _endTime = diag_tickTime;
|
||||
|
||||
TRACE_1("total created",_fragCount);
|
||||
|
||||
END_COUNTER(frago);
|
||||
|
@ -1,19 +1,20 @@
|
||||
/*
|
||||
* Author: jaynus
|
||||
*
|
||||
* Master single PFH abstraction for all rounds being tracked by frag/spall
|
||||
* Master single PFH abstraction for all rounds being tracked by frag/spall.
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*/
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
//PARAMS_2(_pfhArgs,_handle);
|
||||
|
||||
if (!GVAR(enabled)) exitWith {};
|
||||
BEGIN_COUNTER(PFH);
|
||||
|
||||
// Fast exit if nothing to do
|
||||
if (GVAR(objects) isEqualTo []) exitWith {END_COUNTER(PFH);};
|
||||
|
||||
private _gcIndex = [];
|
||||
|
||||
@ -47,3 +48,5 @@ private _deletionCount = 0;
|
||||
|
||||
INC(_deletionCount);
|
||||
} forEach _gcIndex;
|
||||
|
||||
END_COUNTER(PFH);
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_round", "_lastPos", "_lastVel", "_type", "_firedFrame", "_gun", "_doSpall", "_spallTrack", "_foundObjectHPIds", "_skip", "_explosive", "_indirectRange", "_force", "_fragPower"];
|
||||
params ["_round", "_lastPos", "_lastVel", "_shellType", "_firedFrame", "_gun", "_doSpall", "_spallTrack", "_foundObjectHPIds", "_skip", "_explosive", "_indirectRange", "_force", "_fragPower"];
|
||||
|
||||
if (_round in GVAR(blackList)) exitWith {
|
||||
false
|
||||
@ -11,14 +11,22 @@ if (!alive _round) exitWith {
|
||||
if (_skip == 0) then {
|
||||
if ((_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}) || {_force == 1}) then {
|
||||
// shotbullet, shotShell don't seem to explode when touching water, so don't create frags
|
||||
if (((_lastPos select 2) < 0) && {(toLower getText (configFile >> "CfgAmmo" >> _type >> "simulation")) in ["shotbullet", "shotshell"]}) exitWith {};
|
||||
[QGVAR(frag_eh), _this] call CBA_fnc_serverEvent;
|
||||
if (((_lastPos select 2) < 0) && {(toLower getText (configFile >> "CfgAmmo" >> _shellType >> "simulation")) in ["shotbullet", "shotshell"]}) exitWith {};
|
||||
private _isArmed = true;
|
||||
if (!isNil "_gun") then {
|
||||
private _fuseDist = getNumber(configFile >> "CfgAmmo" >> _shellType >> "fuseDistance");
|
||||
_isArmed = ((getPosASL _gun) distance _lastPos > _fuseDist);
|
||||
TRACE_2("",_fuseDist,_isArmed);
|
||||
};
|
||||
if (!_isArmed) exitWith {TRACE_1("round not armed",_this);};
|
||||
TRACE_3("Sending frag event to server",_lastPos,_lastVel,_shellType);
|
||||
[QGVAR(frag_eh), [_lastPos,_lastVel,_shellType]] call CBA_fnc_serverEvent;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (_doSpall) then {
|
||||
DEC(GVAR(spallIsTrackingCount));
|
||||
// diag_log text format ["F: %1", _foundObjectHPIds];
|
||||
TRACE_1("doSpall",_foundObjectHPIds);
|
||||
{
|
||||
if (!isNil "_x") then {
|
||||
_x removeEventHandler ["hitPart", _foundObjectHPIds select _forEachIndex];
|
||||
|
@ -1,11 +0,0 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
// THIS FUNCTION SHOULD NOT BE USED BECAUSE IT CAUSES AN SEARCH AND REBUILD
|
||||
|
||||
params ["_round"];
|
||||
|
||||
if (_round in GVAR(blackList)) then {
|
||||
REM(GVAR(blackList),_round);
|
||||
};
|
||||
|
||||
REM(GVAR(objects),_round);
|
@ -1,13 +0,0 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private _ret = true;
|
||||
if (IS_ARRAY(_this select 0)) then {
|
||||
_ret = false;
|
||||
} else {
|
||||
if ((_this select 0) in GVAR(trackedObjects)) then {
|
||||
REM(GVAR(trackedObjects),_this select 0);
|
||||
} else {
|
||||
_ret = false;
|
||||
};
|
||||
};
|
||||
_ret
|
@ -1,5 +0,0 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (GVAR(tracesStarted)) exitWith {};
|
||||
GVAR(tracesStarted) = true;
|
||||
GVAR(traceID) = [FUNC(drawTraces), 0, []] call CBA_fnc_addPerFrameHandler;
|
@ -2,7 +2,7 @@
|
||||
#define COMPONENT_BEAUTIFIED Frag
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
//#define DEBUG_ENABLED_FRAG
|
||||
// #define DRAW_FRAG_INFO
|
||||
// #define DEBUG_MODE_FULL
|
||||
// #define DISABLE_COMPILE_CACHE
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
Loading…
Reference in New Issue
Block a user