mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Medical Feedback - Change pain scream frequency based on intensity (#7238)
* Add setting for pain scream frequency * Apply suggestions from code review Co-Authored-By: mharis001 <34453221+mharis001@users.noreply.github.com> * remove setting * Update stringtable.xml * Update script_component.hpp
This commit is contained in:
parent
3d64b87a13
commit
654feca3a1
@ -1,12 +0,0 @@
|
|||||||
class ACE_Settings {
|
|
||||||
/*
|
|
||||||
// Not currently used anywhere
|
|
||||||
class GVAR(enableScreams) {
|
|
||||||
category = ECSTRING(medical,Category_Medical);
|
|
||||||
displayName = CSTRING(enableScreams_DisplayName);
|
|
||||||
description = CSTRING(enableScreams_Description);
|
|
||||||
typeName = "BOOL";
|
|
||||||
value = 1;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
};
|
|
@ -14,7 +14,6 @@ class CfgPatches {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// #include "ACE_Settings.hpp" // ToDo: setting not used
|
|
||||||
#include "CfgEventHandlers.hpp"
|
#include "CfgEventHandlers.hpp"
|
||||||
#include "CfgInGameUI.hpp"
|
#include "CfgInGameUI.hpp"
|
||||||
#include "CfgSounds.hpp"
|
#include "CfgSounds.hpp"
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#define TIME_OUT_HIT 1
|
#define TIME_OUT_HIT 1
|
||||||
#define TIME_OUT_MOAN 5
|
#define TIME_OUT_MOAN [12, 7.5, 5]
|
||||||
|
|
||||||
params [["_unit", objNull, [objNull]], ["_type", "hit", [""]], ["_severity", 0, [0]]];
|
params [["_unit", objNull, [objNull]], ["_type", "hit", [""]], ["_severity", 0, [0]]];
|
||||||
// TRACE_3("",_unit,_type,_severity);
|
// TRACE_3("",_unit,_type,_severity);
|
||||||
@ -29,8 +29,8 @@ if (!local _unit) exitWith {
|
|||||||
if !(_unit call EFUNC(common,isAwake)) exitWith {};
|
if !(_unit call EFUNC(common,isAwake)) exitWith {};
|
||||||
|
|
||||||
// Handle timeout
|
// Handle timeout
|
||||||
private _timeOut = [TIME_OUT_HIT, TIME_OUT_MOAN] select (_type == "moan");
|
|
||||||
if (_unit getVariable [QGVAR(soundTimeout) + _type, -1] > CBA_missionTime) exitWith {};
|
if (_unit getVariable [QGVAR(soundTimeout) + _type, -1] > CBA_missionTime) exitWith {};
|
||||||
|
private _timeOut = if (_type == "moan") then { TIME_OUT_MOAN # _severity } else { TIME_OUT_HIT };
|
||||||
_unit setVariable [QGVAR(soundTimeout) + _type, CBA_missionTime + _timeOut];
|
_unit setVariable [QGVAR(soundTimeout) + _type, CBA_missionTime + _timeOut];
|
||||||
|
|
||||||
// Get units speaker
|
// Get units speaker
|
||||||
|
@ -21,9 +21,9 @@ params ["_unit"];
|
|||||||
if (!alive _unit) exitWith {};
|
if (!alive _unit) exitWith {};
|
||||||
if (!local _unit) exitWith {};
|
if (!local _unit) exitWith {};
|
||||||
|
|
||||||
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
if ([_unit] call EFUNC(medical_vitals,handleUnitVitals)) then { // returns true when update ran
|
||||||
|
private _painLevel = GET_PAIN_PERCEIVED(_unit);
|
||||||
private _painLevel = GET_PAIN_PERCEIVED(_unit);
|
if (_painLevel > 0) then {
|
||||||
if (_painLevel > 0) then {
|
[QEGVAR(medical,moan), [_unit, _painLevel]] call CBA_fnc_localEvent;
|
||||||
[QEGVAR(medical,moan), [_unit, _painLevel]] call CBA_fnc_localEvent;
|
};
|
||||||
};
|
};
|
||||||
|
@ -21,9 +21,9 @@ params ["_unit"];
|
|||||||
if (!alive _unit) exitWith {};
|
if (!alive _unit) exitWith {};
|
||||||
if (!local _unit) exitWith {};
|
if (!local _unit) exitWith {};
|
||||||
|
|
||||||
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
if ([_unit] call EFUNC(medical_vitals,handleUnitVitals)) then { // returns true when update ran
|
||||||
|
private _painLevel = GET_PAIN_PERCEIVED(_unit);
|
||||||
private _painLevel = GET_PAIN_PERCEIVED(_unit);
|
if (_painLevel > 0) then {
|
||||||
if (_painLevel > 0) then {
|
[QEGVAR(medical,moan), [_unit, _painLevel]] call CBA_fnc_localEvent;
|
||||||
[QEGVAR(medical,moan), [_unit, _painLevel]] call CBA_fnc_localEvent;
|
};
|
||||||
};
|
};
|
||||||
|
@ -22,11 +22,6 @@ if (!alive _unit || {!local _unit}) exitWith {};
|
|||||||
|
|
||||||
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
[_unit] call EFUNC(medical_vitals,handleUnitVitals);
|
||||||
|
|
||||||
private _painLevel = GET_PAIN_PERCEIVED(_unit);
|
|
||||||
if (_painLevel > 0) then {
|
|
||||||
[QEGVAR(medical,moan), [_unit, _painLevel]] call CBA_fnc_localEvent;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Handle spontaneous wake up from unconsciousness
|
// Handle spontaneous wake up from unconsciousness
|
||||||
if (EGVAR(medical,spontaneousWakeUpChance) > 0) then {
|
if (EGVAR(medical,spontaneousWakeUpChance) > 0) then {
|
||||||
if (_unit call EFUNC(medical_status,hasStableVitals)) then {
|
if (_unit call EFUNC(medical_status,hasStableVitals)) then {
|
||||||
|
@ -7,20 +7,19 @@
|
|||||||
* 0: The Unit <OBJECT>
|
* 0: The Unit <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* Update Ran (at least 1 second between runs) <BOOL>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [player] call ace_medical_vitals_fnc_handleUnitVitals
|
* [player] call ace_medical_vitals_fnc_handleUnitVitals
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
// #define DEBUG_MODE_FULL
|
|
||||||
|
|
||||||
params ["_unit"];
|
params ["_unit"];
|
||||||
|
|
||||||
private _lastTimeUpdated = _unit getVariable [QGVAR(lastTimeUpdated), 0];
|
private _lastTimeUpdated = _unit getVariable [QGVAR(lastTimeUpdated), 0];
|
||||||
private _deltaT = (CBA_missionTime - _lastTimeUpdated) min 10;
|
private _deltaT = (CBA_missionTime - _lastTimeUpdated) min 10;
|
||||||
if (_deltaT < 1) exitWith {}; // state machines could be calling this very rapidly depending on number of local units
|
if (_deltaT < 1) exitWith { false }; // state machines could be calling this very rapidly depending on number of local units
|
||||||
|
|
||||||
BEGIN_COUNTER(Vitals);
|
BEGIN_COUNTER(Vitals);
|
||||||
|
|
||||||
@ -165,3 +164,5 @@ if (!isPlayer _unit) then {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
END_COUNTER(Vitals);
|
END_COUNTER(Vitals);
|
||||||
|
|
||||||
|
true
|
||||||
|
Loading…
Reference in New Issue
Block a user