diff --git a/addons/chemical/CfgSounds.hpp b/addons/chemical/CfgSounds.hpp index 00f704a4f..8ce062af6 100644 --- a/addons/chemical/CfgSounds.hpp +++ b/addons/chemical/CfgSounds.hpp @@ -91,5 +91,70 @@ class CfgSounds { }; titles[] = {}; }; - + class GVAR(chemBaseChime) { + name = QGVAR(chemBaseChime); + sound[] = + { + QPATHTOF(audio\baseChime.ogg), + 2, + 1.0, + 5 + }; + titles[] = {}; + }; + class GVAR(chemSlowChime) { + name = QGVAR(chemSlowChime); + sound[] = + { + QPATHTOF(audio\slowChime.ogg), + 2, + 1.0, + 5 + }; + titles[] = {}; + }; + class GVAR(chemNormalChime) { + name = QGVAR(chemNormalChime); + sound[] = + { + QPATHTOF(audio\normalChime.ogg), + 2, + 1.0, + 5 + }; + titles[] = {}; + }; + class GVAR(chemFastChime) { + name = QGVAR(chemFastChime); + sound[] = + { + QPATHTOF(audio\fastChime.ogg), + 2, + 1.0, + 5 + }; + titles[] = {}; + }; + class GVAR(chemRapidChime) { + name = QGVAR(chemRapidChime); + sound[] = + { + QPATHTOF(audio\rapidChime.ogg), + 2, + 1.0, + 5 + }; + titles[] = {}; + }; + class GVAR(chemTone) { + name = QGVAR(chemTone); + sound[] = + { + QPATHTOF(audio\tone.ogg), + 2, + 1.0, + 5 + }; + titles[] = {}; + }; }; diff --git a/addons/chemical/CfgVehicles.hpp b/addons/chemical/CfgVehicles.hpp index f75b2e9cb..3c817c66d 100644 --- a/addons/chemical/CfgVehicles.hpp +++ b/addons/chemical/CfgVehicles.hpp @@ -6,7 +6,7 @@ class CfgVehicles { class KAT_CheckGasMaskDur { displayName = CSTRING(CheckGasMaskDurability); condition = QUOTE([_player] call FUNC(hasGasMaskOn)); - exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting"}; + exceptions[] = {"isNotSwimming"}; statement = QUOTE(_this call FUNC(checkGasMaskDur)); showDisabled = 0; icon = QPATHTOF(ui\Gasmask_icon.paa); @@ -14,7 +14,7 @@ class CfgVehicles { class KAT_ChangeGasMaskFilter { displayName = CSTRING(ChangeGasMaskFilter); condition = QUOTE([_player] call FUNC(canReplaceFilter)); - exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting"}; + exceptions[] = {"isNotSwimming"}; statement = QUOTE(_this call FUNC(changeGasMaskFilter)); showDisabled = 0; icon = QPATHTOF(ui\gasmaskfilter_ca.paa); @@ -22,7 +22,7 @@ class CfgVehicles { class KAT_PutOnGasMask { displayName = CSTRING(PutOnGasMask); condition = QUOTE([_player] call FUNC(canPutOnGasMask)); - exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting"}; + exceptions[] = {"isNotSwimming"}; statement = QUOTE([_player] call FUNC(putOnGasMask)); showDisabled = 0; icon = QPATHTOF(ui\Gasmask_icon.paa); @@ -30,11 +30,42 @@ class CfgVehicles { class KAT_TakeOffGasMask { displayName = CSTRING(TakeOffGasMask); condition = QUOTE([_player] call FUNC(canTakeOffGasMask)); - exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting"}; + exceptions[] = {"isNotSwimming"}; statement = QUOTE([_player] call FUNC(takeOffGasMask)); showDisabled = 0; icon = QPATHTOF(ui\Gasmask_icon.paa); }; + + class KAT_ChemicalDetector { + displayName = CSTRING(ChemicalDetector_Menu); + icon = QPATHTOF(ui\kat_chemicalDet_icon.paa); + exceptions[] = {"isNotSwimming"}; + + class KAT_ChemicalDetector_Enable { + displayName = CSTRING(EnableDetector); + condition = QUOTE(([_player] call FUNC(hasDetector)) && !(_player getVariable [ARR_2(QQGVAR(detectorEnabled),false)])); + exceptions[] = {"isNotSwimming"}; + statement = QUOTE([_player] call FUNC(enableChemDetector)); + showDisabled = 0; + icon = QPATHTOF(ui\kat_chemicalDet_icon.paa); + }; + class KAT_ChemicalDetector_SoundOn { + displayName = CSTRING(EnableDetectorSound); + condition = QUOTE(!(_player getVariable [ARR_2(QQGVAR(detectorSound),false)]) && ([_player] call FUNC(hasDetector))); + exceptions[] = {"isNotSwimming"}; + statement = QUOTE(_player setVariable [ARR_3(QQGVAR(detectorSound),true,true)]); + showDisabled = 0; + icon = QPATHTOF(ui\kat_chemicalDet_icon.paa); + }; + class KAT_ChemicalDetector_SoundOff { + displayName = CSTRING(DisableDetectorSound); + condition = QUOTE((_player getVariable [ARR_2(QQGVAR(detectorSound),false)]) && ([_player] call FUNC(hasDetector))); + exceptions[] = {"isNotSwimming"}; + statement = QUOTE(_player setVariable [ARR_3(QQGVAR(detectorSound),false,true)]); + showDisabled = 0; + icon = QPATHTOF(ui\kat_chemicalDet_icon.paa); + }; + }; }; }; }; diff --git a/addons/chemical/XEH_PREP.hpp b/addons/chemical/XEH_PREP.hpp index 0decbf75b..417529772 100644 --- a/addons/chemical/XEH_PREP.hpp +++ b/addons/chemical/XEH_PREP.hpp @@ -10,6 +10,7 @@ PREP(checkGasMaskDur); PREP(createSealAction); PREP(csGrenade); PREP(displayGasMaskDur); +PREP(enableChemDetector); PREP(fullHealLocal); PREP(gasManagerPFH); PREP(gasmodule); @@ -21,6 +22,7 @@ PREP(gui_updateInjuryListGeneral); PREP(handleFired); PREP(handleGasMaskDur); PREP(handleRespawn); +PREP(hasDetector); PREP(hasGasmask); PREP(hasGasMaskON); PREP(hideChemDetector); diff --git a/addons/chemical/XEH_postInit.sqf b/addons/chemical/XEH_postInit.sqf index fe535ba4e..912450623 100644 --- a/addons/chemical/XEH_postInit.sqf +++ b/addons/chemical/XEH_postInit.sqf @@ -6,6 +6,11 @@ [QGVAR(handleGasMaskDur), LINKFUNC(handleGasMaskDur)] call CBA_fnc_addEventHandler; [QGVAR(addSealAction), LINKFUNC(createSealAction)] call CBA_fnc_addEventHandler; +[QGVAR(playTone), { + params ["_unit", "_tone"]; + _unit say3D [_tone, 5]; +}] call CBA_fnc_addEventHandler; + // ACE Events [QACEGVAR(medical_gui,updateInjuryListGeneral), LINKFUNC(gui_updateInjuryListGeneral)] call CBA_fnc_addEventHandler; [QACEGVAR(medical_gui,updateBodyImage), LINKFUNC(gui_updateBodyImage)] call CBA_fnc_addEventHandler; diff --git a/addons/chemical/audio/baseChime.ogg b/addons/chemical/audio/baseChime.ogg new file mode 100644 index 000000000..1b76678a7 Binary files /dev/null and b/addons/chemical/audio/baseChime.ogg differ diff --git a/addons/chemical/audio/fastChime.ogg b/addons/chemical/audio/fastChime.ogg new file mode 100644 index 000000000..a527d8230 Binary files /dev/null and b/addons/chemical/audio/fastChime.ogg differ diff --git a/addons/chemical/audio/normalChime.ogg b/addons/chemical/audio/normalChime.ogg new file mode 100644 index 000000000..ad09cbe5e Binary files /dev/null and b/addons/chemical/audio/normalChime.ogg differ diff --git a/addons/chemical/audio/rapidChime.ogg b/addons/chemical/audio/rapidChime.ogg new file mode 100644 index 000000000..a5ceaf32d Binary files /dev/null and b/addons/chemical/audio/rapidChime.ogg differ diff --git a/addons/chemical/audio/slowChime.ogg b/addons/chemical/audio/slowChime.ogg new file mode 100644 index 000000000..c2ce41335 Binary files /dev/null and b/addons/chemical/audio/slowChime.ogg differ diff --git a/addons/chemical/audio/tone.ogg b/addons/chemical/audio/tone.ogg new file mode 100644 index 000000000..b5c644575 Binary files /dev/null and b/addons/chemical/audio/tone.ogg differ diff --git a/addons/chemical/functions/fnc_enableChemDetector.sqf b/addons/chemical/functions/fnc_enableChemDetector.sqf new file mode 100644 index 000000000..6747b569d --- /dev/null +++ b/addons/chemical/functions/fnc_enableChemDetector.sqf @@ -0,0 +1,50 @@ +#include "..\script_component.hpp" +/* + * Author: Mazinski + * Enables the audio on the Chemical Detector. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call kat_chemical_enableChemDetector + * + * Public: No + */ + +params ["_unit"]; + +_unit setVariable [QGVAR(detectorEnabled), true, true]; + +[{ + params ["_args", "_idPFH"]; + _args params ["_unit"]; + + private _alive = alive _unit; + + if (!_alive) exitWith { + [_idPFH] call CBA_fnc_removePerFrameHandler; + }; + + if !("KAT_ChemicalDetector" in assignedItems _unit) exitWith { + _unit setVariable [QGVAR(detectorEnabled), false, true]; + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + private _detectorSound = _unit getVariable [QGVAR(detectorSound), false]; + private _intensity = _unit getVariable [QGVAR(areaIntensity), 0]; + + if (_detectorSound) then { + switch true do { + case (_intensity > 0.9): { [QGVAR(playTone), [_unit, QGVAR(chemTone)], _unit] call CBA_fnc_targetEvent; }; + case (_intensity > 0.7): { [QGVAR(playTone), [_unit, QGVAR(chemRapidChime)], _unit] call CBA_fnc_targetEvent; }; + case (_intensity > 0.5): { [QGVAR(playTone), [_unit, QGVAR(chemFastChime)], _unit] call CBA_fnc_targetEvent; }; + case (_intensity > 0.3): { [QGVAR(playTone), [_unit, QGVAR(chemNormalChime)], _unit] call CBA_fnc_targetEvent; }; + case (_intensity > 0): { [QGVAR(playTone), [_unit, QGVAR(chemSlowChime)], _unit] call CBA_fnc_targetEvent; }; + default { [QGVAR(playTone), [_unit, QGVAR(chemBaseChime)], _unit] call CBA_fnc_targetEvent; }; + }; + }; +}, 5, [_unit]] call CBA_fnc_addPerFrameHandler; \ No newline at end of file diff --git a/addons/chemical/functions/fnc_handleRespawn.sqf b/addons/chemical/functions/fnc_handleRespawn.sqf index 5eb95a8a5..2f60a8c9b 100644 --- a/addons/chemical/functions/fnc_handleRespawn.sqf +++ b/addons/chemical/functions/fnc_handleRespawn.sqf @@ -25,9 +25,4 @@ params ["_unit"]; [_unit] call FUNC(fullHealLocal); -"kat_CHEM_DETECTOR" cutRsc ["RscWeaponChemicalDetector", "PLAIN", 1, false]; -private _ui = uiNamespace getVariable "RscWeaponChemicalDetector"; -private _obj = _ui displayCtrl 101; -_obj ctrlAnimateModel ["Threat_Level_Source", 0, true]; - -_unit setVariable [QGVAR(lastSoundTime), CBA_missionTime, true]; +_unit setVariable [QGVAR(detectorSound), false, true]; diff --git a/addons/chemical/functions/fnc_hasDetector.sqf b/addons/chemical/functions/fnc_hasDetector.sqf new file mode 100644 index 000000000..fb79a915e --- /dev/null +++ b/addons/chemical/functions/fnc_hasDetector.sqf @@ -0,0 +1,24 @@ +#include "..\script_component.hpp" +/* + * Author: DiGii + * + * Arguments: + * 0: Player + * 1: Target + * + * Return Value: + * Bool + * + * Example: + * [player, cursorTarget] call kat_chemical_fnc_hasGasmask; + * + * Public: No +*/ + +params ["_unit"]; + +if ("KAT_ChemicalDetector" in assignedItems _unit) exitWith { + true +}; + +false \ No newline at end of file diff --git a/addons/chemical/functions/fnc_init.sqf b/addons/chemical/functions/fnc_init.sqf index d38a0f3d7..1810233b1 100644 --- a/addons/chemical/functions/fnc_init.sqf +++ b/addons/chemical/functions/fnc_init.sqf @@ -19,4 +19,4 @@ if (!local _unit) exitWith {}; [_unit] call FUNC(fullHealLocal); -_unit setVariable [QGVAR(lastSoundTime), CBA_missionTime, true]; +_unit setVariable [QGVAR(detectorSound), false, true]; \ No newline at end of file diff --git a/addons/chemical/functions/fnc_showChemDetector.sqf b/addons/chemical/functions/fnc_showChemDetector.sqf index 7ca6cda6d..d7b5f1a34 100644 --- a/addons/chemical/functions/fnc_showChemDetector.sqf +++ b/addons/chemical/functions/fnc_showChemDetector.sqf @@ -2,7 +2,7 @@ /* * Author: Garth 'L-H' de Wet * Modified: Mazinski - * Displays the KWatch on screen. + * Displays the JCAD on screen. * * Arguments: * 0: unit @@ -11,7 +11,7 @@ * None * * Example: - * [player] call kat_watch_fnc_showKWatch + * [player] call kat_chemical_fnc_showChemDetector * * Public: Yes */ @@ -47,30 +47,21 @@ private _exposure = _display displayCtrl 18805; _pfhID call CBA_fnc_removePerFrameHandler; }; - private _hour = floor dayTime; - private _minute = floor ((dayTime - _hour) * 60); - - _time ctrlSetText (format ["%1:%2", [_hour, 2] call CBA_fnc_formatNumber, [_minute, 2] call CBA_fnc_formatNumber]); - private _intensity = _unit getVariable [QGVAR(areaIntensity), 0]; - _exposure ctrlSetText (_intensity toFixed 2); + if ((_unit getVariable [QGVAR(detectorEnabled), false])) then { - if (_intensity > 0) then { - private _lastSoundTime = _unit getVariable QGVAR(lastSoundTime); - _unit setVariable [QGVAR(areaIntensity), 0, true]; + private _hour = floor dayTime; + private _minute = floor ((dayTime - _hour) * 60); + + _time ctrlSetText (format ["%1:%2", [_hour, 2] call CBA_fnc_formatNumber, [_minute, 2] call CBA_fnc_formatNumber]); - if (isNil "_lastSoundTime") then { - TRACE_1("undefined lastSoundTime: setting to current time",_lastSoundTime); - _unit setVariable [QGVAR(lastSoundTime), CBA_missionTime]; - }; + _exposure ctrlSetText (_intensity toFixed 2); - if (CBA_missionTime - _lastSoundTime > 6) exitWith { - playSound3D [QPATHTOF(audio\chemDetector.ogg), _unit, false, getPosASL _unit, 4, 1, 10]; - _unit setVariable [QGVAR(lastSoundTime), CBA_missionTime]; - }; + _unit setVariable [QGVAR(areaIntensity), _intensity, true]; } else { - _unit setVariable [QGVAR(areaIntensity), 0, true]; + _time ctrlSetText (LLSTRING(ChemicalDetector_Off)); + _exposure ctrlSetText ("-.--"); }; }, 1, [ diff --git a/addons/chemical/stringtable.xml b/addons/chemical/stringtable.xml index d7e140fea..2acab5c11 100644 --- a/addons/chemical/stringtable.xml +++ b/addons/chemical/stringtable.xml @@ -193,6 +193,9 @@ Utilisé pour détecter les produits chimiques toxiques KAT KAT毒性化学物質の検出に使用 + + OFF + Put on gas mask Poner mascara de gas @@ -797,6 +800,18 @@ ガスマスクを外す Enlever le masque à gaz + + JCAD + + + Turn On Detector + + + Enable Warning Tone + + + Disable Warning Tone + Drop Weapon Chance