From ab6dd0164ee98bff7655a50bd6c0ac7c5f34e1be Mon Sep 17 00:00:00 2001 From: Mike-MF Date: Sat, 23 Sep 2023 18:07:52 +0100 Subject: [PATCH] Compat WS - Realistic Names (#9419) * Compat WS - Realistic Names * use cba subcstring * cleanup python * Update script_macros_common.hpp --------- Co-authored-by: BrettMayson Co-authored-by: PabstMirror --- .hemtt/project.toml | 8 ++ .../compat_ws_realisticnames/CfgWeapons.hpp | 122 ++++++++++++++++++ .../compat_ws_realisticnames/config.cpp | 21 +++ .../script_component.hpp | 3 + .../compat_ws_realisticnames/stringtable.xml | 98 ++++++++++++++ .../cba/addons/main/script_macros_common.hpp | 2 + tools/stringtable_validator.py | 3 +- 7 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 addons/compat_ws/compat_ws_realisticnames/CfgWeapons.hpp create mode 100644 addons/compat_ws/compat_ws_realisticnames/config.cpp create mode 100644 addons/compat_ws/compat_ws_realisticnames/script_component.hpp create mode 100644 addons/compat_ws/compat_ws_realisticnames/stringtable.xml diff --git a/.hemtt/project.toml b/.hemtt/project.toml index a8e50e494d..1714b793f9 100644 --- a/.hemtt/project.toml +++ b/.hemtt/project.toml @@ -44,3 +44,11 @@ workshop = [ dlc = [ "S.O.G. Prairie Fire", ] + +[hemtt.launch.ws] +workshop = [ + "450814997", # CBA_A3's Workshop ID +] +dlc = [ + "Western Sahara", +] diff --git a/addons/compat_ws/compat_ws_realisticnames/CfgWeapons.hpp b/addons/compat_ws/compat_ws_realisticnames/CfgWeapons.hpp new file mode 100644 index 0000000000..7c4f16e3c5 --- /dev/null +++ b/addons/compat_ws/compat_ws_realisticnames/CfgWeapons.hpp @@ -0,0 +1,122 @@ +class CfgWeapons { + // AA12 + class sgun_aa40_base_lxWS; + class sgun_aa40_lxWS: sgun_aa40_base_lxWS { + displayName = SUBCSTRING(AA40_Name); + }; + class sgun_aa40_tan_lxWS: sgun_aa40_base_lxWS { + displayName = SUBCSTRING(AA40_Tan_Name); + }; + class sgun_aa40_snake_lxWS: sgun_aa40_base_lxWS { + displayName = SUBCSTRING(AA40_Snake_Name); + }; + + // Galil ARM + class arifle_Galat_base_lxWS; + class arifle_Galat_lxWS: arifle_Galat_base_lxWS { + displayName = SUBCSTRING(Galat_Name); + }; + class arifle_Galat_worn_lxWS: arifle_Galat_lxWS { + displayName = SUBCSTRING(Galat_Old_Name); + }; + + // GLX 160 + class glaunch_GLX_base_lxWS; + class glaunch_GLX_lxWS: glaunch_GLX_base_lxWS { + displayName = SUBCSTRING(GLX_Name); + }; + class glaunch_GLX_snake_lxWS: glaunch_GLX_base_lxWS { + displayName = SUBCSTRING(GLX_Snake_Name); + }; + class glaunch_GLX_hex_lxWS: glaunch_GLX_base_lxWS { + displayName = SUBCSTRING(GLX_Hex_Name); + }; + class glaunch_GLX_ghex_lxWS: glaunch_GLX_base_lxWS { + displayName = SUBCSTRING(GLX_GreenHex_Name); + }; + class glaunch_GLX_camo_lxWS: glaunch_GLX_base_lxWS { + displayName = SUBCSTRING(GLX_Camo_Name); + }; + class glaunch_GLX_tan_lxWS: glaunch_GLX_base_lxWS { + displayName = SUBCSTRING(GLX_Tan_Name); + }; + + // Mk14 Mod 1 EBR + class srifle_EBR_F; + class srifle_EBR_blk_lxWS: srifle_EBR_F { + displayName = SUBCSTRING(EBR_Black_Name); + }; + class srifle_EBR_snake_lxWS: srifle_EBR_F { + displayName = SUBCSTRING(EBR_Snake_Name); + }; + + // Vektor SS-77 + class LMG_S77_base_lxWS; + class LMG_S77_lxWS: LMG_S77_base_lxWS { + displayName = SUBCSTRING(S77_Name); + }; + class LMG_S77_AAF_lxWS: LMG_S77_base_lxWS { + displayName = SUBCSTRING(S77_AAF_Name); + }; + class LMG_S77_Hex_lxWS: LMG_S77_base_lxWS { + displayName = SUBCSTRING(S77_Hex_Name); + }; + class LMG_S77_GHex_lxWS: LMG_S77_base_lxWS { + displayName = SUBCSTRING(S77_GreenHex_Name); + }; + class LMG_S77_Desert_lxWS: LMG_S77_base_lxWS { + displayName = SUBCSTRING(S77_Desert_Name); + }; + + // Vektor SS-77 (Compact) + class LMG_S77_Compact_base_lxWS; + class LMG_S77_Compact_lxWS: LMG_S77_Compact_base_lxWS { + displayName = SUBCSTRING(S77_Compact_Name); + }; + class LMG_S77_Compact_Snakeskin_lxWS: LMG_S77_Compact_base_lxWS { + displayName = SUBCSTRING(S77_Compact_Snake_Name); + }; + + // FN FAL (Wood) - Closest match is the 50.00 + class DMR_06_base_F; + class arifle_SLR_lxWS: DMR_06_base_F { + displayName = SUBCSTRING(SLR_Wood_Name); + }; + class arifle_SLR_GL_lxWS: arifle_SLR_lxWS { + displayName = SUBCSTRING(SLR_GL_Wood_Name); + }; + + // FN FAL + class arifle_SLR_V_lxWS: arifle_SLR_lxWS { + displayName = SUBCSTRING(SLR_Name); + }; + class arifle_SLR_V_GL_lxWS: arifle_SLR_V_lxWS { + displayName = SUBCSTRING(SLR_GL_Name); + }; + class arifle_SLR_D_lxWS: arifle_SLR_lxWS { + displayName = SUBCSTRING(SLR_Desert_Name); + }; + class arifle_SLR_V_camo_lxWS: arifle_SLR_V_lxWS { + displayName = SUBCSTRING(SLR_Camo_Name); + }; + + // Vektor R4/R5 + class arifle_Velko_base_lxWS; + class arifle_Velko_lxWS: arifle_Velko_base_lxWS { + displayName = SUBCSTRING(Velko_R4_Name); + }; + class arifle_VelkoR5_lxWS: arifle_Velko_base_lxWS { + displayName = SUBCSTRING(Velko_R5_Name); + }; + class arifle_VelkoR5_GL_lxWS: arifle_VelkoR5_lxWS { + displayName = SUBCSTRING(Velko_R5_GL_Name); + }; + class arifle_VelkoR5_snake_lxWS: arifle_VelkoR5_lxWS { + displayName = SUBCSTRING(Velko_R5_Snake_Name); + }; + class arifle_VelkoR5_GL_snake_lxWS: arifle_VelkoR5_GL_lxWS { + displayName = SUBCSTRING(Velko_R5_GL_Snake_Name); + }; + + // XMS has not been added as it's a make believe hybrid of the XM8/VHS-K2: XM8+VHS = XMS +}; diff --git a/addons/compat_ws/compat_ws_realisticnames/config.cpp b/addons/compat_ws/compat_ws_realisticnames/config.cpp new file mode 100644 index 0000000000..5c8e166e00 --- /dev/null +++ b/addons/compat_ws/compat_ws_realisticnames/config.cpp @@ -0,0 +1,21 @@ +#include "script_component.hpp" + +class CfgPatches { + class SUBADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "data_f_lxWS_Loadorder", + "ace_realisticnames" + }; + skipWhenMissingDependencies = 1; + author = ECSTRING(common,ACETeam); + authors[] = {"Mike"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgWeapons.hpp" diff --git a/addons/compat_ws/compat_ws_realisticnames/script_component.hpp b/addons/compat_ws/compat_ws_realisticnames/script_component.hpp new file mode 100644 index 0000000000..b8d0682fa4 --- /dev/null +++ b/addons/compat_ws/compat_ws_realisticnames/script_component.hpp @@ -0,0 +1,3 @@ +#define SUBCOMPONENT realisticnames +#define SUBCOMPONENT_BEAUTIFIED Realistic Names +#include "..\script_component.hpp" diff --git a/addons/compat_ws/compat_ws_realisticnames/stringtable.xml b/addons/compat_ws/compat_ws_realisticnames/stringtable.xml new file mode 100644 index 0000000000..c3e83d27da --- /dev/null +++ b/addons/compat_ws/compat_ws_realisticnames/stringtable.xml @@ -0,0 +1,98 @@ + + + + + AA12 + + + AA12 (Sand) + + + AA12 (Snake) + + + Galil ARM + + + Galil ARM (Old) + + + GLX 160 + + + GLX 160 (Snake) + + + GLX 160 (Hex) + + + GLX 160 (Green Hex) + + + GLX 160 (Camo) + + + GLX 160 (Sand) + + + Mk14 Mod 1 EBR (Black) + + + Mk14 Mod 1 EBR (Snake) + + + Vektor SS-77 + + + Vektor SS-77 (Camo) + + + Vektor SS-77 (Hex) + + + Vektor SS-77 (Green Hex) + + + Vektor SS-77 (Desert) + + + Vektor SS-77 Compact + + + Vektor SS-77 Compact (Snake) + + + FN FAL 50.00 (Wood) + + + FN FAL 50.00 GL (Wood) + + + FN FAL 50.00 + + + FN FAL 50.00 GL + + + FN FAL 50.00 (Desert) + + + FN FAL 50.00 (Jungle) + + + Vektor R4 + + + Vektor R5 Carbine + + + Vektor R5 Carbine GL + + + Vektor R5 Carbine (Snake) + + + Vektor R5 Carbine GL (Snake) + + + diff --git a/include/x/cba/addons/main/script_macros_common.hpp b/include/x/cba/addons/main/script_macros_common.hpp index 7d930c66a8..2683f3b033 100644 --- a/include/x/cba/addons/main/script_macros_common.hpp +++ b/include/x/cba/addons/main/script_macros_common.hpp @@ -1275,9 +1275,11 @@ Author: #define ELSTRING(var1,var2) QUOTE(TRIPLES(STR,DOUBLES(PREFIX,var1),var2)) #define CSTRING(var1) QUOTE(TRIPLES($STR,ADDON,var1)) #define ECSTRING(var1,var2) QUOTE(TRIPLES($STR,DOUBLES(PREFIX,var1),var2)) + #define SUBCSTRING(var1) QUOTE(TRIPLES($STR,SUBADDON,var1)) #define LLSTRING(var1) localize QUOTE(TRIPLES(STR,ADDON,var1)) #define LELSTRING(var1,var2) localize QUOTE(TRIPLES(STR,DOUBLES(PREFIX,var1),var2)) + #define LSUBLSTRING(var1) localize QUOTE(TRIPLES(STR,SUBADDON,var1)) #endif diff --git a/tools/stringtable_validator.py b/tools/stringtable_validator.py index c28af96fd8..2ac3604f44 100644 --- a/tools/stringtable_validator.py +++ b/tools/stringtable_validator.py @@ -53,7 +53,8 @@ def check_stringtable(filepath): print(" ERROR: Package name attribute '{}' is all lowercase, should be in titlecase.".format(package_name)) errors += 1 - if package_name.lower() != os.path.basename(os.path.dirname(filepath)): + component_folder = os.path.basename(os.path.dirname(filepath)) + if package_name.lower() != component_folder: print(" ERROR: Package name attribute '{}' does not match the component folder name.".format(package_name)) errors += 1