Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General - Cleaned up cbaSettings_settingChanged #10050

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions addons/artillerytables/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@ private _categoryName = [format ["ACE %1", localize "str_a3_cfgmarkers_nato_art"
[LSTRING(disableArtilleryComputer_displayName), LSTRING(disableArtilleryComputer_description)],
_categoryName,
false, // default value
true, // isGlobal
{[QGVAR(disableArtilleryComputer), _this] call EFUNC(common,cbaSettings_settingChanged)},
false // Needs mission restart
true // isGlobal
] call CBA_fnc_addSetting;
24 changes: 7 additions & 17 deletions addons/cargo/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)];
[LSTRING(ModuleSettings_enable), LSTRING(ModuleSettings_enable_Description)],
_category,
true,
1,
{[QGVAR(enable), _this] call EFUNC(common,cbaSettings_settingChanged)}
1
] call CBA_fnc_addSetting;

[
Expand All @@ -16,8 +15,7 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)];
[LSTRING(loadTimeCoefficient), LSTRING(loadTimeCoefficient_description)],
_category,
[0, 10, 5, 1],
1,
{[QGVAR(loadTimeCoefficient), _this, true] call EFUNC(common,cbaSettings_settingChanged)}
1
] call CBA_fnc_addSetting;

[
Expand All @@ -26,28 +24,23 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)];
[LSTRING(paradropTimeCoefficent), LSTRING(paradropTimeCoefficent_description)],
_category,
[0, 10, 2.5, 1],
1,
{[QGVAR(paradropTimeCoefficent), _this, true] call EFUNC(common,cbaSettings_settingChanged)}
1
] call CBA_fnc_addSetting;

[
QGVAR(openAfterUnload),
"LIST",
[LSTRING(openAfterUnload), LSTRING(openAfterUnload_description)],
_category,
[[0, 1, 2, 3], [ELSTRING(common,never), LSTRING(unloadObject), LSTRING(paradropButton), ELSTRING(common,both)], 0],
0,
{[QGVAR(openAfterUnload), _this, true] call EFUNC(common,cbaSettings_settingChanged)}
[[0, 1, 2, 3], [ELSTRING(common,never), LSTRING(unloadObject), LSTRING(paradropButton), ELSTRING(common,both)], 0]
] call CBA_fnc_addSetting;

[
QGVAR(carryAfterUnload),
"CHECKBOX",
[LSTRING(carryAfterUnload), LSTRING(carryAfterUnload_description)],
_category,
true,
0,
{[QGVAR(carryAfterUnload), _this] call EFUNC(common,cbaSettings_settingChanged)}
true
] call CBA_fnc_addSetting;

[
Expand All @@ -56,16 +49,13 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)];
[LSTRING(enableDeploy), LSTRING(enableDeploy_description)],
_category,
true,
1,
{[QGVAR(enableDeploy), _this] call EFUNC(common,cbaSettings_settingChanged)}
1
] call CBA_fnc_addSetting;

[
QGVAR(enableRename),
"CHECKBOX",
[LSTRING(ModuleSettings_enableRename), LSTRING(ModuleSettings_enableRename_Description)],
_category,
true,
0,
{[QGVAR(enableRename), _this, true] call EFUNC(common,cbaSettings_settingChanged)}
true
] call CBA_fnc_addSetting;
3 changes: 3 additions & 0 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ if (isServer) then {
[QGVAR(claimSafe), LINKFUNC(claimSafeServer)] call CBA_fnc_addEventHandler;
};

["CBA_SettingChanged", {
["ace_settingChanged", _this] call CBA_fnc_localEvent;
}] call CBA_fnc_addEventHandler;

//////////////////////////////////////////////////
// Set up remote execution
Expand Down
8 changes: 3 additions & 5 deletions addons/common/functions/fnc_cbaSettings_settingChanged.sqf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Function for handeling a cba setting being changed.
* Adds warning if global setting is changed after ace_settingsInitialized
* Function for handling a cba setting being changed.
* Adds warning if global setting is changed after ace_settingsInitialized.
*
* Arguments:
* 0: Setting Name <STRING>
Expand All @@ -21,9 +21,7 @@
params ["_settingName", "_newValue", ["_canBeChanged", false]];
TRACE_2("",_settingName,_newValue);

