mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
75 lines
2.1 KiB
Plaintext
75 lines
2.1 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: Glowbal
|
|
* Handle mine detection in a PFH loop
|
|
*
|
|
* Arguments:
|
|
* 0: args <ARRAY>
|
|
* 1: PHD Id <PFH_ID>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [[args], 2] call ACE_minedetector_fnc_detectorLoop
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_args", "_idPFH"];
|
|
_args params ["_unit", "_type", "_detectorConfig", "_lastPlayed"];
|
|
|
|
// If locality switched just turn off the detector
|
|
if !(local _unit) exitWith {
|
|
[QGVAR(disableDetector), [_unit, _type], _unit] call CBA_fnc_targetEvent;
|
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
|
};
|
|
|
|
if !([_unit, _type] call FUNC(hasDetector)) 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 (currentWeapon _unit != _type) exitWith {
|
|
[_unit, _type] call FUNC(disableDetector);
|
|
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
|
};
|
|
|
|
private _detected = [[_unit, _detectorConfig], FUNC(getDetectedObject), _unit, QGVAR(detectedObjects), 0.15] call EFUNC(common,cachedCall);
|
|
_detected params ["_hasDetected", "_mine", "_distance"];
|
|
|
|
if (!_hasDetected) exitWith {};
|
|
|
|
// Launch a local event stating which mine was detected for mission purposes
|
|
[QGVAR(mineDetected), [_unit, _mine, _distance]] call CBA_fnc_localEvent;
|
|
|
|
private _distanceTiming = switch (true) do {
|
|
case (_distance >= 2): {1};
|
|
case (_distance >= 1.25): {0.85};
|
|
case (_distance >= 0.75): {0.7};
|
|
default {0.5};
|
|
};
|
|
|
|
if (CBA_missionTime - _lastPlayed < _distanceTiming) exitWith {};
|
|
|
|
_args set [3, CBA_missionTime];
|
|
_detectorConfig params ["", "", "_soundClasses"];
|
|
private _soundClass = switch (true) do {
|
|
case (_distance >= 2): {_soundClasses select 3};
|
|
case (_distance >= 1.25): {_soundClasses select 2};
|
|
case (_distance >= 0.5): {_soundClasses select 1};
|
|
default {_soundClasses select 0};
|
|
};
|
|
|
|
[_unit, _soundClass] call FUNC(playDetectorSound);
|