mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Advanced Ballistics - Improve Performance in handleFirePFH (#7699)
* Improve Performance from handleFirePFH in Advanced Ballistics * PabstMirror Suggestion * Dont remove and readd the PFH but have one persitently running * Update addons/advanced_ballistics/XEH_postInit.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
parent
7c93ee9ed3
commit
6a59bf2a6c
@ -22,6 +22,9 @@ if (!hasInterface) exitWith {};
|
||||
["ace_firedPlayer", DFUNC(handleFired)] call CBA_fnc_addEventHandler;
|
||||
["ace_firedPlayerNonLocal", DFUNC(handleFired)] call CBA_fnc_addEventHandler;
|
||||
|
||||
// Register Perframe Handler
|
||||
[FUNC(handleFirePFH), GVAR(simulationInterval)] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
//Add warnings for missing compat PBOs (only if AB is on)
|
||||
{
|
||||
_x params ["_modPBO", "_compatPBO"];
|
||||
|
@ -15,12 +15,11 @@
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
private _deleted = false;
|
||||
{
|
||||
_x params ["_bullet","_caliber","_bulletTraceVisible","_index"];
|
||||
|
||||
if (!alive _bullet) then {
|
||||
GVAR(allBullets) deleteAt (GVAR(allBullets) find _x);
|
||||
} else {
|
||||
if (alive _bullet) then {
|
||||
private _bulletVelocity = velocity _bullet;
|
||||
private _bulletPosition = getPosASL _bullet;
|
||||
|
||||
@ -29,11 +28,12 @@
|
||||
};
|
||||
|
||||
_bullet setVelocity (_bulletVelocity vectorAdd (parseSimpleArray ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6", _index, _bulletVelocity, _bulletPosition, wind, ASLToATL(_bulletPosition) select 2, CBA_missionTime toFixed 6])));
|
||||
} else {
|
||||
GVAR(allBullets) set [_forEachIndex, objNull];
|
||||
_deleted = true;
|
||||
};
|
||||
nil
|
||||
} count +GVAR(allBullets);
|
||||
} forEach GVAR(allBullets);
|
||||
|
||||
if (GVAR(allBullets) isEqualTo []) then {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
GVAR(BulletPFH) = nil;
|
||||
if (_deleted) then {
|
||||
GVAR(allBullets) = GVAR(allBullets) - [objNull];
|
||||
};
|
||||
|
@ -123,7 +123,3 @@ GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000;
|
||||
"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _ammoCount, _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _transonicStabilityCoef, getPosASL _projectile, _bulletVelocity, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), EGVAR(weather,currentOvercast), CBA_missionTime toFixed 6];
|
||||
|
||||
GVAR(allBullets) pushBack [_projectile, _caliber, _bulletTraceVisible, GVAR(currentbulletID)];
|
||||
|
||||
if (isNil QGVAR(BulletPFH)) then {
|
||||
GVAR(BulletPFH) = [FUNC(handleFirePFH), GVAR(simulationInterval), []] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user