["ace_settingChanged", [_settingName, _newValue]] call CBA_fnc_localEvent;

if (!((toLower _settingName) in CBA_settings_needRestart)) exitWith {};
if !((toLower _settingName) in CBA_settings_needRestart) exitWith {};
if (_canBeChanged) exitWith {WARNING_1("update cba setting [%1] to use correct Need Restart param",_settingName);};
if (!GVAR(settingsInitFinished)) exitWith {}; // Ignore changed event before CBA_settingsInitialized

Expand Down
12 changes: 3 additions & 9 deletions addons/cookoff/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,23 @@
[LSTRING(enableFire_name), LSTRING(enableFire_tooltip)],
LSTRING(category_displayName),
true, // default value
true, // isGlobal
{[QGVAR(enableFire), _this] call EFUNC(common,cbaSettings_settingChanged)},
false // Needs mission restart
true // isGlobal
] call CBA_fnc_addSetting;

[
QGVAR(destroyVehicleAfterCookoff), "CHECKBOX",
[LSTRING(destroyVehicleAfterCookoff_name), LSTRING(destroyVehicleAfterCookoff_tooltip)],
LSTRING(category_displayName),
false, // default value
true, // isGlobal
{[QGVAR(destroyVehicleAfterCookoff), _this] call EFUNC(common,cbaSettings_settingChanged)},
false // Needs mission restart
true // isGlobal
] call CBA_fnc_addSetting;

[
QGVAR(enableAmmoCookoff), "CHECKBOX",
[LSTRING(enableAmmoCookoff_name), LSTRING(enableAmmoCookoff_tooltip)],
LSTRING(category_displayName),
true, // default value
true, // isGlobal
{[QGVAR(enableAmmoCookoff), _this] call EFUNC(common,cbaSettings_settingChanged)},
false // Needs mission restart
true // isGlobal
] call CBA_fnc_addSetting;

[
Expand Down
9 changes: 2 additions & 7 deletions addons/csw/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,12 @@ private _categoryArray = [format ["ACE %1", localize LSTRING(DisplayName)]];
[LSTRING(progressBarTimeCoefficent_displayName), LSTRING(progressBarTimeCoefficent_description)],
_categoryArray,
[0,2,1,2], // [min, max, default value, trailing decimals (-1 for whole numbers only)]
true, // isGlobal
{[QGVAR(progressBarTimeCoefficent), _this] call EFUNC(common,cbaSettings_settingChanged)},
false // Needs mission restart
true // isGlobal
] call CBA_fnc_addSetting;

