mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
314b0d23d6
*Added Gun and Ammo Data Screen *Added Atomospheric and Environmental Data Screen *Added Target Data Screen *Added support for coriolis- and spin drift *Added a second option (AT) to enter atmospheric data *Target data is now saved/restored in/from the profileNamespace *Atmosphere data is now saved/restored in/from the profileNamespace *Selected gun profile is now saved/restored in/from the profileNamespace *Fixed several bugs in the dual-/imperial unit systems *Minor bug fixes in the target range assist screen *Minor bug fix in the target speed assist screen
90 lines
3.5 KiB
Plaintext
90 lines
3.5 KiB
Plaintext
/*
|
|
* Author: Ruthberg
|
|
* Calculates the fireing solution and updates the result input/output fields
|
|
*
|
|
* Arguments:
|
|
* Nothing
|
|
*
|
|
* Return Value:
|
|
* Nothing
|
|
*
|
|
* Example:
|
|
* call ace_atragmx_calculate_target_solution
|
|
*
|
|
* Public: No
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
[] call FUNC(parse_input);
|
|
|
|
private ["_scopeBaseAngle"];
|
|
_scopeBaseAngle = (GVAR(workingMemory) select 3);
|
|
|
|
private ["_bulletMass", "_bulletDiameter", "_boreHeight", "_airFriction", "_barrelTwist", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel", "_twistDirection"];
|
|
_bulletMass = GVAR(workingMemory) select 12;
|
|
_bulletDiameter = GVAR(workingMemory) select 13;
|
|
_boreHeight = GVAR(workingMemory) select 5;
|
|
_airFriction = GVAR(workingMemory) select 4;
|
|
_barrelTwist = GVAR(workingMemory) select 14;
|
|
_muzzleVelocity = GVAR(workingMemory) select 1;
|
|
_bc = GVAR(workingMemory) select 15;
|
|
_dragModel = GVAR(workingMemory) select 16;
|
|
_atmosphereModel = GVAR(workingMemory) select 17;
|
|
|
|
_twistDirection = 0;
|
|
if (_barrelTwist > 0) then {
|
|
_twistDirection = 1;
|
|
} else {
|
|
if (_barrelTwist < 0) then {
|
|
_twistDirection = -1;
|
|
};
|
|
};
|
|
_barrelTwist = abs(_barrelTwist);
|
|
|
|
private ["_altitude", "_temperature", "_barometricPressure", "_relativeHumidity"];
|
|
_altitude = GVAR(altitude);
|
|
_temperature = GVAR(temperature);
|
|
_barometricPressure = GVAR(barometricPressure);
|
|
_relativeHumidity = GVAR(relativeHumidity);
|
|
if (!GVAR(atmosphereModeTBH)) then {
|
|
_barometricPressure = 1013.25 * exp(-(_altitude) / 7990);
|
|
_relativeHumidity = 50;
|
|
};
|
|
|
|
private ["_bulletLength", "_stabilityFactor"];
|
|
_bulletLength = 1.8;
|
|
_stabilityFactor = 1.5;
|
|
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then {
|
|
if (_bulletDiameter > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then {
|
|
_stabilityFactor = [_bulletDiameter / 10 / 2.54, _bulletLength, _bulletMass * 15.4323584, _barrelTwist / 2.54, _muzzleVelocity, _temperature, _barometricPressure] call EFUNC(advanced_ballistics,calculateStabilityFactor);
|
|
};
|
|
};
|
|
|
|
private ["_latitude", "_directionOfFire", "_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
|
|
_latitude = GVAR(latitude) select GVAR(currentTarget);
|
|
_directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget);
|
|
_windSpeed = GVAR(windSpeed1) select GVAR(currentTarget);
|
|
_windDirection = GVAR(windDirection) select GVAR(currentTarget);
|
|
_inclinationAngle = GVAR(inclinationAngle) select GVAR(currentTarget);
|
|
_targetSpeed = GVAR(targetSpeed) select GVAR(currentTarget);
|
|
_targetRange = GVAR(targetRange) select GVAR(currentTarget);
|
|
if (GVAR(currentUnit) != 2) then {
|
|
_windSpeed = _windSpeed / 2.23693629;
|
|
_targetSpeed = _targetSpeed / 2.23693629;
|
|
};
|
|
if (GVAR(currentUnit) == 1) then {
|
|
_targetRange = _targetRange / 1.0936133;
|
|
};
|
|
|
|
private ["_result"];
|
|
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
|
|
_windSpeed, _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, false, _stabilityFactor, _twistDirection, _latitude] call FUNC(calculate_solution);
|
|
|
|
GVAR(elevationOutput) set [GVAR(currentTarget), _result select 0];
|
|
GVAR(windageOutput) set [GVAR(currentTarget), _result select 1];
|
|
GVAR(leadOutput) set [GVAR(currentTarget), _result select 2];
|
|
GVAR(tofOutput) set [GVAR(currentTarget), _result select 3];
|
|
GVAR(velocityOutput) set [GVAR(currentTarget), _result select 4];
|
|
|
|
[] call FUNC(update_result);
|