mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Integrate with mk6
This commit is contained in:
parent
8c8e8fe199
commit
659b5faa07
6
addons/artillerytables/CfgMagazines.hpp
Normal file
6
addons/artillerytables/CfgMagazines.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
class CfgMagazines {
|
||||
class 32Rnd_155mm_Mo_shells;
|
||||
class 8Rnd_82mm_Mo_shells: 32Rnd_155mm_Mo_shells {
|
||||
GVAR(airFriction) = -0.0001;
|
||||
};
|
||||
};
|
@ -1,3 +1,6 @@
|
||||
class CfgVehicles {
|
||||
|
||||
class StaticMortar;
|
||||
class Mortar_01_base_F: StaticMortar {
|
||||
GVAR(showGunLaying) = 2;
|
||||
};
|
||||
};
|
||||
|
@ -33,4 +33,5 @@
|
||||
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
#include "dev\showShotInfo.sqf"
|
||||
#include "dev\checkConfigs.sqf"
|
||||
#endif
|
||||
|
@ -19,6 +19,7 @@ class ACE_Extensions {
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgMagazines.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
|
||||
|
18
addons/artillerytables/dev/checkConfigs.sqf
Normal file
18
addons/artillerytables/dev/checkConfigs.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
diag_log text "-------------------------------------------";
|
||||
INFO("Showing entries with custom configs");
|
||||
diag_log text "-------------------------------------------";
|
||||
|
||||
private _customMags = configProperties [(configFile >> "CfgMagazines"), 'isClass _x && {isNumber (_x >> QGVAR(airFriction))}', true];
|
||||
_customMags = _customMags apply {[configName _x, getNumber (_x >> QGVAR(airFriction))]};
|
||||
diag_log text format ["CfgMagazines with custom airFriction [%1]", count _customMags];
|
||||
diag_log text format ["%1", _customMags];
|
||||
|
||||
private _customVeh = configProperties [(configFile >> "CfgVehicles"), 'isClass _x && {isNumber (_x >> QGVAR(showGunLaying))}', true];
|
||||
_customVeh = _customVeh apply {[configName _x, getNumber (_x >> QGVAR(showGunLaying))]};
|
||||
diag_log text format ["CfgVehicles with custom showGunLaying [%1]", count _customVeh];
|
||||
diag_log text format ["%1", _customVeh];
|
||||
|
||||
private _customVeh = configProperties [(configFile >> "CfgVehicles"), 'isClass _x && {isNumber (_x >> QGVAR(applyCorrections))}', true];
|
||||
_customVeh = _customVeh apply {[configName _x, getNumber (_x >> QGVAR(applyCorrections))]};
|
||||
diag_log text format ["CfgVehicles with custom applyCorrections [%1]", count _customVeh];
|
||||
diag_log text format ["%1", _customVeh];
|
@ -26,7 +26,7 @@ params ["_vehicle", "", "", "", "", "_magazine", "_projectile", "_gunner"];
|
||||
TRACE_4("firedEH",_vehicle,_magazine,_projectile,_gunner);
|
||||
|
||||
if (!([_gunner] call EFUNC(common,isPlayer))) exitWith {}; // AI don't know how to use (this does give them more range than a player)
|
||||
if ((_vehicle turretUnit [0]) != _gunner) exitWith {};
|
||||
if ((gunner _vehicle) != _gunner) exitWith {}; // check if primaryGunner
|
||||
|
||||
|
||||
// Get airFriction
|
||||
|
@ -4,8 +4,7 @@
|
||||
* Interaction menu opened, search for nearby artillery vehicles.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
* 1: Player <OBJECT>
|
||||
* 0: Menu Type (1 is self interaction) <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Can Open <BOOL>
|
||||
@ -20,7 +19,7 @@ params ["_menuType"];
|
||||
TRACE_1("interactMenuOpened",_menuType);
|
||||
|
||||
if (_menuType != 1) exitWith {};
|
||||
// if (!("ACE_artilleryTable" in (ace_player call EFUNC(common,uniqueItems)))) exitWith {};
|
||||
if (!("ACE_artilleryTable" in (ace_player call EFUNC(common,uniqueItems)))) exitWith {};
|
||||
|
||||
private _vehicleAdded = ace_player getVariable [QGVAR(vehiclesAdded), []];
|
||||
private _rangeTablesShown = ace_player getVariable [QGVAR(rangeTablesShown), []];
|
||||
@ -65,8 +64,8 @@ TRACE_2("searching for new vehicles",_vehicleAdded,_rangeTablesShown);
|
||||
|
||||
// Some turrets (MK6) have a neutralX rotation that we need to add to min/max config elevation to get actual limits
|
||||
private _weaponDir = _vehicle weaponDirection _weapon;
|
||||
private _turretRot = [vectorDir _vehicle, vectorUp _vehicle, (180 / PI) * _currentTraverseRad] call FUNC(rotateVector3d);
|
||||
private _neutralX = (acos (_turretRot vectorCos _weaponDir)) - ((180 / PI) * _currentElevRad);
|
||||
private _turretRot = [vectorDir _vehicle, vectorUp _vehicle, deg _currentTraverseRad] call FUNC(rotateVector3d);
|
||||
private _neutralX = (acos (_turretRot vectorCos _weaponDir)) - (deg _currentElevRad);
|
||||
_neutralX = (round (_neutralX * 10)) / 10; // minimize floating point errors
|
||||
private _minElev = _neutralX + getNumber (_turretCfg >> "minElev");
|
||||
private _maxElev = _neutralX + getNumber (_turretCfg >> "maxElev");
|
||||
@ -77,6 +76,9 @@ TRACE_2("searching for new vehicles",_vehicleAdded,_rangeTablesShown);
|
||||
getNumber (_vehicleCfg >> "artilleryScanner")
|
||||
};
|
||||
private _advCorrection = GVAR(advancedCorrections) && {_applyCorrections == 1};
|
||||
if ((missionNamespace getVariable [QEGVAR(mk6Mortar,airResistanceEnabled), false]) && {_vehicle isKindOf "Mortar_01_base_F"}) then {
|
||||
_advCorrection = true;
|
||||
};
|
||||
|
||||
// check weapon and limits in case different vehicles use the same weapon (cammo variants should still produce the same array)
|
||||
private _info = [_weapon, _minElev, _maxElev, _advCorrection];
|
||||
@ -94,9 +96,7 @@ TRACE_2("searching for new vehicles",_vehicleAdded,_rangeTablesShown);
|
||||
};
|
||||
private _condition = {
|
||||
//IGNORE_PRIVATE_WARNING ["_player"];
|
||||
// ("ACE_artilleryTable" in (_player call EFUNC(common,uniqueItems)))
|
||||
// && {[_player, objNull, ["notOnMap", "isNotSitting"]] call EFUNC(common,canInteractWith)}
|
||||
true
|
||||
("ACE_artilleryTable" in (_player call EFUNC(common,uniqueItems))) && {[_player, objNull, ["notOnMap", "isNotSitting", "isNotInside"]] call EFUNC(common,canInteractWith)}
|
||||
};
|
||||
private _displayName = format ["%1%2", getText (_vehicleCfg >> "displayName"),["","*"] select _advCorrection];
|
||||
private _action = [format ['QGVAR(%1)',_index], _displayName, QPATHTOF(UI\icon_rangeTable.paa), _statement, _condition, {}, _info] call EFUNC(interact_menu,createAction);
|
||||
|
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
params ["_weaponName", "_elevMin", "_elevMax", "_advCorrection"];
|
||||
TRACE_3("rangeTableOpen",_weaponName,_elevMin,_elevMax);
|
||||
TRACE_4("rangeTableOpen",_weaponName,_elevMin,_elevMax,_advCorrection);
|
||||
|
||||
BEGIN_COUNTER(rangeTableOpen);
|
||||
|
||||
@ -49,7 +49,7 @@ _mags = _mags apply {
|
||||
};
|
||||
TRACE_2("",_magParamsArray,_mags);
|
||||
if ((count _magParamsArray) == 2) then { // test if all magazines share the parameters
|
||||
_mags = [["", "", (_mags select 0) select 2, (_mags select 0) select 3]]; // simplify
|
||||
_mags = [["", "All Magazines", (_mags select 0) select 2, (_mags select 0) select 3]]; // simplify
|
||||
};
|
||||
|
||||
// Get Firemodes:
|
||||
@ -65,13 +65,13 @@ GVAR(magModeData) = [];
|
||||
_x params ["_xDisplayNameShort", "_xDisplayName", "_xInitSpeed", "_xAirFriction"];
|
||||
if (_allSameCharge) then {
|
||||
_ctrlChargeList lbAdd format ["%1", _xDisplayNameShort];
|
||||
_ctrlChargeList lbSetTooltip [count GVAR(magModeData), format ["%1 m/s\n%2",_xInitSpeed toFixed 1, _xDisplayName]];
|
||||
_ctrlChargeList lbSetTooltip [count GVAR(magModeData), format ["%1\n%2 m/s\n%3", _xDisplayName, _xInitSpeed toFixed 1, _xAirFriction]];
|
||||
GVAR(magModeData) pushBack [_xInitSpeed, _xAirFriction];
|
||||
} else {
|
||||
{
|
||||
_x params ["_xModeCharge"];
|
||||
_ctrlChargeList lbAdd format ["[Charge %1] %2", _forEachIndex, _xDisplayNameShort]; // forEachIndex is from firemodes
|
||||
_ctrlChargeList lbSetTooltip [count GVAR(magModeData), format ["%1 m/s\n%2", (_xInitSpeed * _xModeCharge) toFixed 1, _xDisplayName]];
|
||||
_ctrlChargeList lbSetTooltip [count GVAR(magModeData), format ["%1\n%2 m/s\n%3", _xDisplayName, (_xInitSpeed * _xModeCharge) toFixed 1, _xAirFriction]];
|
||||
GVAR(magModeData) pushBack [_xInitSpeed * _xModeCharge, _xAirFriction];
|
||||
} forEach _fireModes;
|
||||
};
|
||||
|
@ -16,7 +16,6 @@
|
||||
*/
|
||||
(_this select 0) params ["_vehicle", "_turret", "_fireModes", "_useAltElevation", "_turretAnimBody"];
|
||||
|
||||
|
||||
if (shownArtilleryComputer && {GVAR(disableArtilleryComputer)}) then {
|
||||
// Still Don't like this solution, but it works
|
||||
closeDialog 0;
|
||||
@ -70,7 +69,7 @@ if (_useRealWeaponDir) then {
|
||||
private _currentTraverseRad = _vehicle animationSourcePhase _turretAnimBody;
|
||||
if (isNil "_currentTraverseRad") then { _currentTraverseRad = _vehicle animationPhase _turretAnimBody; };
|
||||
// Get turret roatation around it's z axis, then calc weapon elev in it's projection
|
||||
private _turretRot = [vectorDir _vehicle, vectorUp _vehicle, (180 / PI) * _currentTraverseRad] call FUNC(rotateVector3d);
|
||||
private _turretRot = [vectorDir _vehicle, vectorUp _vehicle, deg _currentTraverseRad] call FUNC(rotateVector3d);
|
||||
_realElevation = acos (_turretRot vectorDotProduct _weaponDir) + ((_turretRot call CBA_fnc_vect2polar) select 2);
|
||||
if (_realElevation > 90) then { _realElevation = 180 - _realElevation; }; // does not flip azimuth!
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ class CfgPatches {
|
||||
"ACE_Box_82mm_Mo_Illum","ACE_Box_82mm_Mo_Combo"};
|
||||
weapons[] = {"ACE_RangeTable_82mm","ace_mortar_82mm"};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_interaction"};
|
||||
requiredAddons[] = {"ace_interaction", "ace_artillerytables"};
|
||||
author = ECSTRING(common,ACETeam);
|
||||
authors[] = {"PabstMirror","Grey","VKing"};
|
||||
url = ECSTRING(main,URL);
|
||||
|
@ -31,6 +31,7 @@ if (GVAR(useAmmoHandling) && {_vehicle getVariable [QGVAR(initialized),false] &&
|
||||
};
|
||||
|
||||
if (!GVAR(airResistanceEnabled)) exitWith {};
|
||||
if (EGVAR(artillerytables,advancedCorrections)) exitWith { TRACE_1("defer to artillerytables",_this); };
|
||||
|
||||
// Large enough distance to not simulate any wind deflection
|
||||
if (_vehicle distance ACE_player > 8000) exitWith {false};
|
||||
|
@ -77,9 +77,10 @@ if (_lastFireMode != -1) then {
|
||||
|
||||
//Calc real azimuth/elevation
|
||||
//(looking at the sky VS looking at ground will radicaly change fire direction because BIS)
|
||||
private _realAzimuth = -1;
|
||||
private _realElevation = -1;
|
||||
private _realAzimuth = missionNamespace getVariable [QEGVAR(artillerytables,predictedAzimuth), -1];
|
||||
private _realElevation = missionNamespace getVariable [QEGVAR(artillerytables,predictedElevation), -1];
|
||||
|
||||
/*
|
||||
private _useRealWeaponDir = (ctrlText (_display displayCtrl 173)) == "--";
|
||||
if (_useRealWeaponDir && {(_mortarVeh ammo (currentWeapon _mortarVeh)) == 0}) then {
|
||||
// With no ammo, distance display will be empty, but gun will still fire at wonky angle if aimed at ground
|
||||
@ -104,7 +105,7 @@ if (_lastFireMode != -1) then {
|
||||
private _elevationDiff = (cos (_realAzimuth - _upVectorDir)) * acos ((vectorUp _mortarVeh) select 2);
|
||||
_realElevation = ((180 / PI) * (_mortarVeh animationPhase "mainGun")) + 75 - _elevationDiff;
|
||||
};
|
||||
|
||||
*/
|
||||
//Update Heading Display:
|
||||
if (_notGunnerView || (!GVAR(allowCompass))) then {
|
||||
(_display displayCtrl 80156) ctrlSetText "";
|
||||
@ -118,10 +119,10 @@ if (_lastFireMode != -1) then {
|
||||
|
||||
//Update CurrentElevation Display and "charge" text
|
||||
if (_notGunnerView) then {
|
||||
(_display displayCtrl 80085) ctrlSetStructuredText parseText "";
|
||||
// (_display displayCtrl 80085) ctrlSetStructuredText parseText "";
|
||||
(_display displayCtrl 80175) ctrlSetText "";
|
||||
} else {
|
||||
(_display displayCtrl 80085) ctrlSetStructuredText parseText _chargeText;
|
||||
// (_display displayCtrl 80085) ctrlSetStructuredText parseText _chargeText;
|
||||
|
||||
if (_useMils) then {
|
||||
(_display displayCtrl 80175) ctrlSetText str ((round (_realElevation * 6400 / 360)) % 6400);
|
||||
|
@ -14,6 +14,10 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
if (true) exitWith { // todo: more cleanup later
|
||||
TRACE_1("defer to artillerytables",_this);
|
||||
["mortar_82mm", 45, 88, GVAR(airResistanceEnabled) || EGVAR(artillerytables,advancedCorrections)] call EFUNC(artillerytables,rangeTableOpen);
|
||||
};
|
||||
|
||||
#define LIST_CHARGE ((uiNamespace getVariable "ACE_82mm_RangeTable_Dialog") displayCtrl 1501)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user