From d4f16c0459ff14663ac7c825b900fa3fa11a54a3 Mon Sep 17 00:00:00 2001 From: diwako Date: Wed, 25 Mar 2026 15:07:39 +0100 Subject: [PATCH] Add DUI name tag extra info support --- addons/common/XEH_postInitClient.sqf | 4 + addons/common/XEH_preInit.sqf | 132 +--------------------- addons/common/XEH_preInitClient.sqf | 9 -- addons/common/settings.inc.sqf | 159 +++++++++++++++++++++++++++ 4 files changed, 164 insertions(+), 140 deletions(-) create mode 100644 addons/common/settings.inc.sqf diff --git a/addons/common/XEH_postInitClient.sqf b/addons/common/XEH_postInitClient.sqf index c6adb28..4c0a06c 100644 --- a/addons/common/XEH_postInitClient.sqf +++ b/addons/common/XEH_postInitClient.sqf @@ -121,3 +121,7 @@ if (GVAR(arsenalAddAcreTab)) then { }; [] call FUNC(initViewDistance); + +[{!(isNull player)}, { + player setVariable ["diwako_dui_nametags_customInfo", GVAR(sanitizedDuiExtraInfo), true]; +}, []] call CBA_fnc_waitUntilAndExecute; diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index c35342f..e4a28db 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -8,137 +8,7 @@ ADDON = false; GVAR(vehicleNames) = []; GVAR(admins) = compileFinal str (getArray (configFile >> QGVAR(admins))); -[ - QGVAR(displayVehicleNamesSetting), // Internal setting name, should always contain a tag! This will be the global variable which takes the value of the setting. - "CHECKBOX", // setting type - ["Display vehicle names", "Mission makers may enable 3d vehicle names for easier identification"], // Pretty name of the category where the setting can be found. Can be stringtable entry. - [FP_SETTINGS, "General"], // Pretty name shown inside the ingame settings menu. Can be stringtable entry. - true, // data for this setting - nil, // "_isGlobal" flag. Set this to true to always have this setting synchronized between all clients in multiplayer - { - params ["_value"]; - if (_value isEqualTo false) then { - removeMissionEventHandler ["Draw3D", RETDEF(GVAR(drawNamesId),-1)]; - GVAR(drawNamesId) = nil; - } else { - [] call FUNC(runVehicleDrawEH); - }; - } // function that will be executed once on mission start and every time the setting is changed. -] call CBA_fnc_addSetting; - -[ - QGVAR(customChatPingSound), // Internal setting name, should always contain a tag! This will be the global variable which takes the value of the setting. - "CHECKBOX", // setting type - ["Custom chat ping", "Play a notification sound when sending whispers or receiving custom chat"], // Pretty name of the category where the setting can be found. Can be stringtable entry. - [FP_SETTINGS, "General"], // Pretty name shown inside the ingame settings menu. Can be stringtable entry. - true, // data for this setting - nil // "_isGlobal" flag. Set this to true to always have this setting synchronized between all clients in multiplayer -] call CBA_fnc_addSetting; - -[ - QGVAR(useFpDuplex), - "CHECKBOX", - ["Use FP Duplex", "Displays message if stepping on or being stepped on while talking on long range radio. Makes sender who spoke first stop transmitting."], - [FP_SETTINGS, "ACRE"], - true, - true -] call CBA_fnc_addSetting; - -[ - QGVAR(fpDuplexCutOffTransmission), - "CHECKBOX", - ["Make FP duplex end transmission", ""], - [FP_SETTINGS, "ACRE"], - true, - true -] call CBA_fnc_addSetting; - -[ - QGVAR(showReiceiverHint), - "CHECKBOX", - ["Show message receive hint", "Shows an ACRE hint box detailing who is currently sending a message onto your radio"], - [FP_SETTINGS, "ACRE"], - true, - false -] call CBA_fnc_addSetting; - -[ - QGVAR(showReiceiverHintColorLR), - "COLOR", - ["Receiver hint color LR", "Color for long range receiving hint"], - [FP_SETTINGS, "ACRE"], - [0.5, 1.0, 0, 0.8], - false -] call CBA_fnc_addSetting; - -[ - QGVAR(showReiceiverHintColorSR), - "COLOR", - ["Receiver hint color SR", "Color for short range receiving hint"], - [FP_SETTINGS, "ACRE"], - [0.8, 0.5, 1.0, 0.8], - false -] call CBA_fnc_addSetting; - -[ - QGVAR(arsenalAddMedicalTab), - "CHECKBOX", - "Add medical tab", - [FP_SETTINGS, "Arsenal"], - true, - false -] call CBA_fnc_addSetting; - -[ - QGVAR(arsenalAddAcreTab), - "CHECKBOX", - "Add radio tab", - [FP_SETTINGS, "Arsenal"], - true, - false -] call CBA_fnc_addSetting; - -[ - QGVAR(disableRHSStartUp), - "CHECKBOX", - "Disable RHS engine start up", - [FP_SETTINGS, "General"], - true, - true -] call CBA_fnc_addSetting; - -[ - QGVAR(enableViewdistanceSelector), - "CHECKBOX", - "Enable Viewdistance Selector", - [FP_SETTINGS, "View Distance"], - true, - false -] call CBA_fnc_addSetting; - -[ - QGVAR(viewdistanceMinimum), "SLIDER", - ["Minimum Value", ""], - [FP_SETTINGS, "View Distance"], - [250, 10000, 500, 0], - false -] call CBA_fnc_addSetting; - -[ - QGVAR(viewdistanceStep), "SLIDER", - ["Value Step", ""], - [FP_SETTINGS, "View Distance"], - [100, 1000, 250, 0], - false -] call CBA_fnc_addSetting; - -[ - QGVAR(viewdistanceMaximum), "SLIDER", - ["Maximum Value", ""], - [FP_SETTINGS, "View Distance"], - [250, 10000, 5000, 0], - false -] call CBA_fnc_addSetting; +#include "settings.inc.sqf" [QGVAR(endMission), { if (!isNil QGVAR(ending)) exitWith {}; diff --git a/addons/common/XEH_preInitClient.sqf b/addons/common/XEH_preInitClient.sqf index 5b2db30..8d83979 100644 --- a/addons/common/XEH_preInitClient.sqf +++ b/addons/common/XEH_preInitClient.sqf @@ -13,15 +13,6 @@ if (!hasInterface) exitWith {}; '' ] call CBA_fnc_addKeybind; -[ - QGVAR(hideChatHint), - "CHECKBOX", - ["Hide chat hint", "Man I do not wanna see that giant box when i am shit posting!"], - [FP_SETTINGS, "General"], - false, - false -] call CBA_fnc_addSetting; - GVAR(lastMessageFrom) = ""; [QGVAR(chatMessage), { params ["_sender", "_msg", "_type", "_receiver", ["_ping", true]]; diff --git a/addons/common/settings.inc.sqf b/addons/common/settings.inc.sqf new file mode 100644 index 0000000..4c24a04 --- /dev/null +++ b/addons/common/settings.inc.sqf @@ -0,0 +1,159 @@ +[ + QGVAR(displayVehicleNamesSetting), // Internal setting name, should always contain a tag! This will be the global variable which takes the value of the setting. + "CHECKBOX", // setting type + ["Display vehicle names", "Mission makers may enable 3d vehicle names for easier identification"], // Pretty name of the category where the setting can be found. Can be stringtable entry. + [FP_SETTINGS, "General"], // Pretty name shown inside the ingame settings menu. Can be stringtable entry. + true, // data for this setting + nil, // "_isGlobal" flag. Set this to true to always have this setting synchronized between all clients in multiplayer + { + params ["_value"]; + if (_value isEqualTo false) then { + removeMissionEventHandler ["Draw3D", RETDEF(GVAR(drawNamesId),-1)]; + GVAR(drawNamesId) = nil; + } else { + [] call FUNC(runVehicleDrawEH); + }; + } // function that will be executed once on mission start and every time the setting is changed. +] call CBA_fnc_addSetting; + +[ + QGVAR(customChatPingSound), // Internal setting name, should always contain a tag! This will be the global variable which takes the value of the setting. + "CHECKBOX", // setting type + ["Custom chat ping", "Play a notification sound when sending whispers or receiving custom chat"], // Pretty name of the category where the setting can be found. Can be stringtable entry. + [FP_SETTINGS, "General"], // Pretty name shown inside the ingame settings menu. Can be stringtable entry. + true, // data for this setting + nil // "_isGlobal" flag. Set this to true to always have this setting synchronized between all clients in multiplayer +] call CBA_fnc_addSetting; + +[ + QGVAR(useFpDuplex), + "CHECKBOX", + ["Use FP Duplex", "Displays message if stepping on or being stepped on while talking on long range radio. Makes sender who spoke first stop transmitting."], + [FP_SETTINGS, "ACRE"], + true, + true +] call CBA_fnc_addSetting; + +[ + QGVAR(fpDuplexCutOffTransmission), + "CHECKBOX", + ["Make FP duplex end transmission", ""], + [FP_SETTINGS, "ACRE"], + true, + true +] call CBA_fnc_addSetting; + +[ + QGVAR(showReiceiverHint), + "CHECKBOX", + ["Show message receive hint", "Shows an ACRE hint box detailing who is currently sending a message onto your radio"], + [FP_SETTINGS, "ACRE"], + true, + false +] call CBA_fnc_addSetting; + +[ + QGVAR(showReiceiverHintColorLR), + "COLOR", + ["Receiver hint color LR", "Color for long range receiving hint"], + [FP_SETTINGS, "ACRE"], + [0.5, 1.0, 0, 0.8], + false +] call CBA_fnc_addSetting; + +[ + QGVAR(showReiceiverHintColorSR), + "COLOR", + ["Receiver hint color SR", "Color for short range receiving hint"], + [FP_SETTINGS, "ACRE"], + [0.8, 0.5, 1.0, 0.8], + false +] call CBA_fnc_addSetting; + +[ + QGVAR(arsenalAddMedicalTab), + "CHECKBOX", + "Add medical tab", + [FP_SETTINGS, "Arsenal"], + true, + false +] call CBA_fnc_addSetting; + +[ + QGVAR(arsenalAddAcreTab), + "CHECKBOX", + "Add radio tab", + [FP_SETTINGS, "Arsenal"], + true, + false +] call CBA_fnc_addSetting; + +[ + QGVAR(disableRHSStartUp), + "CHECKBOX", + "Disable RHS engine start up", + [FP_SETTINGS, "General"], + true, + true +] call CBA_fnc_addSetting; + +[ + QGVAR(enableViewdistanceSelector), + "CHECKBOX", + "Enable Viewdistance Selector", + [FP_SETTINGS, "View Distance"], + true, + false +] call CBA_fnc_addSetting; + +[ + QGVAR(viewdistanceMinimum), "SLIDER", + ["Minimum Value", ""], + [FP_SETTINGS, "View Distance"], + [250, 10000, 500, 0], + false +] call CBA_fnc_addSetting; + +[ + QGVAR(viewdistanceStep), "SLIDER", + ["Value Step", ""], + [FP_SETTINGS, "View Distance"], + [100, 1000, 250, 0], + false +] call CBA_fnc_addSetting; + +[ + QGVAR(viewdistanceMaximum), "SLIDER", + ["Maximum Value", ""], + [FP_SETTINGS, "View Distance"], + [250, 10000, 5000, 0], + false +] call CBA_fnc_addSetting; + +[ + QGVAR(hideChatHint), + "CHECKBOX", + ["Hide chat hint", "Man I do not wanna see that giant box when i am shit posting!"], + [FP_SETTINGS, "General"], + false, + false +] call CBA_fnc_addSetting; + +// make sure the dedicated server does not get this setting so it cannot be forced from it +if (hasInterface) then { + [ + QGVAR(duiExtraInfo), + "EDITBOX", + ["DUI extra name tag info", "Enter your pronouns, something funny, your name, just don't be rude, at most 15 characters"], + [FP_SETTINGS, "General"], + "", + false, + { + params ["_value"]; + GVAR(sanitizedDuiExtraInfo) = [_value select [0, 15], true] call ace_common_fnc_sanitizeString; + if !(isNull player) then { + player setVariable ["diwako_dui_nametags_customInfo", GVAR(sanitizedDuiExtraInfo), true]; + }; + } + ] call CBA_fnc_addSetting; +};