mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
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:
parent
a5a8c68831
commit
a917d586cb
@ -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;
|
||||
};
|
||||
};
|
||||
|
@ -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)}];
|
||||
};
|
||||
|
@ -6,4 +6,6 @@ PREP_RECOMPILE_START;
|
||||
#include "XEH_PREP.hpp"
|
||||
PREP_RECOMPILE_END;
|
||||
|
||||
#include "initSettings.sqf"
|
||||
|
||||
ADDON = true;
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
|
66
addons/pylons/initSettings.sqf
Normal file
66
addons/pylons/initSettings.sqf
Normal 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;
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user