ACE3/addons/artillerytables/functions/fnc_calculateMuzzleVelocity.sqf
BrettMayson 043b3907fe
Extensions - Rust (#9015)
Co-authored-by: Pepijn Holster <pgaholster@gmail.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: LorenLuke <LukeLLL@aol.com>
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
2024-08-17 12:50:38 -03:00

29 lines
790 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: LorenLuke
* Calculates the muzzleVelocity change with advanced calculations.
*
* Arguments:
* 0: Initial Muzzle velocity; meters/second <NUMBER>
* 1: Temperature; degrees Celsius <NUMBER>
* 2: Atmospheric Density; kg/(meters^3) <NUMBER>
*
* Return Value:
* Adjusted Muzzle Velocity; Meters <NUMBER>
*
* Example:
* [200, 15, 1.225] call ace_artilleryTables_fnc_calculateMuzzleVelocity
*
* Public: No
*/
params ["_muzzleVelocity", "_temperature", "_airDensity"];
// Calculate air density
private _relativeDensity = _airDensity / 1.225;
private _newMuzzleVelocityCoefficient = (((_temperature + 273.13) / 288.13 - 1) / 40 + 1);
private _newMuzzleVelocity = _muzzleVelocity * _newMuzzleVelocityCoefficient;
_newMuzzleVelocity