2016-12-01 19:54:03 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2018-07-18 20:50:03 +00:00
|
|
|
[QEGVAR(medical,injured), {
|
2018-07-18 18:21:27 +00:00
|
|
|
params ["_unit", "_painLevel"];
|
|
|
|
[_unit, "hit", PAIN_TO_SCREAM(_painLevel)] call FUNC(playInjuredSound);
|
2019-10-11 20:00:53 +00:00
|
|
|
|
|
|
|
if (hasInterface && {_unit == ace_player}) then {
|
|
|
|
[true] call FUNC(handleEffects);
|
|
|
|
};
|
2018-07-18 18:21:27 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2018-07-18 20:50:03 +00:00
|
|
|
[QEGVAR(medical,moan), {
|
2018-07-18 18:21:27 +00:00
|
|
|
params ["_unit", "_painLevel"];
|
|
|
|
[_unit, "moan", PAIN_TO_MOAN(_painLevel)] call FUNC(playInjuredSound);
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2019-10-11 20:00:53 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2019-06-22 21:47:35 +00:00
|
|
|
[QEGVAR(medical,fracture), {
|
|
|
|
params ["_unit"];
|
|
|
|
if (_unit == ACE_player) then {
|
|
|
|
playSound SND_FRACTURE;
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2017-03-18 16:53:57 +00:00
|
|
|
GVAR(nextFadeIn) = 0;
|
2017-02-19 04:11:40 +00:00
|
|
|
GVAR(heartBeatEffectRunning) = false;
|
2019-10-11 20:00:53 +00:00
|
|
|
GVAR(lastHeartBeatSound) = 0;
|
|
|
|
GVAR(bloodTickCounter) = 0;
|
2017-02-19 04:11:40 +00:00
|
|
|
|
|
|
|
[false] call FUNC(initEffects);
|
2019-10-11 20:00:53 +00:00
|
|
|
[true] call FUNC(handleEffects);
|
|
|
|
[FUNC(handleEffects), 1, false] call CBA_fnc_addPerFrameHandler;
|
2016-12-09 18:16:41 +00:00
|
|
|
|
|
|
|
["ace_unconscious", {
|
|
|
|
params ["_unit", "_unconscious"];
|
2018-07-18 18:13:25 +00:00
|
|
|
|
2016-12-09 18:16:41 +00:00
|
|
|
if (_unit != ACE_player) exitWith {};
|
2019-08-06 13:10:33 +00:00
|
|
|
TRACE_1("player unconscious eh",_unconscious);
|
2016-12-09 18:16:41 +00:00
|
|
|
|
2019-05-20 20:12:18 +00:00
|
|
|
if (_unconscious && {cameraView == "GUNNER"} && {(vehicle _unit) != _unit} && {cameraOn == vehicle _unit}) then {
|
|
|
|
TRACE_2("exiting gunner view",cameraOn,cameraView);
|
|
|
|
ACE_player switchCamera "INTERNAL";
|
|
|
|
};
|
|
|
|
|
2020-02-22 20:24:47 +00:00
|
|
|
[!_unconscious, _unit] call EFUNC(common,setVolume);
|
2019-10-11 20:00:53 +00:00
|
|
|
|
2018-07-20 21:23:48 +00:00
|
|
|
// Greatly reduce player's hearing ability while unconscious (affects radio addons)
|
2020-06-13 20:55:59 +00:00
|
|
|
private _volume = missionNamespace getVariable [QEGVAR(hearing,unconsciousnessVolume), VOL_UNCONSCIOUS];
|
|
|
|
[QUOTE(ADDON), _volume, _unconscious] call EFUNC(common,setHearingCapability);
|
2018-07-20 21:23:48 +00:00
|
|
|
|
2021-03-08 23:14:19 +00:00
|
|
|
[_unconscious, 1] call FUNC(effectUnconscious);
|
2019-10-11 20:00:53 +00:00
|
|
|
[true] call FUNC(handleEffects);
|
2017-01-29 19:24:16 +00:00
|
|
|
["unconscious", _unconscious] call EFUNC(common,setDisableUserInputStatus);
|
2016-12-09 18:16:41 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
2017-04-30 06:46:51 +00:00
|
|
|
|
2018-07-20 21:23:48 +00:00
|
|
|
// Reset volume upon death for spectators
|
|
|
|
[QEGVAR(medical,death), {
|
|
|
|
params ["_unit"];
|
|
|
|
|
|
|
|
if (_unit != ACE_player) exitWith {};
|
2020-02-22 20:24:47 +00:00
|
|
|
// Players always able to hear for any systems that might run while dead (e.g. spectator)
|
|
|
|
[true, _unit] call EFUNC(common,setVolume);
|
|
|
|
|
2018-07-20 21:23:48 +00:00
|
|
|
[QUOTE(ADDON), 1, false] call EFUNC(common,setHearingCapability);
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
|
|
|
// Update effects to match new unit's current status (this also handles respawn)
|
2017-04-30 06:46:51 +00:00
|
|
|
["unit", {
|
2019-04-09 17:51:59 +00:00
|
|
|
params ["_new"];
|
2019-05-12 04:13:59 +00:00
|
|
|
private _status = IS_UNCONSCIOUS(_new);
|
2018-07-20 21:23:48 +00:00
|
|
|
|
2020-02-22 20:24:47 +00:00
|
|
|
[!_status, _new] call EFUNC(common,setVolume);
|
|
|
|
|
2020-06-13 20:55:59 +00:00
|
|
|
private _volume = missionNamespace getVariable [QEGVAR(hearing,unconsciousnessVolume), VOL_UNCONSCIOUS];
|
|
|
|
[QUOTE(ADDON), _volume, _status] call EFUNC(common,setHearingCapability);
|
2019-10-11 20:00:53 +00:00
|
|
|
[true] call FUNC(handleEffects);
|
2017-04-30 06:46:51 +00:00
|
|
|
["unconscious", _status] call EFUNC(common,setDisableUserInputStatus);
|
|
|
|
}] call CBA_fnc_addPlayerEventHandler;
|
2019-04-27 19:04:31 +00:00
|
|
|
|
2021-10-10 14:24:10 +00:00
|
|
|
// Update effects for featureCamera (curator, arsenal, etc)
|
|
|
|
["featureCamera", {
|
|
|
|
params ["_unit", "_newCamera"];
|
|
|
|
|
|
|
|
[true] call FUNC(handleEffects);
|
|
|
|
|
|
|
|
private _volume = missionNamespace getVariable [QEGVAR(hearing,unconsciousnessVolume), VOL_UNCONSCIOUS];
|
|
|
|
|
|
|
|
if (_newCamera == "") then { // switched back to player view
|
|
|
|
private _status = IS_UNCONSCIOUS(_unit);
|
|
|
|
[!_status, _unit] call EFUNC(common,setVolume);
|
|
|
|
[QUOTE(ADDON), _volume, _status] call EFUNC(common,setHearingCapability);
|
|
|
|
["unconscious", _status] call EFUNC(common,setDisableUserInputStatus);
|
|
|
|
} else { // camera view
|
|
|
|
[true, _unit] call EFUNC(common,setVolume);
|
|
|
|
[QUOTE(ADDON), 1, false] call EFUNC(common,setHearingCapability);
|
2021-11-02 20:24:40 +00:00
|
|
|
["unconscious", false] call EFUNC(common,setDisableUserInputStatus);
|
2021-10-10 14:24:10 +00:00
|
|
|
};
|
|
|
|
}] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
|
2019-10-11 20:00:53 +00:00
|
|
|
// Forced say3D
|
|
|
|
[QGVAR(forceSay3D), {
|
|
|
|
params ["_unit", "_sound", "_distance"];
|
|
|
|
|
|
|
|
if (ACE_player distance _unit > _distance) exitWith {};
|
|
|
|
|
2024-03-26 12:54:06 +00:00
|
|
|
if (isNull objectParent _unit) then {
|
2019-10-11 20:00:53 +00:00
|
|
|
// say3D waits for the previous sound to finish, so use a dummy instead
|
|
|
|
private _dummy = "#dynamicsound" createVehicleLocal [0, 0, 0];
|
|
|
|
_dummy attachTo [_unit, [0, 0, 0], "camera"];
|
|
|
|
_dummy say3D [_sound, _distance, 1, false];
|
|
|
|
|
|
|
|
[{
|
|
|
|
detach _this;
|
|
|
|
deleteVehicle _this;
|
|
|
|
}, _dummy, 5] call CBA_fnc_waitAndExecute;
|
|
|
|
} else {
|
|
|
|
// Fallback: attachTo doesn't work within vehicles
|
|
|
|
_unit say3D [_sound, _distance, 1, false];
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
2019-04-27 19:04:31 +00:00
|
|
|
|
|
|
|
// Kill vanilla bleeding feedback effects.
|
|
|
|
#ifdef DISABLE_VANILLA_DAMAGE_EFFECTS
|
|
|
|
TRACE_1("disabling vanilla bleeding feedback effects",_this);
|
|
|
|
[{
|
|
|
|
{isNil _x} count [
|
|
|
|
"BIS_fnc_feedback_damageCC",
|
|
|
|
"BIS_fnc_feedback_damageRadialBlur",
|
|
|
|
"BIS_fnc_feedback_damageBlur"
|
|
|
|
] == 0
|
|
|
|
}, {
|
|
|
|
{
|
|
|
|
ppEffectDestroy _x;
|
|
|
|
} forEach [
|
|
|
|
BIS_fnc_feedback_damageCC,
|
|
|
|
BIS_fnc_feedback_damageRadialBlur,
|
|
|
|
BIS_fnc_feedback_damageBlur
|
|
|
|
];
|
|
|
|
}] call CBA_fnc_waitUntilAndExecute;
|
|
|
|
#endif
|