From a6ced105ee217be9808315caadd29e4d2f6a60dd Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 1 Sep 2022 19:44:38 +0200 Subject: [PATCH] Add No vehicle clan logo component (#9018) * Add novehicleclanlogo component * Documentation * Update README.md * Use selection name from vehicle config --- addons/novehicleclanlogo/$PBOPREFIX$ | 1 + addons/novehicleclanlogo/CfgEventHandlers.hpp | 18 +++++++++++++ addons/novehicleclanlogo/README.md | 4 +++ addons/novehicleclanlogo/XEH_PREP.hpp | 1 + addons/novehicleclanlogo/XEH_postInit.sqf | 14 ++++++++++ addons/novehicleclanlogo/XEH_preInit.sqf | 11 ++++++++ addons/novehicleclanlogo/XEH_preStart.sqf | 3 +++ addons/novehicleclanlogo/config.cpp | 17 ++++++++++++ .../functions/fnc_removeClanLogo.sqf | 26 +++++++++++++++++++ .../functions/script_component.hpp | 1 + addons/novehicleclanlogo/initSettings.sqf | 11 ++++++++ addons/novehicleclanlogo/script_component.hpp | 16 ++++++++++++ addons/novehicleclanlogo/stringtable.xml | 13 ++++++++++ docs/wiki/feature/novehicleclanlogo.md | 18 +++++++++++++ 14 files changed, 154 insertions(+) create mode 100644 addons/novehicleclanlogo/$PBOPREFIX$ create mode 100644 addons/novehicleclanlogo/CfgEventHandlers.hpp create mode 100644 addons/novehicleclanlogo/README.md create mode 100644 addons/novehicleclanlogo/XEH_PREP.hpp create mode 100644 addons/novehicleclanlogo/XEH_postInit.sqf create mode 100644 addons/novehicleclanlogo/XEH_preInit.sqf create mode 100644 addons/novehicleclanlogo/XEH_preStart.sqf create mode 100644 addons/novehicleclanlogo/config.cpp create mode 100644 addons/novehicleclanlogo/functions/fnc_removeClanLogo.sqf create mode 100644 addons/novehicleclanlogo/functions/script_component.hpp create mode 100644 addons/novehicleclanlogo/initSettings.sqf create mode 100644 addons/novehicleclanlogo/script_component.hpp create mode 100644 addons/novehicleclanlogo/stringtable.xml create mode 100644 docs/wiki/feature/novehicleclanlogo.md diff --git a/addons/novehicleclanlogo/$PBOPREFIX$ b/addons/novehicleclanlogo/$PBOPREFIX$ new file mode 100644 index 0000000000..8232a79524 --- /dev/null +++ b/addons/novehicleclanlogo/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\novehicleclanlogo diff --git a/addons/novehicleclanlogo/CfgEventHandlers.hpp b/addons/novehicleclanlogo/CfgEventHandlers.hpp new file mode 100644 index 0000000000..6c29240403 --- /dev/null +++ b/addons/novehicleclanlogo/CfgEventHandlers.hpp @@ -0,0 +1,18 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); + }; +}; + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/novehicleclanlogo/README.md b/addons/novehicleclanlogo/README.md new file mode 100644 index 0000000000..4a058d99ba --- /dev/null +++ b/addons/novehicleclanlogo/README.md @@ -0,0 +1,4 @@ +novehicleclanlogo +============= + +Prevents clan logo from being displayed on vehicles controlled by players. diff --git a/addons/novehicleclanlogo/XEH_PREP.hpp b/addons/novehicleclanlogo/XEH_PREP.hpp new file mode 100644 index 0000000000..a835a8884f --- /dev/null +++ b/addons/novehicleclanlogo/XEH_PREP.hpp @@ -0,0 +1 @@ +PREP(removeClanLogo); diff --git a/addons/novehicleclanlogo/XEH_postInit.sqf b/addons/novehicleclanlogo/XEH_postInit.sqf new file mode 100644 index 0000000000..ec2049c4a1 --- /dev/null +++ b/addons/novehicleclanlogo/XEH_postInit.sqf @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +// clan logos are not used in singleplayer +if (!isMultiplayer) exitWith {}; + +["CBA_settingsInitialized", { + TRACE_1("settingsInit eh",GVAR(enabled)); + + if (isServer && {GVAR(enabled)}) then { + ["LandVehicle", "initPost", LINKFUNC(removeClanLogo), true, [], true] call CBA_fnc_addClassEventHandler; + ["Air", "initPost", LINKFUNC(removeClanLogo), true, [], true] call CBA_fnc_addClassEventHandler; + ["Ship", "initPost", LINKFUNC(removeClanLogo), true, [], true] call CBA_fnc_addClassEventHandler; + }; +}] call CBA_fnc_addEventHandler; diff --git a/addons/novehicleclanlogo/XEH_preInit.sqf b/addons/novehicleclanlogo/XEH_preInit.sqf new file mode 100644 index 0000000000..9361d05015 --- /dev/null +++ b/addons/novehicleclanlogo/XEH_preInit.sqf @@ -0,0 +1,11 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +#include "initSettings.sqf" + +ADDON = true; diff --git a/addons/novehicleclanlogo/XEH_preStart.sqf b/addons/novehicleclanlogo/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/novehicleclanlogo/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/novehicleclanlogo/config.cpp b/addons/novehicleclanlogo/config.cpp new file mode 100644 index 0000000000..77c7dce638 --- /dev/null +++ b/addons/novehicleclanlogo/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author = ECSTRING(common,ACETeam); + authors[] = {"veteran29"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/novehicleclanlogo/functions/fnc_removeClanLogo.sqf b/addons/novehicleclanlogo/functions/fnc_removeClanLogo.sqf new file mode 100644 index 0000000000..0b35e608fc --- /dev/null +++ b/addons/novehicleclanlogo/functions/fnc_removeClanLogo.sqf @@ -0,0 +1,26 @@ +#include "script_component.hpp" +/* + * Author: veteran29 + * Replaces the vehicle clan logo with an empty texture. + * + * Arguments: + * 0: Vehicle + * + * Return Value: + * None + * + * Example: + * [vehicle player] call ace_novehicleclanlogo_fnc_removeClanLogo + * + * Public: Yes + */ + +params ["_vehicle"]; + +private _selectionClan = getText (configOf _vehicle >> "selectionClan"); +if !(_selectionClan in selectionNames _vehicle) exitWith { + TRACE_2("vehicle does not have 'selectionClan' selection",_vehicle,_selectionLogo); +}; + +TRACE_1("replacing clan logo with empty texture",_vehicle); +_vehicle setObjectTextureGlobal [_selectionClan, "#(argb,1,1,1)color(0,0,0,0)"] // return diff --git a/addons/novehicleclanlogo/functions/script_component.hpp b/addons/novehicleclanlogo/functions/script_component.hpp new file mode 100644 index 0000000000..41e852be27 --- /dev/null +++ b/addons/novehicleclanlogo/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\novehicleclanlogo\script_component.hpp" diff --git a/addons/novehicleclanlogo/initSettings.sqf b/addons/novehicleclanlogo/initSettings.sqf new file mode 100644 index 0000000000..471877ca5c --- /dev/null +++ b/addons/novehicleclanlogo/initSettings.sqf @@ -0,0 +1,11 @@ +private _category = [ELSTRING(common,ACEKeybindCategoryVehicles), LSTRING(DisplayName)],; + +[ + QGVAR(enabled), "CHECKBOX", + [LELSTRING(common,Enabled), LSTRING(Enabled_Tooltip)], + _category, + false, + true, + {}, + true +] call CBA_fnc_addSetting; diff --git a/addons/novehicleclanlogo/script_component.hpp b/addons/novehicleclanlogo/script_component.hpp new file mode 100644 index 0000000000..eef91354bd --- /dev/null +++ b/addons/novehicleclanlogo/script_component.hpp @@ -0,0 +1,16 @@ +#define COMPONENT novehicleclanlogo +#define COMPONENT_BEAUTIFIED No Vehicle Clan Logo +#include "\z\ace\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_NOVEHICLECLANLOGO + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_ENABLED_NOVEHICLECLANLOGO + #define DEBUG_SETTINGS DEBUG_ENABLED_NOVEHICLECLANLOGO +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/novehicleclanlogo/stringtable.xml b/addons/novehicleclanlogo/stringtable.xml new file mode 100644 index 0000000000..70aaa50e17 --- /dev/null +++ b/addons/novehicleclanlogo/stringtable.xml @@ -0,0 +1,13 @@ + + + + + Remove clan logo from vehicles + Usuń logo klanu z pojazdów + + + Prevents clan logo from being displayed on vehicles controlled by players. + Zapobiega wyświetlaniu logo klanu na pojazdach kontrolowanych przez graczy. + + + diff --git a/docs/wiki/feature/novehicleclanlogo.md b/docs/wiki/feature/novehicleclanlogo.md new file mode 100644 index 0000000000..bae1125762 --- /dev/null +++ b/docs/wiki/feature/novehicleclanlogo.md @@ -0,0 +1,18 @@ +--- +layout: wiki +title: No vehicle clan logo +component: novehicleclanlogo +description: Removes clan logo from vehicles. +group: feature +category: realism +parent: wiki +mod: ace +version: + major: 3 + minor: 15 + patch: 1 +--- + +## 1. Overview + +Prevents clan logo from vehicles controlled by players. Can be toggled in ACE Vehicles settings category.