mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added speed of sound calculation:
* Influences the advanced ballistics transonic instability * Influences the ATragMX range card output
This commit is contained in:
parent
e2970ab40e
commit
abf0149b1d
@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_range", "_elevation", "_windage1", "_windage2", "_clickSize", "_clickNumber", "_clickInterval", "_lead", "_TOF", "_velocity", "_kineticEnergy", "_rangeOutput", "_elevationOutput", "_windageOutput", "_lastColumnOutput"];
|
||||
private ["_range", "_elevation", "_windage1", "_windage2", "_clickSize", "_clickNumber", "_clickInterval", "_lead", "_TOF", "_velocity", "_kineticEnergy", "_rangeOutput", "_elevationOutput", "_windageOutput", "_lastColumnOutput", "_speedOfSound"];
|
||||
_lastColumnOutput = "";
|
||||
|
||||
if (GVAR(showWind2) && GVAR(rangeCardCurrentColumn) == 0) then {
|
||||
@ -32,6 +32,8 @@ if (GVAR(currentUnit) == 1) then {
|
||||
|
||||
lnbClear 5007;
|
||||
|
||||
_speedOfSound = GVAR(temperature) call EFUNC(weather,calculateSpeedOfSound);
|
||||
|
||||
{
|
||||
_range = _x select 0;
|
||||
_elevation = _x select 1;
|
||||
@ -72,7 +74,7 @@ lnbClear 5007;
|
||||
_windageOutput = Str(Round(_windage1 * 100) / 100);
|
||||
|
||||
_rangeOutput = Str(_range);
|
||||
if (_velocity < 340.29) then {
|
||||
if (_velocity < _speedOfSound) then {
|
||||
_rangeOutput = _rangeOutput + "*";
|
||||
};
|
||||
|
||||
|
@ -8,6 +8,7 @@ PREP(calculateBarometricPressure);
|
||||
PREP(calculateDewPoint);
|
||||
PREP(calculateHeatIndex);
|
||||
PREP(calculateRoughnessLength);
|
||||
PREP(calculateSpeedOfSound);
|
||||
PREP(calculateTemperatureAtHeight);
|
||||
PREP(calculateWetBulb);
|
||||
PREP(calculateWindChill);
|
||||
|
17
addons/weather/functions/fnc_calculateSpeedOfSound.sqf
Normal file
17
addons/weather/functions/fnc_calculateSpeedOfSound.sqf
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the speed of sound for a given temperature
|
||||
*
|
||||
* Arguments:
|
||||
* temperature - degrees celcius <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* speed of sound - m/s <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
(331.3 + (0.6 * _this))
|
@ -577,7 +577,8 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
||||
positionOffset[0] += sin(bulletDir + M_PI / 2) * spinDriftPartial;
|
||||
positionOffset[1] += cos(bulletDir + M_PI / 2) * spinDriftPartial;
|
||||
|
||||
if (bulletSpeed < 345 && bulletSpeedAvg > 340 && bulletSpeed > 335) {
|
||||
float speedOfSound = 331.3 + (0.6 * temperature);
|
||||
if (bulletSpeed < (speedOfSound + 5) && bulletSpeedAvg > speedOfSound && bulletSpeed > (speedOfSound - 5)) {
|
||||
std::uniform_real_distribution<double> distribution(0.0, 1.0);
|
||||
double coef = 1.0f - bulletDatabase[index].transonicStabilityCoef;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user