From fe056f10e14ff8ac8d2fea089a558e5b23ac8015 Mon Sep 17 00:00:00 2001 From: Garth L-H de Wet Date: Mon, 12 Jan 2015 23:06:32 +0200 Subject: [PATCH] Fixed errors in order to get explosives to load correctly without writing anything to config. Will still need further testing once interaction is fully integrated. --- addons/explosives/CfgEventHandlers.hpp | 4 ++-- .../{CgMagazines.hpp => CfgMagazines.hpp} | 0 addons/explosives/CfgVehicles.hpp | 12 +++++----- addons/explosives/XEH_preInit.sqf | 1 + addons/explosives/config.cpp | 6 ++--- .../explosives/functions/fnc_canDetonate.sqf | 22 +++++++++++++++++++ 6 files changed, 34 insertions(+), 11 deletions(-) rename addons/explosives/{CgMagazines.hpp => CfgMagazines.hpp} (100%) create mode 100644 addons/explosives/functions/fnc_canDetonate.sqf diff --git a/addons/explosives/CfgEventHandlers.hpp b/addons/explosives/CfgEventHandlers.hpp index 6b125bba1b..0a7c988ae4 100644 --- a/addons/explosives/CfgEventHandlers.hpp +++ b/addons/explosives/CfgEventHandlers.hpp @@ -1,11 +1,11 @@ class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE( call compile preprocessFileLineNumbers PATHTOF(XEH_preInit.sqf) ); + init = QUOTE( call COMPILE_FILE(XEH_preInit) ); }; }; class Extended_PostInit_EventHandlers { class ADDON { - init = QUOTE( call compile preprocessFileLineNumbers PATHTOF(XEH_postInit.sqf) ); + init = QUOTE( call COMPILE_FILE(XEH_postInit) ); }; }; diff --git a/addons/explosives/CgMagazines.hpp b/addons/explosives/CfgMagazines.hpp similarity index 100% rename from addons/explosives/CgMagazines.hpp rename to addons/explosives/CfgMagazines.hpp diff --git a/addons/explosives/CfgVehicles.hpp b/addons/explosives/CfgVehicles.hpp index 86b1afccc6..67da08df8e 100644 --- a/addons/explosives/CfgVehicles.hpp +++ b/addons/explosives/CfgVehicles.hpp @@ -10,9 +10,9 @@ class CfgVehicles { class ACE_SelfActions { class GVAR(Explosives) { displayName = $STR_ACE_Explosives_Menu; - condition = QUOTE( !(_player getVariable [ARR_2(QGVAR(PlantingExplosive), false)]) ); + condition = QUOTE( !(_player getVariable [ARR_2('ace_explosives_PlantingExplosive', false)]) ); statement = ""; - exceptions[] = {"ACE_Interaction_isNotSwimming"}; \ + exceptions[] = {"ACE_Interaction_isNotSwimming"}; showDisabled = 1; priority = 4; icon = QUOTE( PATHTOF(UI\Explosives_Menu_ca.paa) ); @@ -21,9 +21,9 @@ class CfgVehicles { //Sub-menu items class ACE_Detonate { displayName = $STR_ACE_Explosives_Detonate; - condition = QUOTE( [_player] call FUNC(hasPlacedExplosives) AND ) and {count ([_player] call FUNC(getDetonators)) > 0} ); + condition = QUOTE( [_player] call FUNC(canDetonate) ); statement = QUOTE( [_player] call FUNC(openTransmitterUI); ); - exceptions[] = {"ACE_Interaction_isNotSwimming"}; \ + exceptions[] = {"ACE_Interaction_isNotSwimming"}; showDisabled = 1; icon = QUOTE( PATHTOF(UI\Explosives_Menu_ca.paa) ); priority = 2; @@ -33,7 +33,7 @@ class CfgVehicles { displayName = $STR_ACE_Explosives_Place; condition = QUOTE( (vehicle _player == _player) and {[_player] call FUNC(hasExplosives)} ); statement = QUOTE( [_player] call FUNC(openPlaceUI); ); - exceptions[] = {"ACE_Interaction_isNotSwimming"}; \ + exceptions[] = {"ACE_Interaction_isNotSwimming"}; showDisabled = 1; icon = QUOTE( PATHTOF(UI\Place_Explosive_ca.paa) ); priority = 1; @@ -43,7 +43,7 @@ class CfgVehicles { displayName = $STR_ACE_Explosives_Defuse; condition = QUOTE( [_player] call FUNC(canDefuse) ); statement = QUOTE( [ARR_2(_player, EGVAR(Interaction, Target))] call FUNC(startDefuse); ); - exceptions[] = {"ACE_Interaction_isNotSwimming"}; \ + exceptions[] = {"ACE_Interaction_isNotSwimming"}; showDisabled = 0; icon = QUOTE( PATHTOF(UI\Defuse_ca.paa) ); priority = 0.8; diff --git a/addons/explosives/XEH_preInit.sqf b/addons/explosives/XEH_preInit.sqf index df24682b1d..8ccfdb5aae 100644 --- a/addons/explosives/XEH_preInit.sqf +++ b/addons/explosives/XEH_preInit.sqf @@ -20,6 +20,7 @@ None PREP(addClacker); PREP(canDefuse); +PREP(canDetonate); PREP(defuseExplosive); PREP(detonateExplosive); diff --git a/addons/explosives/config.cpp b/addons/explosives/config.cpp index dcf5e98634..257929dfab 100644 --- a/addons/explosives/config.cpp +++ b/addons/explosives/config.cpp @@ -6,9 +6,9 @@ class CfgPatches { weapons[] = {"ACE_Clacker", "ACE_DefusalKit", "ACE_M26_Clacker", "ACE_DeadManSwitch"}; requiredVersion = 0.60; requiredAddons[] = {ace_common, ace_interaction}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; + version = QUOTE(VERSION); + versionStr = QUOTE(VERSION); + versionAr[] = {VERSION_AR}; author[] = {"Garth 'L-H' de Wet"}; authorUrl = "http://garth.snakebiteink.co.za/"; }; diff --git a/addons/explosives/functions/fnc_canDetonate.sqf b/addons/explosives/functions/fnc_canDetonate.sqf new file mode 100644 index 0000000000..85a93c267d --- /dev/null +++ b/addons/explosives/functions/fnc_canDetonate.sqf @@ -0,0 +1,22 @@ +/* +Name: ACE_Explosives_fnc_canDetonate + +Author: Garth de Wet (LH) + +Description: +Checks if a unit can detonate an explosive + +Parameters: +0: OBJECT - unit + +Returns: +BOOLEAN - if the unit has explosives and detonators. + +Example: +[player] call ACE_Explosives_fnc_canDetonate; +*/ +#include "\z\ace\explosives\script_component.hpp" +private "_unit"; +_unit = _this select 0; + +[_unit] call FUNC(hasPlacedExplosives) and {count ([_unit] call FUNC(getDetonators)) > 0}