mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Code Test PFH
This commit is contained in:
parent
87b9b5019c
commit
e41ce78dbb
@ -6,7 +6,7 @@ GVAR(currentbulletID) = -1;
|
|||||||
|
|
||||||
GVAR(Protractor) = false;
|
GVAR(Protractor) = false;
|
||||||
GVAR(ProtractorStart) = ACE_time;
|
GVAR(ProtractorStart) = ACE_time;
|
||||||
|
GVAR(allBullets) = [];
|
||||||
GVAR(currentGrid) = 0;
|
GVAR(currentGrid) = 0;
|
||||||
|
|
||||||
GVAR(extensionAvailable) = true;
|
GVAR(extensionAvailable) = true;
|
||||||
|
@ -13,5 +13,5 @@ PREP(initializeTerrainExtension);
|
|||||||
PREP(initModuleSettings);
|
PREP(initModuleSettings);
|
||||||
PREP(readAmmoDataFromConfig);
|
PREP(readAmmoDataFromConfig);
|
||||||
PREP(readWeaponDataFromConfig);
|
PREP(readWeaponDataFromConfig);
|
||||||
|
PREP(handleFirePFH);
|
||||||
ADDON = true;
|
ADDON = true;
|
||||||
|
48
addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf
Normal file
48
addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Author: Glowbal, Ruthberg, joko // Jonas
|
||||||
|
* Handle the PFH for Bullets
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private "_deleted";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_deleted = 0;
|
||||||
|
|
||||||
|
{
|
||||||
|
private ["_bulletVelocity", "_bulletPosition", "_bulletSpeed"];
|
||||||
|
_x params["_bullet","_caliber","_bulletTraceVisible","_index"];
|
||||||
|
|
||||||
|
_bulletVelocity = velocity _bullet;
|
||||||
|
|
||||||
|
_bulletSpeed = vectorMagnitude _bulletVelocity;
|
||||||
|
|
||||||
|
if (!alive _bullet || _bulletSpeed < 100) exitWith {
|
||||||
|
GVAR(allBullets) deleteAt (_forEachIndex - _deleted);
|
||||||
|
_deleted = _deleted + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
_bulletPosition = getPosASL _bullet;
|
||||||
|
|
||||||
|
if (_bulletTraceVisible && _bulletSpeed > 500) then {
|
||||||
|
drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""];
|
||||||
|
};
|
||||||
|
|
||||||
|
_aceTimeSecond = floor ACE_time;
|
||||||
|
call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]);
|
||||||
|
} forEach GVAR(allBullets);
|
||||||
|
|
||||||
|
if (GVAR(allBullets) isEqualTo []) then {
|
||||||
|
diag_log "Remove PFH";
|
||||||
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||||
|
GVAR(BulletPFH) = nil;
|
||||||
|
};
|
@ -121,26 +121,9 @@ GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000;
|
|||||||
_aceTimeSecond = floor ACE_time;
|
_aceTimeSecond = floor ACE_time;
|
||||||
"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), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, ACE_time - _aceTimeSecond];
|
"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), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, ACE_time - _aceTimeSecond];
|
||||||
|
|
||||||
[{
|
GVAR(allBullets) pushBack [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)];
|
||||||
private ["_args", "_index", "_bullet", "_caliber", "_bulletTraceVisible", "_bulletVelocity", "_bulletPosition"];
|
|
||||||
params ["_args","_idPFH"];
|
|
||||||
_args params["_bullet","_caliber","_bulletTraceVisible","_index"];
|
|
||||||
|
|
||||||
_bulletVelocity = velocity _bullet;
|
if (isNil QGVAR(BulletPFH)) then {
|
||||||
|
diag_log "Add PFH";
|
||||||
_bulletSpeed = vectorMagnitude _bulletVelocity;
|
GVAR(BulletPFH) = [FUNC(handleFirePFH), GVAR(simulationInterval), []] call CBA_fnc_addPerFrameHandler;
|
||||||
|
};
|
||||||
if (!alive _bullet || _bulletSpeed < 100) exitWith {
|
|
||||||
[_idPFH] call cba_fnc_removePerFrameHandler;
|
|
||||||
};
|
|
||||||
|
|
||||||
_bulletPosition = getPosASL _bullet;
|
|
||||||
|
|
||||||
if (_bulletTraceVisible && _bulletSpeed > 500) then {
|
|
||||||
drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""];
|
|
||||||
};
|
|
||||||
|
|
||||||
_aceTimeSecond = floor ACE_time;
|
|
||||||
call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]);
|
|
||||||
|
|
||||||
}, GVAR(simulationInterval), [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]] call CBA_fnc_addPerFrameHandler;
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user