mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
commit
5d2d13ec00
@ -2,7 +2,6 @@
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(calculateAirDensity);
|
||||
PREP(calculateAmmoTemperatureVelocityShift);
|
||||
PREP(calculateAtmosphericCorrection);
|
||||
PREP(calculateBarrelLengthVelocityShift);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Displays a wind info (colored arrow) in the top left corner of the screen
|
||||
* Calculates the air density
|
||||
*
|
||||
* Arguments:
|
||||
* 0: temperature - degrees celcius <NUMBER>
|
||||
|
@ -24,7 +24,7 @@ _pressure = _this select 2; // in hPa
|
||||
_relativeHumidity = _this select 3; // as ratio 0-1
|
||||
_atmosphereModel = _this select 4; // "ICAO" or "ASM"
|
||||
|
||||
_airDensity = [_temperature, _pressure, _relativeHumidity] call FUNC(calculateAirDensity);
|
||||
_airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity);
|
||||
|
||||
if (_atmosphereModel == "ICAO") then {
|
||||
(STD_AIR_DENSITY_ICAO / _airDensity) * _ballisticCoefficient
|
||||
|
@ -110,7 +110,7 @@ _stabilityFactor = 1.5;
|
||||
|
||||
if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then {
|
||||
_temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL _unit) select 2);
|
||||
_barometricPressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL _bullet) select 2)) / 7990) - 10 * overcast;
|
||||
_barometricPressure = ((getPosASL _bullet) select 2) call EFUNC(weather,calculateBarometricPressure);
|
||||
_stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor);
|
||||
};
|
||||
|
||||
@ -288,7 +288,7 @@ if (GVAR(AdvancedAirDragEnabled)) then {
|
||||
};
|
||||
|
||||
if (GVAR(AtmosphericDensitySimulationEnabled)) then {
|
||||
_pressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + (_bulletPosition select 2)) / 7990) - 10 * overcast;
|
||||
_pressure = (_bulletPosition select 2) call EFUNC(weather,calculateBarometricPressure);
|
||||
_temperature = GET_TEMPERATURE_AT_HEIGHT(_bulletPosition select 2);
|
||||
_humidity = EGVAR(weather,currentHumidity);
|
||||
_airDensity = STD_AIR_DENSITY_ICAO;
|
||||
@ -315,7 +315,7 @@ if (GVAR(AdvancedAirDragEnabled)) then {
|
||||
_bulletVelocity = _bulletVelocity vectorDiff _accel;
|
||||
} else {
|
||||
if (GVAR(AtmosphericDensitySimulationEnabled)) then {
|
||||
_pressureDeviation = 1013.25 * exp(-(EGVAR(weather,Altitude) + (_bulletPosition select 2)) / 7990) - 1013.25 - 10 * overcast;
|
||||
_pressureDeviation = (_bulletPosition select 2) call EFUNC(weather,calculateBarometricPressure) - 1013.25;
|
||||
_temperature = GET_TEMPERATURE_AT_HEIGHT(_bulletPosition select 2);
|
||||
_humidity = EGVAR(weather,currentHumidity);
|
||||
_airFriction = _airFriction + ((_temperature - 15) * 0.0000015 + _humidity * 0.0000040 + _pressureDeviation * -0.0000009);
|
||||
|
@ -1115,6 +1115,13 @@ class ATragMX_Display {
|
||||
idc=120060;
|
||||
y=0.265*safezoneH+safezoneY+0.520;
|
||||
};
|
||||
class TEXT_GUN_AMMO_DATA_ZERO_RANGE_METER_INDICATOR: TEXT_GUN_AMMO_DATA_BORE_HEIGHT {
|
||||
idc=120061;
|
||||
w=0.05;
|
||||
x=0.550*safezoneW+safezoneX+0.315;
|
||||
y=0.265*safezoneH+safezoneY+0.520;
|
||||
text="";
|
||||
};
|
||||
class TEXT_GUN_AMMO_DATA_DONE: TEXT_TARGET_SPEED_ASSIST_DONE {
|
||||
idc=12008;
|
||||
action=QUOTE(1 call FUNC(toggle_gun_ammo_data));
|
||||
@ -1327,6 +1334,13 @@ class ATragMX_Display {
|
||||
idc=140060;
|
||||
y=0.265*safezoneH+safezoneY+0.520;
|
||||
};
|
||||
class TEXT_TARGET_DATA_TARGET_RANGE_METER_INDICATOR: TEXT_TARGET_DATA_LATITUDE {
|
||||
idc=140061;
|
||||
w=0.05;
|
||||
x=0.550*safezoneW+safezoneX+0.315;
|
||||
y=0.265*safezoneH+safezoneY+0.520;
|
||||
text="";
|
||||
};
|
||||
class TEXT_TARGET_DATA_DONE: TEXT_TARGET_SPEED_ASSIST_DONE {
|
||||
idc=14008;
|
||||
action=QUOTE(1 call FUNC(toggle_target_data));
|
||||
|
@ -6,16 +6,16 @@ if ((profileNamespace getVariable ["ACE_ATragMX_profileNamespaceVersion", 0]) ==
|
||||
GVAR(gunList) = profileNamespace getVariable "ACE_ATragMX_gunList";
|
||||
} else {
|
||||
// Profile Name, Muzzle Velocity, Zero Range, Scope Base Angle, AirFriction, Bore Height, Scope Unit, Scope Click Unit, Scope Click Number, Maximum Elevation, Dialed Elevation, Dialed Windage, Mass, Bullet Diameter, Rifle Twist, BC, Drag Model, Atmosphere Model
|
||||
GVAR(gunList) = [["12.7x108mm" , 820, 100, 0.0659, -0.0008600, 3.81, 0, 2, 10, 120, 0, 0, 48.28, 12.7, 38.10, 0.630, 1, "ASM" ],
|
||||
GVAR(gunList) = [["12.7x108mm" , 820, 100, 0.0657, -0.0006400, 3.81, 0, 2, 10, 120, 0, 0, 48.28, 12.7, 38.10, 0.630, 1, "ASM" ],
|
||||
|
||||
["12.7x99mm AMAX" , 860, 100, 0.0612, -0.0008600, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 38.10, 1.050, 1, "ASM" ],
|
||||
["12.7x99mm" , 853, 100, 0.0623, -0.0008600, 3.81, 0, 2, 10, 120, 0, 0, 41.92, 12.7, 38.10, 0.670, 1, "ASM" ],
|
||||
["12.7x99mm AMAX" , 860, 100, 0.0612, -0.0003740, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 38.10, 1.050, 1, "ASM" ],
|
||||
["12.7x99mm" , 853, 100, 0.0623, -0.0006000, 3.81, 0, 2, 10, 120, 0, 0, 41.92, 12.7, 38.10, 0.670, 1, "ASM" ],
|
||||
|
||||
["12.7x54mm" , 300, 100, 0.3394, -0.0014000, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 24.13, 1.050, 1, "ASM" ],
|
||||
["12.7x54mm" , 300, 100, 0.3395, -0.0001400, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 24.13, 1.050, 1, "ASM" ],
|
||||
|
||||
[".408 Chey Tac" , 910, 100, 0.0569, -0.0004800, 3.81, 0, 2, 10, 120, 0, 0, 27.15, 10.4, 33.02, 0.970, 1, "ASM" ],
|
||||
[".408 Chey Tac" , 910, 100, 0.0571, -0.0003950, 3.81, 0, 2, 10, 120, 0, 0, 27.15, 10.4, 33.02, 0.970, 1, "ASM" ],
|
||||
|
||||
["9.3×64mm" , 870, 100, 0.0619, -0.0007500, 3.81, 0, 2, 10, 120, 0, 0, 14.90, 9.30, 35.56, 0.368, 1, "ASM" ],
|
||||
["9.3×64mm" , 870, 100, 0.0619, -0.0010600, 3.81, 0, 2, 10, 120, 0, 0, 14.90, 9.30, 35.56, 0.368, 1, "ASM" ],
|
||||
|
||||
[".338LM 250gr" , 880, 100, 0.0598, -0.0006060, 3.81, 0, 2, 10, 120, 0, 0, 16.20, 8.58, 25.40, 0.322, 7, "ICAO"],
|
||||
[".338LM 300gr" , 800, 100, 0.0677, -0.0005350, 3.81, 0, 2, 10, 120, 0, 0, 19.44, 8.58, 25.40, 0.381, 7, "ICAO"],
|
||||
|
@ -77,4 +77,4 @@ GVAR(rangeCardData) = [];
|
||||
|
||||
private ["_result"];
|
||||
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
|
||||
[_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true, _stabilityFactor, _twistDirection, _latitude] call FUNC(calculate_solution);
|
||||
[_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true, _stabilityFactor, _twistDirection, _latitude, _directionOfFire] call FUNC(calculate_solution);
|
||||
|
@ -35,6 +35,6 @@ _barometricPressure = 1013.25;
|
||||
_relativeHumidity = 0;
|
||||
|
||||
private ["_result"];
|
||||
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, [0, 0], 0, 0, 0, _zeroRange, _airFriction, 1, "ICAO", false, 1.5, 0, 0] call FUNC(calculate_solution);
|
||||
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, [0, 0], 0, 0, 0, _zeroRange, _airFriction, 1, "ICAO", false, 1.5, 0, 0, 0] call FUNC(calculate_solution);
|
||||
|
||||
_scopeBaseAngle + (_result select 0) / 60
|
||||
|
@ -43,7 +43,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_scopeBaseAngle", "_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_temperature", "_barometricPressure", "_relativeHumidity", "_simSteps", "_windSpeed1", "_windSpeed2", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange", "_drag", "_bc", "_dragModel", "_atmosphereModel", "_storeRangeCardData", "_stabilityFactor", "_twistDirection", "_latitude"];
|
||||
private ["_scopeBaseAngle", "_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_temperature", "_barometricPressure", "_relativeHumidity", "_simSteps", "_windSpeed1", "_windSpeed2", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange", "_drag", "_bc", "_dragModel", "_atmosphereModel", "_storeRangeCardData", "_stabilityFactor", "_twistDirection", "_latitude", "_directionOfFire"];
|
||||
_scopeBaseAngle = _this select 0;
|
||||
_bulletMass = _this select 1;
|
||||
_boreHeight = _this select 2;
|
||||
@ -66,6 +66,7 @@ _storeRangeCardData = _this select 17;
|
||||
_stabilityFactor = _this select 18;
|
||||
_twistDirection = _this select 19;
|
||||
_latitude = _this select 20;
|
||||
_directionOfFire = _this select 21;
|
||||
|
||||
private ["_bulletPos", "_bulletVelocity", "_bulletAccel", "_bulletSpeed", "_gravity", "_deltaT"];
|
||||
_bulletPos = [0, 0, 0];
|
||||
@ -114,6 +115,12 @@ _speedTotal = 0;
|
||||
_stepsTotal = 0;
|
||||
_speedAverage = 0;
|
||||
|
||||
private ["_eoetvoesMultiplier"];
|
||||
_eoetvoesMultiplier = 0;
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then {
|
||||
_eoetvoesMultiplier = 2 * (0.0000729 * _muzzleVelocity / -9.80665) * cos(_latitude) * sin(_directionOfFire);
|
||||
};
|
||||
|
||||
_TOF = 0;
|
||||
|
||||
_bulletPos set [0, 0];
|
||||
@ -169,16 +176,19 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do {
|
||||
_kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2));
|
||||
_kineticEnergy = _kineticEnergy * 0.737562149;
|
||||
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false])) then {
|
||||
if ((_bulletPos select 1) > 0) then {
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (_bulletPos select 1) > 0) then {
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false]) then {
|
||||
_horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage;
|
||||
_horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1));
|
||||
_windage1 = _windage1 + _horizontalCoriolis;
|
||||
_windage2 = _windage2 + _horizontalCoriolis;
|
||||
};
|
||||
};
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then {
|
||||
if ((_bulletPos select 1) > 0) then {
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then {
|
||||
_verticalDeflection = (_bulletPos select 2) * _eoetvoesMultiplier;
|
||||
_verticalCoriolis = - atan(_verticalDeflection / (_bulletPos select 1));
|
||||
_elevation = _elevation + _verticalCoriolis;
|
||||
};
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false]) then {
|
||||
_spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83;
|
||||
_spinDrift = - atan(_spinDeflection / (_bulletPos select 1));
|
||||
_windage1 = _windage1 + _spinDrift;
|
||||
@ -206,16 +216,19 @@ if (_targetRange != 0) then {
|
||||
_kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2));
|
||||
_kineticEnergy = _kineticEnergy * 0.737562149;
|
||||
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false])) then {
|
||||
if ((_bulletPos select 1) > 0) then {
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (_bulletPos select 1) > 0) then {
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false]) then {
|
||||
_horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage;
|
||||
_horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1));
|
||||
_windage1 = _windage1 + _horizontalCoriolis;
|
||||
_windage2 = _windage2 + _horizontalCoriolis;
|
||||
};
|
||||
};
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then {
|
||||
if ((_bulletPos select 1) > 0) then {
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then {
|
||||
_verticalDeflection = (_bulletPos select 2) * _eoetvoesMultiplier;
|
||||
_verticalCoriolis = - atan(_verticalDeflection / (_bulletPos select 1));
|
||||
_elevation = _elevation + _verticalCoriolis;
|
||||
};
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false]) then {
|
||||
_spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83;
|
||||
_spinDrift = - atan(_spinDeflection / (_bulletPos select 1));
|
||||
_windage1 = _windage1 + _spinDrift;
|
||||
|
@ -72,7 +72,7 @@ _targetRange = GVAR(targetRange) select GVAR(currentTarget);
|
||||
|
||||
private ["_result"];
|
||||
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
|
||||
[_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, false, _stabilityFactor, _twistDirection, _latitude] call FUNC(calculate_solution);
|
||||
[_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, false, _stabilityFactor, _twistDirection, _latitude, _directionOfFire] call FUNC(calculate_solution);
|
||||
|
||||
GVAR(elevationOutput) set [GVAR(currentTarget), _result select 0];
|
||||
GVAR(windage1Output) set [GVAR(currentTarget), (_result select 1) select 0];
|
||||
|
@ -4,7 +4,8 @@
|
||||
*
|
||||
* Arguments:
|
||||
* gunID <number>
|
||||
* update solution <BOOL>
|
||||
* restore workingMemory from gunList <BOOL>
|
||||
* update display <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
@ -16,23 +17,30 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_gunID", "_updateSolution"];
|
||||
_gunID = _this select 0;
|
||||
_updateSolution = _this select 1;
|
||||
private ["_gunID", "_restoreMemory", "_updateDisplay"];
|
||||
_gunID = _this select 0;
|
||||
_restoreMemory = _this select 1;
|
||||
_updateDisplay = _this select 2;
|
||||
|
||||
if (_gunID < 0 || _gunID > (count GVAR(gunList)) - 1) exitWith {};
|
||||
|
||||
GVAR(workingMemory) = +(GVAR(gunList) select _gunID);
|
||||
if (_restoreMemory) then {
|
||||
GVAR(workingMemory) = +(GVAR(gunList) select _gunID);
|
||||
};
|
||||
GVAR(currentGun) = _gunID;
|
||||
|
||||
lbSetCurSel [6000, GVAR(currentGun)];
|
||||
if (_updateDisplay) then {
|
||||
lbSetCurSel [6000, GVAR(currentGun)];
|
||||
};
|
||||
|
||||
GVAR(currentScopeUnit) = 0 max (GVAR(workingMemory) select 6) min 3;
|
||||
GVAR(currentScopeClickUnit) = 0 max (GVAR(workingMemory) select 7) min 2;
|
||||
GVAR(currentScopeClickNumber) = 1 max (GVAR(workingMemory) select 8) min 10;
|
||||
|
||||
[] call FUNC(update_gun);
|
||||
[] call FUNC(update_gun_ammo_data);
|
||||
if (_updateDisplay) then {
|
||||
[] call FUNC(update_gun);
|
||||
[] call FUNC(update_gun_ammo_data);
|
||||
};
|
||||
|
||||
GVAR(elevationOutput) set [GVAR(currentTarget), 0];
|
||||
GVAR(windage1Output) set [GVAR(currentTarget), 0];
|
||||
@ -41,6 +49,6 @@ GVAR(leadOutput) set [GVAR(currentTarget), 0];
|
||||
GVAR(tofOutput) set [GVAR(currentTarget), 0];
|
||||
GVAR(velocityOutput) set [GVAR(currentTarget), 0];
|
||||
|
||||
if (_updateSolution) then {
|
||||
if (_updateDisplay) then {
|
||||
[] call FUNC(calculate_target_solution);
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ GVAR(showTargetRangeAssist) call FUNC(show_target_range_assist);
|
||||
GVAR(showTargetSpeedAssist) call FUNC(show_target_speed_assist);
|
||||
GVAR(showTargetSpeedAssistTimer) call FUNC(show_target_speed_assist_timer);
|
||||
|
||||
[GVAR(currentGun), false] call FUNC(change_gun);
|
||||
[GVAR(currentGun), false, true] call FUNC(change_gun);
|
||||
|
||||
{
|
||||
lbAdd [6000, _x select 0];
|
||||
|
@ -17,4 +17,4 @@
|
||||
|
||||
if (!(GVAR(showMainPage) || GVAR(showGunList))) exitWith {};
|
||||
|
||||
[(GVAR(currentGun) + (count GVAR(gunList)) + _this) % (count GVAR(gunList)), true] call FUNC(change_gun);
|
||||
[(GVAR(currentGun) + (count GVAR(gunList)) + _this) % (count GVAR(gunList)), true, true] call FUNC(change_gun);
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(currentUnit) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentUnit", 2]) min 2;
|
||||
GVAR(currentGun) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentGun", 0]);
|
||||
[(profileNamespace getVariable ["ACE_ATragMX_currentGun", 0]), true, false] call FUNC(change_gun);
|
||||
GVAR(currentTarget) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentTarget", 0]) min 3;
|
||||
GVAR(currentScopeUnit) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentScopeUnit", 0]) min 3;
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
GVAR(showGunAmmoData) = _this;
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [12000, 120000, 12001, 120010, 12002, 120020, 12003, 120030, 12004, 120040, 12005, 120050, 12006, 120060, 12007, 12008, 12009, 12010, 12011];
|
||||
{ctrlShow [_x, _this]} forEach [12000, 120000, 12001, 120010, 12002, 120020, 12003, 120030, 12004, 120040, 12005, 120050, 12006, 120060, 120061, 12007, 12008, 12009, 12010, 12011];
|
||||
|
||||
if (_this) then {
|
||||
[] call FUNC(update_gun_ammo_data);
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
GVAR(showTargetData) = _this;
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [14000, 140000, 14001, 140010, 14002, 141020, 140020, 141021, 140021, 14003, 140030, 14004, 140040, 141040, 141041, 140041, 14005, 140050, 14006, 140060, 14007, 14008, 14009, 14010, 14011];
|
||||
{ctrlShow [_x, _this]} forEach [14000, 140000, 14001, 140010, 14002, 141020, 140020, 141021, 140021, 14003, 140030, 14004, 140040, 141040, 141041, 140041, 14005, 140050, 14006, 140060, 140061, 14007, 14008, 14009, 14010, 14011];
|
||||
|
||||
if (_this) then {
|
||||
[] call FUNC(update_target_data);
|
||||
|
@ -20,7 +20,7 @@ if (ctrlVisible 6000) then {
|
||||
true call FUNC(show_main_page);
|
||||
|
||||
if (_this) then {
|
||||
[lbCurSel 6000, true] call FUNC(change_gun);
|
||||
[lbCurSel 6000, true, true] call FUNC(change_gun);
|
||||
};
|
||||
} else {
|
||||
false call FUNC(show_main_page);
|
||||
|
@ -47,10 +47,15 @@ if (GVAR(currentUnit) != 2) then {
|
||||
} else {
|
||||
ctrlSetText [120050, Str(Round(GVAR(workingMemory) select 1))];
|
||||
};
|
||||
if (GVAR(currentUnit) == 2) then {
|
||||
ctrlSetText [120060, Str(Round(GVAR(workingMemory) select 2))];
|
||||
} else {
|
||||
if (GVAR(currentUnit) == 1) then {
|
||||
ctrlSetText [120060, Str(Round((GVAR(workingMemory) select 2) * 1.0936133))];
|
||||
} else {
|
||||
ctrlSetText [120060, Str(Round(GVAR(workingMemory) select 2))];
|
||||
};
|
||||
if (GVAR(currentUnit) == 0) then {
|
||||
ctrlSetText [120061, "*"];
|
||||
} else {
|
||||
ctrlSetText [120061, ""];
|
||||
};
|
||||
|
||||
if (GVAR(currentUnit) == 2) then {
|
||||
|
@ -37,6 +37,11 @@ if (GVAR(currentUnit) == 1) then {
|
||||
} else {
|
||||
ctrlSetText [140060, Str(Round((GVAR(targetRange) select GVAR(currentTarget))))];
|
||||
};
|
||||
if (GVAR(currentUnit) == 0) then {
|
||||
ctrlSetText [140061, "*"];
|
||||
} else {
|
||||
ctrlSetText [140061, ""];
|
||||
};
|
||||
|
||||
if (GVAR(currentUnit) == 2) then {
|
||||
ctrlSetText [14002, "Wind Speed (m/s)"];
|
||||
|
@ -44,7 +44,7 @@ _barometricPressure = GVAR(barometricPressure);
|
||||
_relativeHumidity = GVAR(relativeHumidity);
|
||||
|
||||
private ["_result"];
|
||||
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, [0, 0], 0, 0, 0, _zeroRange, _bc, _dragModel, _atmosphereModel, false, 1.5, 0, 0] call FUNC(calculate_solution);
|
||||
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, [0, 0], 0, 0, 0, _zeroRange, _bc, _dragModel, _atmosphereModel, false, 1.5, 0, 0, 0] call FUNC(calculate_solution);
|
||||
|
||||
GVAR(workingMemory) set [2, _zeroRange];
|
||||
GVAR(workingMemory) set [3, _scopeBaseAngle + (_result select 0) / 60];
|
||||
|
@ -11,4 +11,4 @@
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
#define ATRAGMX_PROFILE_NAMESPACE_VERSION 1.1
|
||||
#define ATRAGMX_PROFILE_NAMESPACE_VERSION 1.2
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Edited with tabler. -->
|
||||
<Project name="ACE">
|
||||
<Package name="Attach">
|
||||
<Key ID="STR_ACE_Attach_AttachDetach">
|
||||
@ -205,4 +204,4 @@
|
||||
<Russian>%1<br/>отсоединен(-а)</Russian>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Edited with tabler. -->
|
||||
<Project name="ACE">
|
||||
<Package name="Captives">
|
||||
<Key ID="STR_ACE_Captives_SetCaptive">
|
||||
@ -189,4 +188,4 @@
|
||||
<Italian>Niente selezionato</Italian>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Edited with tabler. -->
|
||||
<Project name="ACE">
|
||||
<Package name="Dragging">
|
||||
<Key ID="STR_ACE_Dragging_Drag">
|
||||
@ -51,4 +50,4 @@
|
||||
<Russian>Нести</Russian>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Edited with tabler. -->
|
||||
<Project name="ACE">
|
||||
<Package name="Explosives">
|
||||
<Key ID="STR_ACE_Explosives_Menu">
|
||||
@ -503,4 +502,4 @@
|
||||
<Italian>Raccogli</Italian>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -49,4 +49,7 @@ GVAR(expandedTime) = diag_tickTime;
|
||||
GVAR(iconCtrls) = [];
|
||||
GVAR(iconCount) = 0;
|
||||
|
||||
GVAR(foundActions) = [];
|
||||
GVAR(lastTimeSearchedActions) = -1000;
|
||||
|
||||
ADDON = true;
|
||||
|
@ -29,6 +29,7 @@ if (_menuType == 0) then {
|
||||
};
|
||||
GVAR(keyDownTime) = diag_tickTime;
|
||||
GVAR(openedMenuType) = _menuType;
|
||||
GVAR(lastTimeSearchedActions) = -1000;
|
||||
|
||||
GVAR(useCursorMenu) = (vehicle ACE_player != ACE_player) ||
|
||||
visibleMap ||
|
||||
|
@ -24,6 +24,9 @@ _fnc_renderNearbyActions = {
|
||||
_cameraPos = (positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL);
|
||||
_cameraDir = ((positionCameraToWorld [0, 0, 1]) call EFUNC(common,positionToASL)) vectorDiff _cameraPos;
|
||||
|
||||
GVAR(foundActions) = [];
|
||||
GVAR(lastTimeSearchedActions) = diag_tickTime;
|
||||
|
||||
_numInteractObjects = 0;
|
||||
_nearestObjects = nearestObjects [ACE_player, ["All"], 13];
|
||||
{
|
||||
@ -46,6 +49,7 @@ _fnc_renderNearbyActions = {
|
||||
_action = _x;
|
||||
if ([_target, _action] call FUNC(renderBaseMenu)) then {
|
||||
_numInteractions = _numInteractions + 1;
|
||||
GVAR(foundActions) pushBack [_target, _action];
|
||||
};
|
||||
};
|
||||
} forEach GVAR(objectActionList);
|
||||
@ -57,6 +61,7 @@ _fnc_renderNearbyActions = {
|
||||
// Try to render the menu
|
||||
if ([_target, _action] call FUNC(renderBaseMenu)) then {
|
||||
_numInteractions = _numInteractions + 1;
|
||||
GVAR(foundActions) pushBack [_target, _action];
|
||||
};
|
||||
} forEach _classActions;
|
||||
|
||||
@ -71,7 +76,11 @@ _fnc_renderNearbyActions = {
|
||||
} forEach _nearestObjects;
|
||||
};
|
||||
|
||||
|
||||
_fnc_renderLastFrameActions = {
|
||||
{
|
||||
_x call FUNC(renderBaseMenu);
|
||||
} forEach GVAR(foundActions);
|
||||
};
|
||||
|
||||
_fnc_renderSelfActions = {
|
||||
_target = _this;
|
||||
@ -109,7 +118,13 @@ _fnc_renderSelfActions = {
|
||||
if (GVAR(openedMenuType) == 0) then {
|
||||
|
||||
if (vehicle ACE_player == ACE_player) then {
|
||||
call _fnc_renderNearbyActions;
|
||||
if (diag_tickTime > GVAR(lastTimeSearchedActions) + 0.20) then {
|
||||
// Once every 0.2 secs, collect nearby objects active and visible action points and render them
|
||||
call _fnc_renderNearbyActions;
|
||||
} else {
|
||||
// The rest of the frames just draw the same action points rendered the last frame
|
||||
call _fnc_renderLastFrameActions;
|
||||
};
|
||||
} else {
|
||||
(vehicle ACE_player) call _fnc_renderSelfActions;
|
||||
};
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Edited with tabler. -->
|
||||
<Project name="ACE">
|
||||
<Package name="Interaction">
|
||||
<Key ID="STR_ACE_Interaction_MainAction">
|
||||
@ -735,4 +734,4 @@
|
||||
<Italian>Passeggeri</Italian>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -19,7 +19,7 @@ private ["_playerDir", "_windSpeed", "_windDir", "_crosswind", "_headwind", "_hu
|
||||
if (isNil QGVAR(MIN) || isNil QGVAR(MAX)) then {
|
||||
_temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL ACE_player) select 2);
|
||||
_humidity = EGVAR(weather,currentHumidity);
|
||||
_barometricPressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2)) / 7990) - 10 * overcast;
|
||||
_barometricPressure = ((getPosASL ACE_player) select 2) call EFUNC(weather,calculateBarometricPressure);
|
||||
_altitude = EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2);
|
||||
GVAR(MIN) = [0, 0, 0, 0, _temperature, _humidity, _barometricPressure, _altitude];
|
||||
GVAR(MAX) = [0, 0, 0, 0, _temperature, _humidity, _barometricPressure, _altitude];
|
||||
@ -82,7 +82,7 @@ GVAR(MAX) set [5, _humidity max (GVAR(MAX) select 5)];
|
||||
GVAR(TOTAL) set [5, (GVAR(TOTAL) select 5) + _humidity];
|
||||
|
||||
// BARO
|
||||
_barometricPressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2)) / 7990) - 10 * overcast;
|
||||
_barometricPressure = ((getPosASL ACE_player) select 2) call EFUNC(weather,calculateBarometricPressure);
|
||||
GVAR(MIN) set [6, (GVAR(MIN) select 6) min _barometricPressure];
|
||||
GVAR(MAX) set [6, _barometricPressure max (GVAR(MAX) select 6)];
|
||||
GVAR(TOTAL) set [6, (GVAR(TOTAL) select 6) + _barometricPressure];
|
||||
|
@ -174,7 +174,7 @@ switch (GVAR(Menu)) do {
|
||||
};
|
||||
case 6: { // BARO
|
||||
if (!GVAR(MinAvgMax)) then {
|
||||
_textCenterBig = Str(round((1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL ACE_player) select 2)) / 7990) - 10 * overcast) * 10) / 10);
|
||||
_textCenterBig = Str(round((((getPosASL ACE_player) select 2) call EFUNC(weather,calculateBarometricPressure)) * 10) / 10);
|
||||
} else {
|
||||
_textCenterLine1Left = "Min";
|
||||
_textCenterLine2Left = "Avg";
|
||||
|
@ -79,7 +79,11 @@ class ACE_Settings {
|
||||
displayName = "$STR_ACE_Medical_litterSimulationDetail";
|
||||
description = "$STR_ACE_Medical_litterSimulationDetail_Desc";
|
||||
typeName = "SCALAR";
|
||||
value = 500;
|
||||
|
||||
value = 3;
|
||||
values[] = {"Off", "Low", "Medium", "High", "Ultra"};
|
||||
_values[] = { 0, 50, 100, 1000, 5000 };
|
||||
|
||||
isClientSettable = 1;
|
||||
};
|
||||
class GVAR(litterCleanUpDelay) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
if(!hasInterface) exitWith { false };
|
||||
|
||||
PARAMS_3(_litterClass,_position,_direction);
|
||||
private["_litterObject"];
|
||||
private["_litterObject", "_maxLitterCount"];
|
||||
|
||||
if (isNil QGVAR(allCreatedLitter)) then {
|
||||
GVAR(allCreatedLitter) = [];
|
||||
@ -14,7 +14,8 @@ if (isNil QGVAR(allCreatedLitter)) then {
|
||||
_litterObject = _litterClass createVehicleLocal _position;
|
||||
_litterObject setDir _direction;
|
||||
|
||||
if((count GVAR(allCreatedLitter)) > GVAR(litterSimulationDetail) ) then {
|
||||
_maxLitterCount = getArray (configFile >> "ACE_Settings" >> QGVAR(litterSimulationDetail) >> "_values") select GVAR(litterSimulationDetail);
|
||||
if((count GVAR(allCreatedLitter)) > _maxLitterCount ) then {
|
||||
// gank the first litter object, and spawn ours.
|
||||
private["_oldLitter"];
|
||||
_oldLitter = GVAR(allCreatedLitter) deleteAt 0;
|
||||
|
@ -477,7 +477,7 @@
|
||||
<English>Minor</English>
|
||||
<German>Gering</German>
|
||||
<Spanish>Menor</Spanish>
|
||||
<Russian>Легкие ранения</Russian>
|
||||
<Russian>Несрочная помощь</Russian>
|
||||
<Polish>Normalny</Polish>
|
||||
<French>Léger</French>
|
||||
<Czech>Minimální</Czech>
|
||||
@ -487,7 +487,7 @@
|
||||
<Key ID="STR_ACE_MEDICAL_TRIAGE_STATUS_DELAYED">
|
||||
<English>Delayed</English>
|
||||
<Spanish>Retrasado</Spanish>
|
||||
<Russian>Средние ранения</Russian>
|
||||
<Russian>Срочная помощь</Russian>
|
||||
<Polish>Opóźniony</Polish>
|
||||
<French>Différé</French>
|
||||
<German>Verzögert</German>
|
||||
@ -498,7 +498,7 @@
|
||||
<Key ID="STR_ACE_MEDICAL_TRIAGE_STATUS_IMMEDIATE">
|
||||
<English>Immediate</English>
|
||||
<Spanish>Inmediato</Spanish>
|
||||
<Russian>Тяжелые ранения</Russian>
|
||||
<Russian>Неотложная помощь</Russian>
|
||||
<Polish>Natychmiastowy</Polish>
|
||||
<French>Urgence Immédiate</French>
|
||||
<German>Sofort</German>
|
||||
@ -1529,7 +1529,7 @@
|
||||
<English>Heavily wounded</English>
|
||||
<German>Schwer verwundet:</German>
|
||||
<Polish>Ciężko ranny</Polish>
|
||||
<Russian>Сильные ранения</Russian>
|
||||
<Russian>Тяжелые ранения</Russian>
|
||||
<Italian>Gravemente ferito</Italian>
|
||||
<Spanish>Gravemente herido</Spanish>
|
||||
<French>Lourdement blessé</French>
|
||||
@ -1610,7 +1610,7 @@
|
||||
<English>Pain Effect Type</English>
|
||||
<German>Schmerzeffekt-Typ</German>
|
||||
<Polish>Rodzaj efektu bólu</Polish>
|
||||
<Russian>Эффект боли</Russian>
|
||||
<Russian>Визуальный эффект боли</Russian>
|
||||
<Italian>Pain Effect Type</Italian>
|
||||
<Spanish>Tipo de efecto de dolor</Spanish>
|
||||
<French>Type d'effet de douleur</French>
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Edited with tabler. -->
|
||||
<Project name="ACE">
|
||||
<Package name="microdagr">
|
||||
<Key ID="STR_ACE_microdagr_itemName">
|
||||
@ -280,4 +279,4 @@
|
||||
<Italian>Chiudi MicroDAGR</Italian>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -22,7 +22,7 @@
|
||||
<Czech>Zobrazit jména hráčů</Czech>
|
||||
<Portuguese>Mostrar nomes de jogadores</Portuguese>
|
||||
<Italian>Mostra i nomi dei giocatori</Italian>
|
||||
<Russian>Показать имена игроков</Russian>
|
||||
<Russian>Показывать имена игроков (включить имена)</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_NameTags_ShowPlayerNamesOnlyOnCursor">
|
||||
<English>Show player name only on cursor (requires player names)</English>
|
||||
@ -34,7 +34,7 @@
|
||||
<Italian>Mostra i nomi solo se puntati (richiede mostra nomi abilitato)</Italian>
|
||||
<Portuguese>Mostrar nome de jogador somente no cursor (requer nome de jogadores)</Portuguese>
|
||||
<Hungarian>Játékosok nevének mutatása csak a kurzoron (a nevek mutatása szükséges)</Hungarian>
|
||||
<Russian>Показать имена игроков только под курсором (требует имен игроков)</Russian>
|
||||
<Russian>Показать имена игроков только под курсором (при включенных именах)</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_NameTags_ShowPlayerNamesOnlyOnKeyPress">
|
||||
<English>Show player name only on keypress (requires player names)</English>
|
||||
@ -44,7 +44,7 @@
|
||||
<Czech>Zobrazit jména hráčů jen na klávesu (vyžaduje jména hráčů)</Czech>
|
||||
<Polish>Pokaż imiona graczy tylko po przytrzymaniu klawisza (wymagana opcja Pokaż imiona graczy)</Polish>
|
||||
<Hungarian>Játékosnevek mutatása csak gombnyomásra (a nevek mutatása szükséges)</Hungarian>
|
||||
<Russian>Показать имена игроков только по нажатию клавиши (требует имен игроков)</Russian>
|
||||
<Russian>Показать имена игроков только по нажатию клавиши (при включенных именах)</Russian>
|
||||
<Italian>Mostra i nomi solo se si preme il tasto (richiede mostra nomi abilitato)</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_NameTags_ShowPlayerRanks">
|
||||
@ -57,7 +57,7 @@
|
||||
<Italian>Mostra i gradi (richiede mostra nomi abilitato)</Italian>
|
||||
<Portuguese>Mostrar patente de jogadores (requer nome de jogadores)</Portuguese>
|
||||
<Hungarian>Játékosok rendfokozatának mutatása (a nevek mutatása szükséges)</Hungarian>
|
||||
<Russian>Показывать звания игроков (требует имен игроков)</Russian>
|
||||
<Russian>Показывать звания игроков (при вкл. именах)</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_NameTags_ShowVehicleCrewInfo">
|
||||
<English>Show vehicle crew info</English>
|
||||
@ -74,7 +74,7 @@
|
||||
<English>Show name tags for AI units</English>
|
||||
<German>Zeige Namen für KI Einheiten</German>
|
||||
<Spanish>Mostrar etiquetas de nombre para unidades IA </Spanish>
|
||||
<Russian>Показывать именые метки ИИ</Russian>
|
||||
<Russian>Показывать имена ботов</Russian>
|
||||
<Czech>Zobrazit jména AI</Czech>
|
||||
<Polish>Wyświetl imiona jednostek AI</Polish>
|
||||
<French>Afficher les noms des IA</French>
|
||||
@ -85,7 +85,7 @@
|
||||
<English>Show SoundWaves (requires player names)</English>
|
||||
<German>Zeigen Schallwellen (benötigt Spielernamen)</German>
|
||||
<Spanish>Mostrar onda sonora (requiere Mostrar nombres de jugadores)</Spanish>
|
||||
<Russian>Показывать звуковые волны (требует имен игроков)</Russian>
|
||||
<Russian>Индикатор разговора (при вкл. именах)</Russian>
|
||||
<Czech>Zobrazit SoundWaves (vyžaduje jména hráčů)</Czech>
|
||||
<Polish>Pokaż fale dźwiękowe (wymagana opcja Pokaż imiona graczy)</Polish>
|
||||
<French>Afficher "qui parle" (si noms affichés)</French>
|
||||
|
@ -1,6 +1,36 @@
|
||||
//XEH_postInit.sqf
|
||||
//#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
// Rain variables
|
||||
GVAR(enableRain) = true;
|
||||
GVAR(rain_next_period) = -1;
|
||||
GVAR(rain_period_count) = 0;
|
||||
GVAR(rain_initial_rain) = 0;
|
||||
if(overcast >= 0.7) then {
|
||||
GVAR(rain_initial_rain) = (random ((overcast-0.7)/0.3));
|
||||
};
|
||||
GVAR(current_rain) = GVAR(rain_initial_rain);
|
||||
GVAR(rain_current_range) = -1+(random 2);
|
||||
GVAR(overcast_multiplier) = 1;
|
||||
|
||||
// Wind Variables
|
||||
ACE_wind = [0, 0, 0];
|
||||
GVAR(wind_initial_dir) = (random 360);
|
||||
GVAR(wind_initial_speed) = (overcast*5)+(random (overcast*5)) max 1;
|
||||
GVAR(wind_mean_speed) = GVAR(wind_initial_speed);
|
||||
GVAR(wind_mean_dir) = GVAR(wind_initial_dir);
|
||||
GVAR(wind_current_speed) = GVAR(wind_initial_speed);
|
||||
GVAR(wind_current_dir) = GVAR(wind_initial_dir);
|
||||
GVAR(wind_current_range_speed) = -1+(random 2);
|
||||
GVAR(wind_current_range_dir) = -1+(random 2);
|
||||
GVAR(wind_next_period) = -1; //ceil((2+random(5))/(GVAR(overcast_multiplier)/10));
|
||||
GVAR(wind_next_major_period) = -1;
|
||||
GVAR(wind_period_count) = 0;
|
||||
GVAR(wind_major_period_count) = 0;
|
||||
GVAR(wind_total_time) = 0;
|
||||
GVAR(wind_period_start_time) = time;
|
||||
|
||||
call FUNC(getMapData);
|
||||
|
||||
"ACE_WIND_PARAMS" addPublicVariableEventHandler { GVAR(wind_period_start_time) = time; };
|
||||
"ACE_RAIN_PARAMS" addPublicVariableEventHandler { GVAR(rain_period_start_time) = time; };
|
||||
"ACE_MISC_PARAMS" addPublicVariableEventHandler {
|
||||
@ -22,66 +52,9 @@
|
||||
{false},
|
||||
[37, [true, false, false]], false, 0] call CBA_fnc_addKeybind; // (SHIFT + K)
|
||||
|
||||
// Update Wind
|
||||
simulWeatherSync;
|
||||
_fnc_updateWind = {
|
||||
ACE_wind = [] call FUNC(getWind);
|
||||
setWind [ACE_wind select 0, ACE_wind select 1, true];
|
||||
2 setGusts 0;
|
||||
|
||||
// Set waves: 0 when no wind, 1 when wind >= 16 m/s
|
||||
1 setWaves (((vectorMagnitude ACE_wind) / 16.0) min 1.0);
|
||||
|
||||
//systemChat format ["w:%1 %2,ACE_w:%1 %2, w", [wind select 0, wind select 1, ACE_wind select 0, ACE_wind select 1]];
|
||||
};
|
||||
[_fnc_updateWind, 1, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
|
||||
// Update Rain
|
||||
_fnc_updateRain = {
|
||||
private ["_oldStrength","_rainStrength","_transitionTime","_periodPosition","_periodPercent"];
|
||||
if(GVAR(enableRain)) then {
|
||||
if(!isNil "ACE_RAIN_PARAMS" && {!isNil QGVAR(rain_period_start_time)}) then {
|
||||
_oldStrength = ACE_RAIN_PARAMS select 0;
|
||||
_rainStrength = ACE_RAIN_PARAMS select 1;
|
||||
_transitionTime = ACE_RAIN_PARAMS select 2;
|
||||
_periodPosition = (time - GVAR(rain_period_start_time)) min _transitionTime;
|
||||
_periodPercent = (_periodPosition/_transitionTime) min 1;
|
||||
|
||||
0 setRain ((_periodPercent*(_rainStrength-_oldStrength))+_oldStrength);
|
||||
};
|
||||
};
|
||||
};
|
||||
[_fnc_updateRain, 2, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
|
||||
// Update Temperature
|
||||
_fnc_updateTemperature = {
|
||||
private ["_time","_month","_hourlyCoef","_avgTemperature","_pS1","_pS2"];
|
||||
_time = daytime;
|
||||
_month = date select 1;
|
||||
|
||||
// Temperature
|
||||
_hourlyCoef = -0.5 * sin(360 * ((3 + (date select 3))/24 + (date select 4)/1440));
|
||||
|
||||
GVAR(currentTemperature) = (GVAR(TempDay) select (_month - 1)) * (1 - _hourlyCoef) + (GVAR(TempNight) select (_month - 1)) * _hourlyCoef;
|
||||
GVAR(currentTemperature) = GVAR(currentTemperature) - 2 * humidity - 4 * overcast;
|
||||
GVAR(currentTemperature) = round(GVAR(currentTemperature) * 10) / 10;
|
||||
|
||||
// Humidity
|
||||
GVAR(currentHumidity) = (GVAR(Humidity) select _month) / 100;
|
||||
|
||||
if (rain > 0 && overcast > 0.7) then {
|
||||
GVAR(currentHumidity) = 1;
|
||||
} else {
|
||||
_avgTemperature = ((GVAR(TempDay) select (_month - 1)) + (GVAR(TempNight) select (_month - 1))) / 2;
|
||||
_pS1 = 6.112 * exp((17.62 * _avgTemperature) / (243.12 + _avgTemperature));
|
||||
_PS2 = 6.112 * exp((17.62 * GVAR(currentTemperature)) / (243.12 + GVAR(currentTemperature)));
|
||||
GVAR(currentHumidity) = GVAR(currentHumidity) * _PS1 / _PS2;
|
||||
};
|
||||
GVAR(currentHumidity) = 0 max GVAR(currentHumidity) min 1;
|
||||
|
||||
// @todo: take altitude and humidity into account
|
||||
GVAR(currentRelativeDensity) = (273.15 + 20) / (273.15 + GVAR(currentTemperature));
|
||||
};
|
||||
[_fnc_updateTemperature, 20, []] call CBA_fnc_addPerFrameHandler;
|
||||
[FUNC(updateTemperature), 20, []] call CBA_fnc_addPerFrameHandler;
|
||||
[FUNC(updateHumidity), 20, []] call CBA_fnc_addPerFrameHandler;
|
||||
[FUNC(updateWind), 1, []] call CBA_fnc_addPerFrameHandler;
|
||||
[FUNC(updateRain), 2, []] call CBA_fnc_addPerFrameHandler;
|
@ -2,44 +2,16 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
LOG(MSG_INIT);
|
||||
|
||||
PREP(calculateAirDensity);
|
||||
PREP(calculateBarometricPressure);
|
||||
PREP(displayWindInfo);
|
||||
PREP(getMapData);
|
||||
PREP(getWind);
|
||||
PREP(serverController);
|
||||
|
||||
|
||||
// Rain variables
|
||||
GVAR(enableRain) = true;
|
||||
GVAR(rain_next_period) = -1;
|
||||
GVAR(rain_period_count) = 0;
|
||||
GVAR(rain_initial_rain) = 0;
|
||||
if(overcast >= 0.7) then {
|
||||
GVAR(rain_initial_rain) = (random ((overcast-0.7)/0.3));
|
||||
};
|
||||
GVAR(current_rain) = GVAR(rain_initial_rain);
|
||||
GVAR(rain_current_range) = -1+(random 2);
|
||||
GVAR(overcast_multiplier) = 1;
|
||||
|
||||
// Wind Variables
|
||||
ACE_wind = [0, 0, 0];
|
||||
GVAR(wind_initial_dir) = (random 360);
|
||||
GVAR(wind_initial_speed) = (overcast*5)+(random (overcast*5)) max 1;
|
||||
GVAR(wind_mean_speed) = GVAR(wind_initial_speed);
|
||||
GVAR(wind_mean_dir) = GVAR(wind_initial_dir);
|
||||
GVAR(wind_current_speed) = GVAR(wind_initial_speed);
|
||||
GVAR(wind_current_dir) = GVAR(wind_initial_dir);
|
||||
GVAR(wind_current_range_speed) = -1+(random 2);
|
||||
GVAR(wind_current_range_dir) = -1+(random 2);
|
||||
GVAR(wind_next_period) = -1; //ceil((2+random(5))/(GVAR(overcast_multiplier)/10));
|
||||
GVAR(wind_next_major_period) = -1;
|
||||
GVAR(wind_period_count) = 0;
|
||||
GVAR(wind_major_period_count) = 0;
|
||||
GVAR(wind_total_time) = 0;
|
||||
GVAR(wind_period_start_time) = time;
|
||||
|
||||
// Init weather variables, in case they are needed before postInit
|
||||
call FUNC(getMapData);
|
||||
PREP(updateHumidity);
|
||||
PREP(updateRain);
|
||||
PREP(updateTemperature);
|
||||
PREP(updateWind);
|
||||
|
||||
ADDON = true;
|
||||
|
36
addons/weather/functions/fnc_calculateAirDensity.sqf
Normal file
36
addons/weather/functions/fnc_calculateAirDensity.sqf
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the air density
|
||||
*
|
||||
* Arguments:
|
||||
* 0: temperature - degrees celcius <NUMBER>
|
||||
* 1: pressure - hPa <NUMBER>
|
||||
* 2: relativeHumidity - value between 0.0 and 1.0 <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: density of air - kg * m^(-3) <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_temperature", "_pressure", "_relativeHumidity"];
|
||||
_temperature = _this select 0; // in C
|
||||
_pressure = _this select 1; // in hPa
|
||||
_relativeHumidity = _this select 2; // as ratio 0-1
|
||||
|
||||
_pressure = _pressure * 100;
|
||||
|
||||
if (_relativeHumidity > 0) then {
|
||||
private ["_pSat", "_vaporPressure", "_partialPressure"];
|
||||
// Saturation vapor pressure calculated according to: http://wahiduddin.net/calc/density_algorithms.htm
|
||||
_pSat = 6.1078 * 10 ^ ((7.5 * _temperature) / (_temperature + 237.3));
|
||||
_vaporPressure = _relativeHumidity * _pSat;
|
||||
_partialPressure = _pressure - _vaporPressure;
|
||||
|
||||
(_partialPressure * DRY_AIR_MOLAR_MASS + _vaporPressure * WATER_VAPOR_MOLAR_MASS) / (UNIVERSAL_GAS_CONSTANT * KELVIN(_temperature))
|
||||
} else {
|
||||
_pressure / (SPECIFIC_GAS_CONSTANT_DRY_AIR * KELVIN(_temperature))
|
||||
};
|
20
addons/weather/functions/fnc_calculateBarometricPressure.sqf
Normal file
20
addons/weather/functions/fnc_calculateBarometricPressure.sqf
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the barometric pressure based on altitude and weather
|
||||
*
|
||||
* Arguments:
|
||||
* 0: altitude - meters <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: barometric pressure - hPA <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_altitude"];
|
||||
_altitude = _this;
|
||||
|
||||
(1013.25 * exp(-(GVAR(Altitude) + _altitude) / 7990) - 10 * overcast)
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Displays a wind info (colored arrow) in the top left corner of the screen
|
||||
*
|
||||
* Argument:
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Author: Ruthberg, esteldunedain
|
||||
*
|
||||
* Get the weather data for the current map
|
||||
*
|
||||
* Argument:
|
||||
@ -109,3 +110,6 @@ if (worldName in ["Imrali"]) exitWith {
|
||||
GVAR(TempDay) = [1, 3, 9, 14, 19, 23, 25, 24, 21, 13, 7, 2];
|
||||
GVAR(TempNight) = [-4, -3, 0, 4, 9, 12, 14, 14, 10, 6, 2, -2];
|
||||
GVAR(Humidity) = [82, 80, 78, 70, 71, 72, 70, 73, 78, 80, 83, 82];
|
||||
|
||||
GVAR(currentTemperature) = 20;
|
||||
GVAR(currentHumidity) = 0.5;
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Author: ACE2 Team
|
||||
*
|
||||
* Calculate current wind locally from the data broadcasted by the server
|
||||
*
|
||||
* Argument:
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Author: ACE2 Team, esteldunedain
|
||||
*
|
||||
* Calculate the wind and rain evolution on the server. Broadcast the current and next values to the clients
|
||||
*
|
||||
* Argument:
|
||||
|
28
addons/weather/functions/fnc_updateHumidity.sqf
Normal file
28
addons/weather/functions/fnc_updateHumidity.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Author: ACE2 Team
|
||||
*
|
||||
* Updates GVAR(currentHumidity) based on
|
||||
*
|
||||
* Argument:
|
||||
* Nothing
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_month", "_avgTemperature", "_pS1", "_pS2"];
|
||||
_month = date select 1;
|
||||
|
||||
GVAR(currentHumidity) = (GVAR(Humidity) select _month) / 100;
|
||||
|
||||
if (rain > 0 && overcast > 0.7) then {
|
||||
GVAR(currentHumidity) = 1;
|
||||
} else {
|
||||
_avgTemperature = ((GVAR(TempDay) select (_month - 1)) + (GVAR(TempNight) select (_month - 1))) / 2;
|
||||
_pS1 = 6.112 * exp((17.62 * _avgTemperature) / (243.12 + _avgTemperature));
|
||||
_PS2 = 6.112 * exp((17.62 * GVAR(currentTemperature)) / (243.12 + GVAR(currentTemperature)));
|
||||
GVAR(currentHumidity) = GVAR(currentHumidity) * _PS1 / _PS2;
|
||||
};
|
||||
|
||||
GVAR(currentHumidity) = 0 max GVAR(currentHumidity) min 1;
|
26
addons/weather/functions/fnc_updateRain.sqf
Normal file
26
addons/weather/functions/fnc_updateRain.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Author: ACE2 Team
|
||||
*
|
||||
* Updates rain based on ACE_RAIN_PARAMS
|
||||
*
|
||||
* Argument:
|
||||
* Nothing
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_oldStrength", "_rainStrength", "_transitionTime", "_periodPosition", "_periodPercent"];
|
||||
|
||||
if (!GVAR(enableRain)) exitWith {};
|
||||
|
||||
if (!isNil "ACE_RAIN_PARAMS" && {!isNil QGVAR(rain_period_start_time)}) then {
|
||||
_oldStrength = ACE_RAIN_PARAMS select 0;
|
||||
_rainStrength = ACE_RAIN_PARAMS select 1;
|
||||
_transitionTime = ACE_RAIN_PARAMS select 2;
|
||||
_periodPosition = (time - GVAR(rain_period_start_time)) min _transitionTime;
|
||||
_periodPercent = (_periodPosition/_transitionTime) min 1;
|
||||
|
||||
0 setRain ((_periodPercent*(_rainStrength-_oldStrength))+_oldStrength);
|
||||
};
|
22
addons/weather/functions/fnc_updateTemperature.sqf
Normal file
22
addons/weather/functions/fnc_updateTemperature.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Author: ACE2 Team
|
||||
*
|
||||
* Updates GVAR(currentTemperature) based on the map data
|
||||
*
|
||||
* Argument:
|
||||
* Nothing
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_time", "_month", "_hourlyCoef"];
|
||||
_time = daytime;
|
||||
_month = date select 1;
|
||||
|
||||
_hourlyCoef = -0.5 * sin(360 * ((3 + (date select 3))/24 + (date select 4)/1440));
|
||||
|
||||
GVAR(currentTemperature) = (GVAR(TempDay) select (_month - 1)) * (1 - _hourlyCoef) + (GVAR(TempNight) select (_month - 1)) * _hourlyCoef;
|
||||
GVAR(currentTemperature) = GVAR(currentTemperature) - 2 * humidity - 4 * overcast;
|
||||
GVAR(currentTemperature) = round(GVAR(currentTemperature) * 10) / 10;
|
21
addons/weather/functions/fnc_updateWind.sqf
Normal file
21
addons/weather/functions/fnc_updateWind.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Author: ACE2 Team
|
||||
*
|
||||
* Updates wind, gusts and waves based on ACE_wind
|
||||
*
|
||||
* Argument:
|
||||
* Nothing
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
ACE_wind = [] call FUNC(getWind);
|
||||
setWind [ACE_wind select 0, ACE_wind select 1, true];
|
||||
2 setGusts 0;
|
||||
|
||||
// Set waves: 0 when no wind, 1 when wind >= 16 m/s
|
||||
1 setWaves (((vectorMagnitude ACE_wind) / 16.0) min 1.0);
|
||||
|
||||
//hintSilent format["Wind: %1\nACE_wind: %2\nDeviation: %3 (m/s)", wind, ACE_wind, Round((vectorMagnitude (ACE_wind vectorDiff wind)) * 1000) / 1000];
|
@ -10,3 +10,11 @@
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
#define ABSOLUTE_ZERO_IN_CELSIUS -273.15
|
||||
#define KELVIN(t) (t - ABSOLUTE_ZERO_IN_CELSIUS)
|
||||
#define CELSIUS(t) (t + ABSOLUTE_ZERO_IN_CELSIUS)
|
||||
#define UNIVERSAL_GAS_CONSTANT 8.314
|
||||
#define WATER_VAPOR_MOLAR_MASS 0.018016
|
||||
#define DRY_AIR_MOLAR_MASS 0.028964
|
||||
#define SPECIFIC_GAS_CONSTANT_DRY_AIR 287.058
|
||||
|
Loading…
Reference in New Issue
Block a user