Skip to content

Commit 923d5f0

Browse files
committed
feat: Streamline mod profile selection with a single dropdown
The mod profile selection UI was taking up excessive vertical space. This commit addresses this by: - Replacing individual "enable" checkboxes with a single "Active Mod Profile" dropdown menu. - This enforces the constraint that only one mod profile can be active at a time. - The dropdown lists all available mod profiles, including a "None" option to disable all profiles.
1 parent 15e8713 commit 923d5f0

File tree

2 files changed

+141
-158
lines changed

2 files changed

+141
-158
lines changed

gui/common/functions_utility~autociv.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -914,8 +914,10 @@ function saveThisModProfile(nr, autoLabelManually) {
914914
}
915915
}
916916
function enableThisModProfile(nr) {
917+
// Engine.ConfigDB_GetValue("user", "modProfile.p" + nr + "enabled") == "true"
917918
if (
918-
Engine.ConfigDB_GetValue("user", "modProfile.p" + nr + "enabled") == "true"
919+
Engine.ConfigDB_GetValue("user", "modProfile.activeProfile") == nr
920+
919921
) {
920922
const modsFromUserCfg_const = Engine.ConfigDB_GetValue(
921923
"user",
@@ -972,22 +974,14 @@ function saveThisModProfile(nr, autoLabelManually) {
972974
function check_modProfileSelector_settings() {
973975

974976
const autoLabelManually = Engine.ConfigDB_GetValue("user", "modProfile.autoLabelManually") === "true";
977+
const name = "modProfile.activeProfile" // modProfile.activeProfile
978+
const activeProfileNr = Engine.ConfigDB_GetValue("user",name )
975979

976-
[...Array(6)].forEach((_, k0_5) => saveThisModProfile(k0_5, autoLabelManually));
977-
978-
for (let k0_5 = 0; k0_5 <= 5; k0_5++) {
979-
const nameOfCheckBox = "modProfile.p" + k0_5 + "enabled";
980-
if (Engine.ConfigDB_GetValue("user", nameOfCheckBox) === "true") {
981-
if (enableThisModProfile(k0_5)) {
982-
warn(`${k0_5} was enabled as your default mod-configuration.`);
983-
ConfigDB_CreateAndSaveValueA26A27("user", nameOfCheckBox, "false");
984-
// warn(`${k0_5} checkBox disabled (if enabled have conflict with the normal mod selector)`);
985-
return true;
986-
}
987-
break;
988-
}
980+
if ( activeProfileNr > 0 && enableThisModProfile(activeProfileNr)) {
981+
warn(`${activeProfileNr} was enabled as your default mod-configuration.`);
982+
ConfigDB_CreateAndSaveValueA26A27("user", name, "false");
983+
return true;
989984
}
990-
991985
return false;
992986
}
993987

moddata/options.json

Lines changed: 132 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -251,150 +251,139 @@
251251

252252
]
253253
},
254-
{
255-
"label": "Mod Profile Selector",
256-
"options": [
257-
{
258-
"type": "string",
259-
"label": "('mod', 'public' included automatically)",
260-
"tooltip": "all your mods that you want to enable ",
261-
"config": "modProfile.p0"
262-
},
263-
{
264-
"type": "string",
265-
"label": " autoLabel: ",
266-
"tooltip": "if want add new: Settings > Mod Selection",
267-
"config": "modProfile.p0label"
268-
},
269-
{
270-
"type": "boolean",
271-
"label": "[color=\"220 185 70\"]use 0[/color]",
272-
"tooltip": "Set Hotkey-Profiles.\n[color=\"255 0 0\"]RESTART NECESSARY[/color]\n [color=\"255 0 0\"]",
273-
"config": "modProfile.p0enabled"
274-
},
275-
{
276-
"type": "string",
277-
"label": "use folder name. some sometimes not like mod name",
278-
"tooltip": "all your mods that you want to enable \n (if want add new: Settings > Mod Selection\n read: [color=\"255 0 0\"]mod.enabledmods[/color]).\n [color=\"255 0 0\"]",
279-
"config": "modProfile.p1"
280-
},
281-
{
282-
"type": "string",
283-
"label": " autoLabel: ",
284-
"tooltip": "all your mods that you want to enable \n (if want add new: Settings > Mod Selection\n read: [color=\"255 0 0\"]mod.enabledmods[/color]).\n [color=\"255 0 0\"]",
285-
"config": "modProfile.p1label"
286-
},
287-
{
288-
"type": "boolean",
289-
"label": "[color=\"220 185 70\"]use 1[/color]\n",
290-
"tooltip": "Set Hotkey-Profiles.\n[color=\"255 0 0\"]RESTART NECESSARY\n ",
291-
"config": "modProfile.p1enabled"
292-
},
293-
{
294-
"type": "string",
295-
"label": "use folder name. some sometimes not like mod name",
296-
"tooltip": "all your mods that you want to enable \n (if want add new: Settings > Mod Selection\n read: [color=\"255 0 0\"]mod.enabledmods[/color]).\n [color=\"255 0 0\"]",
297-
"config": "modProfile.p2"
298-
},
299-
{
300-
"type": "string",
301-
"label": " autoLabel: ",
302-
"tooltip": "all your mods that you want to enable \n (if want add new: Settings > Mod Selection\n read: [color=\"255 0 0\"]mod.enabledmods[/color]).\n [color=\"255 0 0\"]",
303-
"config": "modProfile.p2label"
304-
},
305-
{
306-
"type": "boolean",
307-
"label": "[color=\"220 185 70\"]use 2[/color]",
308-
"tooltip": "Set Hotkey-Profiles.\n[color=\"255 0 0\"]RESTART NECESSARY[/color]\n [color=\"255 0 0\"]",
309-
"config": "modProfile.p2enabled"
310-
},
311-
{
312-
"type": "string",
313-
"label": "use folder name. some sometimes not like mod name",
314-
"tooltip": "all your mods that you want to enable \n (if want add new: Settings > Mod Selection\n read: [color=\"255 0 0\"]mod.enabledmods[/color]).\n [color=\"255 0 0\"]",
315-
"config": "modProfile.p3"
316-
},
317-
{
318-
"type": "string",
319-
"label": " autoLabel: ",
320-
"tooltip": "all your mods that you want to enable \n (if want add new: Settings > Mod Selection\n read: [color=\"255 0 0\"]mod.enabledmods[/color]).\n [color=\"255 0 0\"]",
321-
"config": "modProfile.p3label"
322-
},
323-
{
324-
"type": "boolean",
325-
"label": "[color=\"220 185 70\"]use 3[/color]",
326-
"tooltip": "Set Hotkey-Profiles.\n[color=\"255 0 0\"]RESTART NECESSARY[/color]\n [color=\"255 0 0\"]",
327-
"config": "modProfile.p3enabled"
328-
},
329-
{
330-
"type": "string",
331-
"label": "use folder name. some sometimes not like mod name",
332-
"tooltip": "all your mods that you want to enable \n (if want add new: Settings > Mod Selection\n read: [color=\"255 0 0\"]mod.enabledmods[/color]).\n [color=\"255 0 0\"]",
333-
"config": "modProfile.p4"
334-
},
335-
{
336-
"type": "string",
337-
"label": " autoLabel: ",
338-
"tooltip": "all your mods that you want to enable \n (if want add new: Settings > Mod Selection\n read: [color=\"255 0 0\"]mod.enabledmods[/color]).\n [color=\"255 0 0\"]",
339-
"config": "modProfile.p4label"
340-
},
341-
{
342-
"type": "boolean",
343-
"label": "[color=\"220 185 70\"]use 4[/color]",
344-
"tooltip": "Set Hotkey-Profiles.\n[color=\"255 0 0\"]RESTART NECESSARY[/color]",
345-
"config": "modProfile.p4enabled"
346-
},
347-
{
348-
"type": "boolean",
349-
"label": "Automatically Enable Kate Overhaul in 8-Player Games: ",
350-
"tooltip": "auto_enable_wehen_join_8_players_game",
351-
"config": "modProfile.auto_enable_wehen_join_8_players_game"
352-
},
353-
{
354-
"type": "string",
355-
"label": "[color=\"255 0 0\"]mod.enabledmods[/color] = used at the moment",
356-
"tooltip": "[color=\"255 0 0\"]will be overwitten\nbetter dont edit[/color].\nmods that you use at the moment\n [color=\"255 0 0\"]more Details at https://trac.wildfiregames.com/wiki/GameDataPaths for example: [/color]\n Path to user data: \n Linux : ~/.config/0ad/user.cfg \n Windows: %AppData%\\0ad\\user.cfg \n macOS : \/Users\/{YOUR USERNAME}\/Library\/Application\\ Support/0ad/user.cfg ",
357-
"config": "mod.enabledmods"
358-
},
359-
{
360-
"type": "string",
361-
"label": "[color=\"255 0 0\"]backup[/color]: will be overwitten\n",
362-
"tooltip": "[color=\"255 0 0\"]i you maybe interested to lear more about GameDataPaths see https://trac.wildfiregames.com/wiki/GameDataPaths [/color]\n [color=\"255 0 0\"] ",
363-
"config": "modProfile.backup"
364-
},
365-
{
366-
"type": "boolean",
367-
"label": "set autoLabel manually",
368-
"tooltip": "default: autoLabel will be created automatically\n with the next game (firt 3 letter of each mod)\n if you have changed the mod-config in its line",
369-
"config": "modProfile.autoLabelManually"
370-
},
371-
{
372-
"type": "boolean",
373-
"label": "show autoFixModsOrder (EXPERIMENTAL)",
374-
"tooltip": "Mods sometimes work better when enabled in a special order ",
375-
"config": "modProfile.showAutoFixModsOrder"
376-
},
377-
{
378-
"type": "string",
379-
"label": "set mods that should always in. e.g. feldmap: ",
380-
"tooltip": "",
381-
"config": "modProfile.alwaysIn"
382-
},
383-
{
384-
"type": "string",
385-
"label": "set mods that should always in replays. e.g. boonGUI : ",
386-
"tooltip": "",
387-
"config": "modProfile.alwaysInReplay"
388-
},
389-
{
390-
"type": "string",
391-
"label": "Chat minimum similarity for commands:",
392-
"tooltip": "Higher reduce the risk of misinterpreting commands. Maximum value: 1.0. Really high values mabe 0.8. 0.3 matches easier.",
393-
"config": "autocivP.fuzzy_minMatchScore"
394-
}
395254

396-
]
397-
},
255+
256+
257+
258+
{
259+
"label": "Mod Profile Selector",
260+
"options": [
261+
{
262+
"type": "dropdown",
263+
"label": "Active Mod Profile: ",
264+
"tooltip": "Select the active mod profile. Only one profile can be active at a time. Restart to apply changes.",
265+
"config": "modProfile.activeProfile",
266+
"list": [
267+
{ "value": "none", "label": "None (Disable All Profiles)" },
268+
{ "value": "0", "label": "Profile 0" },
269+
{ "value": "1", "label": "Profile 1" },
270+
{ "value": "2", "label": "Profile 2" },
271+
{ "value": "3", "label": "Profile 3" },
272+
{ "value": "4", "label": "Profile 4" }
273+
]
274+
},
275+
{
276+
"type": "string",
277+
"label": "Mod Profile 0: ",
278+
"tooltip": "Enter the folder names of the mods to enable (comma-separated) for Profile 0.",
279+
"config": "modProfile.p0"
280+
},
281+
{
282+
"type": "string",
283+
"label": "Mod Profile 0 Label: ",
284+
"tooltip": "A descriptive label for Mod Profile 0 (optional).",
285+
"config": "modProfile.p0label"
286+
},
287+
{
288+
"type": "string",
289+
"label": "Mod Profile 1: ",
290+
"tooltip": "Enter the folder names of the mods to enable (comma-separated) for Profile 1.",
291+
"config": "modProfile.p1"
292+
},
293+
{
294+
"type": "string",
295+
"label": "Mod Profile 1 Label: ",
296+
"tooltip": "A descriptive label for Mod Profile 1 (optional).",
297+
"config": "modProfile.p1label"
298+
},
299+
{
300+
"type": "string",
301+
"label": "Mod Profile 2: ",
302+
"tooltip": "Enter the folder names of the mods to enable (comma-separated) for Profile 2.",
303+
"config": "modProfile.p2"
304+
},
305+
{
306+
"type": "string",
307+
"label": "Mod Profile 2 Label: ",
308+
"tooltip": "A descriptive label for Mod Profile 2 (optional).",
309+
"config": "modProfile.p2label"
310+
},
311+
{
312+
"type": "string",
313+
"label": "Mod Profile 3: ",
314+
"tooltip": "Enter the folder names of the mods to enable (comma-separated) for Profile 3.",
315+
"config": "modProfile.p3"
316+
},
317+
{
318+
"type": "string",
319+
"label": "Mod Profile 3 Label: ",
320+
"tooltip": "A descriptive label for Mod Profile 3 (optional).",
321+
"config": "modProfile.p3label"
322+
},
323+
{
324+
"type": "string",
325+
"label": "Mod Profile 4: ",
326+
"tooltip": "Enter the folder names of the mods to enable (comma-separated) for Profile 4.",
327+
"config": "modProfile.p4"
328+
},
329+
{
330+
"type": "string",
331+
"label": "Mod Profile 4 Label: ",
332+
"tooltip": "A descriptive label for Mod Profile 4 (optional).",
333+
"config": "modProfile.p4label"
334+
},
335+
{
336+
"type": "boolean",
337+
"label": "Automatically Enable Kate Overhaul in 8-Player Games: ",
338+
"tooltip": "auto_enable_wehen_join_8_players_game",
339+
"config": "modProfile.auto_enable_wehen_join_8_players_game"
340+
},
341+
{
342+
"type": "string",
343+
"label": "[color=\"255 0 0\"]mod.enabledmods[/color] = used at the moment",
344+
"tooltip": "[color=\"255 0 0\"]will be overwitten\nbetter dont edit[/color].\nmods that you use at the moment\n [color=\"255 0 0\"]more Details at https://trac.wildfiregames.com/wiki/GameDataPaths for example: [/color]\n Path to user data: \n Linux : ~/.config/0ad/user.cfg \n Windows: %AppData%\\0ad\\user.cfg \n macOS : \/Users\/{YOUR USERNAME}\/Library\/Application\\ Support/0ad/user.cfg ",
345+
"config": "mod.enabledmods"
346+
},
347+
{
348+
"type": "string",
349+
"label": "[color=\"255 0 0\"]backup[/color]: will be overwitten\n",
350+
"tooltip": "[color=\"255 0 0\"]i you maybe interested to lear more about GameDataPaths see https://trac.wildfiregames.com/wiki/GameDataPaths [/color]\n [color=\"255 0 0\"] ",
351+
"config": "modProfile.backup"
352+
},
353+
{
354+
"type": "boolean",
355+
"label": "set autoLabel manually",
356+
"tooltip": "default: autoLabel will be created automatically\n with the next game (firt 3 letter of each mod)\n if you have changed the mod-config in its line",
357+
"config": "modProfile.autoLabelManually"
358+
},
359+
{
360+
"type": "boolean",
361+
"label": "show autoFixModsOrder (EXPERIMENTAL)",
362+
"tooltip": "Mods sometimes work better when enabled in a special order ",
363+
"config": "modProfile.showAutoFixModsOrder"
364+
},
365+
{
366+
"type": "string",
367+
"label": "set mods that should always in. e.g. feldmap: ",
368+
"tooltip": "",
369+
"config": "modProfile.alwaysIn"
370+
},
371+
{
372+
"type": "string",
373+
"label": "set mods that should always in replays. e.g. boonGUI : ",
374+
"tooltip": "",
375+
"config": "modProfile.alwaysInReplay"
376+
},
377+
{
378+
"type": "string",
379+
"label": "Chat minimum similarity for commands:",
380+
"tooltip": "Higher reduce the risk of misinterpreting commands. Maximum value: 1.0. Really high values mabe 0.8. 0.3 matches easier.",
381+
"config": "autocivP.fuzzy_minMatchScore"
382+
}
383+
]
384+
},
385+
386+
398387
{
399388
"label": "♥ Personalization",
400389
"options":

0 commit comments

Comments
 (0)