Add mine detector port from ACE2

This commit is contained in:
Glowbal 2016-05-03 22:37:02 +02:00
parent f6567841a2
commit b4fca958aa
47 changed files with 886 additions and 0 deletions

View File

@ -0,0 +1 @@
z\ace\addons\minedetector

View File

@ -0,0 +1,13 @@
class ACE_detector {
class detectableObjects {
};
class detectors {
class ACE_VMM3 {
radius = 2.5;
// sounds[] = {"ace_sweep_high", "ace_sweep_low"};
sounds[] = {"ace_buzz_2", "ace_buzz_1"};
};
class ACE_VMH3: ACE_VMM3 {
};
};
};

View File

@ -0,0 +1,10 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) );
};
};

View File

@ -0,0 +1,22 @@
class CfgSounds {
class ace_sweep_high {
name = "ace_sweep_high";
sound[] = {QUOTE(PATHTOF(sounds\sweep_high.ogg)), "db+1", 1};
titles[] = {};
};
class ace_sweep_low {
name = "ace_sweep_low";
sound[] = {QUOTE(PATHTOF(sounds\sweep_low.ogg)), "db+1", 1};
titles[] = {};
};
class ace_buzz_1 {
name = "ace_buzz_1";
sound[] = {QUOTE(PATHTOF(sounds\buzz_1.ogg)), "db+1", 1};
titles[] = {};
};
class ace_buzz_2 {
name = "ace_buzz_2";
sound[] = {QUOTE(PATHTOF(sounds\buzz_2.ogg)), "db+1", 1};
titles[] = {};
};
};

View File

@ -0,0 +1,51 @@
class CfgVehicles {
class Box_NATO_Support_F;
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_VMM3,4);
MACRO_ADDITEM(ACE_VMH3,4);
};
};
class Man;
class CAManBase: Man {
class ACE_SelfActions {
class ACE_Equipment {
class GVAR(activate) {
displayName = "Activate Detector";
condition = QUOTE(call FUNC(canActivateDetector));
statement = QUOTE(call FUNC(activateDetector));
showDisabled = 0;
priority = 0.1;
icon = ""; // TODO add icon
exceptions[] = {};
};
class GVAR(deactivate) {
displayName = "Deactivate Detector";
condition = QUOTE(call FUNC(canDeactivateDetector));
statement = QUOTE(call FUNC(deactivateDetector));
showDisabled = 0;
priority = 0.1;
icon = ""; // TODO add icon
exceptions[] = {};
};
};
};
};
class Items_base_F;
class ACE_Explosives_Place: Items_base_F {
GVAR(detectable) = 1;
};
// Editor placed mines
class Static;
class MineBase: Static {
GVAR(detectable) = 1;
};
// Zeus placed mines
class ModuleEmpty_F;
class ModuleMine_F: ModuleEmpty_F {
GVAR(detectable) = 1;
};
};

View File

@ -0,0 +1,37 @@
class Mode_SemiAuto;
class CfgWeapons {
class Pistol_Base_F;
class ACE_VMM3: Pistol_Base_F {
scope = 2;
author = ECSTRING(common,ACETeam);
displayName = "VMM3";
model = QUOTE(PATHTOF(ace_wallon_vmm3.p3d));
picture = QUOTE(PATHTOF(data\equip\w_vmm3_ca.paa));
descriptionShort = "";
magazines[] = { };
modes[] = { "Single" };
class Single : Mode_SemiAuto {
displayName = "";
sounds[] = {};
begin1[] = { "", 1.77828, 1, 1000 };
soundBegin[] = { "begin1", 1 };
reloadTime = 0.075;
recoil = "recoil_pistol_light";
recoilProne = "recoil_prone_pistol_light";
dispersion = 0.001;
minRange = 2;
minRangeProbab = 0.3;
midRange = 250;
midRangeProbab = 0.7;
maxRange = 400;
maxRangeProbab = 0.05;
};
};
class ACE_VMH3: ACE_VMM3 {
scope = 2;
displayName = "VMH3";
model = QUOTE(PATHTOF(ace_wallon_vmh3.p3d));
picture = QUOTE(PATHTOF(data\equip\w_vmh3_ca.paa));
};
};

