diff --git a/addons/pylons/ACE_Settings.hpp b/addons/pylons/ACE_Settings.hpp index 242b5c472d..e2d4c40d5c 100644 --- a/addons/pylons/ACE_Settings.hpp +++ b/addons/pylons/ACE_Settings.hpp @@ -1,46 +1,17 @@ class ACE_Settings { - class GVAR(enabled) { - category = CSTRING(Category_Pylons); - displayName = CSTRING(Enabled); - description = CSTRING(Enabled_description); - value = 1; - typeName = "BOOL"; - }; class GVAR(rearmNewPylons) { - category = CSTRING(Category_Pylons); - displayName = CSTRING(RearmNewPylons); - description = CSTRING(RearmNewPylons_description); - value = 0; - typeName = "BOOL"; + movedToSQF = 1; }; class GVAR(searchDistance) { - category = CSTRING(Category_Pylons); - displayName = CSTRING(SearchDistance); - description = CSTRING(SearchDistance_description); - value = 15; - typeName = "SCALAR"; - sliderSettings[] = {0, 50, 15, 1}; + movedToSQF = 1; }; class GVAR(timePerPylon) { - category = CSTRING(Category_Pylons); - displayName = CSTRING(TimePerPylon); - description = CSTRING(TimePerPylon_description); - value = 5; - typeName = "SCALAR"; - sliderSettings[] = {0, 10, 5, 1}; + movedToSQF = 1; }; class GVAR(requireEngineer) { - category = CSTRING(Category_Pylons); - displayName = CSTRING(RequireEngineer); - description = CSTRING(RequireEngineer_description); - value = 0; - typeName = "BOOL"; + movedToSQF = 1; }; class GVAR(requireToolkit) { - category = CSTRING(Category_Pylons); - displayName = CSTRING(RequireToolkit); - description = CSTRING(RequireToolkit_description); - value = 1; - typeName = "BOOL"; + movedToSQF = 1; }; }; diff --git a/addons/pylons/XEH_postInit.sqf b/addons/pylons/XEH_postInit.sqf index 0e21dabe69..6a8f781469 100644 --- a/addons/pylons/XEH_postInit.sqf +++ b/addons/pylons/XEH_postInit.sqf @@ -1,57 +1,53 @@ #include "script_component.hpp" -["ace_settingsInitialized", { - if (!GVAR(enabled)) exitWith {}; +private _filter = "isClass (_x >> 'Components' >> 'TransportPylonsComponent') && {(getNumber (_x >> 'scope')) > 0}"; +GVAR(aircraftWithPylons) = (_filter configClasses (configFile >> "CfgVehicles")) apply {configName _x}; +{ + [_x, "init", { + params ["_aircraft"]; - private _filter = "isClass (_x >> 'Components' >> 'TransportPylonsComponent') && {(getNumber (_x >> 'scope')) > 0}"; - GVAR(aircraftWithPylons) = (_filter configClasses (configFile >> "CfgVehicles")) apply {configName _x}; - { - [_x, "init", { - params ["_aircraft"]; - - private _loadoutAction = [ - QGVAR(loadoutAction), - localize LSTRING(ConfigurePylons), - "", - {[_target] call FUNC(showDialog)}, - { - private _vehicles = nearestObjects [_target, ["Air", "LandVehicle", "Slingload_base_F", "ReammoBox_F"], GVAR(searchDistance) + 10]; - private _filter = ["transportAmmo", QEGVAR(rearm,defaultSupply)] select (["ace_rearm"] call EFUNC(common,isModLoaded)); - private _rearmVehicles = {(getNumber (configFile >> "CfgVehicles" >> typeOf _x >> _filter)) > 0} count _vehicles; - - (_rearmVehicles > 0 && {[ace_player, _target] call FUNC(canConfigurePylons)}) - } - ] call EFUNC(interact_menu,createAction); - - [_aircraft, 0, ["ACE_MainActions"], _loadoutAction] call EFUNC(interact_menu,addActionToObject); - }, false, [], true] call CBA_fnc_addClassEventHandler; - } forEach GVAR(aircraftWithPylons); - - [QGVAR(setPylonLoadOutEvent), { - params ["_aircraft", "_pylonIndex", "_pylon", "_turret", "_weaponToRemove"]; - TRACE_5("setPylonLoadOutEvent",_aircraft,_pylonIndex,_pylon,_turret,_weaponToRemove); - _aircraft setPylonLoadOut [_pylonIndex, _pylon, false, _turret]; - if (_weaponToRemove != "") then { + private _loadoutAction = [ + QGVAR(loadoutAction), + localize LSTRING(ConfigurePylons), + "", + {[_target] call FUNC(showDialog)}, { - if (_aircraft turretLocal _x) then { - TRACE_3("removing",_aircraft,_x,_weaponToRemove); - _aircraft removeWeaponTurret [_weaponToRemove, _x]; - }; - } forEach [[-1], [0]]; - }; - }] call CBA_fnc_addEventHandler; + if (!GVAR(enabledFromAmmoTrucks)) exitWith {false}; - [QGVAR(setAmmoOnPylonEvent), { - params ["_aircraft", "_pylonIndex", "_count"]; - _aircraft setAmmoOnPylon [_pylonIndex, _count]; - }] call CBA_fnc_addEventHandler; + private _vehicles = nearestObjects [_target, ["Air", "LandVehicle", "Slingload_base_F", "ReammoBox_F"], GVAR(searchDistance) + 10]; + private _filter = ["transportAmmo", QEGVAR(rearm,defaultSupply)] select (["ace_rearm"] call EFUNC(common,isModLoaded)); + private _rearmVehicles = {(getNumber (configFile >> "CfgVehicles" >> typeOf _x >> _filter)) > 0} count _vehicles; - if (isServer) then { - GVAR(currentAircraftNamespace) = true call CBA_fnc_createNamespace; - publicVariable QGVAR(currentAircraftNamespace); + (_rearmVehicles > 0 && {[ace_player, _target] call FUNC(canConfigurePylons)}) + } + ] call EFUNC(interact_menu,createAction); - addMissionEventHandler ["HandleDisconnect", {call FUNC(handleDisconnect)}]; + [_aircraft, 0, ["ACE_MainActions"], _loadoutAction] call EFUNC(interact_menu,addActionToObject); + }, false, [], true] call CBA_fnc_addClassEventHandler; +} forEach GVAR(aircraftWithPylons); + +[QGVAR(setPylonLoadOutEvent), { + params ["_aircraft", "_pylonIndex", "_pylon", "_turret", "_weaponToRemove"]; + TRACE_5("setPylonLoadOutEvent",_aircraft,_pylonIndex,_pylon,_turret,_weaponToRemove); + _aircraft setPylonLoadOut [_pylonIndex, _pylon, false, _turret]; + if (_weaponToRemove != "") then { + { + if (_aircraft turretLocal _x) then { + TRACE_3("removing",_aircraft,_x,_weaponToRemove); + _aircraft removeWeaponTurret [_weaponToRemove, _x]; + }; + } forEach [[-1], [0]]; }; - - GVAR(searchDistanceSqr) = GVAR(searchDistance) ^ 2; }] call CBA_fnc_addEventHandler; + +[QGVAR(setAmmoOnPylonEvent), { + params ["_aircraft", "_pylonIndex", "_count"]; + _aircraft setAmmoOnPylon [_pylonIndex, _count]; +}] call CBA_fnc_addEventHandler; + +if (isServer) then { + GVAR(currentAircraftNamespace) = true call CBA_fnc_createNamespace; + publicVariable QGVAR(currentAircraftNamespace); + + addMissionEventHandler ["HandleDisconnect", {call FUNC(handleDisconnect)}]; +}; diff --git a/addons/pylons/XEH_preInit.sqf b/addons/pylons/XEH_preInit.sqf index b47cf6628d..9361d05015 100644 --- a/addons/pylons/XEH_preInit.sqf +++ b/addons/pylons/XEH_preInit.sqf @@ -6,4 +6,6 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +#include "initSettings.sqf" + ADDON = true; diff --git a/addons/pylons/config.cpp b/addons/pylons/config.cpp index fc7159e08b..011167fd22 100644 --- a/addons/pylons/config.cpp +++ b/addons/pylons/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_interact_menu"}; + requiredAddons[] = {"ace_interact_menu", "ace_zeus"}; author = ECSTRING(common,ACETeam); authors[] = {"654wak654"}; url = ECSTRING(main,URL); diff --git a/addons/pylons/functions/fnc_showDialog.sqf b/addons/pylons/functions/fnc_showDialog.sqf index 5be18d20e8..c7836c07b1 100644 --- a/addons/pylons/functions/fnc_showDialog.sqf +++ b/addons/pylons/functions/fnc_showDialog.sqf @@ -18,7 +18,15 @@ params ["_aircraft", ["_isCurator", false]]; -if (!GVAR(enabled) || {!(typeOf _aircraft in GVAR(aircraftWithPylons))}) exitWith {}; +if !(typeOf _aircraft in GVAR(aircraftWithPylons)) exitWith { + if (_isCurator) then { + [LSTRING(AircraftDoesntHavePylons)] call EFUNC(zeus,showMessage); + }; +}; + +if (_isCurator && {!GVAR(enabledForZeus)}) exitWith { + [LSTRING(ConfigurePylonsDisabledForZeus)] call EFUNC(zeus,showMessage); +}; private _currentUser = _aircraft getVariable [QGVAR(currentUser), objNull]; if (!isNull _currentUser) exitWith { @@ -75,10 +83,10 @@ GVAR(comboBoxes) = []; private _mags = _aircraft getCompatiblePylonMagazines (_forEachIndex + 1); private _userWhitelist = _aircraft getVariable [QGVAR(magazineWhitelist), _mags]; private _userBlacklist = _aircraft getVariable [QGVAR(magazineBlacklist), []]; - + _mags = _mags arrayIntersect _userWhitelist; _mags = _mags - _userBlacklist; - + private _index = 0; { _combo lbAdd getText (configFile >> "CfgMagazines" >> _x >> "displayName"); diff --git a/addons/pylons/initSettings.sqf b/addons/pylons/initSettings.sqf new file mode 100644 index 0000000000..57a2a79efb --- /dev/null +++ b/addons/pylons/initSettings.sqf @@ -0,0 +1,66 @@ +[ + QGVAR(enabledFromAmmoTrucks), + "CHECKBOX", + [LSTRING(EnabledFromAmmoTrucks), LSTRING(EnabledFromAmmoTrucks_description)], + LSTRING(Category_Pylons), + [true], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(enabledForZeus), + "CHECKBOX", + [LSTRING(EnabledForZeus), LSTRING(EnabledForZeus_description)], + LSTRING(Category_Pylons), + [true], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(rearmNewPylons), + "CHECKBOX", + [LSTRING(RearmNewPylons), LSTRING(RearmNewPylons_description)], + LSTRING(Category_Pylons), + [false], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(requireEngineer), + "CHECKBOX", + [LSTRING(RequireEngineer), LSTRING(RequireEngineer_description)], + LSTRING(Category_Pylons), + [false], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(requireToolkit), + "CHECKBOX", + [LSTRING(RequireToolkit), LSTRING(RequireToolkit_description)], + LSTRING(Category_Pylons), + [true], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(searchDistance), + "SLIDER", + [LSTRING(SearchDistance), LSTRING(SearchDistance_description)], + LSTRING(Category_Pylons), + [5, 50, 15, 0], + true, + { + params ["_searchDistance"]; + GVAR(searchDistanceSqr) = _searchDistance ^ 2; + } +] call CBA_Settings_fnc_init; + +[ + QGVAR(timePerPylon), + "SLIDER", + [LSTRING(TimePerPylon), LSTRING(TimePerPylon_description)], + LSTRING(Category_Pylons), + [1, 10, 5, 0], + true +] call CBA_Settings_fnc_init; diff --git a/addons/pylons/stringtable.xml b/addons/pylons/stringtable.xml index e127392293..3050cb5f92 100644 --- a/addons/pylons/stringtable.xml +++ b/addons/pylons/stringtable.xml @@ -91,23 +91,23 @@ 車両が遠すぎます Fahrzeug zu weit entfernt - - Enable Pylons Menu - パイロン メニューを有効化 - Abilita Menu Piloni - 啟用派龍架選單 - 启用派龙架选单 - 파일런 메뉴 활성 - Aktiviere das Menü für Außenlaststationen. + + Enable Pylons Menu for Zeus - - Enable pylon configuration menu for aircraft. - 航空機へのパイロン設定メニューを有効化します。 - Abilita il menù di configurazione piloni per aereo. - 啟用後可透過派龍架選單來定義飛機的武裝配置。 - 启用后可透过派龙架选单来定义飞机的武装配置。 - 항공기의 파일런 설정 메뉴를 활성합니다. - Aktiviert die Konfiguration der Außenlaststationen. für Fluggeräte. + + Enables use of the zeus module. + + + Enable Pylons Menu from Ammo Trucks + + + Enables use of pylons menu from ammo trucks. + + + This aircraft doesn't have pylons + + + Configure pylons module is disabled for zeus Rearm New Pylons