Pylons - Separate settings for in-game and zeus (#6365)

* Modernize pylons

* Revert docs/wiki/featurex/fortify.md

* Bring back ACE settings with movedToSQF

* 🤦

* Move settings to separate file, Fix postInit logic problems

* Tabs -> spaces
This commit is contained in:
Ozan Eğitmen 2018-05-31 18:43:02 +03:00 committed by PabstMirror
parent a5a8c68831
commit a917d586cb
7 changed files with 145 additions and 102 deletions

View File

@ -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;
};
};

View File

@ -1,8 +1,5 @@
#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};
{
@ -15,6 +12,8 @@
"",
{[_target] call FUNC(showDialog)},
{
if (!GVAR(enabledFromAmmoTrucks)) exitWith {false};
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;
@ -52,6 +51,3 @@
addMissionEventHandler ["HandleDisconnect", {call FUNC(handleDisconnect)}];
};
GVAR(searchDistanceSqr) = GVAR(searchDistance) ^ 2;
}] call CBA_fnc_addEventHandler;

View File

@ -6,4 +6,6 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
#include "initSettings.sqf"
ADDON = true;

View File

@ -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);

View File

@ -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 {

View File

@ -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;

View File

@ -91,23 +91,23 @@
<Japanese>車両が遠すぎます</Japanese>
<German>Fahrzeug zu weit entfernt</German>
</Key>
<Key ID="STR_ACE_Pylons_Enabled">
<English>Enable Pylons Menu</English>
<Japanese>パイロン メニューを有効化</Japanese>
<Italian>Abilita Menu Piloni</Italian>
<Chinese>啟用派龍架選單</Chinese>
<Chinesesimp>启用派龙架选单</Chinesesimp>
<Korean>파일런 메뉴 활성</Korean>
<German>Aktiviere das Menü für Außenlaststationen.</German>
<Key ID="STR_ACE_Pylons_EnabledForZeus">
<English>Enable Pylons Menu for Zeus</English>
</Key>
<Key ID="STR_ACE_Pylons_Enabled_description">
<English>Enable pylon configuration menu for aircraft.</English>
<Japanese>航空機へのパイロン設定メニューを有効化します。</Japanese>
<Italian>Abilita il menù di configurazione piloni per aereo.</Italian>
<Chinese>啟用後可透過派龍架選單來定義飛機的武裝配置。</Chinese>
<Chinesesimp>启用后可透过派龙架选单来定义飞机的武装配置。</Chinesesimp>
<Korean>항공기의 파일런 설정 메뉴를 활성합니다.</Korean>
<German>Aktiviert die Konfiguration der Außenlaststationen. für Fluggeräte.</German>
<Key ID="STR_ACE_Pylons_EnabledForZeus_description">
<English>Enables use of the zeus module.</English>
</Key>
<Key ID="STR_ACE_Pylons_EnabledFromAmmoTrucks">
<English>Enable Pylons Menu from Ammo Trucks</English>
</Key>
<Key ID="STR_ACE_Pylons_EnabledFromAmmoTrucks_description">
<English>Enables use of pylons menu from ammo trucks.</English>
</Key>
<Key ID="STR_ACE_Pylons_AircraftDoesntHavePylons">
<English>This aircraft doesn't have pylons</English>
</Key>
<Key ID="STR_ACE_Pylons_ConfigurePylonsDisabledForZeus">
<English>Configure pylons module is disabled for zeus</English>
</Key>
<Key ID="STR_ACE_Pylons_RearmNewPylons">
<English>Rearm New Pylons</English>