[
QGVAR(dragAfterDeploy), "CHECKBOX",
[LSTRING(dragAfterDeploy_displayName), LSTRING(dragAfterDeploy_description)],
_categoryArray,
false, // default value
false, // isGlobal
{[QGVAR(dragAfterDeploy), _this] call EFUNC(common,cbaSettings_settingChanged)},
false // Needs mission restart
false // default value
] call CBA_fnc_addSetting;
4 changes: 1 addition & 3 deletions addons/fastroping/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ private _category = [LELSTRING(common,categoryUncategorized), LLSTRING(setting_c
[LSTRING(setting_requireRopeItems_displayName)],
_category,
false, // default value
true, // isGlobal
{[QGVAR(requireRopeItems), _this] call EFUNC(common,cbaSettings_settingChanged)},
false // needRestart
true // isGlobal
] call CBA_fnc_addSetting;

[
Expand Down
18 changes: 8 additions & 10 deletions addons/headless/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
format ["ACE %1", LLSTRING(Module)],
false,
1,
{[QGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
true
{[QXGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;

[
Expand All @@ -15,8 +15,7 @@
[LSTRING(Delay), LSTRING(DelayDesc)],
format ["ACE %1", LLSTRING(Module)],
[0, 60, 15, -1],
1,
{[QGVAR(delay), _this] call EFUNC(common,cbaSettings_settingChanged)}
1
] call CBA_fnc_addSetting;

[
Expand All @@ -26,8 +25,8 @@
format ["ACE %1", LLSTRING(Module)],
[[0, 1, 2], [ELSTRING(Common,Disabled), LSTRING(Instant), LSTRING(Delayed)], 0],
1,
{[QGVAR(delay), _this] call EFUNC(common,cbaSettings_settingChanged)},
true
{[QXGVAR(endMission), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;

[
Expand All @@ -36,8 +35,7 @@
[LSTRING(Log), LSTRING(LogDesc)],
format ["ACE %1", LLSTRING(Module)],
false,
1,
{[QGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)}
1
] call CBA_fnc_addSetting;

[
Expand All @@ -47,6 +45,6 @@
format ["ACE %1", LLSTRING(Module)],
[[0, 1, 2], [ELSTRING(Common,Disabled), LSTRING(TransferLoadoutCurrent), LSTRING(TransferLoadoutConfig)], 0],
1,
{},
true // needs mission restart
{[QXGVAR(transferLoadout), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;
4 changes: 1 addition & 3 deletions addons/interact_menu/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ private _categoryColors = [_category, format ["| %1 |", LELSTRING(common,subcate
QGVAR(textSize), "LIST",
LSTRING(textSize),
_category,
[[0, 1, 2, 3, 4], ["str_very_small", "str_small", "str_medium", "str_large", "str_very_large"], 2],
0,
{[QGVAR(textSize), _this] call EFUNC(common,cbaSettings_settingChanged)}
[[0, 1, 2, 3, 4], ["str_very_small", "str_small", "str_medium", "str_large", "str_very_large"], 2]
] call CBA_fnc_addSetting;

[
Expand Down
2 changes: 1 addition & 1 deletion addons/interaction/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
false,
true,
{[QGVAR(disableNegativeRating), _this] call EFUNC(common,cbaSettings_settingChanged)},
true
true // Needs mission restart
] call CBA_fnc_addSetting;

[
Expand Down
13 changes: 3 additions & 10 deletions addons/map/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,11 @@
false,
true,
{
[QGVAR(BFT_Enabled), _this] call EFUNC(common,cbaSettings_settingChanged);

if (GVAR(BFT_Enabled) && {isNil QGVAR(BFT_markers)}) then {
GVAR(BFT_markers) = [];
[LINKFUNC(blueForceTrackingUpdate), GVAR(BFT_Interval), []] call CBA_fnc_addPerFrameHandler;
};
},
false
}
] call CBA_fnc_addSetting;

[
Expand All @@ -94,9 +91,7 @@
[localize LSTRING(BFT_ShowPlayerNames_DisplayName), localize LSTRING(BFT_ShowPlayerNames_Description)],
[format ["ACE %1", localize LSTRING(Module_DisplayName)], localize LSTRING(BFT_Module_DisplayName)],
false,
true,
{[QGVAR(BFT_ShowPlayerNames), _this] call EFUNC(common,cbaSettings_settingChanged)},
false
true
] call CBA_fnc_addSetting;

[
Expand All @@ -105,7 +100,5 @@
[localize LSTRING(BFT_HideAiGroups_DisplayName), localize LSTRING(BFT_HideAiGroups_Description)],
[format ["ACE %1", localize LSTRING(Module_DisplayName)], localize LSTRING(BFT_Module_DisplayName)],
false,
true,
{[QGVAR(BFT_HideAiGroups), _this] call EFUNC(common,cbaSettings_settingChanged)},
false
true
] call CBA_fnc_addSetting;
4 changes: 1 addition & 3 deletions addons/microdagr/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@ private _category = [LELSTRING(common,categoryUncategorized), LLSTRING(itemName)
[LSTRING(WaypointPrecision_DisplayName), LSTRING(WaypointPrecision_Description)],
_category,
[[1, 2, 3], [LSTRING(WaypointPrecision_medium), LSTRING(WaypointPrecision_close), LSTRING(WaypointPrecision_exact)], 2], // [values, titles, defaultIndex]
true, // isGlobal
{[QGVAR(waypointPrecision), _this] call EFUNC(common,cbaSettings_settingChanged)},
false // require mission restart
true // isGlobal
] call CBA_fnc_addSetting;
4 changes: 1 addition & 3 deletions addons/parachute/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ private _category = [LELSTRING(common,categoryUncategorized), localize "str_dn_p
"CHECKBOX",
[LSTRING(HideAltimeter), LSTRING(HideAltimeter_tooltip)],
_category,
true,
false,
{[QGVAR(hideAltimeter), _this, false] call EFUNC(common,cbaSettings_settingChanged)}
true
] call CBA_fnc_addSetting;

[
Expand Down
11 changes: 4 additions & 7 deletions addons/rearm/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,29 @@ private _category = [ELSTRING(main,Category_Logistics), LLSTRING(DisplayName)];
true,
true,
{[QGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
true
true // Needs mission restart
] call CBA_fnc_addSetting;

[
QGVAR(level), "LIST",
[LSTRING(RearmSettings_level_DisplayName), LSTRING(RearmSettings_level_Description)],
_category,
[[0,1,2],[LSTRING(RearmSettings_vehicle), LSTRING(RearmSettings_magazine), LSTRING(RearmSettings_caliber)],0], // [values, titles, defaultIndex]
true, // isGlobal
{[QGVAR(level), _this] call EFUNC(common,cbaSettings_settingChanged)}
true // isGlobal
] call CBA_fnc_addSetting;

[
QGVAR(supply), "LIST",
[LSTRING(RearmSettings_supply_DisplayName), LSTRING(RearmSettings_supply_Description)],
_category,
[[0,1,2],[LSTRING(RearmSettings_unlimited), LSTRING(RearmSettings_limited), LSTRING(RearmSettings_magazineSupply)],0], // [values, titles, defaultIndex]
true, // isGlobal
{[QGVAR(supply), _this] call EFUNC(common,cbaSettings_settingChanged)}
true // isGlobal
] call CBA_fnc_addSetting;

[
QGVAR(distance), "SLIDER",
[LLSTRING(RearmSettings_distance_DisplayName), LLSTRING(RearmSettings_distance_Description)],
_category,
[10, 50, 20, 0],
true, // isGlobal
{[QGVAR(supply), _this] call EFUNC(common,cbaSettings_settingChanged)}
true // isGlobal
] call CBA_fnc_addSetting;
12 changes: 4 additions & 8 deletions addons/refuel/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,29 @@ private _category = [ELSTRING(main,Category_Logistics), "str_state_refuel"];
[LSTRING(RefuelSettings_speed_DisplayName), LSTRING(RefuelSettings_speed_Description)],
_category,
[0,25,1,1], // [min, max, default value, trailing decimals (-1 for whole numbers only)]
true, // isGlobal
{[QGVAR(rate), _this] call EFUNC(common,cbaSettings_settingChanged)}
true // isGlobal
] call CBA_fnc_addSetting;

[
QGVAR(cargoRate), "SLIDER",
[LSTRING(RefuelSettings_speedCargo_DisplayName), LSTRING(RefuelSettings_speedCargo_Description)],
_category,
[0,250,10,1], // [min, max, default value, trailing decimals (-1 for whole numbers only)]
true, // isGlobal
{[QGVAR(cargoRate), _this] call EFUNC(common,cbaSettings_settingChanged)}
true // isGlobal
] call CBA_fnc_addSetting;

[
QGVAR(hoseLength), "SLIDER",
[LSTRING(RefuelSettings_hoseLength_DisplayName)],
_category,
[0,50,12,1], // [min, max, default value, trailing decimals (-1 for whole numbers only)]
true, // isGlobal
{[QGVAR(hoseLength), _this] call EFUNC(common,cbaSettings_settingChanged)}
true // isGlobal
] call CBA_fnc_addSetting;

[
QGVAR(progressDuration), "TIME",
[LSTRING(RefuelSettings_progressDuration_DisplayName), LSTRING(RefuelSettings_progressDuration_Description)],
_category,
[0, 10, 2], // [min, max, default value]
true, // isGlobal
{[QGVAR(progressDuration), _this] call EFUNC(common,cbaSettings_settingChanged)}
true // isGlobal
] call CBA_fnc_addSetting;
Loading