diff --git a/addons/mk6mortar/CfgEventHandlers.hpp b/addons/mk6mortar/CfgEventHandlers.hpp index 3daad1425a..34c6ecc22c 100644 --- a/addons/mk6mortar/CfgEventHandlers.hpp +++ b/addons/mk6mortar/CfgEventHandlers.hpp @@ -8,3 +8,10 @@ class Extended_PostInit_EventHandlers { clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) ); }; }; +class Extended_FiredBIS_EventHandlers { + class Mortar_01_base_F { + class ADDON { + firedBIS = QUOTE(_this call FUNC(handleFired)); + }; + }; +}; diff --git a/addons/mk6mortar/CfgVehicles.hpp b/addons/mk6mortar/CfgVehicles.hpp index b7d6ed9365..a40cc68efb 100644 --- a/addons/mk6mortar/CfgVehicles.hpp +++ b/addons/mk6mortar/CfgVehicles.hpp @@ -4,11 +4,12 @@ class CfgVehicles { class ACE_SelfActions { class ACE_Equipment { class GVAR(rangetable) { - displayName = "Open 82mm Rangetable"; + displayName = "$STR_ACE_MK6MORTAR_rangetable_action"; condition = QUOTE(_this call FUNC(rangeTableCanUse)); statement = QUOTE(_this call FUNC(rangeTableOpen)); priority = 0; icon = QUOTE(PATHTOF(UI\icon_rangeTable.paa)); + exceptions[] = {"notOnMap", "isNotInside"}; }; }; }; diff --git a/addons/mk6mortar/CfgWeapons.hpp b/addons/mk6mortar/CfgWeapons.hpp index f628fe1717..7d5153e9ad 100644 --- a/addons/mk6mortar/CfgWeapons.hpp +++ b/addons/mk6mortar/CfgWeapons.hpp @@ -5,8 +5,8 @@ class CfgWeapons { class ACE_RangeTable_82mm: ACE_ItemCore { author = "$STR_ACE_Common_ACETeam"; scope = 2; - displayName = "82mm Rangetable"; - descriptionShort = "82mm Rangetable D"; + displayName = "$STR_ACE_MK6MORTAR_rangetable_name"; + descriptionShort = "$STR_ACE_MK6MORTAR_rangetable_description"; picture = QUOTE(PATHTOF(UI\icon_rangeTable.paa)); class ItemInfo: InventoryItem_Base_F { mass = 0.5; diff --git a/addons/mk6mortar/functions/fnc_dev_buildTable.sqf b/addons/mk6mortar/functions/fnc_dev_buildTable.sqf index d36aa61819..b659cd1512 100644 --- a/addons/mk6mortar/functions/fnc_dev_buildTable.sqf +++ b/addons/mk6mortar/functions/fnc_dev_buildTable.sqf @@ -1,24 +1,23 @@ /* -Name: AGM_Artillery_fnc_dev_buildTable - -Author: Pabst Mirror - -Description: - DEV function to build mortar tables, very cpu intensive (never used durring normal gameplay) - -Parameters: (normal BIS "Fired" EH stuff) - 0: NUMBER - Muzzle Velocity - 1: NUMBER - Air Friction - -Returns: - Data in clipboard - -Example: - [100, -0.0001] spawn AGM_Artillery_fnc_dev_buildTable; //spawn (scheduled) is slower - [100, -0.0001] call AGM_Artillery_fnc_dev_buildTable; //faster, but will lock while processing -*/ + * Author: PabstMirror + * DEV function to build mortar tables, very cpu intensive (never used durring normal gameplay) + * + * Arguments: + * 0: Muzzle Velocity <NUMBER> + * 1: Air Friction <NUMBER> + * + * Return Value: + * <Data in clipboard> + * + * Example: + * [100, -0.0001] spawn ace_mk6mortar_fnc_dev_buildTable; //spawn (scheduled) is slower + * [100, -0.0001] call ace_mk6mortar_fnc_dev_buildTable; //faster, but will lock while processing + * + * Public: No + */ #include "script_component.hpp" + private ["_muzzleVelocity", "_airFriction", "_stillInRange", "_currentRange", "_increasePerRow", "_outputArray", "_rangeToHit", "_lineElevation", "_lineHeightElevation", "_lineTimeOfFlight", "_lineCrosswindDeg", "_lineHeadwindMeters", "_lineTailWindMeters", "_lineTempDec", "_lineTempInc", "_lineAirDensDec", "_lineAirDensInc", "_result", "_outputString"]; _muzzleVelocity = _this select 0; @@ -32,28 +31,28 @@ _outputArray = []; //[_rangeToHit, _lineElevation, _lineHeightElevation, _lineTimeOfFlight, _lineCrosswindDeg, _lineHeadwindMeters, _lineTailWindMeters, _lineTempDec, _lineTempInc, _lineAirDensDec, _lineAirDensInc] while {_stillInRange} do { - _result = [_muzzleVelocity, _currentRange, _airFriction] call FUNC(dev_simulateCalcRangeTableLine); - if (_result isEqualTo []) then { - _stillInRange = false; - } else { - if ((_result select 1) < 86) then { - _outputArray pushBack [ - ([(_result select 0), "meters", false] call FUNC(dev_formatNumber)), - ([(_result select 1), "mil", true] call FUNC(dev_formatNumber)), - ([(_result select 2), "mil", true] call FUNC(dev_formatNumber)), - ([(_result select 3), "sec", false] call FUNC(dev_formatNumber)), - ([(_result select 4), "milPrecise", true] call FUNC(dev_formatNumber)), - ([(_result select 5), "metersprecise", false] call FUNC(dev_formatNumber)), - ([(_result select 6), "metersprecise", false] call FUNC(dev_formatNumber)), - ([(_result select 7), "metersprecise", false] call FUNC(dev_formatNumber)), - ([(_result select 8), "metersprecise", false] call FUNC(dev_formatNumber)), - ([(_result select 9), "metersprecise", false] call FUNC(dev_formatNumber)), - ([(_result select 10), "metersprecise", false] call FUNC(dev_formatNumber)) - ]; + _result = [_muzzleVelocity, _currentRange, _airFriction] call FUNC(dev_simulateCalcRangeTableLine); + if (_result isEqualTo []) then { + _stillInRange = false; + } else { + if ((_result select 1) < 86) then { + _outputArray pushBack [ + ([(_result select 0), "meters", false] call FUNC(dev_formatNumber)), + ([(_result select 1), "mil", true] call FUNC(dev_formatNumber)), + ([(_result select 2), "mil", true] call FUNC(dev_formatNumber)), + ([(_result select 3), "sec", false] call FUNC(dev_formatNumber)), + ([(_result select 4), "milPrecise", true] call FUNC(dev_formatNumber)), + ([(_result select 5), "metersprecise", false] call FUNC(dev_formatNumber)), + ([(_result select 6), "metersprecise", false] call FUNC(dev_formatNumber)), + ([(_result select 7), "metersprecise", false] call FUNC(dev_formatNumber)), + ([(_result select 8), "metersprecise", false] call FUNC(dev_formatNumber)), + ([(_result select 9), "metersprecise", false] call FUNC(dev_formatNumber)), + ([(_result select 10), "metersprecise", false] call FUNC(dev_formatNumber)) + ]; + }; + _currentRange = _currentRange + _increasePerRow; }; - _currentRange = _currentRange + _increasePerRow; - }; - hint str _currentRange; + hintSilent str _currentRange; }; //handle floating point rounding errors @@ -62,14 +61,14 @@ _outputString = format ["case ((abs(_muzzleVelocity - %1) < 0.00001) && ((abs(_a ", _muzzleVelocity, _airFriction]; { - if (_forEachIndex < ((count _outputArray) - 1)) then { - _outputString = _outputString + format ["%1, + if (_forEachIndex < ((count _outputArray) - 1)) then { + _outputString = _outputString + format ["%1, ", _x]; - } else { - _outputString = _outputString + format ["%1 - ] + } else { + _outputString = _outputString + format ["%1 + ] };", _x]; - }; + }; } forEach _outputArray; copyToClipboard _outputString; diff --git a/addons/mk6mortar/functions/fnc_dev_formatNumber.sqf b/addons/mk6mortar/functions/fnc_dev_formatNumber.sqf index 47e9fc7fbf..a8ad155eec 100644 --- a/addons/mk6mortar/functions/fnc_dev_formatNumber.sqf +++ b/addons/mk6mortar/functions/fnc_dev_formatNumber.sqf @@ -4,19 +4,19 @@ Name: AGM_Artillery_fnc_formatNumber Author: Pabst Mirror Description: - Converts numbers into nicely formated strings. +Converts numbers into nicely formated strings. Parameters: - 0: NUMBER - Input number - 1: STRING - Output type (see case statement) - 2: BOOL - If output type is mil, convert input type from deg->mil +0: NUMBER - Input number +1: STRING - Output type (see case statement) +2: BOOL - If output type is mil, convert input type from deg->mil Returns: - STRING - Formatted number +STRING - Formatted number Example: - [45, "mil4", true] call AGM_Artillery_fnc_formatNumber = "0800" -*/ +[45, "mil4", true] call AGM_Artillery_fnc_formatNumber = "0800" + */ #include "script_component.hpp" private ["_theNumber", "_inputType", "_convertToMils", "_decimalPlaces", "_integerPlaces", "_prefix", "_return"]; @@ -30,47 +30,47 @@ _integerPlaces = -1; switch (toLower _inputType) do { case ("meters"): { - _decimalPlaces = 0; - _integerPlaces = 1; - }; + _decimalPlaces = 0; + _integerPlaces = 1; + }; case ("metersprecise"): { - _decimalPlaces = 1; - _integerPlaces = 1; - }; + _decimalPlaces = 1; + _integerPlaces = 1; + }; case ("meters4"): { - _decimalPlaces = 0; - _integerPlaces = 4; - }; + _decimalPlaces = 0; + _integerPlaces = 4; + }; case ("deg3precise"): { - _decimalPlaces = 2; - _integerPlaces = 3; - }; + _decimalPlaces = 2; + _integerPlaces = 3; + }; case ("mil"): { - _decimalPlaces = 0; - _integerPlaces = 1; - if (_convertToMils) then { - _theNumber = _theNumber * (6400 / 360); + _decimalPlaces = 0; + _integerPlaces = 1; + if (_convertToMils) then { + _theNumber = _theNumber * (6400 / 360); + }; }; - }; case ("mil4"): { - _decimalPlaces = 0; - _integerPlaces = 4; - if (_convertToMils) then { - _theNumber = _theNumber * (6400 / 360); + _decimalPlaces = 0; + _integerPlaces = 4; + if (_convertToMils) then { + _theNumber = _theNumber * (6400 / 360); + }; }; - }; case ("milprecise"): { - _decimalPlaces = 1; - _integerPlaces = 1; - if (_convertToMils) then { - _theNumber = _theNumber * (6400 / 360); + _decimalPlaces = 1; + _integerPlaces = 1; + if (_convertToMils) then { + _theNumber = _theNumber * (6400 / 360); + }; }; - }; case ("sec"): { - _decimalPlaces = 1; - _integerPlaces = 1; - }; - default {systemChat format ["badtype %1", _inputType];}; + _decimalPlaces = 1; + _integerPlaces = 1; + }; + default {systemChat format ["badtype %1", _inputType];}; }; diff --git a/addons/mk6mortar/functions/fnc_dev_simulateFindSolution.sqf b/addons/mk6mortar/functions/fnc_dev_simulateFindSolution.sqf index ddeab4015f..29a44e3a51 100644 --- a/addons/mk6mortar/functions/fnc_dev_simulateFindSolution.sqf +++ b/addons/mk6mortar/functions/fnc_dev_simulateFindSolution.sqf @@ -1,26 +1,25 @@ /* -Name: FUNC(simulateFindSolution) - -Author: Pabst Mirror - -Description: - Converts numbers into nicely formated strings. - -Parameters: - 0: NUMBER - Range to Hit (Meters) - 1: NUMBER - Height To Hit (Meters) - 2: NUMBER - Muzzle Velocity (M/S) - 3: NUMBER - Air Friction - 4: NUMBER - Time Step (seconds) (eg 1/50 will simulate 50 cycles per second) - -Returns: - ARRAY - [NUMBER - Elevation In Degrees, NUMBER - Shot Durration] - -Example: - [_rangeToHit, _heightToHit, _muzzleVelocity, _airFriction, TIME_STEP] call FUNC(simulateFindSolution); -*/ + * Author: PabstMirror + * DEV to find a firing solution for a given range + * + * Arguments: + * 0: Range to Hit (Meters)<NUMBER> + * 1: Height To Hit (Meters)<NUMBER> + * 2: Muzzle Velocity (M/S)<NUMBER> + * 3: Air Friction <NUMBER> + * 4: Time Step (seconds) (eg 1/50 will simulate 50 cycles per second) <NUMBER> + * + * Return Value: + * ARRAY - [NUMBER - Elevation In Degrees, NUMBER - Shot Durration] + * + * Example: + * [_rangeToHit, _heightToHit, _muzzleVelocity, _airFriction, TIME_STEP] call FUNC(simulateFindSolution); + * + * Public: No + */ #include "script_component.hpp" + private ["_rangeToHit", "_heightToHit", "_muzzleVelocity", "_airFriction", "_maxElev", "_minElev", "_error", "_solutionElevation", "_lastTestResult", "_numberOfAttempts"]; #define MAX_ATTEMPTS 22 @@ -41,15 +40,15 @@ _numberOfAttempts = 0; //(binary search) while {(_numberOfAttempts < MAX_ATTEMPTS) && ((abs _error) > 0.2)} do { - _numberOfAttempts = _numberOfAttempts + 1; - _solutionElevation = (_maxElev + _minElev) / 2; - _lastTestResult = [_solutionElevation, _muzzleVelocity, _airFriction, 15, 1, 0, 0, _heightToHit, _timeStep] call FUNC(dev_simulateShot); - _error = _rangeToHit - (_lastTestResult select 0); - if (_error > 0) then { - _maxElev = _solutionElevation; //test range was short - } else { - _minElev = _solutionElevation; //test range was long - }; + _numberOfAttempts = _numberOfAttempts + 1; + _solutionElevation = (_maxElev + _minElev) / 2; + _lastTestResult = [_solutionElevation, _muzzleVelocity, _airFriction, 15, 1, 0, 0, _heightToHit, _timeStep] call FUNC(dev_simulateShot); + _error = _rangeToHit - (_lastTestResult select 0); + if (_error > 0) then { + _maxElev = _solutionElevation; //test range was short + } else { + _minElev = _solutionElevation; //test range was long + }; }; if (_numberOfAttempts >= MAX_ATTEMPTS) exitWith {[]}; diff --git a/addons/mk6mortar/functions/fnc_dev_simulateShot.sqf b/addons/mk6mortar/functions/fnc_dev_simulateShot.sqf index 42ceef21fd..de8471726c 100644 --- a/addons/mk6mortar/functions/fnc_dev_simulateShot.sqf +++ b/addons/mk6mortar/functions/fnc_dev_simulateShot.sqf @@ -1,31 +1,26 @@ /* -Name: simulateShot - -Author: Pabst Mirror - -Description: - Simulates the path of a fired shell. - -Parameters: - 0: NUMBER - Shot Angle (degrees) - 1: NUMBER - Muzzle Velocity (m/s) - 2: NUMBER - Air Friction - 3: NUMBER - Tempeture (degres celcius) - 4: NUMBER - Relative Air Denisty - 5: NUMBER - Tail Wind (m/s) - 6: NUMBER - Cross Wind (m/s) - 7: NUMBER - Height Of Target (M) - 8: NUMBER - Time Step (fraction of a second) - -Returns: - ARRAY - - NUMBER - Distance Traveld - NUMBER - Shot Time - NUMBER - Offset (degrees) - -Example: - [45, 180, -0.0001, 15, 1, 10, 0, 0, 1/50] call simulateShot; -*/ + * Author: PabstMirror + * DEV function to build mortar tables, very cpu intensive (never used durring normal gameplay) + * + * Arguments: + * 0: Shot Angle (degrees) <NUMBER> + * 1: Muzzle Velocity (m/s) <NUMBER> + * 2: Air Friction <NUMBER> + * 3: Tempeture (degres celcius) <NUMBER> + * 4: Relative Air Denisty <NUMBER> + * 5: Tail Wind (m/s) <NUMBER> + * 6: Cross Wind (m/s) <NUMBER> + * 7: Height Of Target (M) <NUMBER> + * 8: Time Step (fraction of a second) <NUMBER> + * + * Return Value: + * <ARRAY> [Distance Traveled<NUMBER>, Shot Time<NUMBER>, Offset (degrees)<NUMBER>] + * + * Example: + * [45, 180, -0.0001, 15, 1, 10, 0, 0, 1/50] call ace_mk6mortar_fnc_dev_simulateShot; + * + * Public: No + */ #include "script_component.hpp" private ["_angleDeg", "_muzzleVelocity", "_airFriction", "_temp", "_relDensity", "_tailWind", "_crosswind", "_heightOfTarget", "_wind", "_gravity", "_timeStep", "_currentPos", "_currentVelocity", "_currentTime", "_lastPos", "_kCoefficent", "_aparentWind", "_changeInVelocity", "_linConversion", "_middlePos", "_middlePosOld", "_middleTotalTravelTime", "_offsetDeg"]; @@ -53,15 +48,15 @@ _lastPos = _currentPos; _kCoefficent = -1 * _relDensity * _airFriction; //save time in the loop and compute once while {((_currentVelocity select 2) > 0) || ((_currentPos select 2) >= _heightOfTarget)} do { - _lastPos = _currentPos; + _lastPos = _currentPos; - _aparentWind = _wind vectorDiff _currentVelocity; - _changeInVelocity = _gravity vectorAdd (_aparentWind vectorMultiply ((vectorMagnitude _aparentWind) * _kCoefficent)); + _aparentWind = _wind vectorDiff _currentVelocity; + _changeInVelocity = _gravity vectorAdd (_aparentWind vectorMultiply ((vectorMagnitude _aparentWind) * _kCoefficent)); - _currentVelocity = _currentVelocity vectorAdd (_changeInVelocity vectorMultiply _timeStep); + _currentVelocity = _currentVelocity vectorAdd (_changeInVelocity vectorMultiply _timeStep); - _currentPos = _currentPos vectorAdd (_currentVelocity vectorMultiply _timeStep); - _currentTime = _currentTime + _timeStep; + _currentPos = _currentPos vectorAdd (_currentVelocity vectorMultiply _timeStep); + _currentTime = _currentTime + _timeStep; }; //Uses linearConversion to get a weighted average betwen points before and after dropping below target height @@ -73,6 +68,6 @@ _middlePos = (_lastPos vectorMultiply (1 - _linConversion)) vectorAdd (_currentP _middleTotalTravelTime = _currentTime - (_timeStep * (1-_linConversion)); //Find shot offset (from crosswind), in degrees - _offsetDeg = (_middlePos select 0) aTan2 (_middlePos select 1); +_offsetDeg = (_middlePos select 0) aTan2 (_middlePos select 1); [(_middlePos select 1), _middleTotalTravelTime, _offsetDeg] diff --git a/addons/mk6mortar/functions/fnc_handleFired.sqf b/addons/mk6mortar/functions/fnc_handleFired.sqf index 679b689d6d..555abcbe6f 100644 --- a/addons/mk6mortar/functions/fnc_handleFired.sqf +++ b/addons/mk6mortar/functions/fnc_handleFired.sqf @@ -15,7 +15,7 @@ * Nothing * * Example: - * [clientFiredBIS-XEH] call ace_mk6mortars_fnc_handleFired + * [clientFiredBIS-XEH] call ace_mk6mortar_fnc_handleFired * * Public: No */ @@ -26,27 +26,29 @@ disableSerialization; PARAMS_7(_vehicle,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); if (!GVAR(airResistanceEnabled)) exitWith {}; - -if (_unit distance ACE_player > 3000) exitWith {false}; // Large enough distance to not simulate any wind deflection. +// Large enough distance to not simulate any wind deflection +if (_unit distance ACE_player > 8000) exitWith {false}; //AI will have no clue how to use: _shooterMan = gunner _vehicle; if (!([_shooterMan] call EFUNC(common,isPlayer))) exitWith {false}; +//Should be zero, just make sure: +_bisAirFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction"); +if (_bisAirFriction != 0) exitWith {ERROR("Non zero base airFriction");}; //Hack Until these are intergrated: if (isNil QEGVAR(weather,currentRelativeDensity)) then { EGVAR(weather,currentRelativeDensity) = 1; }; if (isNil QEGVAR(weather,currentTemperature)) then { - EGVAR(weather,currentTemperature) = 20; + EGVAR(weather,currentTemperature) = 15; }; //powder effects: _temperature = EGVAR(weather,currentTemperature); _newMuzzleVelocityCoefficent = (((_temperature + 273.13) / 288.13 - 1) / 40 + 1); -systemChat str _newMuzzleVelocityCoefficent; if (_newMuzzleVelocityCoefficent != 1) then { _bulletVelocity = velocity _projectile; _bulletSpeed = vectorMagnitude _bulletVelocity; @@ -55,8 +57,8 @@ if (_newMuzzleVelocityCoefficent != 1) then { _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; }; +systemChat format ["PFEH for %1", _ammo]; -// if (_bullet isKindOf "BulletBase") then { [{ private ["_deltaT", "_bulletVelocity", "_bulletSpeed", "_trueVelocity", "_trueSpeed", "_dragRef", "_accelRef", "_drag", "_accel"]; PARAMS_2(_args,_pfID); @@ -72,17 +74,13 @@ if (_newMuzzleVelocityCoefficent != 1) then { _bulletVelocity = velocity _shell; _bulletSpeed = vectorMagnitude _bulletVelocity; - if (vectorMagnitude ACE_wind > 0) then { - _trueVelocity = _bulletVelocity vectorDiff ACE_wind; - _trueSpeed = vectorMagnitude _trueVelocity; + _trueVelocity = _bulletVelocity vectorDiff ACE_wind; + _trueSpeed = vectorMagnitude _trueVelocity; - _drag = _deltaT * _airFriction * _trueSpeed * EGVAR(weather,currentRelativeDensity); - _accel = _trueVelocity vectorMultiply (_drag); + _drag = _deltaT * _airFriction * _trueSpeed * EGVAR(weather,currentRelativeDensity); + _accel = _trueVelocity vectorMultiply (_drag); + _bulletVelocity = _bulletVelocity vectorAdd _accel; - _bulletVelocity = _bulletVelocity vectorAdd _accel; - }; _shell setVelocity _bulletVelocity; }, 0, [_projectile, MK6_82mm_AIR_FRICTION, time]] call CBA_fnc_addPerFrameHandler; -// }; - diff --git a/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf b/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf index 705105eed5..8fa11b1cda 100644 --- a/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf +++ b/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf @@ -10,6 +10,7 @@ * No * * Example: + * [bob, mortar] call ace_mk6mortar_fnc_handlePlayerVehicleChanged; * * Public: No */ @@ -48,7 +49,7 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes") _currentFireMode = (weaponState [_mortarVeh, [0]]) select 2; _currentChargeMode = _fireModes find _currentFireMode; - _text = format ["<t size='0.8'>%1: %2 <img image='%3'/></t>", "Charge", _currentChargeMode, QUOTE(PATHTOF(UI\ui_charges.paa))]; + _text = format ["<t size='0.8'>%1: %2 <img image='%3'/></t>", (localize "STR_ACE_MK6MORTAR_rangetable_charge"), _currentChargeMode, QUOTE(PATHTOF(UI\ui_charges.paa))]; _chargeText ctrlSetStructuredText parseText _text; if (shownArtilleryComputer && {!GVAR(allowComputerRangefinder)}) then { //Don't like this solution, but it works @@ -57,22 +58,29 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes") }; _display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull]; - if (isNull _display) exitWith {systemChat "null";}; + if (isNull _display) exitWith {}; //It may be null for the first frame + + //Hud should hidden in 3rd person + _notGunnerView = cameraView != "GUNNER"; //Update CurrentElevation Display: - _elevDeg = parseNumber ctrlText (_display displayCtrl 175); - if (_useMils) then { - (_display displayCtrl 80175) ctrlSetText str round (_elevDeg * 6400 / 360); + if (_notGunnerView) then { + (_display displayCtrl 80175) ctrlSetText ""; } else { - (_display displayCtrl 80175) ctrlSetText str _elevDeg; + _elevDeg = parseNumber ctrlText (_display displayCtrl 175); + if (_useMils) then { + (_display displayCtrl 80175) ctrlSetText str round (_elevDeg * 6400 / 360); + } else { + (_display displayCtrl 80175) ctrlSetText str _elevDeg; + }; }; //Update ElevationNeeded Display: - if (!GVAR(allowComputerRangefinder)) then { + if (_notGunnerView || (!GVAR(allowComputerRangefinder))) then { (_display displayCtrl 80176) ctrlSetText ""; } else { _elevDeg = parseNumber ctrlText (_display displayCtrl 176); - if (_elevDeg <= 0) then { + if (_elevDeg <= 0) then { //Bad data means "----" out of range (_display displayCtrl 80176) ctrlSetText (ctrlText (_display displayCtrl 176)); } else { if (_useMils) then { @@ -84,7 +92,7 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes") }; //Update Heading Display: - if (!GVAR(allowCompass)) then { + if (_notGunnerView || (!GVAR(allowCompass))) then { (_display displayCtrl 80156) ctrlSetText ""; } else { _rotationDegrees = ((getDir _mortarVeh) + (((-180 / PI) * (_mortarVeh animationPhase "mainTurret")) + 360)) % 360; @@ -95,4 +103,4 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes") }; }; }; -}, 0, [_newVehicle, _chargeText,_fireModes]] call CBA_fnc_addPerFrameHandler; \ No newline at end of file +}, 0, [_newVehicle, _chargeText,_fireModes]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/mk6mortar/functions/fnc_moduleInit.sqf b/addons/mk6mortar/functions/fnc_moduleInit.sqf index c7301c074b..75bab4cee9 100644 --- a/addons/mk6mortar/functions/fnc_moduleInit.sqf +++ b/addons/mk6mortar/functions/fnc_moduleInit.sqf @@ -11,7 +11,7 @@ * None * * Example: - * + * [fromModule] call ace_mk6mortar_fnc_moduleInit * * Public: No */ diff --git a/addons/mk6mortar/functions/fnc_rangeTableOpen.sqf b/addons/mk6mortar/functions/fnc_rangeTableOpen.sqf index 5ad6736e84..67d33c2727 100644 --- a/addons/mk6mortar/functions/fnc_rangeTableOpen.sqf +++ b/addons/mk6mortar/functions/fnc_rangeTableOpen.sqf @@ -9,7 +9,7 @@ * No * * Example: - * + * [] call ace_mk6mortar_fnc_rangeTableOpen * * Public: No */ @@ -38,7 +38,7 @@ _muzzleVelocities = []; _showToPlayer = getNumber (configFile >> "CfgWeapons" >> _weaponName >> _x >> "showToPlayer"); if (_showToPlayer == 1) then { _artilleryCharge = getNumber (configFile >> "CfgWeapons" >> _weaponName >> _x >> "artilleryCharge"); - LIST_CHARGE lbAdd format ["%1: %2 [%3m/s]", "Charge", (count _muzzleVelocities), (_initSpeed * _artilleryCharge)]; + LIST_CHARGE lbAdd format ["%1: %2", (localize "STR_ACE_MK6MORTAR_rangetable_charge"), (count _muzzleVelocities)]; LIST_CHARGE lbSetData [(count _muzzleVelocities), str (_artilleryCharge * _initSpeed)]; _muzzleVelocities pushBack _artilleryCharge; }; diff --git a/addons/mk6mortar/functions/fnc_rangeTablePageChange.sqf b/addons/mk6mortar/functions/fnc_rangeTablePageChange.sqf index eb28b80e6f..6846640f25 100644 --- a/addons/mk6mortar/functions/fnc_rangeTablePageChange.sqf +++ b/addons/mk6mortar/functions/fnc_rangeTablePageChange.sqf @@ -9,7 +9,7 @@ * No * * Example: - * + * [] call ace_mk6mortar_fnc_rangeTablePageChange * * Public: No */ diff --git a/addons/mk6mortar/functions/fnc_rangeTablePreCalculatedValues.sqf b/addons/mk6mortar/functions/fnc_rangeTablePreCalculatedValues.sqf index 5c8489941f..7c34b6389f 100644 --- a/addons/mk6mortar/functions/fnc_rangeTablePreCalculatedValues.sqf +++ b/addons/mk6mortar/functions/fnc_rangeTablePreCalculatedValues.sqf @@ -11,7 +11,7 @@ * <ARRAY> * * Example: - * + * [200, 0] call ace_mk6mortar_fnc_rangeTablePreCalculatedValues * * Public: No */ diff --git a/addons/mk6mortar/functions/fnc_turretDisplayLoaded.sqf b/addons/mk6mortar/functions/fnc_turretDisplayLoaded.sqf index dcce66f089..4972265528 100644 --- a/addons/mk6mortar/functions/fnc_turretDisplayLoaded.sqf +++ b/addons/mk6mortar/functions/fnc_turretDisplayLoaded.sqf @@ -9,6 +9,7 @@ * None * * Example: + * [] call ace_mk6mortar_fnc_turretDisplayLoaded * * Public: No */ @@ -28,9 +29,9 @@ #define CTRL_CA_ELEV (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_ELEV") #define CTRL_CA_ELEV_NEED (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_ELEV_NEED") + disableSerialization; -// PARAMS_1(_display); _display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull]; if (isNull _display) exitWith {}; diff --git a/addons/mk6mortar/stringtable.xml b/addons/mk6mortar/stringtable.xml index d105660bcd..da61afb03b 100644 --- a/addons/mk6mortar/stringtable.xml +++ b/addons/mk6mortar/stringtable.xml @@ -1,9 +1,18 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Edited with tabler - 2015-04-05 --> +<!-- Edited with tabler - 2015-04-06 --> <Project name="ACE"> <Package name="mk6mortar"> - <Key ID="STR_ACE_mk6mortar_useMils"> - <English>Mk6 Mortar: Show Angle in MILS</English> + <Key ID="STR_ACE_MK6MORTAR_rangetable_name"> + <English>82mm Rangetable</English> + </Key> + <Key ID="STR_ACE_MK6MORTAR_rangetable_description"> + <English>Range Table for the MK6 82mm Mortar</English> + </Key> + <Key ID="STR_ACE_MK6MORTAR_rangetable_action"> + <English>Open 82mm Rangetable</English> + </Key> + <Key ID="STR_ACE_MK6MORTAR_rangetable_charge"> + <English>Charge</English> </Key> </Package> </Project> \ No newline at end of file