diff --git a/addons/minedetector/CfgAmmo.hpp b/addons/minedetector/CfgAmmo.hpp new file mode 100644 index 0000000000..bd2a3fdca6 --- /dev/null +++ b/addons/minedetector/CfgAmmo.hpp @@ -0,0 +1,30 @@ +class CfgAmmo { + + // seems to not get inherited + class Default; + class TimeBombCore: Default { + GVAR(detectable) = 1; + }; + + // these below do get inherited + class DirectionalBombCore; + class DirectionalBombBase: DirectionalBombCore { + GVAR(detectable) = 1; + }; + + class BoundingMineCore; + class BoundingMineBase: BoundingMineCore { + GVAR(detectable) = 1; + }; + + class MineCore; + class MineBase: MineCore { + GVAR(detectable) = 1; + }; + + class PipeBombCore; + class PipeBombBase: PipeBombCore { + GVAR(detectable) = 1; + }; + +}; diff --git a/addons/minedetector/CfgVehicles.hpp b/addons/minedetector/CfgVehicles.hpp index f2ee240ac4..a96d8429fa 100644 --- a/addons/minedetector/CfgVehicles.hpp +++ b/addons/minedetector/CfgVehicles.hpp @@ -42,7 +42,7 @@ class CfgVehicles { class MineBase: Static { GVAR(detectable) = 1; }; - + // Zeus placed mines class ModuleEmpty_F; class ModuleMine_F: ModuleEmpty_F { diff --git a/addons/minedetector/XEH_preInit.sqf b/addons/minedetector/XEH_preInit.sqf index ff17ca6d22..9529c201c5 100644 --- a/addons/minedetector/XEH_preInit.sqf +++ b/addons/minedetector/XEH_preInit.sqf @@ -5,6 +5,6 @@ ADDON = false; #include "XEH_PREP.hpp" // TODO load from config instead of hardcoded in sqf -GVAR(ALL_DETECTABLE_TYPES) = ["ACE_Explosive_Object", "ACE_Explosive_Helper", "ACE_Explosives_Place", "ModuleMine_F", "MineBase"]; +GVAR(ALL_DETECTABLE_TYPES) = ["ACE_Explosive_Object", "ACE_Explosive_Helper", "ACE_Explosives_Place", "ModuleMine_F", "TimeBombCore", "MineBase", "DirectionalBombBase", "BoundingMineBase", "PipeBombBase"]; ADDON = true; diff --git a/addons/minedetector/config.cpp b/addons/minedetector/config.cpp index a0dc28107a..5d9dd2198f 100644 --- a/addons/minedetector/config.cpp +++ b/addons/minedetector/config.cpp @@ -15,6 +15,7 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgWeapons.hpp" +#include "CfgAmmo.hpp" #include "CfgVehicles.hpp" #include "CfgSounds.hpp" #include "ACE_detector.hpp" diff --git a/addons/minedetector/functions/fnc_getDetectedObject.sqf b/addons/minedetector/functions/fnc_getDetectedObject.sqf index 62eebe63d3..004de3d0f9 100644 --- a/addons/minedetector/functions/fnc_getDetectedObject.sqf +++ b/addons/minedetector/functions/fnc_getDetectedObject.sqf @@ -27,10 +27,10 @@ private _direction = _unit weaponDirection "Put"; private _detectorPointAGL = _worldPosition vectorAdd (_direction vectorMultiply __DR); -private _mines = nearestObjects [_detectorPointAGL, _detectableTypes, _radius]; +private _nearestObjects = nearestObjects [_detectorPointAGL, [], _radius]; #ifdef DEBUG_MODE_FULL -GVAR(debugDetector) = [_detectorPointAGL, _mines]; +GVAR(debugDetector) = [_detectorPointAGL, _nearestObjects]; #endif private _isDetectable = false; @@ -38,15 +38,24 @@ private _mine = objNull; private _distance = -1; { - //Try all mines in range and use first detectable one: - if ((getNumber (configFile >> "CfgVehicles" >> (typeOf _x) >> QGVAR(detectable))) == 1) exitWith { - _isDetectable = true; - _mine = _x; - _distance = _detectorPointAGL distance _x; - }; - nil -} count _mines; + private _object = _x; -TRACE_3("return",_isDetectable, _mine, _distance); + if ({_object isKindOf _x} count _detectableTypes > 0) then { + //Try all unprepared mines in range and use first detectable one: + if ((getNumber (configFile >> "CfgVehicles" >> (typeOf _x) >> QGVAR(detectable))) == 1) exitWith { + _isDetectable = true; + _mine = _x; + _distance = _detectorPointAGL distance _x; + }; + //Try all prepared mines in range and use first detectable one: + if ((getNumber (configFile >> "CfgAmmo" >> (typeOf _x) >> QGVAR(detectable))) == 1) exitWith { + _isDetectable = true; + _mine = _x; + _distance = _detectorPointAGL distance _x; + }; + }; +} forEach _nearestObjects; + +TRACE_3("return",_isDetectable,_mine,_distance); [_isDetectable, _mine, _distance];