View File

@ -0,0 +1,11 @@
ace_minedetector
===========
Add mine detectors
## Maintainers
The people responsible for merging changes to this component or answering potential questions.
- [Glowbal](https://github.com/Glowbal)
- [Grey](https://github.com/Grey-Soldierman)

View File

@ -0,0 +1,13 @@
PREP(canActivateDetector);
PREP(canDeactivateDetector);
PREP(activateDetector);
PREP(deactivateDetector);
PREP(hasDetector);
PREP(detectorLoop);
PREP(disableDetector);
PREP(enableDetector);
PREP(getDetectedObject);
PREP(isDetectorEnabled);
PREP(playDetectorSound);
PREP(getDetectorConfig);

View File

@ -0,0 +1,20 @@
#include "script_component.hpp"
["minedetector_enabled", {
params ["_unit", "_type"];
private _config = [_type] call FUNC(getDetectorConfig);
private _helperObject = "ACE_LogicDummy" createVehicleLocal (getPos _unit);
_unit setvariable [QGVAR(helperLogic), _helperObject];
[FUNC(detectorLoop), 0.05, [_unit, _type, _config, ACE_time, _helperObject]] call CBA_fnc_addPerFrameHandler;
}] call EFUNC(common,addEventhandler);
["minedetector_disabled", {
params ["_unit", "_type"];
private _helperObject = _unit getvariable [QGVAR(helperLogic), objNull];
if !(isNull _helperObject) then {
deleteVehicle _helperObject;
};
}] call EFUNC(common,addEventhandler);

View File

@ -0,0 +1,10 @@
#include "script_component.hpp"
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"];
ADDON = true;

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,19 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {"ACE_VMH3","ACE_VMM3"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_explosives"};
author[] = {"Grey", "Glowbal", "Rocko"};
authorUrl = "";
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
#include "CfgWeapons.hpp"
#include "CfgVehicles.hpp"
#include "CfgSounds.hpp"
#include "ACE_detector.hpp"

View File

@ -0,0 +1,92 @@
ambient[] = {1.0, 1.0, 1.0, 1.0};
diffuse[] = {1.0, 1.0, 1.0, 1.0};
forcedDiffuse[] = {0.0, 0.0, 0.0, 0.0};
emmisive[] = {0.0, 0.0, 0.0, 1.0};
specular[] = {0.93, 0.93, 0.93, 1.0};
specularPower = 200.0;
PixelShaderID = "Super";
VertexShaderID = "Super";
class Stage1 {
texture="z\ace\addons\minedetector\data\ace_vmh3_nohq.paa";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage2 {
texture = "a3\weapons_f\data\detailmaps\metal_detail_dt.paa";
uvSource = "tex";
class uvTransform {
aside[] = {6.0, 0.0, 0.0};
up[] = {0.0, 3.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage3 {
texture = "#(argb,8,8,3)color(0,0,0,0,MC)";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage4 {
texture = "#(argb,8,8,3)color(1,0,0,1,AS)";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage5 {
texture="z\ace\addons\minedetector\data\ace_vmh3_smdi.paa";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage6 {
texture = "#(ai,64,64,1)fresnel(1.29,0.5)";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage7 {
texture = "a3\data_f\env_land_co.paa";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,92 @@
ambient[] = {1.0, 1.0, 1.0, 1.0};
diffuse[] = {1.0, 1.0, 1.0, 1.0};
forcedDiffuse[] = {0.0, 0.0, 0.0, 0.0};
emmisive[] = {0.0, 0.0, 0.0, 1.0};
specular[] = {0.93, 0.93, 0.93, 1.0};
specularPower = 200.0;
PixelShaderID = "Super";
VertexShaderID = "Super";
class Stage1 {
texture="z\ace\addons\minedetector\data\ace_vmm3_nohq.paa";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage2 {
texture = "a3\weapons_f\data\detailmaps\metal_detail_dt.paa";
uvSource = "tex";
class uvTransform {
aside[] = {6.0, 0.0, 0.0};
up[] = {0.0, 3.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage3 {
texture = "#(argb,8,8,3)color(0,0,0,0,MC)";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage4 {
texture = "#(argb,8,8,3)color(1,0,0,1,AS)";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage5 {
texture="z\ace\addons\minedetector\data\ace_vmm3_smdi.paa";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage6 {
texture = "#(ai,64,64,1)fresnel(1.29,0.5)";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};
class Stage7 {
texture = "a3\data_f\env_land_co.paa";
uvSource = "tex";
class uvTransform {
aside[] = {1.0, 0.0, 0.0};
up[] = {0.0, 1.0, 0.0};
dir[] = {0.0, 0.0, 0.0};
pos[] = {0.0, 0.0, 0.0};
};
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,154 @@
class CfgSkeletons
{
class Default
{
isDiscrete = 1;
skeletonInherit = "";
skeletonBones[] = {};
};
class OFP2_ManSkeleton
{
isDiscrete = 0;
skeletonInherit = "";
skeletonBones[] =
{
"Pelvis","",
"Spine","Pelvis",
"Spine1","Spine",
"Spine2","Spine1",
"Spine3","Spine2",
"Camera","Pelvis",
"weapon","Spine1",
"launcher","Spine1",
//Head skeleton in hierarchy
"neck","Spine3",
"neck1","neck",
"head","neck1",
//New facial features
"Face_Hub","head",
"Face_Jawbone","Face_Hub",
"Face_Jowl","Face_Jawbone",
"Face_chopRight","Face_Jawbone",
"Face_chopLeft","Face_Jawbone",
"Face_LipLowerMiddle","Face_Jawbone",
"Face_LipLowerLeft","Face_Jawbone",
"Face_LipLowerRight","Face_Jawbone",
"Face_Chin","Face_Jawbone",
"Face_Tongue","Face_Jawbone",
"Face_CornerRight","Face_Hub",
"Face_CheekSideRight","Face_CornerRight",
"Face_CornerLeft","Face_Hub",
"Face_CheekSideLeft","Face_CornerLeft",
"Face_CheekFrontRight","Face_Hub",
"Face_CheekFrontLeft","Face_Hub",
"Face_CheekUpperRight","Face_Hub",
"Face_CheekUpperLeft","Face_Hub",
"Face_LipUpperMiddle","Face_Hub",
"Face_LipUpperRight","Face_Hub",
"Face_LipUpperLeft","Face_Hub",
"Face_NostrilRight","Face_Hub",
"Face_NostrilLeft","Face_Hub",
"Face_Forehead","Face_Hub",
"Face_BrowFrontRight","Face_Forehead",
"Face_BrowFrontLeft","Face_Forehead",
"Face_BrowMiddle","Face_Forehead",
"Face_BrowSideRight","Face_Forehead",
"Face_BrowSideLeft","Face_Forehead",
"Face_Eyelids","Face_Hub",
"Face_EyelidUpperRight","Face_Hub",
"Face_EyelidUpperLeft","Face_Hub",
"Face_EyelidLowerRight","Face_Hub",
"Face_EyelidLowerLeft","Face_Hub",
"EyeLeft","Face_Hub",
"EyeRight","Face_Hub",
//Left upper side
"LeftShoulder","Spine3",
"LeftArm","LeftShoulder",
"LeftArmRoll","LeftArm",
"LeftForeArm","LeftArmRoll",
"LeftForeArmRoll","LeftForeArm",
"LeftHand","LeftForeArmRoll",
"LeftHandRing","LeftHand",
"LeftHandRing1","LeftHandRing",
"LeftHandRing2","LeftHandRing1",
"LeftHandRing3","LeftHandRing2",
"LeftHandPinky1","LeftHandRing",
"LeftHandPinky2","LeftHandPinky1",
"LeftHandPinky3","LeftHandPinky2",
"LeftHandMiddle1","LeftHand",
"LeftHandMiddle2","LeftHandMiddle1",
"LeftHandMiddle3","LeftHandMiddle2",
"LeftHandIndex1","LeftHand",
"LeftHandIndex2","LeftHandIndex1",
"LeftHandIndex3","LeftHandIndex2",
"LeftHandThumb1","LeftHand",
"LeftHandThumb2","LeftHandThumb1",
"LeftHandThumb3","LeftHandThumb2",
//Right upper side
"RightShoulder","Spine3",
"RightArm","RightShoulder",
"RightArmRoll","RightArm",
"RightForeArm","RightArmRoll",
"RightForeArmRoll","RightForeArm",
"RightHand","RightForeArmRoll",
"RightHandRing","RightHand",
"RightHandRing1","RightHandRing",
"RightHandRing2","RightHandRing1",
"RightHandRing3","RightHandRing2",
"RightHandPinky1","RightHandRing",
"RightHandPinky2","RightHandPinky1",
"RightHandPinky3","RightHandPinky2",
"RightHandMiddle1","RightHand",
"RightHandMiddle2","RightHandMiddle1",
"RightHandMiddle3","RightHandMiddle2",
"RightHandIndex1","RightHand",
"RightHandIndex2","RightHandIndex1",
"RightHandIndex3","RightHandIndex2",
"RightHandThumb1","RightHand",
"RightHandThumb2","RightHandThumb1",
"RightHandThumb3","RightHandThumb2",
//Left lower side
"LeftUpLeg","Pelvis",
"LeftUpLegRoll","LeftUpLeg",
"LeftLeg","LeftUpLegRoll",
"LeftLegRoll","LeftLeg",
"LeftFoot","LeftLegRoll",
"LeftToeBase","LeftFoot",
//Right lower side
"RightUpLeg","Pelvis",
"RightUpLegRoll","RightUpLeg",
"RightLeg","RightUpLegRoll",
"RightLegRoll","RightLeg",
"RightFoot","RightLegRoll",
"RightToeBase","RightFoot"
};
// location of pivot points (local axes) for hierarchical animation
pivotsModel="a3\anims_f\data\skeleton\SkeletonPivots.p3d";
};
};
class CfgModels
{
class Default
{
sectionsInherit="";
sections[] = {};
skeletonName = "";
};
class ArmaMan : Default
{
htMin = 60; // Minimum half-cooling time (in seconds)
htMax = 1800; // Maximum half-cooling time (in seconds)
afMax = 30; // Maximum temperature in case the model is alive (in celsius)
mfMax = 0; // Maximum temperature when the model is moving (in celsius)
mFact = 1; // Metabolism factor - number from interval <0, 1> (0 - metabolism has no influence, 1 - metabolism has full influence (no other temperature source will be considered)).
tBody = 37; // Metabolism temperature of the model (in celsius)
sections[] =
{
"osobnost","Head_Injury","Body_Injury","l_leg_injury","l_arm_injury","r_arm_injury","r_leg_injury","injury_body", "injury_legs", "injury_hands",
"clan","clan_sign","Camo","CamoB","Camo1","Camo2","personality","hl", "injury_head"
};
skeletonName = "OFP2_ManSkeleton";
};
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,21 @@
/*
* Author: Glowbal
* Activate the mine detector
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_minedetector_fnc_activateDetector
*
* Public: No
*/
#include "script_component.hpp"
if (call FUNC(canActivateDetector)) then {
[ACE_player, currentWeapon ACE_player] call FUNC(enableDetector);
};

View File

@ -0,0 +1,19 @@
/*
* Author: Glowbal
* Check if the mine detector can be activated
*
* Arguments:
* None
*
* Return Value:
* Can be activated <BOOL>
*
* Example:
* [] call ace_minedetector_fnc_canActivateDetector
*
* Public: No
*/
#include "script_component.hpp"
([ACE_player] call FUNC(hasDetector)) && !([ACE_player, currentWeapon ACE_player] call FUNC(isDetectorEnabled));

View File

@ -0,0 +1,19 @@
/*
* Author: Glowbal
* Check if the mine detector can be deactivated
*
* Arguments:
* None
*
* Return Value:
* Can be deactivated <BOOL>
*
* Example:
* [] call ace_minedetector_fnc_canDeactivateDetector
*
* Public: No
*/
#include "script_component.hpp"
([ACE_player] call FUNC(hasDetector)) && ([ACE_player, currentWeapon ACE_player] call FUNC(isDetectorEnabled));

View File

@ -0,0 +1,21 @@
/*
* Author: Glowbal
* Deactivate the mine detector
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_minedetector_fnc_deactivateDetector
*
* Public: No
*/
#include "script_component.hpp"
if (call FUNC(canDeactivateDetector)) then {
[ACE_player, currentWeapon ACE_player] call FUNC(disableDetector);
};

View File

@ -0,0 +1,44 @@
/*
* Author: Glowbal
* Handle mine detection in a PFH loop
*
* Arguments:
* 0: args <ARRAY>
* 1: PHD Id <PFH_ID>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["_args", "_idPFH"];
_args params ["_unit", "_type", "_detectorConfig", "_lastPlayed"];
if !([_unit, _type] call FUNC(hasDetectorType)) exitwith {
// disable detector type
[_unit, _type] call FUNC(disableDetector);
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
if (!alive _unit) exitwith {
[_unit, _type] call FUNC(disableDetector);
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
if !([_unit, _type] call FUNC(isDetectorEnabled)) exitwith {
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
if (ACE_player == _unit && {currentWeapon _unit == _type}) then {
private _detected = [_unit, _detectorConfig] call FUNC(getDetectedObject);
_detected params ["_hasDetected", "_object", "_distance"];
if (_hasDetected && (ACE_time - _lastPlayed > 0.9)) then {
_args set [3, ACE_time];
_detectorConfig params ["_type", "_radius", "_detectableTypes", "_sounds"];
private _sound = _sounds select (_distance >= 1.2);
[_unit, _sound, true] call FUNC(playDetectorSound);
};
};

View File

@ -0,0 +1,24 @@
/*
* Author: Glowbal
* Disables the mine detector
*
* Arguments:
* 0: Unit <OBJECT>
* 1: detecter type <STRING>
*
* Return Value:
* None
*
* Example:
* [UNIT, DETECTOR_CLASS_NAME] call ace_minedetector_fnc_disableDetector
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_detectorType"];
_unit setvariable [format[QGVAR(enable_%1), _detectorType], false];
["minedetector_disabled", [_unit, _detectorType]] call EFUNC(common,localEvent);

View File

@ -0,0 +1,24 @@
/*
* Author: Glowbal
* Enables the mine detector
*
* Arguments:
* 0: Unit <OBJECT>
* 1: detecter type <STRING>
*
* Return Value:
* None
*
* Example:
* [UNIT, DETECTOR_CLASS_NAME] call ace_minedetector_fnc_enableDetector
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_detectorType"];
_unit setvariable [format[QGVAR(enable_%1), _detectorType], true];
["minedetector_enabled", [_unit, _detectorType]] call EFUNC(common,localEvent);

View File

@ -0,0 +1,44 @@
/*
* Author: Glowbal
* Enables the mine detector
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Configuration <ARRAY>
*
* Return Value:
* [isDetected <BOOL>, mine <OBJECT>, distance <NUMBER>] <ARRAY>
*
* Example:
* [ace_player, DETECTOR_CONFIG] call ace_minedetector_fnc_getDetectedObject
*
* Public: No
*/
#define __DR 1.3
#include "script_component.hpp"
params ["_unit", "_detectorConfig"];
_detectorConfig params ["_type", "_radius", "_detectableTypes", "_sounds"];
private _worldPosition = _unit modelToWorld (_unit selectionPosition "granat");
private _direction = _unit weaponDirection "Put";
_worldPosition params ["_posX", "_posY", "_posZ"];
_direction params ["_dirX", "_dirY", "_dirZ"];
private _dPnt = [_posX + __DR * _dirX, _posY + __DR * _dirY, _posZ + __DR * _dirZ];
private _mines = nearestObjects [_dPnt, _detectableTypes, _radius];
if (_mines isEqualTo []) exitwith {
[false, objNull, -1];
};
// guaranteed to have at least one element. Lets get the first
private _mine = _mines select 0;
private _distance = _dPnt distance _mine;
private _isDetectable = getNumber (configFile >> "CfgVehicles" >> typeOf _mine >> QGVAR(detectable));
[(_isDetectable > 0), _mine, _distance];

View File

@ -0,0 +1,31 @@
/*
* Author: Glowbal
* Get the mine detector configuration from the config file
*
* Arguments:
* 0: Detector class name <STRING>
*
* Return Value:
* Detector configuration or empty array if invalid <ARRAY>
*
* Example:
* ["my_detector"] call ace_minedetector_fnc_getDetectorConfig
*
* Public: No
*/
#include "script_component.hpp"
params ["_detectorType"];
private _config = (configFile >> "ACE_detector" >> "detectors" >> _detectorType);
if (isClass _config) then {
[
_detectorType,
getNumber (_config >> "radius"),
GVAR(ALL_DETECTABLE_TYPES), // TODO read from config and use this as a back up value instead
getArray (_config >> "sounds")
];
} else {
[];
};

View File

@ -0,0 +1,21 @@
/*
* Author: Glowbal
* Check if unit has a mine detector in hands
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Current weapon is a mine detector <BOOLEAN>
*
* Example:
* [ace_player] call ace_minedetector_fnc_hasDetector
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
!(([currentWeapon _unit] call FUNC(getDetectorConfig)) isEqualTo []);

View File

@ -0,0 +1,21 @@
/*
* Author: Glowbal
* Check if the mine detector is enabled
*
* Arguments:
* 0: detecter type <STRING>
*
* Return Value:
* None
*
* Example:
* ["example"] call ace_minedetector_fnc_[functionName]
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_detectorType"];
alive _unit && {(_unit getvariable [format[QGVAR(enable_%1), _detectorType], false])};

View File

@ -0,0 +1,31 @@
/*
* Author: Glowbal
* Play the detector sound
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Sound class name <STRING>
*
* Return Value:
* None
*
* Example:
* ["example"] call ace_minedetector_fnc_playDetectorSound
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_detectorSound"];
if (isNull _unit) exitwith {}; // TODO log error - unit does not exist
if (!alive _unit) exitwith {
// log error, unit is not alive
};
private _helperObject = _unit getvariable [QGVAR(helperLogic), objNull];
if !(isNull _helperObject) then {
_helperObject attachto [_unit,[0,0,-3],""];
[_helperObject, _unit] say3D _detectorSound;
};

View File

@ -0,0 +1 @@
#include "\z\ace\addons\minedetector\script_component.hpp"

View File

@ -0,0 +1,12 @@
#define COMPONENT minedetector
#include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_MINEDETECTOR
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_MINEDETECTOR
#define DEBUG_SETTINGS DEBUG_SETTINGS_MINEDETECTOR
#endif
#include "\z\ace\addons\main\script_macros.hpp"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="MineDetector">
<Key ID="STR_ACE_MineDetector_">
<English>Vallon</English>
</Key>
</Package>
</Project>