Skip to content

Commit d1dde4c

Browse files
Mine Detector - Added public framework (#10785)
* Added public mine detector framework * Fix variables on respawn Co-authored-by: PabstMirror <pabstmirror@gmail.com> --------- Co-authored-by: PabstMirror <pabstmirror@gmail.com>
1 parent 6fb37dd commit d1dde4c

28 files changed

Lines changed: 334 additions & 250 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
class ACE_detector {
22
class detectors {
33
class ACE_VMM3 {
4+
detectorPosition[] = {1.3, -0.22, 0.4};
45
radius = 2.5;
56
sounds[] = {"ace_detector_1", "ace_detector_2", "ace_detector_3", "ace_detector_4"};
7+
soundDistances[] = {0, 0.5, 1.25, 2};
8+
soundIntervals[] = {0.5, 0.7, 0.85, 1};
9+
soundIntervalDistances[] = {0, 0.75, 1.25, 2};
610
};
711
class ACE_VMH3: ACE_VMM3 {
12+
detectorPosition[] = {1, -0.32, 0.3};
813
};
914
};
1015
};

addons/minedetector/CfgAmmo.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
class CfgAmmo {
2-
3-
// seems to not get inherited
2+
// Seems to not get inherited
43
class Default;
54
class TimeBombCore: Default {
65
GVAR(detectable) = 1;
76
};
87

9-
// these below do get inherited
8+
// These below do get inherited
109
class DirectionalBombCore;
1110
class DirectionalBombBase: DirectionalBombCore {
1211
GVAR(detectable) = 1;

addons/minedetector/CfgEventHandlers.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ class Extended_PreStart_EventHandlers {
33
init = QUOTE(call COMPILE_SCRIPT(XEH_preStart));
44
};
55
};
6+
67
class Extended_PreInit_EventHandlers {
78
class ADDON {
89
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
910
};
1011
};
12+
1113
class Extended_PostInit_EventHandlers {
1214
class ADDON {
1315
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit));

addons/minedetector/CfgSounds.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
class CfgSounds {
22
class ace_detector_1 {
33
name = "ace_detector_1";
4-
sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wss)), "db+3", 1};
4+
sound[] = {QPATHTOF(sounds\metal_detector.wss), "db+3", 1};
55
titles[] = {};
66
};
77
class ace_detector_2 {
88
name = "ace_detector_2";
9-
sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wss)), "db+3", 0.9};
9+
sound[] = {QPATHTOF(sounds\metal_detector.wss), "db+3", 0.9};
1010
titles[] = {};
1111
};
1212
class ace_detector_3 {
1313
name = "ace_detector_3";
14-
sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wss)), "db+3", 0.8};
14+
sound[] = {QPATHTOF(sounds\metal_detector.wss), "db+3", 0.8};
1515
titles[] = {};
1616
};
1717
class ace_detector_4 {
1818
name = "ace_detector_4";
19-
sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wss)), "db+3", 0.7};
19+
sound[] = {QPATHTOF(sounds\metal_detector.wss), "db+3", 0.7};
2020
titles[] = {};
2121
};
2222
};

