From 194564193ab793a549f9f47fc5bb37fa08dc4e82 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sun, 12 Jan 2025 11:14:55 +0100 Subject: [PATCH] Disable cook-off for some drones --- addons/compat_sog/CfgEventHandlers.hpp | 2 +- addons/compat_sog/XEH_PREP.hpp | 1 - .../functions/fnc_disableCookoff.sqf | 21 ------------------- addons/compat_ws/CfgEventHandlers.hpp | 13 ++++++++++++ addons/compat_ws/config.cpp | 1 + addons/cookoff/CfgEventHandlers.hpp | 14 +++++++++++++ addons/cookoff/XEH_PREP.hpp | 1 + .../cookoff/functions/fnc_disableCookoff.sqf | 21 +++++++++++++++++++ 8 files changed, 51 insertions(+), 23 deletions(-) delete mode 100644 addons/compat_sog/functions/fnc_disableCookoff.sqf create mode 100644 addons/compat_ws/CfgEventHandlers.hpp create mode 100644 addons/cookoff/functions/fnc_disableCookoff.sqf diff --git a/addons/compat_sog/CfgEventHandlers.hpp b/addons/compat_sog/CfgEventHandlers.hpp index d28b79fb991..f2a681ac80e 100644 --- a/addons/compat_sog/CfgEventHandlers.hpp +++ b/addons/compat_sog/CfgEventHandlers.hpp @@ -44,7 +44,7 @@ class Extended_InitPost_EventHandlers { }; class vn_bicycle_base { class ADDON { - init = QUOTE(call FUNC(disableCookoff)); + init = QUOTE(call EFUNC(cookoff,disableCookoff)); }; }; }; diff --git a/addons/compat_sog/XEH_PREP.hpp b/addons/compat_sog/XEH_PREP.hpp index b9f7907afed..af95ac7edc3 100644 --- a/addons/compat_sog/XEH_PREP.hpp +++ b/addons/compat_sog/XEH_PREP.hpp @@ -1,4 +1,3 @@ -PREP(disableCookoff); PREP(handleBikeMinePlace); PREP(handlePunjiTrapDamage); PREP(handlePunjiTrapPlace); diff --git a/addons/compat_sog/functions/fnc_disableCookoff.sqf b/addons/compat_sog/functions/fnc_disableCookoff.sqf deleted file mode 100644 index 07c36567a6c..00000000000 --- a/addons/compat_sog/functions/fnc_disableCookoff.sqf +++ /dev/null @@ -1,21 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: BaerMitUmlaut - * Disables cookoff for bicycles. - * - * Arguments: - * 0: Bicycle - * - * Return Value: - * None - * - * Example: - * [bicycle] call ace_compat_sog_fnc_disableCookoff - * - * Public: No - */ - -params ["_bicycle"]; - -_bicycle setVariable [QEGVAR(cookoff,enable), false]; -_bicycle setVariable [QEGVAR(cookoff,enableAmmoCookoff), false]; diff --git a/addons/compat_ws/CfgEventHandlers.hpp b/addons/compat_ws/CfgEventHandlers.hpp new file mode 100644 index 00000000000..905e1e777c9 --- /dev/null +++ b/addons/compat_ws/CfgEventHandlers.hpp @@ -0,0 +1,13 @@ +class Extended_InitPost_EventHandlers { + class UAV_02_Base_lxWS { + class ADDON { + init = QUOTE(call EFUNC(cookoff,disableCookoff)); + }; + }; + + class UAV_02_IED_Base_lxWS { + class ADDON { + init = ""; // Enable cook-off for IED drone + }; + }; +}; diff --git a/addons/compat_ws/config.cpp b/addons/compat_ws/config.cpp index 54a6df99eec..9dc85f5d82a 100644 --- a/addons/compat_ws/config.cpp +++ b/addons/compat_ws/config.cpp @@ -15,5 +15,6 @@ class CfgPatches { }; }; +#include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" diff --git a/addons/cookoff/CfgEventHandlers.hpp b/addons/cookoff/CfgEventHandlers.hpp index f6503c2479b..80c41b909c9 100644 --- a/addons/cookoff/CfgEventHandlers.hpp +++ b/addons/cookoff/CfgEventHandlers.hpp @@ -15,3 +15,17 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); }; }; + +class Extended_InitPost_EventHandlers { + class UGV_02_Demining_Base_F { + class ADDON { + init = QUOTE(call FUNC(disableCookoff)); + }; + }; + + class UGV_02_Science_Base_F { + class ADDON { + init = QUOTE(call FUNC(disableCookoff)); + }; + }; +}; diff --git a/addons/cookoff/XEH_PREP.hpp b/addons/cookoff/XEH_PREP.hpp index 94059089535..170bae5af2f 100644 --- a/addons/cookoff/XEH_PREP.hpp +++ b/addons/cookoff/XEH_PREP.hpp @@ -4,6 +4,7 @@ PREP(cookOffLocal); PREP(cookOffServer); PREP(detonateAmmunitionServer); PREP(detonateAmmunitionServerLoop); +PREP(disableCookoff); PREP(engineFireLocal); PREP(engineFireServer); PREP(getVehicleAmmo); diff --git a/addons/cookoff/functions/fnc_disableCookoff.sqf b/addons/cookoff/functions/fnc_disableCookoff.sqf new file mode 100644 index 00000000000..c55328889df --- /dev/null +++ b/addons/cookoff/functions/fnc_disableCookoff.sqf @@ -0,0 +1,21 @@ +#include "..\script_component.hpp" +/* + * Author: BaerMitUmlaut + * Disables cookoff for objects. Use in init fields. + * + * Arguments: + * 0: Object + * + * Return Value: + * None + * + * Example: + * cursorObject call ace_cookoff_fnc_disableCookoff + * + * Public: No + */ + +params ["_object"]; + +_object setVariable [QGVAR(enable), false]; +_object setVariable [QGVAR(enableAmmoCookoff), false];