mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
- Restore the config of detector sounds through CfgSounds
- Add the possibility of switching between headphones or speaker - Move detector actions to their own submenu
This commit is contained in:
parent
34654fffb7
commit
f73b6b1aad
@ -2,9 +2,7 @@ class ACE_detector {
|
|||||||
class detectors {
|
class detectors {
|
||||||
class ACE_VMM3 {
|
class ACE_VMM3 {
|
||||||
radius = 2.5;
|
radius = 2.5;
|
||||||
name = "ace_detector_1";
|
sounds[] = {"ace_detector_1", "ace_detector_2", "ace_detector_3", "ace_detector_4"};
|
||||||
sound = QUOTE(PATHTO_R(sounds\metal_detector.wss));
|
|
||||||
pitchs[] = {1, 0.9, 0.8, 0.7};
|
|
||||||
};
|
};
|
||||||
class ACE_VMH3: ACE_VMM3 {
|
class ACE_VMH3: ACE_VMM3 {
|
||||||
};
|
};
|
||||||
|
22
addons/minedetector/CfgSounds.hpp
Normal file
22
addons/minedetector/CfgSounds.hpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
class CfgSounds {
|
||||||
|
class ace_detector_1 {
|
||||||
|
name = "ace_detector_1";
|
||||||
|
sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wss)), "db+1", 1};
|
||||||
|
titles[] = {};
|
||||||
|
};
|
||||||
|
class ace_detector_2 {
|
||||||
|
name = "ace_detector_2";
|
||||||
|
sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wss)), "db+1", 0.9};
|
||||||
|
titles[] = {};
|
||||||
|
};
|
||||||
|
class ace_detector_3 {
|
||||||
|
name = "ace_detector_3";
|
||||||
|
sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wss)), "db+1", 0.8};
|
||||||
|
titles[] = {};
|
||||||
|
};
|
||||||
|
class ace_detector_4 {
|
||||||
|
name = "ace_detector_4";
|
||||||
|
sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wss)), "db+1", 0.7};
|
||||||
|
titles[] = {};
|
||||||
|
};
|
||||||
|
};
|
@ -11,6 +11,12 @@ class CfgVehicles {
|
|||||||
class CAManBase: Man {
|
class CAManBase: Man {
|
||||||
class ACE_SelfActions {
|
class ACE_SelfActions {
|
||||||
class ACE_Equipment {
|
class ACE_Equipment {
|
||||||
|
class GVAR(metalDetector) {
|
||||||
|
displayName = CSTRING(MetalDetector);
|
||||||
|
condition = QUOTE([ACE_player] call FUNC(hasDetector));
|
||||||
|
statement = "";
|
||||||
|
icon = "" //TODO
|
||||||
|
exceptions[] = {};
|
||||||
class GVAR(activate) {
|
class GVAR(activate) {
|
||||||
displayName = CSTRING(ActivateDetector);
|
displayName = CSTRING(ActivateDetector);
|
||||||
condition = QUOTE(call FUNC(canActivateDetector));
|
condition = QUOTE(call FUNC(canActivateDetector));
|
||||||
@ -25,6 +31,21 @@ class CfgVehicles {
|
|||||||
icon = QPATHTOF(ui\icon_mineDetectorOff.paa);
|
icon = QPATHTOF(ui\icon_mineDetectorOff.paa);
|
||||||
exceptions[] = {};
|
exceptions[] = {};
|
||||||
};
|
};
|
||||||
|
class GVAR(connectHeadphones) {
|
||||||
|
displayName = CSTRING(ConnectHeadphones);
|
||||||
|
condition = QUOTE(call FUNC(canConnectHeadphones));
|
||||||
|
statement = QUOTE([ARR_2(ACE_player, true)] call FUNC(connectHeadphones));
|
||||||
|
icon = "" //TODO
|
||||||
|
exceptions[] = {};
|
||||||
|
};
|
||||||
|
class GVAR(disconnectHeadphones) {
|
||||||
|
displayName = CSTRING(DisconnectHeadphones);
|
||||||
|
condition = QUOTE(call FUNC(canDisconnectHeadphones));
|
||||||
|
statement = QUOTE([ARR_2(ACE_player, false)] call FUNC(connectHeadphones));
|
||||||
|
icon = "" //TODO
|
||||||
|
exceptions[] = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
|
|
||||||
PREP(canActivateDetector);
|
PREP(canActivateDetector);
|
||||||
|
PREP(canConnectHeadphones);
|
||||||
PREP(canDeactivateDetector);
|
PREP(canDeactivateDetector);
|
||||||
|
PREP(canDisconnectHeadphones);
|
||||||
|
PREP(connectHeadphones);
|
||||||
PREP(activateDetector);
|
PREP(activateDetector);
|
||||||
PREP(deactivateDetector);
|
PREP(deactivateDetector);
|
||||||
PREP(hasDetector);
|
PREP(hasDetector);
|
||||||
|
@ -18,4 +18,5 @@ class CfgPatches {
|
|||||||
#include "CfgWeapons.hpp"
|
#include "CfgWeapons.hpp"
|
||||||
#include "CfgAmmo.hpp"
|
#include "CfgAmmo.hpp"
|
||||||
#include "CfgVehicles.hpp"
|
#include "CfgVehicles.hpp"
|
||||||
|
#include "CfgSounds.hpp"
|
||||||
#include "ACE_detector.hpp"
|
#include "ACE_detector.hpp"
|
||||||
|
@ -16,4 +16,5 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
([ACE_player] call FUNC(hasDetector)) && !([ACE_player, currentWeapon ACE_player] call FUNC(isDetectorEnabled));
|
([ACE_player] call FUNC(hasDetector)) &&
|
||||||
|
!([ACE_player, currentWeapon ACE_player] call FUNC(isDetectorEnabled));
|
||||||
|
20
addons/minedetector/functions/fnc_canConnectHeadphones.sqf
Normal file
20
addons/minedetector/functions/fnc_canConnectHeadphones.sqf
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Author: esteldunedain
|
||||||
|
* Check if headphones can be connected to the mine detector
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Can be connected <BOOL>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [] call ace_minedetector_fnc_canConnectHeadphones
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
!(ACE_player getVariable [QGVAR(isUsingHeadphones), false]) &&
|
||||||
|
{[ACE_player] call FUNC(hasDetector)};
|
@ -16,4 +16,5 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
([ACE_player] call FUNC(hasDetector)) && {[ACE_player, currentWeapon ACE_player] call FUNC(isDetectorEnabled)};
|
([ACE_player] call FUNC(hasDetector)) &&
|
||||||
|
{[ACE_player, currentWeapon ACE_player] call FUNC(isDetectorEnabled)};
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Author: esteldunedain
|
||||||
|
* Check if headphones can be disconnected from the mine detector
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Can be disconnected <BOOL>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [] call ace_minedetector_fnc_canDisconnectHeadphones
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
(ACE_player getVariable [QGVAR(isUsingHeadphones), false]) &&
|
||||||
|
{[ACE_player] call FUNC(hasDetector)};
|
27
addons/minedetector/functions/fnc_connectHeadphones.sqf
Normal file
27
addons/minedetector/functions/fnc_connectHeadphones.sqf
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Author: esteldunedain
|
||||||
|
* Connect/disconnect headphones to the mine detector
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
* 1: Connect? <BOOLEAN>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [_unit, true] call ace_minedetector_fnc_connectHeadphones
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit", "_state"];
|
||||||
|
_unit setVariable [QGVAR(isUsingHeadphones), _state];
|
||||||
|
|
||||||
|
if (_state) then {
|
||||||
|
[localize LSTRING(HeadphonesConnected)] call EFUNC(common,displayTextStructured);
|
||||||
|
} else {
|
||||||
|
[localize LSTRING(HeadphonesDisconnected)] call EFUNC(common,displayTextStructured);
|
||||||
|
};
|
@ -49,11 +49,12 @@ private _distanceTiming = switch (true) do {
|
|||||||
if (CBA_missionTime - _lastPlayed < _distanceTiming) exitWith {};
|
if (CBA_missionTime - _lastPlayed < _distanceTiming) exitWith {};
|
||||||
|
|
||||||
_args set [3, CBA_missionTime];
|
_args set [3, CBA_missionTime];
|
||||||
_detectorConfig params ["", "", "_sound", "_pitchs"];
|
_detectorConfig params ["", "", "_soundClasses"];
|
||||||
private _pitch = switch (true) do {
|
private _soundClass = switch (true) do {
|
||||||
case (_distance >= 2): {_pitchs select 3};
|
case (_distance >= 2): {_soundClasses select 3};
|
||||||
case (_distance >= 1.25): {_pitchs select 2};
|
case (_distance >= 1.25): {_soundClasses select 2};
|
||||||
case (_distance >= 0.5): {_pitchs select 1};
|
case (_distance >= 0.5): {_soundClasses select 1};
|
||||||
default {_pitchs select 0};
|
default {_soundClasses select 0};
|
||||||
};
|
};
|
||||||
[_unit, _sound, _pitch] call FUNC(playDetectorSound);
|
|
||||||
|
[_unit, _soundClass] call FUNC(playDetectorSound);
|
||||||
|
@ -25,8 +25,7 @@ if (isNil "_detectorConfig") then {
|
|||||||
_detectorConfig = [
|
_detectorConfig = [
|
||||||
_detectorType,
|
_detectorType,
|
||||||
getNumber (_cfgEntry >> "radius"),
|
getNumber (_cfgEntry >> "radius"),
|
||||||
getText (_cfgEntry >> "sound"),
|
getArray (_cfgEntry >> "sounds")
|
||||||
getArray (_cfgEntry >> "pitchs")
|
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
_detectorConfig = [];
|
_detectorConfig = [];
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
* 1: Sound file name <STRING>
|
* 1: Sound class <STRING>
|
||||||
* 2: Sound pitch <NUMBER>
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -18,7 +17,7 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit", "_sound", "_pitch"];
|
params ["_unit", "_soundClass"];
|
||||||
|
|
||||||
if (isNull _unit) exitWith {
|
if (isNull _unit) exitWith {
|
||||||
ACE_LOGERROR_1("unit does not exist [%1]",_unit);
|
ACE_LOGERROR_1("unit does not exist [%1]",_unit);
|
||||||
@ -27,6 +26,9 @@ if (!alive _unit) exitWith {
|
|||||||
ACE_LOGERROR_1("unit is not alive [%1]",_unit);
|
ACE_LOGERROR_1("unit is not alive [%1]",_unit);
|
||||||
};
|
};
|
||||||
|
|
||||||
private _posASL = AGLtoASL (_unit modelToWorld (_unit selectionPosition "granat"));
|
if (_unit getVariable [QGVAR(isUsingHeadphones), false]) then {
|
||||||
|
_unit say2D _soundClass;
|
||||||
playSound3D [_sound, objNull, false, _posASL, 5, _pitch, 15];
|
} else {
|
||||||
|
private _posASL = AGLtoASL (_unit modelToWorld (_unit selectionPosition "granat"));
|
||||||
|
[_soundClass, _posASL, 5, 15] call EFUNC(common,playConfigSound3D);
|
||||||
|
};
|
||||||
|
@ -5,13 +5,29 @@
|
|||||||
<English>Metal detector</English>
|
<English>Metal detector</English>
|
||||||
<French>Détecteur de métaux</French>
|
<French>Détecteur de métaux</French>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_MineDetector_MetalDetector">
|
||||||
|
<English>Metal detector</English>
|
||||||
|
<French>Détecteur de métaux</French>
|
||||||
|
</Key>
|
||||||
<Key ID="STR_ACE_MineDetector_ActivateDetector">
|
<Key ID="STR_ACE_MineDetector_ActivateDetector">
|
||||||
<English>Activate Detector</English>
|
<English>Activate</English>
|
||||||
<French>Activer le détecteur</French>
|
<French>Activer</French>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_MineDetector_DeactivateDetector">
|
<Key ID="STR_ACE_MineDetector_DeactivateDetector">
|
||||||
<English>Deactivate Detector</English>
|
<English>Deactivate</English>
|
||||||
<French>Désactiver le détecteur</French>
|
<French>Désactiver</French>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_MineDetector_ConnectHeadphones">
|
||||||
|
<English>Connect Headphones</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_MineDetector_DisconnectHeadphones">
|
||||||
|
<English>Disconnect Headphones</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_MineDetector_HeadphonesConnected">
|
||||||
|
<English>Headphones Connected</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_MineDetector_HeadphonesDisconnected">
|
||||||
|
<English>Headphones Disconnected</English>
|
||||||
</Key>
|
</Key>
|
||||||
</Package>
|
</Package>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user