1
0
mirror of https://github.com/acemod/ACE3.git synced 2024-08-30 18:23:18 +00:00

Localization / Headers

This commit is contained in:
PabstMirror 2015-04-06 01:05:28 -05:00
parent 2ada87e3ac
commit d295ee6980
15 changed files with 200 additions and 183 deletions

View File

@ -8,3 +8,10 @@ class Extended_PostInit_EventHandlers {
clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) ); clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) );
}; };
}; };
class Extended_FiredBIS_EventHandlers {
class Mortar_01_base_F {
class ADDON {
firedBIS = QUOTE(_this call FUNC(handleFired));
};
};
};

View File

@ -4,11 +4,12 @@ class CfgVehicles {
class ACE_SelfActions { class ACE_SelfActions {
class ACE_Equipment { class ACE_Equipment {
class GVAR(rangetable) { class GVAR(rangetable) {
displayName = "Open 82mm Rangetable"; displayName = "$STR_ACE_MK6MORTAR_rangetable_action";
condition = QUOTE(_this call FUNC(rangeTableCanUse)); condition = QUOTE(_this call FUNC(rangeTableCanUse));
statement = QUOTE(_this call FUNC(rangeTableOpen)); statement = QUOTE(_this call FUNC(rangeTableOpen));
priority = 0; priority = 0;
icon = QUOTE(PATHTOF(UI\icon_rangeTable.paa)); icon = QUOTE(PATHTOF(UI\icon_rangeTable.paa));
exceptions[] = {"notOnMap", "isNotInside"};
}; };
}; };
}; };

View File

@ -5,8 +5,8 @@ class CfgWeapons {
class ACE_RangeTable_82mm: ACE_ItemCore { class ACE_RangeTable_82mm: ACE_ItemCore {
author = "$STR_ACE_Common_ACETeam"; author = "$STR_ACE_Common_ACETeam";
scope = 2; scope = 2;
displayName = "82mm Rangetable"; displayName = "$STR_ACE_MK6MORTAR_rangetable_name";
descriptionShort = "82mm Rangetable D"; descriptionShort = "$STR_ACE_MK6MORTAR_rangetable_description";
picture = QUOTE(PATHTOF(UI\icon_rangeTable.paa)); picture = QUOTE(PATHTOF(UI\icon_rangeTable.paa));
class ItemInfo: InventoryItem_Base_F { class ItemInfo: InventoryItem_Base_F {
mass = 0.5; mass = 0.5;

View File

@ -1,24 +1,23 @@
/* /*
Name: AGM_Artillery_fnc_dev_buildTable * Author: PabstMirror
* DEV function to build mortar tables, very cpu intensive (never used durring normal gameplay)
Author: Pabst Mirror *
* Arguments:
Description: * 0: Muzzle Velocity <NUMBER>
DEV function to build mortar tables, very cpu intensive (never used durring normal gameplay) * 1: Air Friction <NUMBER>
*
Parameters: (normal BIS "Fired" EH stuff) * Return Value:
0: NUMBER - Muzzle Velocity * <Data in clipboard>
1: NUMBER - Air Friction *
* Example:
Returns: * [100, -0.0001] spawn ace_mk6mortar_fnc_dev_buildTable; //spawn (scheduled) is slower
Data in clipboard * [100, -0.0001] call ace_mk6mortar_fnc_dev_buildTable; //faster, but will lock while processing
*
Example: * Public: No
[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
*/
#include "script_component.hpp" #include "script_component.hpp"
private ["_muzzleVelocity", "_airFriction", "_stillInRange", "_currentRange", "_increasePerRow", "_outputArray", "_rangeToHit", "_lineElevation", "_lineHeightElevation", "_lineTimeOfFlight", "_lineCrosswindDeg", "_lineHeadwindMeters", "_lineTailWindMeters", "_lineTempDec", "_lineTempInc", "_lineAirDensDec", "_lineAirDensInc", "_result", "_outputString"]; private ["_muzzleVelocity", "_airFriction", "_stillInRange", "_currentRange", "_increasePerRow", "_outputArray", "_rangeToHit", "_lineElevation", "_lineHeightElevation", "_lineTimeOfFlight", "_lineCrosswindDeg", "_lineHeadwindMeters", "_lineTailWindMeters", "_lineTempDec", "_lineTempInc", "_lineAirDensDec", "_lineAirDensInc", "_result", "_outputString"];
_muzzleVelocity = _this select 0; _muzzleVelocity = _this select 0;
@ -32,28 +31,28 @@ _outputArray = [];
//[_rangeToHit, _lineElevation, _lineHeightElevation, _lineTimeOfFlight, _lineCrosswindDeg, _lineHeadwindMeters, _lineTailWindMeters, _lineTempDec, _lineTempInc, _lineAirDensDec, _lineAirDensInc] //[_rangeToHit, _lineElevation, _lineHeightElevation, _lineTimeOfFlight, _lineCrosswindDeg, _lineHeadwindMeters, _lineTailWindMeters, _lineTempDec, _lineTempInc, _lineAirDensDec, _lineAirDensInc]
while {_stillInRange} do { while {_stillInRange} do {
_result = [_muzzleVelocity, _currentRange, _airFriction] call FUNC(dev_simulateCalcRangeTableLine); _result = [_muzzleVelocity, _currentRange, _airFriction] call FUNC(dev_simulateCalcRangeTableLine);
if (_result isEqualTo []) then { if (_result isEqualTo []) then {
_stillInRange = false; _stillInRange = false;
} else { } else {
if ((_result select 1) < 86) then { if ((_result select 1) < 86) then {
_outputArray pushBack [ _outputArray pushBack [
([(_result select 0), "meters", false] call FUNC(dev_formatNumber)), ([(_result select 0), "meters", false] call FUNC(dev_formatNumber)),
([(_result select 1), "mil", true] call FUNC(dev_formatNumber)), ([(_result select 1), "mil", true] call FUNC(dev_formatNumber)),
([(_result select 2), "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 3), "sec", false] call FUNC(dev_formatNumber)),
([(_result select 4), "milPrecise", true] call FUNC(dev_formatNumber)), ([(_result select 4), "milPrecise", true] call FUNC(dev_formatNumber)),
([(_result select 5), "metersprecise", false] call FUNC(dev_formatNumber)), ([(_result select 5), "metersprecise", false] call FUNC(dev_formatNumber)),
([(_result select 6), "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 7), "metersprecise", false] call FUNC(dev_formatNumber)),
([(_result select 8), "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 9), "metersprecise", false] call FUNC(dev_formatNumber)),
([(_result select 10), "metersprecise", false] call FUNC(dev_formatNumber)) ([(_result select 10), "metersprecise", false] call FUNC(dev_formatNumber))
]; ];
};
_currentRange = _currentRange + _increasePerRow;
}; };
_currentRange = _currentRange + _increasePerRow; hintSilent str _currentRange;
};
hint str _currentRange;
}; };
//handle floating point rounding errors //handle floating point rounding errors
@ -62,14 +61,14 @@ _outputString = format ["case ((abs(_muzzleVelocity - %1) < 0.00001) && ((abs(_a
", _muzzleVelocity, _airFriction]; ", _muzzleVelocity, _airFriction];
{ {
if (_forEachIndex < ((count _outputArray) - 1)) then { if (_forEachIndex < ((count _outputArray) - 1)) then {
_outputString = _outputString + format ["%1, _outputString = _outputString + format ["%1,
", _x]; ", _x];
} else { } else {
_outputString = _outputString + format ["%1 _outputString = _outputString + format ["%1
] ]
};", _x]; };", _x];
}; };
} forEach _outputArray; } forEach _outputArray;
copyToClipboard _outputString; copyToClipboard _outputString;

View File

@ -4,19 +4,19 @@ Name: AGM_Artillery_fnc_formatNumber
Author: Pabst Mirror Author: Pabst Mirror
Description: Description:
Converts numbers into nicely formated strings. Converts numbers into nicely formated strings.
Parameters: Parameters:
0: NUMBER - Input number 0: NUMBER - Input number
1: STRING - Output type (see case statement) 1: STRING - Output type (see case statement)
2: BOOL - If output type is mil, convert input type from deg->mil 2: BOOL - If output type is mil, convert input type from deg->mil
Returns: Returns:
STRING - Formatted number STRING - Formatted number
Example: Example:
[45, "mil4", true] call AGM_Artillery_fnc_formatNumber = "0800" [45, "mil4", true] call AGM_Artillery_fnc_formatNumber = "0800"
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_theNumber", "_inputType", "_convertToMils", "_decimalPlaces", "_integerPlaces", "_prefix", "_return"]; private ["_theNumber", "_inputType", "_convertToMils", "_decimalPlaces", "_integerPlaces", "_prefix", "_return"];
@ -30,47 +30,47 @@ _integerPlaces = -1;
switch (toLower _inputType) do { switch (toLower _inputType) do {
case ("meters"): { case ("meters"): {
_decimalPlaces = 0; _decimalPlaces = 0;
_integerPlaces = 1; _integerPlaces = 1;
}; };
case ("metersprecise"): { case ("metersprecise"): {
_decimalPlaces = 1; _decimalPlaces = 1;
_integerPlaces = 1; _integerPlaces = 1;
}; };
case ("meters4"): { case ("meters4"): {
_decimalPlaces = 0; _decimalPlaces = 0;
_integerPlaces = 4; _integerPlaces = 4;
}; };
case ("deg3precise"): { case ("deg3precise"): {
_decimalPlaces = 2; _decimalPlaces = 2;
_integerPlaces = 3; _integerPlaces = 3;
}; };
case ("mil"): { case ("mil"): {
_decimalPlaces = 0; _decimalPlaces = 0;
_integerPlaces = 1; _integerPlaces = 1;
if (_convertToMils) then { if (_convertToMils) then {
_theNumber = _theNumber * (6400 / 360); _theNumber = _theNumber * (6400 / 360);
};
}; };
};
case ("mil4"): { case ("mil4"): {
_decimalPlaces = 0; _decimalPlaces = 0;
_integerPlaces = 4; _integerPlaces = 4;
if (_convertToMils) then { if (_convertToMils) then {
_theNumber = _theNumber * (6400 / 360); _theNumber = _theNumber * (6400 / 360);
};
}; };
};
case ("milprecise"): { case ("milprecise"): {
_decimalPlaces = 1; _decimalPlaces = 1;
_integerPlaces = 1; _integerPlaces = 1;
if (_convertToMils) then { if (_convertToMils) then {
_theNumber = _theNumber * (6400 / 360); _theNumber = _theNumber * (6400 / 360);
};
}; };
};
case ("sec"): { case ("sec"): {
_decimalPlaces = 1; _decimalPlaces = 1;
_integerPlaces = 1; _integerPlaces = 1;
}; };
default {systemChat format ["badtype %1", _inputType];}; default {systemChat format ["badtype %1", _inputType];};
}; };

View File

@ -1,26 +1,25 @@
/* /*
Name: FUNC(simulateFindSolution) * Author: PabstMirror
* DEV to find a firing solution for a given range
Author: Pabst Mirror *
* Arguments:
Description: * 0: Range to Hit (Meters)<NUMBER>
Converts numbers into nicely formated strings. * 1: Height To Hit (Meters)<NUMBER>
* 2: Muzzle Velocity (M/S)<NUMBER>
Parameters: * 3: Air Friction <NUMBER>
0: NUMBER - Range to Hit (Meters) * 4: Time Step (seconds) (eg 1/50 will simulate 50 cycles per second) <NUMBER>
1: NUMBER - Height To Hit (Meters) *
2: NUMBER - Muzzle Velocity (M/S) * Return Value:
3: NUMBER - Air Friction * ARRAY - [NUMBER - Elevation In Degrees, NUMBER - Shot Durration]
4: NUMBER - Time Step (seconds) (eg 1/50 will simulate 50 cycles per second) *
* Example:
Returns: * [_rangeToHit, _heightToHit, _muzzleVelocity, _airFriction, TIME_STEP] call FUNC(simulateFindSolution);
ARRAY - [NUMBER - Elevation In Degrees, NUMBER - Shot Durration] *
* Public: No
Example: */
[_rangeToHit, _heightToHit, _muzzleVelocity, _airFriction, TIME_STEP] call FUNC(simulateFindSolution);
*/
#include "script_component.hpp" #include "script_component.hpp"
private ["_rangeToHit", "_heightToHit", "_muzzleVelocity", "_airFriction", "_maxElev", "_minElev", "_error", "_solutionElevation", "_lastTestResult", "_numberOfAttempts"]; private ["_rangeToHit", "_heightToHit", "_muzzleVelocity", "_airFriction", "_maxElev", "_minElev", "_error", "_solutionElevation", "_lastTestResult", "_numberOfAttempts"];
#define MAX_ATTEMPTS 22 #define MAX_ATTEMPTS 22
@ -41,15 +40,15 @@ _numberOfAttempts = 0;
//(binary search) //(binary search)
while {(_numberOfAttempts < MAX_ATTEMPTS) && ((abs _error) > 0.2)} do { while {(_numberOfAttempts < MAX_ATTEMPTS) && ((abs _error) > 0.2)} do {
_numberOfAttempts = _numberOfAttempts + 1; _numberOfAttempts = _numberOfAttempts + 1;
_solutionElevation = (_maxElev + _minElev) / 2; _solutionElevation = (_maxElev + _minElev) / 2;
_lastTestResult = [_solutionElevation, _muzzleVelocity, _airFriction, 15, 1, 0, 0, _heightToHit, _timeStep] call FUNC(dev_simulateShot); _lastTestResult = [_solutionElevation, _muzzleVelocity, _airFriction, 15, 1, 0, 0, _heightToHit, _timeStep] call FUNC(dev_simulateShot);
_error = _rangeToHit - (_lastTestResult select 0); _error = _rangeToHit - (_lastTestResult select 0);
if (_error > 0) then { if (_error > 0) then {
_maxElev = _solutionElevation; //test range was short _maxElev = _solutionElevation; //test range was short
} else { } else {
_minElev = _solutionElevation; //test range was long _minElev = _solutionElevation; //test range was long
}; };
}; };
if (_numberOfAttempts >= MAX_ATTEMPTS) exitWith {[]}; if (_numberOfAttempts >= MAX_ATTEMPTS) exitWith {[]};

View File

@ -1,31 +1,26 @@
/* /*
Name: simulateShot * Author: PabstMirror
* DEV function to build mortar tables, very cpu intensive (never used durring normal gameplay)
Author: Pabst Mirror *
* Arguments:
Description: * 0: Shot Angle (degrees) <NUMBER>
Simulates the path of a fired shell. * 1: Muzzle Velocity (m/s) <NUMBER>
* 2: Air Friction <NUMBER>
Parameters: * 3: Tempeture (degres celcius) <NUMBER>
0: NUMBER - Shot Angle (degrees) * 4: Relative Air Denisty <NUMBER>
1: NUMBER - Muzzle Velocity (m/s) * 5: Tail Wind (m/s) <NUMBER>
2: NUMBER - Air Friction * 6: Cross Wind (m/s) <NUMBER>
3: NUMBER - Tempeture (degres celcius) * 7: Height Of Target (M) <NUMBER>
4: NUMBER - Relative Air Denisty * 8: Time Step (fraction of a second) <NUMBER>
5: NUMBER - Tail Wind (m/s) *
6: NUMBER - Cross Wind (m/s) * Return Value:
7: NUMBER - Height Of Target (M) * <ARRAY> [Distance Traveled<NUMBER>, Shot Time<NUMBER>, Offset (degrees)<NUMBER>]
8: NUMBER - Time Step (fraction of a second) *
* Example:
Returns: * [45, 180, -0.0001, 15, 1, 10, 0, 0, 1/50] call ace_mk6mortar_fnc_dev_simulateShot;
ARRAY - *
NUMBER - Distance Traveld * Public: No
NUMBER - Shot Time */
NUMBER - Offset (degrees)
Example:
[45, 180, -0.0001, 15, 1, 10, 0, 0, 1/50] call simulateShot;
*/
#include "script_component.hpp" #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"]; 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 _kCoefficent = -1 * _relDensity * _airFriction; //save time in the loop and compute once
while {((_currentVelocity select 2) > 0) || ((_currentPos select 2) >= _heightOfTarget)} do { while {((_currentVelocity select 2) > 0) || ((_currentPos select 2) >= _heightOfTarget)} do {
_lastPos = _currentPos; _lastPos = _currentPos;
_aparentWind = _wind vectorDiff _currentVelocity; _aparentWind = _wind vectorDiff _currentVelocity;
_changeInVelocity = _gravity vectorAdd (_aparentWind vectorMultiply ((vectorMagnitude _aparentWind) * _kCoefficent)); _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); _currentPos = _currentPos vectorAdd (_currentVelocity vectorMultiply _timeStep);
_currentTime = _currentTime + _timeStep; _currentTime = _currentTime + _timeStep;
}; };
//Uses linearConversion to get a weighted average betwen points before and after dropping below target height //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)); _middleTotalTravelTime = _currentTime - (_timeStep * (1-_linConversion));
//Find shot offset (from crosswind), in degrees //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] [(_middlePos select 1), _middleTotalTravelTime, _offsetDeg]

View File

@ -15,7 +15,7 @@
* Nothing * Nothing
* *
* Example: * Example:
* [clientFiredBIS-XEH] call ace_mk6mortars_fnc_handleFired * [clientFiredBIS-XEH] call ace_mk6mortar_fnc_handleFired
* *
* Public: No * Public: No
*/ */
@ -26,27 +26,29 @@ disableSerialization;
PARAMS_7(_vehicle,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); PARAMS_7(_vehicle,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
if (!GVAR(airResistanceEnabled)) exitWith {}; if (!GVAR(airResistanceEnabled)) exitWith {};
// Large enough distance to not simulate any wind deflection
if (_unit distance ACE_player > 3000) exitWith {false}; // 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: //AI will have no clue how to use:
_shooterMan = gunner _vehicle; _shooterMan = gunner _vehicle;
if (!([_shooterMan] call EFUNC(common,isPlayer))) exitWith {false}; 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: //Hack Until these are intergrated:
if (isNil QEGVAR(weather,currentRelativeDensity)) then { if (isNil QEGVAR(weather,currentRelativeDensity)) then {
EGVAR(weather,currentRelativeDensity) = 1; EGVAR(weather,currentRelativeDensity) = 1;
}; };
if (isNil QEGVAR(weather,currentTemperature)) then { if (isNil QEGVAR(weather,currentTemperature)) then {
EGVAR(weather,currentTemperature) = 20; EGVAR(weather,currentTemperature) = 15;
}; };
//powder effects: //powder effects:
_temperature = EGVAR(weather,currentTemperature); _temperature = EGVAR(weather,currentTemperature);
_newMuzzleVelocityCoefficent = (((_temperature + 273.13) / 288.13 - 1) / 40 + 1); _newMuzzleVelocityCoefficent = (((_temperature + 273.13) / 288.13 - 1) / 40 + 1);
systemChat str _newMuzzleVelocityCoefficent;
if (_newMuzzleVelocityCoefficent != 1) then { if (_newMuzzleVelocityCoefficent != 1) then {
_bulletVelocity = velocity _projectile; _bulletVelocity = velocity _projectile;
_bulletSpeed = vectorMagnitude _bulletVelocity; _bulletSpeed = vectorMagnitude _bulletVelocity;
@ -55,8 +57,8 @@ if (_newMuzzleVelocityCoefficent != 1) then {
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
}; };
systemChat format ["PFEH for %1", _ammo];
// if (_bullet isKindOf "BulletBase") then {
[{ [{
private ["_deltaT", "_bulletVelocity", "_bulletSpeed", "_trueVelocity", "_trueSpeed", "_dragRef", "_accelRef", "_drag", "_accel"]; private ["_deltaT", "_bulletVelocity", "_bulletSpeed", "_trueVelocity", "_trueSpeed", "_dragRef", "_accelRef", "_drag", "_accel"];
PARAMS_2(_args,_pfID); PARAMS_2(_args,_pfID);
@ -72,17 +74,13 @@ if (_newMuzzleVelocityCoefficent != 1) then {
_bulletVelocity = velocity _shell; _bulletVelocity = velocity _shell;
_bulletSpeed = vectorMagnitude _bulletVelocity; _bulletSpeed = vectorMagnitude _bulletVelocity;
if (vectorMagnitude ACE_wind > 0) then { _trueVelocity = _bulletVelocity vectorDiff ACE_wind;
_trueVelocity = _bulletVelocity vectorDiff ACE_wind; _trueSpeed = vectorMagnitude _trueVelocity;
_trueSpeed = vectorMagnitude _trueVelocity;
_drag = _deltaT * _airFriction * _trueSpeed * EGVAR(weather,currentRelativeDensity); _drag = _deltaT * _airFriction * _trueSpeed * EGVAR(weather,currentRelativeDensity);
_accel = _trueVelocity vectorMultiply (_drag); _accel = _trueVelocity vectorMultiply (_drag);
_bulletVelocity = _bulletVelocity vectorAdd _accel;
_bulletVelocity = _bulletVelocity vectorAdd _accel;
};
_shell setVelocity _bulletVelocity; _shell setVelocity _bulletVelocity;
}, 0, [_projectile, MK6_82mm_AIR_FRICTION, time]] call CBA_fnc_addPerFrameHandler; }, 0, [_projectile, MK6_82mm_AIR_FRICTION, time]] call CBA_fnc_addPerFrameHandler;
// };

View File

@ -10,6 +10,7 @@
* No * No
* *
* Example: * Example:
* [bob, mortar] call ace_mk6mortar_fnc_handlePlayerVehicleChanged;
* *
* Public: No * Public: No
*/ */
@ -48,7 +49,7 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes")
_currentFireMode = (weaponState [_mortarVeh, [0]]) select 2; _currentFireMode = (weaponState [_mortarVeh, [0]]) select 2;
_currentChargeMode = _fireModes find _currentFireMode; _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; _chargeText ctrlSetStructuredText parseText _text;
if (shownArtilleryComputer && {!GVAR(allowComputerRangefinder)}) then { if (shownArtilleryComputer && {!GVAR(allowComputerRangefinder)}) then {
//Don't like this solution, but it works //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]; _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: //Update CurrentElevation Display:
_elevDeg = parseNumber ctrlText (_display displayCtrl 175); if (_notGunnerView) then {
if (_useMils) then { (_display displayCtrl 80175) ctrlSetText "";
(_display displayCtrl 80175) ctrlSetText str round (_elevDeg * 6400 / 360);
} else { } 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: //Update ElevationNeeded Display:
if (!GVAR(allowComputerRangefinder)) then { if (_notGunnerView || (!GVAR(allowComputerRangefinder))) then {
(_display displayCtrl 80176) ctrlSetText ""; (_display displayCtrl 80176) ctrlSetText "";
} else { } else {
_elevDeg = parseNumber ctrlText (_display displayCtrl 176); _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)); (_display displayCtrl 80176) ctrlSetText (ctrlText (_display displayCtrl 176));
} else { } else {
if (_useMils) then { if (_useMils) then {
@ -84,7 +92,7 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes")
}; };
//Update Heading Display: //Update Heading Display:
if (!GVAR(allowCompass)) then { if (_notGunnerView || (!GVAR(allowCompass))) then {
(_display displayCtrl 80156) ctrlSetText ""; (_display displayCtrl 80156) ctrlSetText "";
} else { } else {
_rotationDegrees = ((getDir _mortarVeh) + (((-180 / PI) * (_mortarVeh animationPhase "mainTurret")) + 360)) % 360; _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; }, 0, [_newVehicle, _chargeText,_fireModes]] call CBA_fnc_addPerFrameHandler;

View File

@ -11,7 +11,7 @@
* None * None
* *
* Example: * Example:
* * [fromModule] call ace_mk6mortar_fnc_moduleInit
* *
* Public: No * Public: No
*/ */

View File

@ -9,7 +9,7 @@
* No * No
* *
* Example: * Example:
* * [] call ace_mk6mortar_fnc_rangeTableOpen
* *
* Public: No * Public: No
*/ */
@ -38,7 +38,7 @@ _muzzleVelocities = [];
_showToPlayer = getNumber (configFile >> "CfgWeapons" >> _weaponName >> _x >> "showToPlayer"); _showToPlayer = getNumber (configFile >> "CfgWeapons" >> _weaponName >> _x >> "showToPlayer");
if (_showToPlayer == 1) then { if (_showToPlayer == 1) then {
_artilleryCharge = getNumber (configFile >> "CfgWeapons" >> _weaponName >> _x >> "artilleryCharge"); _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)]; LIST_CHARGE lbSetData [(count _muzzleVelocities), str (_artilleryCharge * _initSpeed)];
_muzzleVelocities pushBack _artilleryCharge; _muzzleVelocities pushBack _artilleryCharge;
}; };

View File

@ -9,7 +9,7 @@
* No * No
* *
* Example: * Example:
* * [] call ace_mk6mortar_fnc_rangeTablePageChange
* *
* Public: No * Public: No
*/ */

View File

@ -11,7 +11,7 @@
* <ARRAY> * <ARRAY>
* *
* Example: * Example:
* * [200, 0] call ace_mk6mortar_fnc_rangeTablePreCalculatedValues
* *
* Public: No * Public: No
*/ */

View File

@ -9,6 +9,7 @@
* None * None
* *
* Example: * Example:
* [] call ace_mk6mortar_fnc_turretDisplayLoaded
* *
* Public: No * 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 (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") #define CTRL_CA_ELEV_NEED (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_ELEV_NEED")
disableSerialization; disableSerialization;
// PARAMS_1(_display);
_display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull]; _display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull];
if (isNull _display) exitWith {}; if (isNull _display) exitWith {};

View File

@ -1,9 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2015-04-05 --> <!-- Edited with tabler - 2015-04-06 -->
<Project name="ACE"> <Project name="ACE">
<Package name="mk6mortar"> <Package name="mk6mortar">
<Key ID="STR_ACE_mk6mortar_useMils"> <Key ID="STR_ACE_MK6MORTAR_rangetable_name">
<English>Mk6 Mortar: Show Angle in MILS</English> <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> </Key>
</Package> </Package>
</Project> </Project>