mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #334 from acemod/mk6tweaks
Vanilla Mortars - Rangetables/Tweaks
This commit is contained in:
commit
6b5fa25ba9
1
addons/mk6mortar/$PBOPREFIX$
Normal file
1
addons/mk6mortar/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\Addons\mk6mortar
|
17
addons/mk6mortar/CfgEventHandlers.hpp
Normal file
17
addons/mk6mortar/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) );
|
||||
};
|
||||
};
|
||||
class Extended_FiredBIS_EventHandlers {
|
||||
class Mortar_01_base_F {
|
||||
class ADDON {
|
||||
firedBIS = QUOTE(_this call FUNC(handleFired));
|
||||
};
|
||||
};
|
||||
};
|
83
addons/mk6mortar/CfgVehicles.hpp
Normal file
83
addons/mk6mortar/CfgVehicles.hpp
Normal file
@ -0,0 +1,83 @@
|
||||
class CfgVehicles {
|
||||
class Man;
|
||||
class CAManBase: Man {
|
||||
class ACE_SelfActions {
|
||||
class ACE_Equipment {
|
||||
class GVAR(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"};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class LandVehicle;
|
||||
class StaticWeapon: LandVehicle {
|
||||
class Turrets {
|
||||
class MainTurret;
|
||||
};
|
||||
};
|
||||
class StaticMortar: StaticWeapon {
|
||||
class Turrets: Turrets {
|
||||
class MainTurret: MainTurret {
|
||||
};
|
||||
};
|
||||
};
|
||||
class Mortar_01_base_F: StaticMortar {
|
||||
class Turrets: Turrets {
|
||||
class MainTurret: MainTurret {
|
||||
turretInfoType = "ACE_Mk6_RscWeaponRangeArtillery";
|
||||
};
|
||||
};
|
||||
class ACE_SelfActions {
|
||||
class GVAR(toggleMils) {
|
||||
displayName = "Toggle MILS";
|
||||
condition = QUOTE(true);
|
||||
statement = QUOTE(_this call FUNC(toggleMils));
|
||||
exceptions[] = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Logic;
|
||||
class Module_F: Logic {
|
||||
class ModuleDescription {};
|
||||
};
|
||||
class GVAR(module): Module_F {
|
||||
author = "$STR_ACE_Common_ACETeam";
|
||||
category = "ACE";
|
||||
displayName = "MK6 Settings";
|
||||
function = QFUNC(moduleInit);
|
||||
scope = 2;
|
||||
isGlobal = 0;
|
||||
icon = QUOTE(PATHTOF(UI\Icon_Module_mk6_ca.paa));
|
||||
functionPriority = 0;
|
||||
class Arguments {
|
||||
class airResistanceEnabled {
|
||||
displayName = "Air Resitance";
|
||||
description = "For Player Shots, Model Air Restiance and Wind Effects";
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class allowComputerRangefinder {
|
||||
displayName = "Allow MK6 Computer";
|
||||
description = "Show the Computer and Rangefinder (these NEED to be removed if you enable air resistance)";
|
||||
typeName = "BOOL";
|
||||
defaultValue = 0;
|
||||
};
|
||||
class allowCompass {
|
||||
displayName = "Allow MK6 Compass";
|
||||
description = "Show the MK6 Digital Compass";
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
};
|
||||
class ModuleDescription: ModuleDescription {
|
||||
description = "";
|
||||
};
|
||||
};
|
||||
};
|
15
addons/mk6mortar/CfgWeapons.hpp
Normal file
15
addons/mk6mortar/CfgWeapons.hpp
Normal file
@ -0,0 +1,15 @@
|
||||
class CfgWeapons {
|
||||
class ACE_ItemCore;
|
||||
class InventoryItem_Base_F;
|
||||
|
||||
class ACE_RangeTable_82mm: ACE_ItemCore {
|
||||
author = "$STR_ACE_Common_ACETeam";
|
||||
scope = 2;
|
||||
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;
|
||||
};
|
||||
};
|
||||
};
|
10
addons/mk6mortar/README.md
Normal file
10
addons/mk6mortar/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
ace_mk6mortar
|
||||
==========
|
||||
|
||||
Tweaks the mk6 mortar from Arma3
|
||||
|
||||
## Maintainers
|
||||
|
||||
The people responsible for merging changes to this component or answering potential questions.
|
||||
|
||||
- [PabstMirror](https://github.com/PabstMirror)
|
44
addons/mk6mortar/RscInGameUI.hpp
Normal file
44
addons/mk6mortar/RscInGameUI.hpp
Normal file
@ -0,0 +1,44 @@
|
||||
class RscInGameUI {
|
||||
class RscWeaponRangeArtillery {
|
||||
class CA_IGUI_elements_group: RscControlsGroup {};
|
||||
};
|
||||
class ACE_Mk6_RscWeaponRangeArtillery: RscWeaponRangeArtillery {
|
||||
onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_Mk6_RscWeaponRangeArtillery',(_this select 0))]; _this call FUNC(turretDisplayLoaded););
|
||||
controls[] = {"ACE_MILS_GROUP", "CA_IGUI_elements_group","CA_RangeElements_group"};
|
||||
class ACE_MILS_GROUP: CA_IGUI_elements_group {
|
||||
idc = 80170;
|
||||
class controls {
|
||||
class CA_Heading_MILS: RscText {
|
||||
idc = 80156;
|
||||
style = 2;
|
||||
colorText[] = {0.706,0.0745,0.0196,1};
|
||||
sizeEx = "0.028*SafezoneH";
|
||||
shadow = 0;
|
||||
font = "EtelkaMonospacePro";
|
||||
text = "015";
|
||||
x = "25.0 * (0.01875 * SafezoneH)";
|
||||
y = "6.3 * (0.025 * SafezoneH)";
|
||||
w = "3.3333 * (0.01875 * SafezoneH)";
|
||||
h = "1 * (0.025 * SafezoneH)";
|
||||
};
|
||||
class CA_Elev_MILS: RscText {
|
||||
idc = 80175;
|
||||
style = 1;
|
||||
sizeEx = "0.038*SafezoneH";
|
||||
colorText[] = {0.706,0.0745,0.0196,1};
|
||||
shadow = 0;
|
||||
font = "EtelkaMonospacePro";
|
||||
text = "80.5";
|
||||
x = "36.8 * (0.01875 * SafezoneH)";
|
||||
y = "29.3 * (0.025 * SafezoneH)";
|
||||
w = "5.2 * (0.01875 * SafezoneH)";
|
||||
h = "1.2 * (0.025 * SafezoneH)";
|
||||
};
|
||||
class CA_Elev_Need_MILS: CA_Elev_MILS {
|
||||
idc = 80176;
|
||||
y = "30.8 * (0.025 * SafezoneH)";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
87
addons/mk6mortar/RscRangeTable.hpp
Normal file
87
addons/mk6mortar/RscRangeTable.hpp
Normal file
@ -0,0 +1,87 @@
|
||||
class ACE_82mm_RangeTable_Dialog {
|
||||
idd = -1;
|
||||
movingEnable = 1;
|
||||
onLoad = "uiNamespace setVariable ['ACE_82mm_RangeTable_Dialog', _this select 0];";
|
||||
objects[] = {};
|
||||
|
||||
class ControlsBackground {
|
||||
class TableBackground: RscPicture {
|
||||
idc = -1;
|
||||
text = QUOTE(PATHTOF(UI\RangeTable_background.paa));
|
||||
x = "18 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
|
||||
y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
|
||||
w = "16.2634559672906 * (safeZoneH / 40)";
|
||||
h = "23 * ((safeZoneH / 1.2) / 25)";
|
||||
colorBackground[] = {1,1,1,1};
|
||||
};
|
||||
class ChargeBackground: RscText {
|
||||
idc = -1;
|
||||
x = "14 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
|
||||
y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
|
||||
w = "4 * (safeZoneH / 40)";
|
||||
h = "5 * ((safeZoneH / 1.2) / 25)";
|
||||
colorBackground[] = {0,0,0,1};
|
||||
};
|
||||
};
|
||||
class controls {
|
||||
class TheTable: RscListNBox {
|
||||
idc = 20001;
|
||||
// style = ST_CENTER + ST_MULTI + LB_TEXTURES;
|
||||
// style = ST_LEFT + ST_MULTI + LB_TEXTURES;
|
||||
// style = LB_MULTI + ST_LEFT; // Style
|
||||
x = "18 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
|
||||
y = "3.76 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
|
||||
w = "16.2634559672906 * (safeZoneH / 40)";
|
||||
h = "20.24 * ((safeZoneH / 1.2) / 25)";
|
||||
columns[] = {(10/867),(86/867),(171/867),(238/867),(320/867),(405/867),
|
||||
(485/867),(546/867),(607/867),(668/867),(729/867),(790/867)};
|
||||
rowHeight = 0.015 * safeZoneH;
|
||||
sizeEx = "0.014 * safeZoneH";
|
||||
font = "EtelkaMonospacePro";
|
||||
drawSideArrows = 1;
|
||||
idcLeft = 14124;
|
||||
idcRight = 412343243;
|
||||
colorText[] = {0, 0, 0, 1};
|
||||
shadow = "0";
|
||||
// colorBorder[] = {1,0,0,1};
|
||||
// colorBackground[] = {1, 0, 0, 1};
|
||||
colorSelectBackground[] = {0, 0, 0, 0.025};
|
||||
colorSelectBackground2[] = {0, 0, 0, 0.025};
|
||||
colorScrollbar[] = {0.95,0,0.95,1};
|
||||
class ListScrollBar: ScrollBar{
|
||||
color[] = {0,0,0,0.6};
|
||||
};
|
||||
};
|
||||
class ChargeListBox: RscListbox {
|
||||
idc = 1501;
|
||||
style = ST_RIGHT;
|
||||
x = "14 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
|
||||
y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
|
||||
w = "4 * (safeZoneH / 40)";
|
||||
h = "5 * ((safeZoneH / 1.2) / 25)";
|
||||
onLBSelChanged = QUOTE(_this call FUNC(rangeTablePageChange));
|
||||
};
|
||||
class CloseBackground: RscText {
|
||||
idc = -1;
|
||||
x = "33.7634559672906 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
|
||||
y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
|
||||
w = "0.5 * (safeZoneH / 40)";
|
||||
h = "0.5 * ((safeZoneH / 1.2) / 25)";
|
||||
colorBackground[] = {0,0,0,0.5};
|
||||
};
|
||||
class CloseActiveText: RscActiveText {
|
||||
idc = -1;
|
||||
style = 48;
|
||||
color[] = {1,1,1,0.7};
|
||||
text = "A3\Ui_f\data\GUI\Rsc\RscDisplayArcadeMap\icon_exit_cross_ca.paa";
|
||||
x = "33.7634559672906 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
|
||||
y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
|
||||
w = "0.5 * (safeZoneH / 40)";
|
||||
h = "0.5 * ((safeZoneH / 1.2) / 25)";
|
||||
colorText[] = {1,1,1,0.7};
|
||||
colorActive[] = {1,1,1,1};
|
||||
tooltip = "Close";
|
||||
onButtonClick = "closeDialog 0";
|
||||
};
|
||||
};
|
||||
};
|
BIN
addons/mk6mortar/UI/Icon_Module_mk6_ca.paa
Normal file
BIN
addons/mk6mortar/UI/Icon_Module_mk6_ca.paa
Normal file
Binary file not shown.
BIN
addons/mk6mortar/UI/RangeTable_background.paa
Normal file
BIN
addons/mk6mortar/UI/RangeTable_background.paa
Normal file
Binary file not shown.
BIN
addons/mk6mortar/UI/icon_rangeTable.paa
Normal file
BIN
addons/mk6mortar/UI/icon_rangeTable.paa
Normal file
Binary file not shown.
BIN
addons/mk6mortar/UI/ui_charges.paa
Normal file
BIN
addons/mk6mortar/UI/ui_charges.paa
Normal file
Binary file not shown.
5
addons/mk6mortar/XEH_clientInit.sqf
Normal file
5
addons/mk6mortar/XEH_clientInit.sqf
Normal file
@ -0,0 +1,5 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
["playerVehicleChanged", {_this call FUNC(handlePlayerVehicleChanged);}] call EFUNC(common,addEventHandler);
|
21
addons/mk6mortar/XEH_preInit.sqf
Normal file
21
addons/mk6mortar/XEH_preInit.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(dev_buildTable);
|
||||
PREP(dev_formatNumber);
|
||||
PREP(dev_simulateCalcRangeTableLine);
|
||||
PREP(dev_simulateFindSolution);
|
||||
PREP(dev_simulateShot);
|
||||
|
||||
PREP(handleFired);
|
||||
PREP(handlePlayerVehicleChanged);
|
||||
PREP(moduleInit);
|
||||
PREP(rangeTableCanUse);
|
||||
PREP(rangeTableOpen);
|
||||
PREP(rangeTablePageChange);
|
||||
PREP(rangeTablePreCalculatedValues);
|
||||
PREP(toggleMils);
|
||||
PREP(turretDisplayLoaded);
|
||||
|
||||
ADDON = true;
|
47
addons/mk6mortar/config.cpp
Normal file
47
addons/mk6mortar/config.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
weapons[] = {"ACE_RangeTable_82mm"};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_interaction"};
|
||||
author[] = {"PabstMirror"};
|
||||
authorUrl = "https://github.com/acemod";
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
|
||||
class RscText;
|
||||
class RscListbox;
|
||||
class RscListNBox;
|
||||
class RscPicture;
|
||||
class RscControlsGroup;
|
||||
class ScrollBar;
|
||||
class RscActiveText;
|
||||
|
||||
#include "RscInGameUI.hpp"
|
||||
#include "RscRangeTable.hpp"
|
||||
|
||||
class ACE_Settings {
|
||||
//These settings effect gameplay difficutly: defaults will leave the mortar the same as vanilla
|
||||
class GVAR(airResistanceEnabled) {
|
||||
value = 0;
|
||||
typeName = "BOOL";
|
||||
isClientSetable = 0;
|
||||
};
|
||||
class GVAR(allowComputerRangefinder) {
|
||||
value = 1;
|
||||
typeName = "BOOL";
|
||||
isClientSetable = 0;
|
||||
};
|
||||
class GVAR(allowCompass) {
|
||||
value = 1;
|
||||
typeName = "BOOL";
|
||||
isClientSetable = 0;
|
||||
};
|
||||
};
|
87
addons/mk6mortar/functions/fnc_dev_buildTable.sqf
Normal file
87
addons/mk6mortar/functions/fnc_dev_buildTable.sqf
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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;
|
||||
_airFriction = _this select 1;
|
||||
_stillInRange = true;
|
||||
_currentRange = 100;
|
||||
_increasePerRow = 50;
|
||||
_outputArray = [];
|
||||
|
||||
|
||||
//[_rangeToHit, _lineElevation, _lineHeightElevation, _lineHeightTimeDelta, _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 (_airFriction == 0) then {
|
||||
_result set [4, 0];
|
||||
_result set [5, 0];
|
||||
_result set [6, 0];
|
||||
_result set [7, 0];
|
||||
_result set [8, 0];
|
||||
_result set [9, 0];
|
||||
_result set [10, 0];
|
||||
};
|
||||
if ((_result select 1) < 88) 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), "sec", false] call FUNC(dev_formatNumber)),
|
||||
([(_result select 5), "milPrecise", true] 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 select 11), "metersprecise", false] call FUNC(dev_formatNumber))
|
||||
];
|
||||
};
|
||||
_currentRange = _currentRange + _increasePerRow;
|
||||
};
|
||||
hintSilent str _currentRange;
|
||||
};
|
||||
|
||||
//handle floating point rounding errors
|
||||
_outputString = format ["case ((abs(_muzzleVelocity - %1) < 0.00001) && {(abs(_airFriction - %2) < 0.00001)}): {
|
||||
[
|
||||
", _muzzleVelocity, _airFriction];
|
||||
|
||||
{
|
||||
if (_forEachIndex < ((count _outputArray) - 1)) then {
|
||||
_outputString = _outputString + format ["%1,
|
||||
", _x];
|
||||
} else {
|
||||
_outputString = _outputString + format ["%1
|
||||
]
|
||||
};", _x];
|
||||
};
|
||||
} forEach _outputArray;
|
||||
|
||||
copyToClipboard _outputString;
|
||||
rangeTableOutput = _outputString;
|
||||
|
||||
hint "done";
|
80
addons/mk6mortar/functions/fnc_dev_formatNumber.sqf
Normal file
80
addons/mk6mortar/functions/fnc_dev_formatNumber.sqf
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
Author: Pabst Mirror
|
||||
|
||||
Description:
|
||||
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
|
||||
|
||||
Returns:
|
||||
STRING - Formatted number
|
||||
|
||||
Example:
|
||||
[45, "mil4", true] call ace_mk6mortar_fnc_dev_formatNumber = "0800"
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_theNumber", "_inputType", "_convertToMils", "_decimalPlaces", "_integerPlaces", "_prefix", "_return"];
|
||||
|
||||
_theNumber = _this select 0;
|
||||
_inputType = _this select 1;
|
||||
_convertToMils = _this select 2;
|
||||
|
||||
_decimalPlaces = -1;
|
||||
_integerPlaces = -1;
|
||||
|
||||
switch (toLower _inputType) do {
|
||||
case ("meters"): {
|
||||
_decimalPlaces = 0;
|
||||
_integerPlaces = 1;
|
||||
};
|
||||
case ("metersprecise"): {
|
||||
_decimalPlaces = 1;
|
||||
_integerPlaces = 1;
|
||||
};
|
||||
case ("meters4"): {
|
||||
_decimalPlaces = 0;
|
||||
_integerPlaces = 4;
|
||||
};
|
||||
case ("deg3precise"): {
|
||||
_decimalPlaces = 2;
|
||||
_integerPlaces = 3;
|
||||
};
|
||||
case ("mil"): {
|
||||
_decimalPlaces = 0;
|
||||
_integerPlaces = 1;
|
||||
if (_convertToMils) then {
|
||||
_theNumber = _theNumber * (6400 / 360);
|
||||
};
|
||||
};
|
||||
case ("mil4"): {
|
||||
_decimalPlaces = 0;
|
||||
_integerPlaces = 4;
|
||||
if (_convertToMils) then {
|
||||
_theNumber = _theNumber * (6400 / 360);
|
||||
};
|
||||
};
|
||||
case ("milprecise"): {
|
||||
_decimalPlaces = 1;
|
||||
_integerPlaces = 1;
|
||||
if (_convertToMils) then {
|
||||
_theNumber = _theNumber * (6400 / 360);
|
||||
};
|
||||
};
|
||||
case ("sec"): {
|
||||
_decimalPlaces = 1;
|
||||
_integerPlaces = 1;
|
||||
};
|
||||
default {systemChat format ["badtype %1", _inputType];};
|
||||
};
|
||||
|
||||
//CBA_fnc_formatNumber is silly: [-9.58545, 1, 1, false] call CBA_fnc_formatNumber == "-9.-6"
|
||||
|
||||
_prefix = if (_theNumber < 0) then {"-"} else {""};
|
||||
|
||||
_return = [abs (_theNumber), _integerPlaces, _decimalPlaces, false] call CBA_fnc_formatNumber;
|
||||
|
||||
(_prefix + _return)
|
@ -0,0 +1,79 @@
|
||||
/*
|
||||
Author: Pabst Mirror
|
||||
|
||||
Description:
|
||||
Builds a rangeTable line for a certian range, given muzzle velocity and air friction, returns [] if out of range.
|
||||
|
||||
Parameters:
|
||||
0: NUMBER - Muzzle Velocity
|
||||
1: NUMBER - Air Friction
|
||||
2: NUMBER - Range To Hit
|
||||
|
||||
Returns:
|
||||
ARRAY - Range Table Line Data (see return line)
|
||||
|
||||
Example:
|
||||
[300, -0.0001, 3000] call ace_mk6mortar_fnc_simulateCalcRangeTableLine
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define TIME_STEP (1/50)
|
||||
|
||||
private ["_startTime", "_muzzleVelocity", "_rangeToHit", "_airFriction", "_vacElevation", "_radicand", "_maxElev", "_minElev", "_error", "_solutionElevation", "_lastTestResult", "_numberOfAttempts", "_lineElevation", "_lineTimeOfFlight", "_lineHeightElevation", "_lineHeightTimeDelta", "_lineCrosswindDeg", "_lineHeadwindMeters", "_lineTailWindMeters", "_result"];
|
||||
|
||||
_startTime = diag_tickTime;
|
||||
|
||||
_muzzleVelocity = _this select 0;
|
||||
_rangeToHit = _this select 1;
|
||||
_airFriction = _this select 2;
|
||||
|
||||
//Run Binary search for correct elevation
|
||||
_solution = [_rangeToHit, 0, _muzzleVelocity, _airFriction, TIME_STEP] call FUNC(dev_simulateFindSolution);
|
||||
if (_solution isEqualTo []) exitWith {[]};
|
||||
|
||||
//Real Elevation
|
||||
_lineElevation = _solution select 0;
|
||||
|
||||
//Time Of Flight:
|
||||
_lineTimeOfFlight = _solution select 1;
|
||||
|
||||
//Height Adjustment for -100m (another binary search)
|
||||
_solution = [_rangeToHit, -100, _muzzleVelocity, _airFriction, TIME_STEP] call FUNC(dev_simulateFindSolution);
|
||||
if (_solution isEqualTo []) exitWith {[]};//should never be triggered (lower elevation easier to hit)
|
||||
|
||||
_lineHeightElevation = ((_solution select 0) - _lineElevation);
|
||||
_lineHeightTimeDelta = (_solution select 1) - _lineTimeOfFlight;
|
||||
|
||||
//Compute for 10x and divide to minimize rounding errors
|
||||
|
||||
//Crosswind
|
||||
_lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, 15, 1, 0, 10, 0, TIME_STEP] call FUNC(dev_simulateShot);
|
||||
_lineCrosswindDeg = (_lastTestResult select 2) / 10;
|
||||
|
||||
//Headwind:
|
||||
_lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, 15, 1, -10, 0, 0, TIME_STEP] call FUNC(dev_simulateShot);
|
||||
_lineHeadwindMeters = (_rangeToHit - (_lastTestResult select 0)) / 10;
|
||||
|
||||
//TailWind:
|
||||
_lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, 15, 1, 10, 0, 0, TIME_STEP] call FUNC(dev_simulateShot);
|
||||
_lineTailWindMeters = (_rangeToHit - (_lastTestResult select 0)) / 10;
|
||||
|
||||
//Air Temp Dec
|
||||
_lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, (15 - 10), 1, 0, 0, 0, TIME_STEP] call FUNC(dev_simulateShot);
|
||||
_lineTempDec = (_rangeToHit - (_lastTestResult select 0)) / 10;
|
||||
|
||||
//Air Temp Inc
|
||||
_lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, (15 + 10), 1, 0, 0, 0, TIME_STEP] call FUNC(dev_simulateShot);
|
||||
_lineTempInc = (_rangeToHit - (_lastTestResult select 0)) / 10;
|
||||
|
||||
//Air Density Dec
|
||||
_lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, 15, 0.9, 0, 0, 0, TIME_STEP] call FUNC(dev_simulateShot);
|
||||
_lineAirDensDec = (_rangeToHit - (_lastTestResult select 0)) / 10;
|
||||
|
||||
//Air Density Inc
|
||||
_lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, 15, 1.1, 0, 0, 0, TIME_STEP] call FUNC(dev_simulateShot);
|
||||
_lineAirDensInc = (_rangeToHit - (_lastTestResult select 0)) / 10;
|
||||
|
||||
// systemChat format ["debug: Range %1 - in %2 sec", _rangeToHit, (diag_tickTime - _startTime)];
|
||||
|
||||
[_rangeToHit, _lineElevation, _lineHeightElevation, _lineHeightTimeDelta, _lineTimeOfFlight, _lineCrosswindDeg, _lineHeadwindMeters, _lineTailWindMeters, _lineTempDec, _lineTempInc, _lineAirDensDec, _lineAirDensInc]
|
55
addons/mk6mortar/functions/fnc_dev_simulateFindSolution.sqf
Normal file
55
addons/mk6mortar/functions/fnc_dev_simulateFindSolution.sqf
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
_rangeToHit = _this select 0;
|
||||
_heightToHit = _this select 1;
|
||||
_muzzleVelocity = _this select 2;
|
||||
_airFriction = _this select 3;
|
||||
_timeStep = _this select 4;
|
||||
|
||||
_maxElev = 90;
|
||||
_minElev = 45; //todo - Low Angle Howitzers???
|
||||
|
||||
_error = 10000;
|
||||
_solutionElevation = -1;
|
||||
_lastTestResult = [];
|
||||
_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
|
||||
};
|
||||
};
|
||||
if (_numberOfAttempts >= MAX_ATTEMPTS) exitWith {[]};
|
||||
|
||||
//return the elevation and time required
|
||||
[_solutionElevation, (_lastTestResult select 1)]
|
73
addons/mk6mortar/functions/fnc_dev_simulateShot.sqf
Normal file
73
addons/mk6mortar/functions/fnc_dev_simulateShot.sqf
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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", "_timeStep", "_wind", "_gravity", "_currentPos", "_currentVelocity", "_currentTime", "_lastPos", "_kCoefficent", "_aparentWind", "_changeInVelocity", "_linConversion", "_middlePos", "_middlePosOld", "_middleTotalTravelTime", "_offsetDeg"];
|
||||
|
||||
_angleDeg = _this select 0;
|
||||
_muzzleVelocity = _this select 1;
|
||||
_airFriction = _this select 2;
|
||||
_temp = _this select 3;
|
||||
_relDensity = _this select 4;
|
||||
_tailWind = _this select 5;
|
||||
_crosswind = _this select 6;
|
||||
_heightOfTarget = _this select 7;
|
||||
_timeStep = _this select 8;
|
||||
|
||||
_wind = [_crosswind, _tailWind, 0];
|
||||
_gravity = [0,0,-9.8];
|
||||
|
||||
_currentPos = [0,0,0];
|
||||
_muzzleVelocity = _muzzleVelocity * (((_temp + 273.13) / 288.13 - 1) / 40 + 1);
|
||||
_currentVelocity = [0, (_muzzleVelocity * cos _angleDeg), (_muzzleVelocity * sin _angleDeg)];
|
||||
|
||||
_currentTime = 0;
|
||||
_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;
|
||||
|
||||
_aparentWind = _wind vectorDiff _currentVelocity;
|
||||
_changeInVelocity = _gravity vectorAdd (_aparentWind vectorMultiply ((vectorMagnitude _aparentWind) * _kCoefficent));
|
||||
|
||||
_currentVelocity = _currentVelocity vectorAdd (_changeInVelocity vectorMultiply _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
|
||||
_linConversion = linearConversion [(_lastPos select 2), (_currentPos select 2), _heightOfTarget, 0, 1, true];
|
||||
_middlePos = (_lastPos vectorMultiply (1 - _linConversion)) vectorAdd (_currentPos vectorMultiply (_linConversion));
|
||||
// _middlePosOld = (_lastPos vectorAdd _currentPos) vectorMultiply 0.5;
|
||||
|
||||
//Same to find travel time
|
||||
_middleTotalTravelTime = _currentTime - (_timeStep * (1-_linConversion));
|
||||
|
||||
//Find shot offset (from crosswind), in degrees
|
||||
_offsetDeg = (_middlePos select 0) aTan2 (_middlePos select 1);
|
||||
|
||||
[(_middlePos select 1), _middleTotalTravelTime, _offsetDeg]
|
89
addons/mk6mortar/functions/fnc_handleFired.sqf
Normal file
89
addons/mk6mortar/functions/fnc_handleFired.sqf
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Called when the mortar is fired.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: mortar - Object the event handler is assigned to <OBJECT>
|
||||
* 1: weapon - Fired weapon <STRING>
|
||||
* 2: muzzle - Muzzle that was used <STRING>
|
||||
* 3: mode - Current mode of the fired weapon <STRING>
|
||||
* 4: ammo - Ammo used <STRING>
|
||||
* 5: magazine - magazine name which was used <STRING>
|
||||
* 6: projectile - Object of the projectile that was shot <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [clientFiredBIS-XEH] call ace_mk6mortar_fnc_handleFired
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_shooterMan", "_bisAirFriction", "_temperature", "_newMuzzleVelocityCoefficent", "_bulletVelocity", "_bulletSpeed", "_muzzleVelocity", "_muzzleVelocityShift"];
|
||||
|
||||
disableSerialization;
|
||||
|
||||
PARAMS_7(_vehicle,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
|
||||
|
||||
if (!GVAR(airResistanceEnabled)) exitWith {};
|
||||
// Large enough distance to not simulate any wind deflection
|
||||
if (_vehicle 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");};
|
||||
|
||||
|
||||
//Calculate air density:
|
||||
_altitude = (getPosASL _vehicle) select 2;
|
||||
#define GET_TEMPERATURE_AT_HEIGHT(h) (EGVAR(weather,currentTemperature) - 0.0065 * (h))
|
||||
_temperature = GET_TEMPERATURE_AT_HEIGHT(_altitude);
|
||||
_pressure = _altitude call EFUNC(weather,calculateBarometricPressure);
|
||||
_relativeHumidity = EGVAR(weather,currentHumidity);
|
||||
_airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity);
|
||||
_relativeDensity = _airDensity / 1.225;
|
||||
|
||||
TRACE_5("FiredWeather",_temperature,_pressure,_relativeHumidity,_airDensity,_relativeDensity);
|
||||
|
||||
//powder effects:
|
||||
_newMuzzleVelocityCoefficent = (((_temperature + 273.13) / 288.13 - 1) / 40 + 1);
|
||||
if (_newMuzzleVelocityCoefficent != 1) then {
|
||||
_bulletVelocity = velocity _projectile;
|
||||
_bulletSpeed = vectorMagnitude _bulletVelocity;
|
||||
_bulletVelocity = (vectorNormalized _bulletVelocity) vectorMultiply (_bulletSpeed * _newMuzzleVelocityCoefficent);
|
||||
_projectile setVelocity _bulletVelocity;
|
||||
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
|
||||
};
|
||||
|
||||
|
||||
[{
|
||||
private ["_deltaT", "_bulletVelocity", "_bulletSpeed", "_trueVelocity", "_trueSpeed", "_dragRef", "_accelRef", "_drag", "_accel"];
|
||||
PARAMS_2(_args,_pfID);
|
||||
EXPLODE_4_PVT(_args,_shell,_airFriction,_time,_relativeDensity);
|
||||
|
||||
if (isNull _shell || {!alive _shell}) exitwith {
|
||||
[_pfID] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
_deltaT = time - _time;
|
||||
_args set[2, time];
|
||||
|
||||
_bulletVelocity = velocity _shell;
|
||||
_bulletSpeed = vectorMagnitude _bulletVelocity;
|
||||
|
||||
_trueVelocity = _bulletVelocity vectorDiff ACE_wind;
|
||||
_trueSpeed = vectorMagnitude _trueVelocity;
|
||||
|
||||
_drag = _deltaT * _airFriction * _trueSpeed * _relativeDensity;
|
||||
_accel = _trueVelocity vectorMultiply (_drag);
|
||||
_bulletVelocity = _bulletVelocity vectorAdd _accel;
|
||||
|
||||
_shell setVelocity _bulletVelocity;
|
||||
|
||||
}, 0, [_projectile, MK6_82mm_AIR_FRICTION, time, _relativeDensity]] call CBA_fnc_addPerFrameHandler;
|
108
addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf
Normal file
108
addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf
Normal file
@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Handles player getting into new vehicle. Loads PFEG for mortar display if it is a mortar.
|
||||
*
|
||||
* Arguments:
|
||||
* 0:Player <OBJECT>
|
||||
* 1: New Vehicle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* No
|
||||
*
|
||||
* Example:
|
||||
* [bob, mortar] call ace_mk6mortar_fnc_handlePlayerVehicleChanged;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_chargeText", "_xPos", "_yPos", "_wPos", "_hPos", "_tubeWeaponName", "_fireModes"];
|
||||
|
||||
PARAMS_2(_player,_newVehicle);
|
||||
|
||||
if (isNull _newVehicle) exitWith {};
|
||||
if (!(_newVehicle isKindOf "Mortar_01_base_F")) exitWith {};
|
||||
|
||||
_chargeText = (findDisplay 46) ctrlCreate ["RscStructuredText", 80085];
|
||||
|
||||
_xPos = (profilenamespace getvariable ["IGUI_GRID_WEAPON_X", ((safezoneX + safezoneW) - (12.4 * (((safezoneW / safezoneH) min 1.2) / 40)) - 0.5 * (((safezoneW / safezoneH) min 1.2) / 40))]);
|
||||
_yPos = 2.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (profilenamespace getvariable ["IGUI_GRID_WEAPON_Y", (safezoneY + 0.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))]);
|
||||
_wPos = 10 * (((safezoneW / safezoneH) min 1.2) / 40);
|
||||
_hPos = 1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25);
|
||||
|
||||
_chargeText ctrlSetPosition [_xPos, _yPos, _wPos, _hPos];
|
||||
_chargeText ctrlCommit 0;
|
||||
|
||||
_tubeWeaponName = (weapons _newVehicle) select 0;
|
||||
_fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes");
|
||||
|
||||
[{
|
||||
PARAMS_2(_args,_pfID);
|
||||
EXPLODE_3_PVT(_args,_mortarVeh,_chargeText,_fireModes);
|
||||
|
||||
if ((vehicle ACE_player) != _mortarVeh) then {
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
ctrlDelete _chargeText;
|
||||
} else {
|
||||
|
||||
_useMils = _mortarVeh getVariable [QGVAR(useMils), true];
|
||||
|
||||
//Compute: 'charge' from weaponstate
|
||||
_currentFireMode = (weaponState [_mortarVeh, [0]]) select 2;
|
||||
_currentChargeMode = _fireModes find _currentFireMode;
|
||||
|
||||
_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
|
||||
closeDialog 0;
|
||||
[parseText "Computer Disabled"] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
||||
_display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull];
|
||||
if (isNull _display) exitWith {}; //It may be null for the first frame
|
||||
|
||||
//Hud should hidden in 3rd person
|
||||
_notGunnerView = cameraView != "GUNNER";
|
||||
|
||||
//Update CurrentElevation Display:
|
||||
if (_notGunnerView) then {
|
||||
(_display displayCtrl 80175) ctrlSetText "";
|
||||
} else {
|
||||
_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 (_notGunnerView || (!GVAR(allowComputerRangefinder))) then {
|
||||
(_display displayCtrl 80176) ctrlSetText "";
|
||||
} else {
|
||||
_elevDeg = parseNumber ctrlText (_display displayCtrl 176);
|
||||
if (_elevDeg <= 0) then { //Bad data means "----" out of range
|
||||
(_display displayCtrl 80176) ctrlSetText (ctrlText (_display displayCtrl 176));
|
||||
} else {
|
||||
if (_useMils) then {
|
||||
(_display displayCtrl 80176) ctrlSetText str round (_elevDeg * 6400 / 360);
|
||||
} else {
|
||||
(_display displayCtrl 80176) ctrlSetText str _elevDeg;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//Update Heading Display:
|
||||
if (_notGunnerView || (!GVAR(allowCompass))) then {
|
||||
(_display displayCtrl 80156) ctrlSetText "";
|
||||
} else {
|
||||
_rotationDegrees = ((getDir _mortarVeh) + (((-180 / PI) * (_mortarVeh animationPhase "mainTurret")) + 360)) % 360;
|
||||
if (_useMils) then {
|
||||
(_display displayCtrl 80156) ctrlSetText str round (_rotationDegrees * 6400 / 360);
|
||||
} else {
|
||||
(_display displayCtrl 80156) ctrlSetText (ctrlText (_display displayCtrl 156));
|
||||
};
|
||||
};
|
||||
};
|
||||
}, 0, [_newVehicle, _chargeText,_fireModes]] call CBA_fnc_addPerFrameHandler;
|
27
addons/mk6mortar/functions/fnc_moduleInit.sqf
Normal file
27
addons/mk6mortar/functions/fnc_moduleInit.sqf
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Loads settings from the module.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The Module Logic Object <OBJECT>
|
||||
* 1: synced objects <ARRAY>
|
||||
* 2: Activated <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [fromModule] call ace_mk6mortar_fnc_moduleInit
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_3(_logic,_syncedUnits,_activated);
|
||||
|
||||
if (!_activated) exitWith {WARNING("Module - placed but not active");};
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
[_logic, QGVAR(airResistanceEnabled), "airResistanceEnabled"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(allowComputerRangefinder), "allowComputerRangefinder"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(allowCompass), "allowCompass"] call EFUNC(common,readSettingFromModule);
|
21
addons/mk6mortar/functions/fnc_rangeTableCanUse.sqf
Normal file
21
addons/mk6mortar/functions/fnc_rangeTableCanUse.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Can player open 82mm rangetable.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
* 1: Player <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can Open <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [bob, bob] call ace_mk6mortar_fnc_rangeTableCanUse
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_vehicle,_player);
|
||||
|
||||
"ACE_RangeTable_82mm" in (items _player);
|
48
addons/mk6mortar/functions/fnc_rangeTableOpen.sqf
Normal file
48
addons/mk6mortar/functions/fnc_rangeTableOpen.sqf
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Opens the rangetable and fills the charge listbox.
|
||||
*
|
||||
* Arguments:
|
||||
* No
|
||||
*
|
||||
* Return Value:
|
||||
* No
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_mk6mortar_fnc_rangeTableOpen
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define LIST_CHARGE ((uiNamespace getVariable "ACE_82mm_RangeTable_Dialog") displayCtrl 1501)
|
||||
|
||||
private ["_weaponName", "_magazines", "_initSpeed", "_fireModes", "_muzzleVelocities", "_showToPlayer", "_artilleryCharge"];
|
||||
|
||||
_weaponName = "mortar_82mm"; //todo: work on other weapons
|
||||
|
||||
createDialog "ACE_82mm_RangeTable_Dialog";
|
||||
if (isNull (uiNamespace getVariable ["ACE_82mm_RangeTable_Dialog", displayNull])) exitWith {ERROR("Dialog failed to open");};
|
||||
|
||||
//Get Magazine Types
|
||||
_magazines = getArray (configFile >> "CfgWeapons" >> _weaponName >> "magazines");
|
||||
|
||||
//For now just get settings from first mag, all rounds have same flight characteristics:
|
||||
if ((count _magazines) < 1) exitWith {ERROR("No Magazines for weapon");};
|
||||
_initSpeed = getNumber (configFile >> "CfgMagazines" >> (_magazines select 0) >> "initSpeed");
|
||||
|
||||
//Get Charge Modes
|
||||
_fireModes = getArray (configFile >> "CfgWeapons" >> _weaponName >> "modes");
|
||||
|
||||
_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", (localize "STR_ACE_MK6MORTAR_rangetable_charge"), (count _muzzleVelocities)];
|
||||
LIST_CHARGE lbSetData [(count _muzzleVelocities), str (_artilleryCharge * _initSpeed)];
|
||||
_muzzleVelocities pushBack _artilleryCharge;
|
||||
};
|
||||
} forEach _fireModes;
|
||||
|
||||
LIST_CHARGE lbSetCurSel 0;
|
37
addons/mk6mortar/functions/fnc_rangeTablePageChange.sqf
Normal file
37
addons/mk6mortar/functions/fnc_rangeTablePageChange.sqf
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Called when listbox selection changes. Updates the rangetable with new values.
|
||||
*
|
||||
* Arguments:
|
||||
* No
|
||||
*
|
||||
* Return Value:
|
||||
* No
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_mk6mortar_fnc_rangeTablePageChange
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define RANGE_TABLE ((uiNamespace getVariable "ACE_82mm_RangeTable_Dialog") displayCtrl 20001)
|
||||
#define LIST_CHARGE ((uiNamespace getVariable "ACE_82mm_RangeTable_Dialog") displayCtrl 1501)
|
||||
|
||||
private ["_listBoxData", "_muzzleVelocity", "_airFriction", "_precalcArray"];
|
||||
|
||||
_listBoxData = LIST_CHARGE lbData (lbCurSel LIST_CHARGE);
|
||||
if (isNil "_listBoxData" || {_listBoxData == ""}) exitWith {ERROR("lbCurSel out of bounds or no data");};
|
||||
_muzzleVelocity = parseNumber _listBoxData;
|
||||
|
||||
_airFriction = if (GVAR(airResistanceEnabled)) then {MK6_82mm_AIR_FRICTION} else {0};
|
||||
|
||||
_precalcArray = [_muzzleVelocity, _airFriction] call FUNC(rangeTablePreCalculatedValues);
|
||||
|
||||
lnbClear RANGE_TABLE;
|
||||
{
|
||||
RANGE_TABLE lnbAddRow _x;
|
||||
} forEach _precalcArray;
|
||||
|
||||
//put dummy line at end because scrolling is fucked and can't see last line
|
||||
RANGE_TABLE lnbAddRow ["", "", "", "", "", "", "", "", "", "", ""];
|
271
addons/mk6mortar/functions/fnc_rangeTablePreCalculatedValues.sqf
Normal file
271
addons/mk6mortar/functions/fnc_rangeTablePreCalculatedValues.sqf
Normal file
@ -0,0 +1,271 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Simple Lookup Table for various muzzle velocities and air frictions.
|
||||
* Use ace_mk6mortar_fnc_dev_buildTable to build
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Muzzle Velocity <NUMBER>
|
||||
* 1: Air Friction <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* [200, 0] call ace_mk6mortar_fnc_rangeTablePreCalculatedValues
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_muzzleVelocity,_airFriction);
|
||||
|
||||
switch (true) do {
|
||||
|
||||
case ((abs(_muzzleVelocity - 70) < 0.00001) && {(abs(_airFriction - -0.0001) < 0.00001)}): {
|
||||
[
|
||||
["100","1493","9","1.4","14.0","3.7","0.4","-0.3","0.0","-0.0","-0.0","0.0"],
|
||||
["150","1438","14","1.4","13.9","2.5","0.4","-0.4","0.0","-0.0","-0.1","0.0"],
|
||||
["200","1381","20","1.4","13.8","1.9","0.5","-0.4","0.0","-0.0","-0.1","0.1"],
|
||||
["250","1321","27","1.5","13.6","1.5","0.5","-0.4","0.0","-0.0","-0.1","0.1"],
|
||||
["300","1256","36","1.6","13.3","1.3","0.6","-0.5","0.0","-0.1","-0.1","0.1"],
|
||||
["350","1183","49","1.7","12.9","1.1","0.6","-0.5","0.1","-0.1","-0.1","0.1"],
|
||||
["400","1097","70","1.9","12.4","0.9","0.6","-0.5","0.1","-0.1","-0.2","0.1"],
|
||||
["450","979","113","2.3","11.6","0.8","0.6","-0.5","0.1","-0.1","-0.2","0.2"]
|
||||
]
|
||||
};
|
||||
case ((abs(_muzzleVelocity - 140) < 0.00001) && {(abs(_airFriction - -0.0001) < 0.00001)}): {
|
||||
[
|
||||
["150","1556","1","0.8","27.2","16.3","2.5","-2.4","0.0","-0.0","-0.2","0.2"],
|
||||
["200","1541","1","0.8","27.2","12.3","2.5","-2.4","0.0","-0.0","-0.3","0.2"],
|
||||
["250","1527","2","0.8","27.2","9.9","2.6","-2.4","0.0","-0.0","-0.3","0.3"],
|
||||
["300","1512","2","0.8","27.2","8.3","2.7","-2.4","0.1","-0.0","-0.4","0.4"],
|
||||
["350","1497","3","0.8","27.1","7.1","2.7","-2.5","0.0","-0.1","-0.5","0.4"],
|
||||
["400","1482","3","0.8","27.1","6.2","2.7","-2.5","0.1","-0.1","-0.5","0.5"],
|
||||
["450","1467","3","0.8","27.0","5.6","2.8","-2.5","0.1","-0.1","-0.6","0.6"],
|
||||
["500","1451","4","0.8","27.0","5.0","2.9","-2.6","0.1","-0.1","-0.6","0.6"],
|
||||
["550","1436","4","0.8","26.9","4.6","2.9","-2.6","0.1","-0.1","-0.7","0.7"],
|
||||
["600","1420","5","0.8","26.8","4.2","3.0","-2.7","0.1","-0.1","-0.8","0.8"],
|
||||
["650","1404","5","0.8","26.8","3.9","3.0","-2.7","0.1","-0.1","-0.9","0.8"],
|
||||
["700","1388","6","0.8","26.7","3.6","3.1","-2.8","0.1","-0.1","-0.9","0.9"],
|
||||
["750","1372","6","0.8","26.6","3.4","3.2","-2.8","0.1","-0.1","-1.0","1.0"],
|
||||
["800","1355","7","0.8","26.5","3.2","3.2","-2.9","0.1","-0.1","-1.1","1.1"],
|
||||
["850","1338","8","0.8","26.4","3.0","3.3","-2.9","0.1","-0.1","-1.1","1.1"],
|
||||
["900","1321","8","0.8","26.2","2.8","3.4","-3.0","0.1","-0.1","-1.2","1.2"],
|
||||
["950","1303","9","0.9","26.1","2.7","3.4","-3.1","0.1","-0.2","-1.3","1.2"],
|
||||
["1000","1285","10","0.9","26.0","2.6","3.5","-3.1","0.2","-0.1","-1.4","1.3"],
|
||||
["1050","1266","11","0.9","25.8","2.4","3.5","-3.2","0.1","-0.2","-1.4","1.4"],
|
||||
["1100","1247","12","0.9","25.7","2.3","3.6","-3.3","0.1","-0.2","-1.5","1.4"],
|
||||
["1150","1228","13","0.9","25.5","2.2","3.7","-3.3","0.2","-0.2","-1.6","1.5"],
|
||||
["1200","1207","14","1.0","25.3","2.1","3.7","-3.4","0.2","-0.2","-1.7","1.6"],
|
||||
["1250","1186","15","1.0","25.1","2.0","3.8","-3.4","0.2","-0.2","-1.7","1.7"],
|
||||
["1300","1163","17","1.0","24.8","1.9","3.8","-3.5","0.2","-0.2","-1.8","1.7"],
|
||||
["1350","1140","19","1.0","24.6","1.9","3.9","-3.5","0.2","-0.2","-1.9","1.8"],
|
||||
["1400","1115","21","1.1","24.3","1.8","3.9","-3.6","0.2","-0.2","-1.9","1.9"],
|
||||
["1450","1088","24","1.1","23.9","1.7","4.0","-3.6","0.2","-0.2","-2.0","1.9"],
|
||||
["1500","1060","27","1.2","23.6","1.6","4.0","-3.7","0.2","-0.2","-2.1","2.0"],
|
||||
["1550","1028","32","1.3","23.1","1.5","4.0","-3.7","0.2","-0.2","-2.1","2.1"],
|
||||
["1600","991","38","1.4","22.6","1.5","4.0","-3.7","0.2","-0.2","-2.2","2.1"],
|
||||
["1650","947","49","1.7","21.9","1.4","4.0","-3.7","0.2","-0.3","-2.3","2.2"],
|
||||
["1700","888","71","2.1","21.0","1.3","3.9","-3.6","0.3","-0.3","-2.3","2.2"]
|
||||
]
|
||||
};
|
||||
case ((abs(_muzzleVelocity - 200) < 0.00001) && {(abs(_airFriction - -0.0001) < 0.00001)}): {
|
||||
[
|
||||
["250","1559","1","0.6","37.3","23.8","6.1","-5.9","0.0","-0.0","-0.6","0.5"],
|
||||
["300","1551","1","0.6","37.3","20.0","6.1","-5.9","0.1","-0.0","-0.7","0.7"],
|
||||
["350","1543","1","0.6","37.3","17.2","6.2","-5.9","0.0","-0.1","-0.8","0.7"],
|
||||
["400","1535","1","0.6","37.3","15.1","6.2","-5.9","0.1","-0.0","-0.9","0.9"],
|
||||
["450","1527","1","0.6","37.3","13.4","6.3","-6.0","0.1","-0.1","-1.0","1.0"],
|
||||
["500","1519","1","0.6","37.2","12.1","6.3","-6.0","0.1","-0.1","-1.1","1.1"],
|
||||
["550","1510","1","0.6","37.2","11.0","6.4","-6.0","0.1","-0.1","-1.3","1.2"],
|
||||
["600","1502","1","0.6","37.2","10.1","6.4","-6.1","0.1","-0.1","-1.4","1.3"],
|
||||
["650","1494","1","0.6","37.2","9.4","6.5","-6.1","0.1","-0.1","-1.5","1.4"],
|
||||
["700","1485","2","0.6","37.1","8.7","6.5","-6.2","0.1","-0.1","-1.6","1.5"],
|
||||
["750","1477","2","0.6","37.1","8.2","6.6","-6.2","0.1","-0.1","-1.7","1.6"],
|
||||
["800","1468","2","0.6","37.0","7.7","6.7","-6.3","0.1","-0.1","-1.8","1.8"],
|
||||
["850","1460","2","0.6","37.0","7.2","6.7","-6.3","0.1","-0.1","-2.0","1.9"],
|
||||
["900","1451","2","0.6","37.0","6.8","6.8","-6.4","0.1","-0.1","-2.1","2.0"],
|
||||
["950","1443","2","0.6","36.9","6.5","6.9","-6.4","0.1","-0.1","-2.2","2.1"],
|
||||
["1000","1434","2","0.6","36.9","6.2","6.9","-6.5","0.1","-0.1","-2.3","2.2"],
|
||||
["1050","1425","2","0.6","36.8","5.9","7.0","-6.6","0.1","-0.2","-2.5","2.3"],
|
||||
["1100","1417","3","0.6","36.8","5.6","7.1","-6.6","0.1","-0.2","-2.6","2.4"],
|
||||
["1150","1408","3","0.6","36.7","5.4","7.1","-6.7","0.2","-0.2","-2.7","2.5"],
|
||||
["1200","1399","3","0.6","36.6","5.2","7.2","-6.7","0.2","-0.2","-2.8","2.7"],
|
||||
["1250","1390","3","0.6","36.6","5.0","7.3","-6.8","0.2","-0.2","-2.9","2.8"],
|
||||
["1300","1381","3","0.6","36.5","4.8","7.4","-6.9","0.2","-0.2","-3.0","2.9"],
|
||||
["1350","1372","3","0.6","36.4","4.6","7.4","-6.9","0.2","-0.2","-3.2","3.0"],
|
||||
["1400","1362","4","0.6","36.4","4.4","7.5","-7.0","0.2","-0.2","-3.3","3.1"],
|
||||
["1450","1353","4","0.6","36.3","4.3","7.6","-7.1","0.2","-0.2","-3.4","3.2"],
|
||||
["1500","1344","4","0.6","36.2","4.2","7.7","-7.1","0.2","-0.2","-3.5","3.4"],
|
||||
["1550","1334","4","0.6","36.1","4.0","7.7","-7.2","0.2","-0.2","-3.7","3.5"],
|
||||
["1600","1324","4","0.6","36.0","3.9","7.8","-7.3","0.2","-0.2","-3.8","3.6"],
|
||||
["1650","1314","4","0.7","35.9","3.8","7.9","-7.3","0.2","-0.2","-3.9","3.7"],
|
||||
["1700","1304","5","0.7","35.8","3.7","7.9","-7.4","0.2","-0.2","-4.0","3.8"],
|
||||
["1750","1294","5","0.7","35.7","3.6","8.0","-7.5","0.2","-0.2","-4.2","3.9"],
|
||||
["1800","1284","5","0.7","35.6","3.5","8.1","-7.6","0.2","-0.3","-4.3","4.0"],
|
||||
["1850","1274","5","0.7","35.5","3.4","8.2","-7.6","0.2","-0.3","-4.4","4.2"],
|
||||
["1900","1263","6","0.7","35.4","3.3","8.2","-7.7","0.2","-0.3","-4.5","4.3"],
|
||||
["1950","1253","6","0.7","35.2","3.2","8.3","-7.8","0.2","-0.3","-4.7","4.4"],
|
||||
["2000","1242","6","0.7","35.1","3.1","8.4","-7.8","0.3","-0.3","-4.8","4.5"],
|
||||
["2050","1231","7","0.7","35.0","3.0","8.4","-7.9","0.3","-0.3","-4.9","4.7"],
|
||||
["2100","1219","7","0.7","34.8","2.9","8.5","-8.0","0.3","-0.3","-5.0","4.8"],
|
||||
["2150","1208","7","0.7","34.7","2.9","8.5","-8.0","0.3","-0.3","-5.2","4.9"],
|
||||
["2200","1196","8","0.7","34.5","2.8","8.6","-8.1","0.3","-0.3","-5.3","5.0"],
|
||||
["2250","1184","8","0.7","34.3","2.7","8.7","-8.2","0.3","-0.3","-5.4","5.1"],
|
||||
["2300","1171","9","0.8","34.2","2.7","8.7","-8.2","0.3","-0.3","-5.5","5.2"],
|
||||
["2350","1158","9","0.8","34.0","2.6","8.8","-8.3","0.3","-0.3","-5.7","5.4"],
|
||||
["2400","1145","10","0.8","33.8","2.5","8.8","-8.3","0.3","-0.3","-5.8","5.5"],
|
||||
["2450","1132","10","0.8","33.6","2.5","8.9","-8.4","0.3","-0.3","-5.9","5.6"],
|
||||
["2500","1118","11","0.8","33.3","2.4","8.9","-8.4","0.3","-0.3","-6.0","5.7"],
|
||||
["2550","1103","12","0.8","33.1","2.4","9.0","-8.5","0.3","-0.3","-6.1","5.8"],
|
||||
["2600","1088","13","0.9","32.8","2.3","9.0","-8.5","0.4","-0.3","-6.2","5.9"],
|
||||
["2650","1072","14","0.9","32.6","2.2","9.0","-8.6","0.4","-0.4","-6.4","6.0"],
|
||||
["2700","1056","15","0.9","32.3","2.2","9.0","-8.6","0.3","-0.4","-6.5","6.1"],
|
||||
["2750","1038","16","1.0","31.9","2.1","9.1","-8.6","0.4","-0.4","-6.6","6.3"],
|
||||
["2800","1020","18","1.0","31.6","2.1","9.1","-8.6","0.4","-0.4","-6.7","6.4"],
|
||||
["2850","1000","20","1.1","31.2","2.0","9.1","-8.6","0.4","-0.4","-6.8","6.5"],
|
||||
["2900","978","22","1.1","30.8","1.9","9.0","-8.6","0.4","-0.4","-6.9","6.5"],
|
||||
["2950","954","26","1.2","30.3","1.9","9.0","-8.6","0.4","-0.4","-7.0","6.6"],
|
||||
["3000","927","31","1.4","29.7","1.8","8.9","-8.5","0.4","-0.4","-7.1","6.7"],
|
||||
["3050","894","38","1.6","29.0","1.7","8.8","-8.4","0.4","-0.4","-7.2","6.8"],
|
||||
["3100","849","54","2.0","27.9","1.6","8.5","-8.3","0.4","-0.4","-7.2","6.8"]
|
||||
]
|
||||
};
|
||||
case ((abs(_muzzleVelocity - 70) < 0.00001) && {(abs(_airFriction - 0) < 0.00001)}): {
|
||||
[
|
||||
["100","1497","9","1.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["150","1445","14","1.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["200","1390","19","1.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["250","1333","26","1.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["300","1272","34","1.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["350","1204","45","1.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["400","1127","61","1.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["450","1028","91","2.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"]
|
||||
]
|
||||
};
|
||||
case ((abs(_muzzleVelocity - 140) < 0.00001) && {(abs(_airFriction - 0) < 0.00001)}): {
|
||||
[
|
||||
["150","1562","1","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["200","1549","1","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["250","1536","2","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["300","1523","2","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["350","1510","2","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["400","1497","3","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["450","1484","3","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["500","1471","3","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["550","1458","4","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["600","1445","4","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["650","1431","4","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["700","1418","5","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["750","1404","5","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["800","1390","6","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["850","1376","6","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["900","1362","6","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["950","1348","7","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1000","1333","7","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1050","1318","8","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1100","1303","9","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1150","1288","9","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1200","1272","10","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1250","1256","11","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1300","1239","12","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1350","1222","13","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1400","1205","13","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1450","1187","15","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1500","1168","16","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1550","1148","18","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1600","1127","19","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1650","1105","21","1.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1700","1082","24","1.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1750","1057","27","1.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1800","1029","31","1.3","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1850","997","37","1.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1900","960","46","1.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1950","912","63","1.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"]
|
||||
]
|
||||
};
|
||||
case ((abs(_muzzleVelocity - 200) < 0.00001) && {(abs(_airFriction - 0) < 0.00001)}): {
|
||||
[
|
||||
["300","1563","0","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["350","1556","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["400","1550","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["450","1544","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["500","1537","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["550","1531","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["600","1525","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["650","1519","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["700","1512","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["750","1506","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["800","1499","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["850","1493","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["900","1487","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["950","1480","1","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1000","1474","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1050","1467","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1100","1461","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1150","1454","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1200","1448","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1250","1441","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1300","1435","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1350","1428","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1400","1422","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1450","1415","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1500","1408","2","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1550","1402","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1600","1395","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1650","1388","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["1700","1381","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1750","1374","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1800","1367","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1850","1360","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1900","1353","3","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["1950","1346","4","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["2000","1339","4","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["2050","1332","4","0.5","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["2100","1325","4","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["2150","1317","4","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["2200","1310","4","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["2250","1302","4","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["2300","1295","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["2350","1287","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["2400","1280","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["2450","1272","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["2500","1264","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["2550","1256","5","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["2600","1248","6","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["2650","1240","6","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["2700","1232","6","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["2750","1223","6","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["2800","1215","7","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["2850","1206","7","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["2900","1197","7","0.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["2950","1188","7","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["3000","1179","8","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["3050","1170","8","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["3100","1160","8","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["3150","1151","9","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["3200","1141","9","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["3250","1131","10","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["3300","1120","10","0.7","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["3350","1109","11","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["3400","1098","11","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["3450","1087","12","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["3500","1075","13","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["3550","1062","14","0.8","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["3600","1049","15","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["3650","1036","16","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["3700","1021","17","0.9","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["3750","1006","19","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["3800","990","21","1.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["3850","971","24","1.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["3900","952","27","1.2","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["3950","929","32","1.4","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"],
|
||||
["4000","900","40","1.6","0.0","0.0","0.0","0.0","0.0","0.0","0.0","-0.0"],
|
||||
["4050","861","56","2.1","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"]
|
||||
]
|
||||
};
|
||||
default {
|
||||
ERROR("MuzzleVelocity not found in LUT");
|
||||
[]
|
||||
};
|
||||
};
|
24
addons/mk6mortar/functions/fnc_toggleMils.sqf
Normal file
24
addons/mk6mortar/functions/fnc_toggleMils.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Toggles the mortart to show mils or degrees
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
* 1: Player <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* No
|
||||
*
|
||||
* Example:
|
||||
* [mortar,bob] call ace_mk6mortar_fnc_toggleMils;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_mortarVeh,_unit);
|
||||
|
||||
private "_currentSetting";
|
||||
|
||||
_currentSetting = _mortarVeh getVariable [QGVAR(useMils), true];
|
||||
_mortarVeh setVariable [QGVAR(useMils), (!_currentSetting)];
|
67
addons/mk6mortar/functions/fnc_turretDisplayLoaded.sqf
Normal file
67
addons/mk6mortar/functions/fnc_turretDisplayLoaded.sqf
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Called when the mk6's in game UI is loaded. Hides rangefinder data if it is disabled.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_mk6mortar_fnc_turretDisplayLoaded
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define CTRL_CA_OPTICSPITCH (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_OPTICSPITCH")
|
||||
#define CTRL_CA_OPTICSZOOM (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_OPTICSZOOM")
|
||||
#define CTRL_CA_SOLUTION_TEXT (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_SOLUTION_TEXT")
|
||||
#define CTRL_CA_DISTANCE_TEXT (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_DISTANCE_TEXT")
|
||||
#define CTRL_CA_DISTANCE (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_DISTANCE")
|
||||
#define CTRL_CA_TIME_TEXT (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_TIME_TEXT")
|
||||
#define CTRL_CA_TIME (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_TIME")
|
||||
#define CTRL_CA_ELEV_NEED_TEXT (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_ELEV_NEED_TEXT")
|
||||
#define CTRL_CA_RANGEELEMENTS_GROUP (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_RangeElements_group")
|
||||
|
||||
#define CTRL_CA_HEADING (configFile >> "RscInGameUI" >> "ACE_Mk6_RscWeaponRangeArtillery" >> "CA_IGUI_elements_group" >> "controls" >> "CA_Heading")
|
||||
#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")
|
||||
|
||||
private ["_display", "_fnc_hideControl"];
|
||||
|
||||
disableSerialization;
|
||||
|
||||
_display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull];
|
||||
if (isNull _display) exitWith {};
|
||||
|
||||
_fnc_hideControl = {
|
||||
private "_idc";
|
||||
PARAMS_2(_path,_hideCtrl);
|
||||
_idc = getNumber (_path >> "IDC");
|
||||
_pos = [];
|
||||
if (_hideCtrl) then {
|
||||
_pos = [-9,-9,0,0];
|
||||
} else {
|
||||
{
|
||||
if (isNumber (_path >> _x)) then {
|
||||
_pos pushBack (getNumber (_path >> _x));
|
||||
} else {
|
||||
_pos pushBack (call compile (getText (_path >> _x)));
|
||||
};
|
||||
} forEach ["x", "y", "w", "h"];
|
||||
};
|
||||
(_display displayCtrl _idc) ctrlSetPosition _pos;
|
||||
(_display displayCtrl _idc) ctrlCommit 0;
|
||||
};
|
||||
|
||||
{
|
||||
[_x, (!GVAR(allowComputerRangefinder))] call _fnc_hideControl;
|
||||
} forEach [CTRL_CA_OPTICSPITCH, CTRL_CA_OPTICSZOOM, CTRL_CA_SOLUTION_TEXT, CTRL_CA_DISTANCE_TEXT, CTRL_CA_DISTANCE, CTRL_CA_TIME_TEXT, CTRL_CA_TIME, CTRL_CA_ELEV_NEED_TEXT, CTRL_CA_RANGEELEMENTS_GROUP];
|
||||
|
||||
//Always hide these, handled by the mil convertions PFEH in handlePlayerVehChanged
|
||||
[CTRL_CA_HEADING, true] call _fnc_hideControl;
|
||||
[CTRL_CA_ELEV, true] call _fnc_hideControl;
|
||||
[CTRL_CA_ELEV_NEED, true] call _fnc_hideControl;
|
||||
|
1
addons/mk6mortar/functions/script_component.hpp
Normal file
1
addons/mk6mortar/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\mk6mortar\script_component.hpp"
|
14
addons/mk6mortar/script_component.hpp
Normal file
14
addons/mk6mortar/script_component.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
#define COMPONENT mk6mortar
|
||||
#include "\z\ace\Addons\main\script_mod.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_MK6MORTAR
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_MK6MORTAR
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_MK6MORTAR
|
||||
#endif
|
||||
|
||||
#include "\z\ace\Addons\main\script_macros.hpp"
|
||||
|
||||
#define MK6_82mm_AIR_FRICTION -0.0001
|
18
addons/mk6mortar/stringtable.xml
Normal file
18
addons/mk6mortar/stringtable.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Edited with tabler - 2015-04-06 -->
|
||||
<Project name="ACE">
|
||||
<Package name="mk6mortar">
|
||||
<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>
|
BIN
extras/assets/icons/png/Icon_Module_mk6_ca.png
Normal file
BIN
extras/assets/icons/png/Icon_Module_mk6_ca.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
Loading…
Reference in New Issue
Block a user