addons/minedetector/CfgVehicles.hpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,43 @@ class CfgVehicles {
1313
class ACE_Equipment {
1414
class GVAR(metalDetector) {
1515
displayName = CSTRING(MetalDetector);
16-
condition = QUOTE([ACE_player] call FUNC(hasDetector));
16+
condition = QUOTE(_player call FUNC(hasDetector));
1717
statement = "";
1818
icon = QPATHTOF(ui\icon_mineDetector.paa);
1919
exceptions[] = {};
2020
class GVAR(activate) {
2121
displayName = CSTRING(ActivateDetector);
22-
condition = QUOTE(call FUNC(canActivateDetector));
23-
statement = QUOTE(call FUNC(activateDetector));
22+
condition = QUOTE(_player call FUNC(canActivateDetector));
23+
statement = QUOTE(_player call FUNC(activateDetector));
2424
icon = QPATHTOF(ui\icon_mineDetectorOn.paa);
2525
exceptions[] = {};
2626
};
2727
class GVAR(deactivate) {
2828
displayName = CSTRING(DeactivateDetector);
29-
condition = QUOTE(call FUNC(canDeactivateDetector));
30-
statement = QUOTE(call FUNC(deactivateDetector));
29+
condition = QUOTE(_player call FUNC(canDeactivateDetector));
30+
statement = QUOTE(_player call FUNC(deactivateDetector));
3131
icon = QPATHTOF(ui\icon_mineDetectorOff.paa);
3232
exceptions[] = {};
3333
};
3434
class GVAR(connectHeadphones) {
3535
displayName = CSTRING(ConnectHeadphones);
36-
condition = QUOTE(call FUNC(canConnectHeadphones));
37-
statement = QUOTE([ARR_2(ACE_player,true)] call FUNC(connectHeadphones));
36+
condition = QUOTE(_player call FUNC(canConnectHeadphones));
37+
statement = QUOTE([ARR_2(_player,true)] call FUNC(connectHeadphones));
3838
icon = ""; //TODO
3939
exceptions[] = {};
4040
};
4141
class GVAR(disconnectHeadphones) {
4242
displayName = CSTRING(DisconnectHeadphones);
43-
condition = QUOTE(call FUNC(canDisconnectHeadphones));
44-
statement = QUOTE([ARR_2(ACE_player,false)] call FUNC(connectHeadphones));
43+
condition = QUOTE(_player call FUNC(canDisconnectHeadphones));
44+
statement = QUOTE([ARR_2(_player,false)] call FUNC(connectHeadphones));
4545
icon = ""; //TODO
4646
exceptions[] = {};
4747
};
4848
};
4949
};
5050
};
5151
};
52+
5253
class Items_base_F;
5354
class ACE_Explosives_Place: Items_base_F {
5455
GVAR(detectable) = 1;

addons/minedetector/CfgWeapons.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class CfgWeapons {
1010
author = ECSTRING(common,ACETeam);
1111
displayName = "VMM3";
1212
descriptionShort = CSTRING(VMM3_Description);
13-
model = QUOTE(PATHTOF(ace_wallon_vmm3.p3d));
14-
picture = QUOTE(PATHTOF(data\equip\w_vmm3_ca.paa));
13+
model = QPATHTOF(ace_wallon_vmm3.p3d);
14+
picture = QPATHTOF(data\equip\w_vmm3_ca.paa);
1515
magazines[] = { };
1616
modes[] = { "Single" };
1717
cursor = "EmptyCursor";
@@ -43,8 +43,8 @@ class CfgWeapons {
4343
scope = 2;
4444
displayName = "VMH3";
4545
author = ECSTRING(common,ACETeam);
46-
model = QUOTE(PATHTOF(ace_wallon_vmh3.p3d));
47-
picture = QUOTE(PATHTOF(data\equip\w_vmh3_ca.paa));
46+
model = QPATHTOF(ace_wallon_vmh3.p3d);
47+
picture = QPATHTOF(data\equip\w_vmh3_ca.paa);
4848
class WeaponSlotsInfo: WeaponSlotsInfo {
4949
mass = 55;
5050
};

addons/minedetector/XEH_PREP.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
1+
PREP(activateDetector);
22
PREP(canActivateDetector);
33
PREP(canConnectHeadphones);
44
PREP(canDeactivateDetector);
55
PREP(canDisconnectHeadphones);
66
PREP(connectHeadphones);
7-
PREP(activateDetector);
87
PREP(deactivateDetector);
9-
PREP(hasDetector);
108
PREP(detectorLoop);
11-
PREP(disableDetector);
12-
PREP(enableDetector);
139
PREP(getDetectedObject);
10+
PREP(getDetectorConfig);
11+
PREP(hasDetector);
1412
PREP(isDetectorEnabled);
1513
PREP(playDetectorSound);
16-
PREP(getDetectorConfig);

addons/minedetector/XEH_postInit.sqf

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,21 @@
33
// Create a dictionary to store detector configs
44
GVAR(detectorConfigs) = createHashMap;
55

6-
[QGVAR(enableDetector), LINKFUNC(enableDetector)] call CBA_fnc_addEventHandler;
7-
[QGVAR(disableDetector), LINKFUNC(disableDetector)] call CBA_fnc_addEventHandler;
8-
96
// Shows detector and mine posistions in 3d when debug is on
107
#ifdef DEBUG_MODE_FULL
118
GVAR(debugDetector) = [];
9+
1210
addMissionEventHandler ["Draw3D", {
1311
if (GVAR(debugDetector) isEqualTo []) exitWith {};
12+
1413
GVAR(debugDetector) params ["_detectorPointAGL", "_mines"];
15-
drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [0,0,1,1], _detectorPointAGL, 1, 1, 0, "detector", 1, 0.02, "PuristaMedium"];
14+
15+
drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [0, 0, 1, 1], _detectorPointAGL, 1, 1, 0, "detector", 1, 0.02, "PuristaMedium"];
16+
1617
{
1718
private _name = format ["%1@%2", typeOf _x, (floor ((_x distance _detectorPointAGL) * 10)) / 10];
18-
if ((getNumber (configOf _x >> QGVAR(detectable))) == 1) then {
19-
drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [1,0,0,1], (ASLToAGL (getPosASL _x)), 1, 1, 0, _name, 1, 0.02, "PuristaMedium"];
20-
} else {
21-
drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [1,1,0,1], (ASLToAGL (getPosASL _x)), 1, 1, 0, _name, 1, 0.02, "PuristaMedium"];
22-
};
19+
20+
drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [[1, 1, 0, 1], [1, 0, 0, 1]] select (getNumber (configOf _x >> QGVAR(detectable)) == 1), ASLToAGL (getPosASL _x), 1, 1, 0, _name, 1, 0.02, "PuristaMedium"];
2321
} forEach _mines;
2422
}];
2523
#endif

addons/minedetector/XEH_preStart.sqf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
#include "XEH_PREP.hpp"
44

5-
// Cache detectable classes, see XEH_postInit.sqf
5+
// Cache detectable classes
66
private _detectableClasses = [];
7+
78
{
89
if ((getNumber (_x >> QGVAR(detectable))) == 1) then {
910
_detectableClasses pushBackUnique configName _x;
1011
};
1112
} forEach (configProperties [configFile >> "CfgVehicles", "isClass _x", true]);
13+
1214
{
1315
if ((getNumber (_x >> QGVAR(detectable))) == 1) then {
1416
_detectableClasses pushBackUnique configName _x;

addons/minedetector/config.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class CfgPatches {
44
class ADDON {
55
name = COMPONENT_NAME;
66
units[] = {};
7-
weapons[] = {"ACE_VMH3","ACE_VMM3"};
7+
weapons[] = {"ACE_VMH3", "ACE_VMM3"};
88
requiredVersion = REQUIRED_VERSION;
99
requiredAddons[] = {"ace_explosives"};
1010
author = ECSTRING(common,ACETeam);

0 commit comments

Comments
 (0)