diff --git a/addons/common/ACE_ExtensionsHashes.hpp b/addons/common/ACE_ExtensionsHashes.hpp new file mode 100644 index 00000000000..74fe4defab1 --- /dev/null +++ b/addons/common/ACE_ExtensionsHashes.hpp @@ -0,0 +1,6 @@ +class ACE_ExtensionsHashes { + class ace { + dll = "b83c2c9c7c989eaf888c885d13a2fdf4a61d1c5f"; + dll_x64 = "356a61c4bd2aa13556a8ba0b467c819b3b438d6c"; + }; +}; diff --git a/addons/common/config.cpp b/addons/common/config.cpp index f7b27ce3749..f94b1d376cd 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -75,3 +75,5 @@ class ACE_Tests { mapConfigs = QPATHTOF(dev\test_mapConfigs.sqf); cfgPatches = QPATHTOF(dev\test_cfgPatches.sqf); }; + +#include "ACE_ExtensionsHashes.hpp" diff --git a/addons/common/functions/fnc_checkFiles.sqf b/addons/common/functions/fnc_checkFiles.sqf index 13ad27a7cb5..8ae67eb04a0 100644 --- a/addons/common/functions/fnc_checkFiles.sqf +++ b/addons/common/functions/fnc_checkFiles.sqf @@ -116,31 +116,52 @@ if (_oldCompats isNotEqualTo []) then { /////////////// // Check extensions /////////////// -private _platform = toLowerANSI (productVersion select 6); +if (hasInterface) then { + private _platform = toLowerANSI (productVersion select 6); -if (_platform in ["linux", "osx"]) then { - // Linux and OSX client ports do not support extensions at all - if (hasInterface) then { + // Check for presence + if (_platform in ["linux", "osx"]) exitWith { + // Linux and OSX client ports do not support extensions at all WARNING("Operating system does not support extensions"); - } else { - INFO("Operating system does not support extensions"); }; -} else { + ("ace" callExtension ["version", []]) params [["_versionEx", "", [""]], ["_returnCode", -1, [-1]]]; if (_returnCode != 0 || {_versionEx == ""}) then { private _errorMsg = format ["Extension not found. [Return Code: %1]", _returnCode]; ERROR(_errorMsg); - - if (hasInterface) then { - ["[ACE] ERROR", _errorMsg] call FUNC(errorMessage); - }; + ["[ACE] ERROR", _errorMsg] call FUNC(errorMessage); } else { _versionEx = _versionEx select [0, 8]; // git hash INFO_1("Extension [Version: %1]",_versionEx); }; -}; + // Check for correct hash + if (GVAR(checkExtensions)) then { + private _allExtensions = allExtensions; + + { + private _extName = configName _x; + private _extensionType = "dll"; + if (productVersion select 7 == "x64") then { _extensionType = format ["%1_x64", _extensionType]; }; + private _expectedHash = getText (_x >> _extensionType); + + private _extensionHash = ""; + { + if ((_x getOrDefault ["name", ""]) == _extName) exitWith { + _extensionHash = _x getOrDefault ["hash", ""]; + }; + } forEach _allExtensions; + TRACE_3("",_extName,_expectedHash,_extensionHash); + + if (_extensionHash != _expectedHash) then { + private _errorMsg = format ["Extension %1 wrong version [%2 vs %3].", _extName, _extensionHash, _expectedHash]; + ERROR(_errorMsg); + ["[ACE] ERROR", _errorMsg] call FUNC(errorMessage); + }; + } forEach ("true" configClasses (configFile >> "ACE_ExtensionsHashes")); + }; +}; /////////////// // Check server version/addons diff --git a/addons/common/initSettings.inc.sqf b/addons/common/initSettings.inc.sqf index 4b3a2fd9c9d..a0a495b094e 100644 --- a/addons/common/initSettings.inc.sqf +++ b/addons/common/initSettings.inc.sqf @@ -29,6 +29,15 @@ private _categorySway = [_category, LSTRING(subcategory_sway)]; 1 ] call CBA_fnc_addSetting; +[ + QGVAR(checkExtensions), + "CHECKBOX", + [LSTRING(checkExtensions_DisplayName)], + _category, + false, + 1 +] call CBA_fnc_addSetting; + [ QGVAR(settingFeedbackIcons), "LIST", diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index fa26901e46b..ece8ece410d 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -409,6 +409,9 @@ 检查 PBO PBO-k ellenőrzése + + Check Extensions + What addons are allowed regardless? Jaké addony jsou povoleny? diff --git a/addons/compat_ef/CfgWeapons.hpp b/addons/compat_ef/CfgWeapons.hpp index 1b2cd4c3fe5..33fa1c41d2d 100644 --- a/addons/compat_ef/CfgWeapons.hpp +++ b/addons/compat_ef/CfgWeapons.hpp @@ -7,25 +7,6 @@ class CfgWeapons { EGVAR(nightvision,border) = QPATHTOEF(nightvision,data\nvg_mask_binos_4096.paa); }; - // -- ace_hearing -- - class HelmetBase; - class EF_H_Protecta: HelmetBase { - HEARING_PROTECTION_PELTOR; - }; - class EF_H_MCH; // this does not have peltor - class EF_H_MCH_Basic: EF_H_MCH { - HEARING_PROTECTION_PELTOR; - }; - class EF_H_MCH_BasicNet_Des: EF_H_MCH { - HEARING_PROTECTION_PELTOR; - }; - class EF_H_MCH_Full: EF_H_MCH { - HEARING_PROTECTION_PELTOR; - }; - class EF_H_MCH_FullCamo_Des: EF_H_MCH { - HEARING_PROTECTION_PELTOR; - }; - // -- ace_overpressure -- class autocannon_30mm; class EF_autocannon_50mm_AAV9: autocannon_30mm { diff --git a/addons/compat_ef/compat_ef_hearing/CfgWeapons.hpp b/addons/compat_ef/compat_ef_hearing/CfgWeapons.hpp new file mode 100644 index 00000000000..ece1f54c252 --- /dev/null +++ b/addons/compat_ef/compat_ef_hearing/CfgWeapons.hpp @@ -0,0 +1,19 @@ +class CfgWeapons { + class HelmetBase; + class EF_H_Protecta: HelmetBase { + HEARING_PROTECTION_PELTOR; + }; + class EF_H_MCH; // this does not have peltor + class EF_H_MCH_Basic: EF_H_MCH { + HEARING_PROTECTION_PELTOR; + }; + class EF_H_MCH_BasicNet_Des: EF_H_MCH { + HEARING_PROTECTION_PELTOR; + }; + class EF_H_MCH_Full: EF_H_MCH { + HEARING_PROTECTION_PELTOR; + }; + class EF_H_MCH_FullCamo_Des: EF_H_MCH { + HEARING_PROTECTION_PELTOR; + }; +}; diff --git a/addons/compat_ef/compat_ef_hearing/config.cpp b/addons/compat_ef/compat_ef_hearing/config.cpp new file mode 100644 index 00000000000..c091a27c8fd --- /dev/null +++ b/addons/compat_ef/compat_ef_hearing/config.cpp @@ -0,0 +1,19 @@ +#include "script_component.hpp" +#include "\z\ace\addons\hearing\script_macros_hearingProtection.hpp" + +class CfgPatches { + class SUBADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"EF_Weapons", "EF_Marines", "ace_hearing"}; + skipWhenMissingDependencies = 1; + author = ECSTRING(common,ACETeam); + url = ECSTRING(main,URL); + VERSION_CONFIG; + addonRootClass = QUOTE(ADDON); + }; +}; + +#include "CfgWeapons.hpp" diff --git a/addons/compat_ef/compat_ef_hearing/script_component.hpp b/addons/compat_ef/compat_ef_hearing/script_component.hpp new file mode 100644 index 00000000000..8edb825af34 --- /dev/null +++ b/addons/compat_ef/compat_ef_hearing/script_component.hpp @@ -0,0 +1,3 @@ +#define SUBCOMPONENT hearing +#define SUBCOMPONENT_BEAUTIFIED Hearing +#include "..\script_component.hpp" diff --git a/addons/compat_ef/config.cpp b/addons/compat_ef/config.cpp index 9f701b7083f..0a8eea8c41c 100644 --- a/addons/compat_ef/config.cpp +++ b/addons/compat_ef/config.cpp @@ -1,5 +1,4 @@ #include "script_component.hpp" -#include "\z\ace\addons\hearing\script_macros_hearingProtection.hpp" class CfgPatches { class ADDON { diff --git a/addons/compat_spe/CfgWeapons.hpp b/addons/compat_spe/CfgWeapons.hpp index f6b1532bdad..35d04a36dcd 100644 --- a/addons/compat_spe/CfgWeapons.hpp +++ b/addons/compat_spe/CfgWeapons.hpp @@ -1,5 +1,4 @@ class CfgWeapons { - #include "CfgWeapons\helmets.hpp" #include "CfgWeapons\launchers.hpp" #include "CfgWeapons\weapons.hpp" }; diff --git a/addons/compat_spe/CfgWeapons/helmets.hpp b/addons/compat_spe/CfgWeapons/helmets.hpp deleted file mode 100644 index 54cbfd15b86..00000000000 --- a/addons/compat_spe/CfgWeapons/helmets.hpp +++ /dev/null @@ -1,142 +0,0 @@ -class H_SPE_HelmetB; -class H_SPE_Hat: H_SPE_HelmetB {}; - -//ALLIED PILOT -class H_SPE_US_Helmet_Pilot: H_SPE_Hat { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Pilot_Op: H_SPE_US_Helmet_Pilot { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Pilot_Glasses_Up: H_SPE_US_Helmet_Pilot { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Pilot_Glasses_Down: H_SPE_US_Helmet_Pilot { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Pilot_Respirator: H_SPE_US_Helmet_Pilot { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Pilot_Respirator_Glasses_Up: H_SPE_US_Helmet_Pilot_Respirator { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Pilot_Respirator_Glasses_Down: H_SPE_US_Helmet_Pilot_Respirator { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Pilot_SWDG_Respirator: H_SPE_US_Helmet_Pilot { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Pilot_SWDG_low_Respirator: H_SPE_US_Helmet_Pilot { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_H15: H_SPE_US_Helmet_Pilot { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_H15_Op: H_SPE_US_Helmet_H15 { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_H15_SWDG: H_SPE_US_Helmet_H15 { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_H15_SWDG_low: H_SPE_US_Helmet_H15 { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_H15_O2: H_SPE_US_Helmet_H15 { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_H15_B7_O2: H_SPE_US_Helmet_H15_O2 { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_H15_B7_low_O2: H_SPE_US_Helmet_H15_O2 { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_H15_SWDG_O2: H_SPE_US_Helmet_H15_O2 { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_H15_SWDG_low_O2: H_SPE_US_Helmet_H15_O2 { - HEARING_PROTECTION_EARMUFF; -}; - -//ALLIED TANKER -class H_SPE_US_Helmet_Tank: H_SPE_HelmetB { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Tank_NG: H_SPE_US_Helmet_Tank { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Tank_Nun: H_SPE_US_Helmet_Tank { - HEARING_PROTECTION_OPEN; -}; -class H_SPE_US_Helmet_Tank_M1_OS: H_SPE_US_Helmet_Tank { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Tank_M1_NS: H_SPE_US_Helmet_Tank_M1_OS { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Tank_M1_Scrim: H_SPE_US_Helmet_Tank_M1_OS { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Tank_polar: H_SPE_US_Helmet_Tank { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Tank_polar_tapes: H_SPE_US_Helmet_Tank_polar { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Tank_polar_low: H_SPE_US_Helmet_Tank_polar { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_US_Helmet_Tank_tapes: H_SPE_US_Helmet_Tank { - HEARING_PROTECTION_EARMUFF; -}; - -//AXIS PILOT -class H_SPE_GER_LW_PilotHelmet_base: H_SPE_Hat { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_GER_LW_PilotHelmet: H_SPE_GER_LW_PilotHelmet_base { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_GER_LW_S_PilotHelmet: H_SPE_GER_LW_PilotHelmet_base { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_GER_LW_PilotHelmet_Mask_base: H_SPE_Hat { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_GER_LW_PilotHelmet_Mask: H_SPE_GER_LW_PilotHelmet_Mask_base { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_GER_LW_PilotHelmet_S_Mask: H_SPE_GER_LW_PilotHelmet_Mask_base { - HEARING_PROTECTION_EARMUFF; -}; - -//AXIS TANKER -class H_SPE_GER_TankPrivateCap: H_SPE_Hat { - HEARING_PROTECTION_OPEN; -}; -class H_SPE_GER_TankOfficerCap: H_SPE_Hat { - HEARING_PROTECTION_OPEN; -}; -class H_SPE_GER_Fieldcap: H_SPE_Hat { - HEARING_PROTECTION_OPEN; -}; -class H_SPE_GER_Fieldcap2: H_SPE_GER_Fieldcap { - HEARING_PROTECTION_OPEN; -}; -class H_SPE_GER_TankPrivateCap2: H_SPE_GER_TankPrivateCap { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_GER_TankOffzCap2: H_SPE_GER_TankPrivateCap { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_GER_TankOfficerCap2: H_SPE_GER_TankOfficerCap { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_GER_SPGPrivateCap: H_SPE_Hat { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_GER_ST_Tanker_Cap2: H_SPE_GER_Fieldcap2 { - HEARING_PROTECTION_EARMUFF; -}; -class H_SPE_GER_ST_Tanker_Cap: H_SPE_GER_Fieldcap { - HEARING_PROTECTION_EARMUFF; -}; diff --git a/addons/compat_spe/compat_spe_hearing/CfgWeapons.hpp b/addons/compat_spe/compat_spe_hearing/CfgWeapons.hpp new file mode 100644 index 00000000000..a1e1fcc3b99 --- /dev/null +++ b/addons/compat_spe/compat_spe_hearing/CfgWeapons.hpp @@ -0,0 +1,145 @@ +class CfgWeapons { + class H_SPE_HelmetB; + class H_SPE_Hat: H_SPE_HelmetB {}; + + //ALLIED PILOT + class H_SPE_US_Helmet_Pilot: H_SPE_Hat { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Pilot_Op: H_SPE_US_Helmet_Pilot { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Pilot_Glasses_Up: H_SPE_US_Helmet_Pilot { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Pilot_Glasses_Down: H_SPE_US_Helmet_Pilot { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Pilot_Respirator: H_SPE_US_Helmet_Pilot { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Pilot_Respirator_Glasses_Up: H_SPE_US_Helmet_Pilot_Respirator { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Pilot_Respirator_Glasses_Down: H_SPE_US_Helmet_Pilot_Respirator { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Pilot_SWDG_Respirator: H_SPE_US_Helmet_Pilot { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Pilot_SWDG_low_Respirator: H_SPE_US_Helmet_Pilot { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_H15: H_SPE_US_Helmet_Pilot { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_H15_Op: H_SPE_US_Helmet_H15 { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_H15_SWDG: H_SPE_US_Helmet_H15 { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_H15_SWDG_low: H_SPE_US_Helmet_H15 { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_H15_O2: H_SPE_US_Helmet_H15 { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_H15_B7_O2: H_SPE_US_Helmet_H15_O2 { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_H15_B7_low_O2: H_SPE_US_Helmet_H15_O2 { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_H15_SWDG_O2: H_SPE_US_Helmet_H15_O2 { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_H15_SWDG_low_O2: H_SPE_US_Helmet_H15_O2 { + HEARING_PROTECTION_EARMUFF; + }; + + //ALLIED TANKER + class H_SPE_US_Helmet_Tank: H_SPE_HelmetB { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Tank_NG: H_SPE_US_Helmet_Tank { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Tank_Nun: H_SPE_US_Helmet_Tank { + HEARING_PROTECTION_OPEN; + }; + class H_SPE_US_Helmet_Tank_M1_OS: H_SPE_US_Helmet_Tank { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Tank_M1_NS: H_SPE_US_Helmet_Tank_M1_OS { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Tank_M1_Scrim: H_SPE_US_Helmet_Tank_M1_OS { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Tank_polar: H_SPE_US_Helmet_Tank { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Tank_polar_tapes: H_SPE_US_Helmet_Tank_polar { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Tank_polar_low: H_SPE_US_Helmet_Tank_polar { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_US_Helmet_Tank_tapes: H_SPE_US_Helmet_Tank { + HEARING_PROTECTION_EARMUFF; + }; + + //AXIS PILOT + class H_SPE_GER_LW_PilotHelmet_base: H_SPE_Hat { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_GER_LW_PilotHelmet: H_SPE_GER_LW_PilotHelmet_base { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_GER_LW_S_PilotHelmet: H_SPE_GER_LW_PilotHelmet_base { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_GER_LW_PilotHelmet_Mask_base: H_SPE_Hat { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_GER_LW_PilotHelmet_Mask: H_SPE_GER_LW_PilotHelmet_Mask_base { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_GER_LW_PilotHelmet_S_Mask: H_SPE_GER_LW_PilotHelmet_Mask_base { + HEARING_PROTECTION_EARMUFF; + }; + + //AXIS TANKER + class H_SPE_GER_TankPrivateCap: H_SPE_Hat { + HEARING_PROTECTION_OPEN; + }; + class H_SPE_GER_TankOfficerCap: H_SPE_Hat { + HEARING_PROTECTION_OPEN; + }; + class H_SPE_GER_Fieldcap: H_SPE_Hat { + HEARING_PROTECTION_OPEN; + }; + class H_SPE_GER_Fieldcap2: H_SPE_GER_Fieldcap { + HEARING_PROTECTION_OPEN; + }; + class H_SPE_GER_TankPrivateCap2: H_SPE_GER_TankPrivateCap { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_GER_TankOffzCap2: H_SPE_GER_TankPrivateCap { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_GER_TankOfficerCap2: H_SPE_GER_TankOfficerCap { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_GER_SPGPrivateCap: H_SPE_Hat { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_GER_ST_Tanker_Cap2: H_SPE_GER_Fieldcap2 { + HEARING_PROTECTION_EARMUFF; + }; + class H_SPE_GER_ST_Tanker_Cap: H_SPE_GER_Fieldcap { + HEARING_PROTECTION_EARMUFF; + }; + +}; diff --git a/addons/compat_spe/compat_spe_hearing/config.cpp b/addons/compat_spe/compat_spe_hearing/config.cpp new file mode 100644 index 00000000000..b2b55e9ff42 --- /dev/null +++ b/addons/compat_spe/compat_spe_hearing/config.cpp @@ -0,0 +1,27 @@ +#include "script_component.hpp" +#include "\z\ace\addons\hearing\script_macros_hearingProtection.hpp" + +class CfgPatches { + class SUBADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "ww2_spe_assets_c_weapons_infantryweapons_c", + "ww2_spe_assets_c_vehicles_staticweapons_c", + "ww2_spe_assets_c_vehicles_weapons_c", + "ww2_spe_core_f_system_staticweapons_f", + "ww2_spe_core_c_core_c_eventhandlers", + "ace_hearing" + }; + skipWhenMissingDependencies = 1; + author = ECSTRING(common,ACETeam); + url = ECSTRING(main,URL); + VERSION_CONFIG; + + addonRootClass = QUOTE(ADDON); + }; +}; + +#include "CfgWeapons.hpp" diff --git a/addons/compat_spe/compat_spe_hearing/script_component.hpp b/addons/compat_spe/compat_spe_hearing/script_component.hpp new file mode 100644 index 00000000000..8edb825af34 --- /dev/null +++ b/addons/compat_spe/compat_spe_hearing/script_component.hpp @@ -0,0 +1,3 @@ +#define SUBCOMPONENT hearing +#define SUBCOMPONENT_BEAUTIFIED Hearing +#include "..\script_component.hpp" diff --git a/addons/compat_spe/config.cpp b/addons/compat_spe/config.cpp index 5c1ba718d68..13bd24f53dd 100644 --- a/addons/compat_spe/config.cpp +++ b/addons/compat_spe/config.cpp @@ -1,5 +1,4 @@ #include "script_component.hpp" -#include "\z\ace\addons\hearing\script_macros_hearingProtection.hpp" class CfgPatches { class ADDON { diff --git a/addons/medical_treatment/functions/fnc_createLitterServer.sqf b/addons/medical_treatment/functions/fnc_createLitterServer.sqf index afeba0eb36b..b19ddc9baa5 100644 --- a/addons/medical_treatment/functions/fnc_createLitterServer.sqf +++ b/addons/medical_treatment/functions/fnc_createLitterServer.sqf @@ -24,15 +24,22 @@ if (isNil QGVAR(litterObjects)) then { GVAR(litterCleanup) = false; }; -private _model = getText (configFile >> "CfgVehicles" >> _litterClass >> "model"); -if (_model == "") exitWith {}; +private _config = configFile >> "CfgVehicles" >> _litterClass; +private _modelOrClass = if (getNumber (_config >> QGVAR(useClass)) == 1) then { + _litterClass +} else { + getText (_config >> "model"); +}; + + +if (_modelOrClass == "") exitWith {}; // createSimpleObject expects a path without the leading slash -if (_model select [0, 1] == "\") then { - _model = _model select [1]; +if (_modelOrClass select [0, 1] == "\") then { + _modelOrClass = _modelOrClass select [1]; }; -private _object = createSimpleObject [_model, [0, 0, 0]]; +private _object = createSimpleObject [_modelOrClass, [0, 0, 0]]; _object setPosASL _position; _object setDir _direction; diff --git a/addons/medical_treatment/initSettings.inc.sqf b/addons/medical_treatment/initSettings.inc.sqf index b5297e7f34b..11166f8002e 100644 --- a/addons/medical_treatment/initSettings.inc.sqf +++ b/addons/medical_treatment/initSettings.inc.sqf @@ -3,7 +3,7 @@ "LIST", [LSTRING(AdvancedDiagnose_DisplayName), LSTRING(AdvancedDiagnose_Description)], LSTRING(Category), - [[0, 1, 2, 3], [ELSTRING(common,Disabled), ELSTRING(common,Enabled), LSTRING(AdvancedDiagnose_DiagnoseCardiacArrest), LSTRING(AdvancedDiagnose_DiagnoseCardiacArrestDirect)], 1], + [[0, 1, 2, 3], [ELSTRING(common,Disabled), ELSTRING(common,Enabled), LSTRING(AdvancedDiagnose_DiagnoseCardiacArrest), LSTRING(AdvancedDiagnose_DiagnoseCardiacArrestDirect)], 2], true ] call CBA_fnc_addSetting; diff --git a/addons/sitting/XEH_clientInit.sqf b/addons/sitting/XEH_clientInit.sqf index bb2b1e2e681..4b3ea3fbadf 100644 --- a/addons/sitting/XEH_clientInit.sqf +++ b/addons/sitting/XEH_clientInit.sqf @@ -9,13 +9,10 @@ if (!hasInterface) exitWith {}; // If not enabled, then do not add CanInteractWith Condition or event handlers if (!XGVAR(enable)) exitWith {}; - // Initialize classes as they spawn - ["ThingX", "init", LINKFUNC(addSitActions), nil, nil, true] call CBA_fnc_addClassEventHandler; - - // Initialize statically defined benches (also appear as world objects, no class EH thrown) + // Initialize all seats { - [_x] call FUNC(addSitActions); - } forEach [BENCHES]; + _x call FUNC(addSitActions); + } forEach keys (uiNamespace getVariable [QGVAR(seats), []]); // Add interaction menu exception ["isNotSitting", {isNil {(_this select 0) getVariable QGVAR(sittingStatus)}}] call EFUNC(common,addCanInteractWithCondition); diff --git a/addons/sitting/XEH_preStart.sqf b/addons/sitting/XEH_preStart.sqf index 022888575ed..0cc72dc4912 100644 --- a/addons/sitting/XEH_preStart.sqf +++ b/addons/sitting/XEH_preStart.sqf @@ -1,3 +1,8 @@ #include "script_component.hpp" #include "XEH_PREP.hpp" + +private _seats = QUOTE(getNumber (_x >> QQXGVAR(canSit)) == 1) configClasses (configFile >> "CfgVehicles"); +_seats = _seats apply {configName _x}; + +uiNamespace setVariable [QGVAR(seats), compileFinal (_seats createHashMapFromArray [])]; diff --git a/addons/sitting/functions/fnc_addSitActions.sqf b/addons/sitting/functions/fnc_addSitActions.sqf index a705ca21e69..d9264af1027 100644 --- a/addons/sitting/functions/fnc_addSitActions.sqf +++ b/addons/sitting/functions/fnc_addSitActions.sqf @@ -15,6 +15,11 @@ * Public: No */ +// Only run this after the settings are initialized +if !(EGVAR(common,settingsInitFinished)) exitWith { + EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(addSitActions), _this]; +}; + params ["_seat"]; private _type = _seat; @@ -69,3 +74,4 @@ if !((_sitPosition select 0) isEqualType []) then { [_type, 0, _menuType, _sitAction] call EFUNC(interact_menu,addActionToClass); } forEach _sitPosition; +nil // return diff --git a/addons/sitting/functions/fnc_canSit.sqf b/addons/sitting/functions/fnc_canSit.sqf index 609bcea6828..5c8ea3be549 100644 --- a/addons/sitting/functions/fnc_canSit.sqf +++ b/addons/sitting/functions/fnc_canSit.sqf @@ -21,10 +21,13 @@ params ["_seat", "_player", ["_seatPos", 0]]; // Sitting enabled, not occupied and standing up (or not on a big slope) XGVAR(enable) && -{[_player, _seat] call EFUNC(common,canInteractWith)} && {isNil {_player getVariable QGVAR(sittingStatus)}} && -{ +{round (vectorUp _seat select 0) == 0 && {round (vectorUp _seat select 1) == 0} && {round (vectorUp _seat select 2) == 1}} && { private _seatsClaimed = _seat getVariable [QGVAR(seatsClaimed), []]; - _seatsClaimed isEqualTo [] || {!(_seatsClaimed select _seatPos)} -} && -{round (vectorUp _seat select 0) == 0 && {round (vectorUp _seat select 1) == 0} && {round (vectorUp _seat select 2) == 1}} + + (_seatsClaimed isEqualTo [] || {isNull (_seatsClaimed select _seatPos)}) && { + ([_player, _seat] call EFUNC(common,canInteractWith)) || // not claimed (common case) + // Can self-interact and chair claimed by another sitter + {([_player, objNull] call EFUNC(common,canInteractWith)) && {(_seatsClaimed findIf {!isNull _x}) != -1}} + } +} diff --git a/addons/sitting/functions/fnc_sit.sqf b/addons/sitting/functions/fnc_sit.sqf index d359083c44a..29da603c64f 100644 --- a/addons/sitting/functions/fnc_sit.sqf +++ b/addons/sitting/functions/fnc_sit.sqf @@ -1,7 +1,7 @@ #include "..\script_component.hpp" /* * Author: Jonpas, vabene1111 - * Sits down the player. + * Makes the player sit down. * * Arguments: * 0: Seat @@ -65,16 +65,9 @@ _player setVariable [QGVAR(sittingStatus), [_seat, _actionID, _seatPos]]; private _seatsClaimed = _seat getVariable [QGVAR(seatsClaimed), []]; // Initialize claimed seats if first time sitting on it if (_seatsClaimed isEqualTo []) then { - if (_multiSitting) then { - for "_i" from 0 to ((count _sitPositionAll) - 1) do { - _seatsClaimed pushBack (_i == _seatPos); - }; - } else { - _seatsClaimed = [true]; - }; -} else { - _seatsClaimed set [_seatPos, true]; + _seatsClaimed resize [count _sitPositionAll, objNull]; }; +_seatsClaimed set [_seatPos, _player]; _seat setVariable [QGVAR(seatsClaimed), _seatsClaimed, true]; // Also prevent dragging/carrying @@ -82,27 +75,44 @@ if !([_seat] call EFUNC(common,owned)) then { [_player, _seat] call EFUNC(common,claim); }; -// Add automatical stand PFH in case of interruptions +// Automatically stand up if interrupted private _seatPosOrig = getPosASL _seat; private _seatDistOrig = (getPosASL _player) distance _seat; [{ params ["_args", "_pfhId"]; - _args params ["_player", "_seat", "_seatPosOrig", "_seatDistOrig"]; + _args params ["_player", "_seat", "_seatPos", "_seatPosOrig", "_seatDistOrig"]; // Remove PFH if not sitting any more if (isNil {_player getVariable QGVAR(sittingStatus)}) exitWith { [_pfhId] call CBA_fnc_removePerFrameHandler; TRACE_1("Remove PFH",_player getVariable [ARR_2(QGVAR(sittingStatus),false)]); + + if (!alive _seat) exitWith {}; + + // Allow sitting on this seat again + private _seatsClaimed = _seat getVariable [QGVAR(seatsClaimed), []]; + _seatsClaimed set [_seatPos, objNull]; + _seat setVariable [QGVAR(seatsClaimed), _seatsClaimed, true]; + + // Unclaim... + [objNull, _seat] call EFUNC(common,claim); + + // ...but have a remaining unit reclaim ownership immediately + private _index = _seatsClaimed findIf {!isNull _x}; + + if (_index == -1) exitWith {}; + + [_seatsClaimed select _index, _seat] call EFUNC(common,claim); }; - // Stand up if chair gets deleted or moved - if (isNull _seat || + // Stand up if chair gets deleted or moved + if (!alive _seat || {getPosASL _player distance _seatPosOrig > _seatDistOrig + 0.5} || {((getPosASL _seat) vectorDistance _seatPosOrig) > 0.01} ) exitWith { _player call FUNC(stand); TRACE_2("Chair moved",getPosASL _seat,_seatPosOrig); }; -}, 0, [_player, _seat, _seatPosOrig, _seatDistOrig]] call CBA_fnc_addPerFrameHandler; +}, 0, [_player, _seat, _seatPos, _seatPosOrig, _seatDistOrig]] call CBA_fnc_addPerFrameHandler; ["ace_satDown", [_player, _seat, _seatPos]] call CBA_fnc_localEvent; diff --git a/addons/sitting/functions/fnc_stand.sqf b/addons/sitting/functions/fnc_stand.sqf index b25c7a5ee1e..26fb4fd6191 100644 --- a/addons/sitting/functions/fnc_stand.sqf +++ b/addons/sitting/functions/fnc_stand.sqf @@ -1,7 +1,7 @@ #include "..\script_component.hpp" /* * Author: Jonpas - * Stands up the player. + * Makes the player stand up. * * Arguments: * Player @@ -39,14 +39,19 @@ _player setVariable [QGVAR(sittingStatus), nil]; ["ace_stoodUp", [_player, _seat, _seatPos]] call CBA_fnc_localEvent; -if (isNull _seat) exitWith {}; +if (!alive _seat) exitWith {}; // Allow sitting on this seat again private _seatsClaimed = _seat getVariable [QGVAR(seatsClaimed), []]; -_seatsClaimed set [_seatPos, false]; +_seatsClaimed set [_seatPos, objNull]; _seat setVariable [QGVAR(seatsClaimed), _seatsClaimed, true]; -// Unclaim if no one else sitting on it -if (_seatsClaimed find true == -1) then { - [objNull, _seat] call EFUNC(common,claim); -}; +// Unclaim... +[objNull, _seat] call EFUNC(common,claim); + +// ...but have a remaining unit reclaim ownership immediately +private _index = _seatsClaimed findIf {!isNull _x}; + +if (_index == -1) exitWith {}; + +[_seatsClaimed select _index, _seat] call EFUNC(common,claim); diff --git a/docs/wiki/framework/clgp-framework.md b/docs/wiki/framework/clgp-framework.md index e1bd1133d1d..8d8dc6dda43 100644 --- a/docs/wiki/framework/clgp-framework.md +++ b/docs/wiki/framework/clgp-framework.md @@ -22,8 +22,8 @@ CLGP allows firing submunition shells that will deploy into missiles that can us ```cpp class CfgAmmo { class x_submunition: SubmunitionBase { // this ammo can be fired normally - ace_clgp_deployCondition = "your_fnc"; // function that returns true when it should be triggered - ace_clgp_artilleryDrag = 1; + ace_missile_clgp_deployCondition = "your_fnc"; // function that returns true when it should be triggered + ace_missile_clgp_artilleryDrag = 1; submunitionAmmo = "x_missle"; class Eventhandlers { fired = "call ace_missile_clgp_fnc_submunition_ammoFired"; // need to add the EH yourself to all ammos diff --git a/docs/wiki/framework/sitting-framework.md b/docs/wiki/framework/sitting-framework.md index b8f8ff37b08..7478976a572 100644 --- a/docs/wiki/framework/sitting-framework.md +++ b/docs/wiki/framework/sitting-framework.md @@ -1,7 +1,7 @@ --- layout: wiki title: Sitting Framework -description: Explains how to set-up sitting objects (eg. chairs) with ACE sitting system. +description: Explains how to set-up sitting objects (e.g. chairs) with ACE sitting system. group: framework order: 5 parent: wiki @@ -15,10 +15,7 @@ redirect_from: "/wiki/frameworkx/sitting-framework.md" ## 1. Requirements -Object must inherit from `ThingX` or any of its sub-classes. - -Object must have Extended Event Handler (XEH) enabled (this is not the case for the majority of vanilla objects in `ThingX` class), configuration entry on how to do that is shown below. - +Object must have `acex_sitting_canSit = 1` defined. ## 2. Config Values @@ -30,7 +27,6 @@ class CfgVehicles { acex_sitting_sitPosition[] = {0, -0.1, -0.45}; // Position relative to object (may behave weird with certain objects) acex_sitting_interactPosition[] = {0, -0.1, -0.45}; ace_sitting_animations[] = {"ace_sitting_HubSittingChairA_idle1"}; // Overwrite random animation pool - XEH_ENABLED; // Enable XEH (only necessary if XEH is not yet enabled for this class or the one this inherits from) }; }; ``` diff --git a/extension/Makefile.toml b/extension/Makefile.toml index 3002e34dccf..22f16e3ee18 100644 --- a/extension/Makefile.toml +++ b/extension/Makefile.toml @@ -55,5 +55,13 @@ dependencies = ["build_x32_release"] [tasks.debug] dependencies = ["move_x32_debug", "move_x64_debug"] -[tasks.release] +[tasks.updateSigs] +script_runner = "python" +script_extension = "py" +script_runner_args = ["../tools/getExtensionHash.py"] +script = ''' +''' dependencies = ["move_x32_release", "move_x64_release"] + +[tasks.release] +dependencies = ["updateSigs"] diff --git a/tools/.vscode/tasks.json b/tools/.vscode/tasks.json index 277d4bcc85b..ef04bb50f57 100644 --- a/tools/.vscode/tasks.json +++ b/tools/.vscode/tasks.json @@ -119,7 +119,7 @@ } }, { - "label": "Extension: x64", + "label": "Extension: make move_x64_release", "command": "cargo", "options": { "cwd": "${workspaceFolder}" @@ -133,7 +133,7 @@ } }, { - "label": "Extension: Release", + "label": "Extension: make release", "command": "cargo", "options": { "cwd": "${workspaceFolder}" diff --git a/tools/getExtensionHash.py b/tools/getExtensionHash.py new file mode 100644 index 00000000000..fa990218c44 --- /dev/null +++ b/tools/getExtensionHash.py @@ -0,0 +1,36 @@ +import pathlib +import os +import hashlib + +addon_base_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + +extensions = {} + +for file in os.listdir(addon_base_path): + path = pathlib.Path(addon_base_path, file) + extension_type = "dll" + if path.suffix == ".dll": + key = path.stem + if key.endswith("_x64"): + key = key.removesuffix("_x64") + extension_type += "_x64" + print(f"looking at {path}") + with open(path, 'rb') as file_read: + sha1 = hashlib.sha1() + data = file_read.read() + sha1.update(data) + arr = extensions.get(key, {}) + arr[extension_type] = sha1.hexdigest() + extensions[key] = arr + +file_out = pathlib.Path(addon_base_path, "addons", "common", "ACE_ExtensionsHashes.hpp") +with open(file_out, 'w') as file_write: + print(f"class ACE_ExtensionsHashes {{", file=file_write) + for key, values in extensions.items(): + print(f" class {key} {{", file=file_write) + for type, hash in values.items(): + print(f" {type} = \"{hash}\";", file=file_write) + print(f" }};", file=file_write) + print(f"}};", file=file_write) + +print(f"Wrote {len(extensions)} to {file_out}")