fix mine detector not picking up fused explosives

This commit is contained in:
bux578 2016-06-16 17:20:15 +02:00
parent 66450ad36a
commit 5f52101b26
5 changed files with 53 additions and 13 deletions

View File

@ -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;
};
};

View File

@ -42,7 +42,7 @@ class CfgVehicles {
class MineBase: Static {
GVAR(detectable) = 1;
};
// Zeus placed mines
class ModuleEmpty_F;
class ModuleMine_F: ModuleEmpty_F {

View File

@ -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;

View File

@ -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"

View File

@ -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];