mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Move Latitude and Altitude parameters to weather
This commit is contained in:
parent
c73aff03bd
commit
7a1e905c79
@ -18,30 +18,6 @@ GVAR(WindInfoStart) = time;
|
||||
GVAR(Protractor) = false;
|
||||
GVAR(ProtractorStart) = time;
|
||||
|
||||
GVAR(Altitude) = 0;
|
||||
GVAR(Latitude) = 50;
|
||||
|
||||
if (worldName in ["Chernarus", "Bootcamp_ACR", "Woodland_ACR", "utes"]) then { GVAR(Latitude) = 50; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Altis", "Stratis"]) then { GVAR(Latitude) = 40; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Takistan", "Zargabad", "Mountains_ACR"]) then { GVAR(Latitude) = 35; GVAR(Altitude) = 2000; };
|
||||
if (worldName in ["Shapur_BAF", "ProvingGrounds_PMC"]) then { GVAR(Latitude) = 35; GVAR(Altitude) = 100; };
|
||||
if (worldName in ["fallujah"]) then { GVAR(Latitude) = 33; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["fata", "Abbottabad"]) then { GVAR(Latitude) = 30; GVAR(Altitude) = 1000; };
|
||||
if (worldName in ["sfp_wamako"]) then { GVAR(Latitude) = 14; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["sfp_sturko"]) then { GVAR(Latitude) = 56; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Bornholm"]) then { GVAR(Latitude) = 55; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Imrali"]) then { GVAR(Latitude) = 40; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Caribou"]) then { GVAR(Latitude) = 68; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Namalsk"]) then { GVAR(Latitude) = 65; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["MCN_Aliabad"]) then { GVAR(Latitude) = 36; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Clafghan"]) then { GVAR(Latitude) = 34; GVAR(Altitude) = 640; };
|
||||
if (worldName in ["Sangin", "hellskitchen"]) then { GVAR(Latitude) = 32; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Sara"]) then { GVAR(Latitude) = 40; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["reshmaan"]) then { GVAR(Latitude) = 35; GVAR(Altitude) = 2000; };
|
||||
if (worldName in ["Thirsk"]) then { GVAR(Latitude) = 65; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["lingor"]) then { GVAR(Latitude) = -4; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Panthera3"]) then { GVAR(Latitude) = 46; GVAR(Altitude) = 0; };
|
||||
|
||||
// TODO: Remove this hack once the weather engine is up and running
|
||||
if (isNil QUOTE(EGVAR(weather,currentTemperature))) then { EGVAR(weather,currentTemperature) = 24; };
|
||||
if (isNil QUOTE(EGVAR(weather,currentHumidity))) then { EGVAR(weather,currentHumidity) = 50; };
|
||||
|
@ -100,7 +100,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(-(GVAR(Altitude) + ((getPosASL _bullet) select 2)) / 7990) - 10 * overcast;
|
||||
_barometricPressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL _bullet) select 2)) / 7990) - 10 * overcast;
|
||||
_stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor);
|
||||
};
|
||||
|
||||
@ -252,7 +252,7 @@ if ((GVAR(bulletDatabaseOccupiedIndices) pushBack _index) == 0) then {
|
||||
};
|
||||
|
||||
if (GVAR(AtmosphericDensitySimulationEnabled)) then {
|
||||
_pressure = 1013.25 * exp(-(GVAR(Altitude) + (_bulletPosition select 2)) / 7990) - 10 * overcast;
|
||||
_pressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + (_bulletPosition select 2)) / 7990) - 10 * overcast;
|
||||
_temperature = GET_TEMPERATURE_AT_HEIGHT(_bulletPosition select 2);
|
||||
_humidity = EGVAR(weather,currentHumidity);
|
||||
_airDensity = STD_AIR_DENSITY_ICAO;
|
||||
@ -279,7 +279,7 @@ if ((GVAR(bulletDatabaseOccupiedIndices) pushBack _index) == 0) then {
|
||||
_bulletVelocity = _bulletVelocity vectorDiff _accel;
|
||||
} else {
|
||||
if (GVAR(AtmosphericDensitySimulationEnabled)) then {
|
||||
_pressureDeviation = 1013.25 * exp(-(GVAR(Altitude) + (_bulletPosition select 2)) / 7990) - 1013.25 - 10 * overcast;
|
||||
_pressureDeviation = 1013.25 * exp(-(EGVAR(weather,Altitude) + (_bulletPosition select 2)) / 7990) - 1013.25 - 10 * overcast;
|
||||
_temperature = GET_TEMPERATURE_AT_HEIGHT(_bulletPosition select 2);
|
||||
_humidity = EGVAR(weather,currentHumidity);
|
||||
_airFriction = _airFriction + ((_temperature - 15) * 0.0000015 + _humidity * 0.0000040 + _pressureDeviation * -0.0000009);
|
||||
@ -297,7 +297,7 @@ if ((GVAR(bulletDatabaseOccupiedIndices) pushBack _index) == 0) then {
|
||||
};
|
||||
|
||||
if (GVAR(CoriolisEnabled) && _bulletSpeedAvg > 0) then {
|
||||
_horizontalDeflection = 0.0000729 * (_unit distanceSqr _bullet) * sin(GVAR(Latitude)) / _bulletSpeedAvg;
|
||||
_horizontalDeflection = 0.0000729 * (_unit distanceSqr _bullet) * sin(EGVAR(weather,Latitude)) / _bulletSpeedAvg;
|
||||
_horizontalDeflectionPartial = _horizontalDeflection - (GVAR(bulletDatabaseHDeflect) select _index);
|
||||
GVAR(bulletDatabaseHDeflect) set[_index, _horizontalDeflection];
|
||||
_vect = [sin(_bulletDir + 90) * _horizontalDeflectionPartial, cos(_bulletDir + 90) * _horizontalDeflectionPartial, 0];
|
||||
@ -308,7 +308,7 @@ if ((GVAR(bulletDatabaseOccupiedIndices) pushBack _index) == 0) then {
|
||||
/*
|
||||
// Negligible effect on the trajectory
|
||||
if (GVAR(EoetvoesEnabled)) then {
|
||||
_centripetalAccel = 2 * 0.0000729 * (_muzzleVelocity / -32.2) * cos(GVAR(Latitude)) * sin(_bulletDir);
|
||||
_centripetalAccel = 2 * 0.0000729 * (_muzzleVelocity / -32.2) * cos(EGVAR(weather,Latitude)) * sin(_bulletDir);
|
||||
_accel = [0, 0, -(_centripetalAccel * _deltaT)];
|
||||
|
||||
_bulletVelocity = _bulletVelocity vectorAdd _accel;
|
||||
|
@ -98,7 +98,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(-(GVAR(Altitude) + ((getPosASL _bullet) select 2)) / 7990) - 10 * overcast;
|
||||
_barometricPressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL _bullet) select 2)) / 7990) - 10 * overcast;
|
||||
_stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor);
|
||||
};
|
||||
|
||||
@ -143,7 +143,7 @@ if (count GVAR(bulletDatabaseFreeIndices) > 0) then {
|
||||
GVAR(bulletDatabaseFreeIndices) = GVAR(bulletDatabaseFreeIndices) - [_index];
|
||||
};
|
||||
|
||||
"AdvancedBallistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", _index, _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, GVAR(Latitude), EGVAR(weather,currentTemperature), GVAR(Altitude), EGVAR(weather,currentHumidity), overcast, floor(time), time - floor(time)];
|
||||
"AdvancedBallistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", _index, _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, EGVAR(weather,Latitude), EGVAR(weather,currentTemperature), EGVAR(weather,Altitude), EGVAR(weather,currentHumidity), overcast, floor(time), time - floor(time)];
|
||||
GVAR(bulletDatabase) set[_index, [_bullet, _caliber, _bulletTraceVisible, _index]];
|
||||
|
||||
if ((GVAR(bulletDatabaseOccupiedIndices) pushBack _index) == 0) then {
|
||||
|
@ -11,6 +11,31 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
// @todo: Read Altitude and Latitud from config
|
||||
GVAR(Altitude) = 0;
|
||||
GVAR(Latitude) = 50;
|
||||
|
||||
if (worldName in ["Chernarus", "Bootcamp_ACR", "Woodland_ACR", "utes"]) then { GVAR(Latitude) = 50; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Altis", "Stratis"]) then { GVAR(Latitude) = 40; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Takistan", "Zargabad", "Mountains_ACR"]) then { GVAR(Latitude) = 35; GVAR(Altitude) = 2000; };
|
||||
if (worldName in ["Shapur_BAF", "ProvingGrounds_PMC"]) then { GVAR(Latitude) = 35; GVAR(Altitude) = 100; };
|
||||
if (worldName in ["fallujah"]) then { GVAR(Latitude) = 33; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["fata", "Abbottabad"]) then { GVAR(Latitude) = 30; GVAR(Altitude) = 1000; };
|
||||
if (worldName in ["sfp_wamako"]) then { GVAR(Latitude) = 14; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["sfp_sturko"]) then { GVAR(Latitude) = 56; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Bornholm"]) then { GVAR(Latitude) = 55; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Imrali"]) then { GVAR(Latitude) = 40; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Caribou"]) then { GVAR(Latitude) = 68; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Namalsk"]) then { GVAR(Latitude) = 65; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["MCN_Aliabad"]) then { GVAR(Latitude) = 36; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Clafghan"]) then { GVAR(Latitude) = 34; GVAR(Altitude) = 640; };
|
||||
if (worldName in ["Sangin", "hellskitchen"]) then { GVAR(Latitude) = 32; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Sara"]) then { GVAR(Latitude) = 40; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["reshmaan"]) then { GVAR(Latitude) = 35; GVAR(Altitude) = 2000; };
|
||||
if (worldName in ["Thirsk"]) then { GVAR(Latitude) = 65; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["lingor"]) then { GVAR(Latitude) = -4; GVAR(Altitude) = 0; };
|
||||
if (worldName in ["Panthera3"]) then { GVAR(Latitude) = 46; GVAR(Altitude) = 0; };
|
||||
|
||||
// Check if the weather data is defined in the map config
|
||||
if (isArray (configFile >> "CfgWorlds" >> worldName >> "ACE_TempDay")) exitWith {
|
||||
GVAR(TempDay) = getArray (configFile >> "CfgWorlds" >> worldName >> "ACE_TempDay");
|
||||
|
Loading…
Reference in New Issue
Block a user