diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index b242f24486..c2b32b84fa 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -90,19 +90,12 @@ class ACE_Settings { typeName = "BOOL"; value = 1; }; - class GVAR(preventInstaDeath) { - category = CSTRING(Category_Medical); - displayName = CSTRING(MedicalSettings_preventInstaDeath_DisplayName); - description = CSTRING(MedicalSettings_preventInstaDeath_Description); - typeName = "BOOL"; - value = 0; - }; class GVAR(enableRevive) { category = CSTRING(Category_Medical); displayName = CSTRING(ReviveSettings_enableRevive_DisplayName); description = CSTRING(ReviveSettings_enableRevive_Description); typeName = "SCALAR"; - value = 0; + value = 2; values[] = {"Disabled", "Players only", "Players and AI"}; }; class GVAR(maxReviveTime) { @@ -203,13 +196,6 @@ class ACE_Settings { typeName = "SCALAR"; value = 0.9; }; - class GVAR(painIsOnlySuppressed) { - category = CSTRING(Category_Medical); - displayName = CSTRING(AdvancedMedicalSettings_painIsOnlySuppressed_DisplayName); - description = CSTRING(AdvancedMedicalSettings_painIsOnlySuppressed_Description); - typeName = "BOOL"; - value = 1; - }; class GVAR(painEffectType) { category = CSTRING(Category_Medical); displayName = CSTRING(painEffectType); diff --git a/addons/medical/XEH_PREP.hpp b/addons/medical/XEH_PREP.hpp index 519a96585c..840ce3d47e 100644 --- a/addons/medical/XEH_PREP.hpp +++ b/addons/medical/XEH_PREP.hpp @@ -13,6 +13,7 @@ PREP(getBloodPressure); PREP(getBloodVolumeChange); PREP(getCardiacOutput); PREP(getHeartRateChange); +PREP(getPainLevel); PREP(handleIncapacitation); PREP(handleKilled); PREP(handleLocal); diff --git a/addons/medical/functions/fnc_getHeartRateChange.sqf b/addons/medical/functions/fnc_getHeartRateChange.sqf index 3ccccc2671..49b11d91c8 100644 --- a/addons/medical/functions/fnc_getHeartRateChange.sqf +++ b/addons/medical/functions/fnc_getHeartRateChange.sqf @@ -18,59 +18,55 @@ params ["_unit", "_deltaT"]; private _hrIncrease = 0; -if (!(_unit getVariable [QGVAR(inCardiacArrest),false])) then { - private _hrTargetAdjustment = 0; - private _adjustment = _unit getVariable [QGVAR(heartRateAdjustments), []]; - { - _x params ["_value", "_timeTillMaxEffect", "_maxTimeInSystem", "_timeInSystem", "_callBack"]; - if (abs _value > 0 && {_maxTimeInSystem > 0}) then { - if (_timeInSystem >= _maxTimeInSystem) then { - _adjustment set [_forEachIndex, ObjNull]; - [_unit] call _callBack; - } else { - _timeInSystem = _timeInSystem + _deltaT; - private _effectRatio = (_timeInSystem / (1 max _timeTillMaxEffect)) min 1; - _hrTargetAdjustment = _value * _effectRatio * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem; - _x set [3, _timeInSystem]; - }; +private _hrTargetAdjustment = 0; +private _adjustment = _unit getVariable [QGVAR(heartRateAdjustments), []]; +{ + _x params ["_value", "_timeTillMaxEffect", "_maxTimeInSystem", "_timeInSystem", "_callBack"]; + if (abs _value > 0 && {_maxTimeInSystem > 0}) then { + if (_timeInSystem >= _maxTimeInSystem) then { + _adjustment set [_forEachIndex, ObjNull]; + [_unit] call _callBack; } else { - _adjustment set [_forEachIndex, ObjNull]; - [_unit] call _callBack; + _timeInSystem = _timeInSystem + _deltaT; + private _effectRatio = ((_timeInSystem / (1 max _timeTillMaxEffect)) ^ 2) min 1; + _hrTargetAdjustment = _hrTargetAdjustment + _value * _effectRatio * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem; + _x set [3, _timeInSystem]; }; - } forEach _adjustment; + } else { + _adjustment set [_forEachIndex, ObjNull]; + [_unit] call _callBack; + }; +} forEach _adjustment; - _adjustment = _adjustment - [ObjNull]; - _unit setVariable [QGVAR(heartRateAdjustments), _adjustment]; - - if (!(_unit getVariable [QGVAR(inCardiacArrest), false])) then { - private _heartRate = (_unit getVariable [QGVAR(heartRate), 80]); - private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]; - if (_bloodVolume > BLOOD_VOLUME_CLASS_4_HEMORRHAGE) then { - private _hrChange = 0; - ([_unit] call FUNC(getBloodPressure)) params ["_bloodPressureL", "_bloodPressureH"]; - private _meanBP = (2/3) * _bloodPressureH + (1/3) * _bloodPressureL; - private _pain = _unit getVariable [QGVAR(pain), 0]; - private _hasPain = _unit getVariable [QGVAR(hasPain), false]; - private _targetBP = 107; - private _targetHR = 80; - if (_bloodVolume < BLOOD_VOLUME_CLASS_3_HEMORRHAGE) then { - _targetBP = _targetBP * (_bloodVolume / DEFAULT_BLOOD_VOLUME); - }; - if (_hasPain && {_pain > 0.2}) then { - _targetHR = _targetHR + 50 * _pain; - }; - _targetHR = _targetHR + _hrTargetAdjustment; - _hrChange = round(_targetHR - _heartRate) / 2; - if ((_meanBP > _targetBP && {_heartRate > _targetHR}) || {_bloodVolume < BLOOD_VOLUME_CLASS_2_HEMORRHAGE && {_heartRate < 200}}) then { - _hrChange = 2 * round(_targetBP - _meanBP); - if (_hrChange < 0) then { - _hrChange = _hrChange / 20; - }; - }; - _hrIncrease = _hrIncrease + _hrChange; - } else { - _hrIncrease = _hrIncrease - (random 5) * round(_heartRate / 10); +_adjustment = _adjustment - [ObjNull]; +_unit setVariable [QGVAR(heartRateAdjustments), _adjustment]; + +if (!(_unit getVariable [QGVAR(inCardiacArrest), false])) then { + private _heartRate = (_unit getVariable [QGVAR(heartRate), 80]); + private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]; + if (_bloodVolume > BLOOD_VOLUME_CLASS_4_HEMORRHAGE) then { + private _hrChange = 0; + ([_unit] call FUNC(getBloodPressure)) params ["_bloodPressureL", "_bloodPressureH"]; + private _meanBP = (2/3) * _bloodPressureH + (1/3) * _bloodPressureL; + private _painLevel = [_unit] call FUNC(getPainLevel); + private _targetBP = 107; + private _targetHR = 80; + if (_bloodVolume < BLOOD_VOLUME_CLASS_3_HEMORRHAGE) then { + _targetBP = _targetBP * (_bloodVolume / DEFAULT_BLOOD_VOLUME); }; + if (_bloodVolume < BLOOD_VOLUME_CLASS_2_HEMORRHAGE) then { + _targetHR = _heartRate * (_targetBP / (45 max _meanBP)); + }; + if (_painLevel > 0.2) then { + _targetHR = _targetHR max (80 + 50 * _painLevel); + }; + _hrChange = round(_targetHR - _heartRate) / 2; + if (_hrChange < 0) then { + _hrChange = _hrChange / 20; + }; + _hrIncrease = _hrIncrease + _hrChange; + } else { + _hrIncrease = _hrIncrease - round(_heartRate / 10); }; }; diff --git a/addons/medical/functions/fnc_getPainLevel.sqf b/addons/medical/functions/fnc_getPainLevel.sqf new file mode 100644 index 0000000000..38eb9cbf90 --- /dev/null +++ b/addons/medical/functions/fnc_getPainLevel.sqf @@ -0,0 +1,20 @@ +/* + * Author: Ruthberg + * Get the total pain level of a unit. + * + * Arguments: + * 0: The Unit + * + * ReturnValue: + * Pain level (0 .. 1) + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; + +private _pain = _unit getVariable [QGVAR(pain), 0]; +private _painSuppress = _unit getVariable [QGVAR(painSuppress), 0]; + +(0 max (_pain - _painSuppress) min 1) diff --git a/addons/medical/functions/fnc_handleIncapacitation.sqf b/addons/medical/functions/fnc_handleIncapacitation.sqf index 494afbd74e..f4d136a5ec 100644 --- a/addons/medical/functions/fnc_handleIncapacitation.sqf +++ b/addons/medical/functions/fnc_handleIncapacitation.sqf @@ -14,7 +14,7 @@ params ["_unit"]; -private _pain = _unit getVariable [QGVAR(pain), 0]; +private _painLevel = [_unit] call FUNC(getPainLevel); private _headDamage = 0; private _bodyDamage = 0; @@ -40,6 +40,6 @@ if (_bodyDamage > 1.05) then { [QGVAR(CriticalInjury), _unit] call CBA_fnc_localEvent; }; -if ((_pain >= PAIN_UNCONSCIOUS) && {random 1 < 0.1}) then { +if ((_painLevel >= PAIN_UNCONSCIOUS) && {random 1 < 0.1}) then { [QGVAR(CriticalInjury), _unit] call CBA_fnc_localEvent; }; diff --git a/addons/medical/functions/fnc_handleKilled.sqf b/addons/medical/functions/fnc_handleKilled.sqf index a88f28a764..3e04ae7582 100644 --- a/addons/medical/functions/fnc_handleKilled.sqf +++ b/addons/medical/functions/fnc_handleKilled.sqf @@ -14,9 +14,9 @@ #include "script_component.hpp" params ["_unit"]; + if (!local _unit) exitWith {}; -_unit setVariable [QGVAR(pain), 0]; -_unit setVariable [QGVAR(heartRate), 0]; -_unit setVariable [QGVAR(bloodPressure), [0, 0]]; -_unit setVariable [QGVAR(airwayStatus), 0]; \ No newline at end of file +_unit setVariable [QGVAR(pain), 0, true]; +_unit setVariable [QGVAR(heartRate), 0, true]; +_unit setVariable [QGVAR(bloodPressure), [0, 0], true]; diff --git a/addons/medical/functions/fnc_handleStateDefault.sqf b/addons/medical/functions/fnc_handleStateDefault.sqf index 35ad6f62ce..be4c4f9d79 100644 --- a/addons/medical/functions/fnc_handleStateDefault.sqf +++ b/addons/medical/functions/fnc_handleStateDefault.sqf @@ -15,7 +15,7 @@ if (!local _unit) exitWith { [_unit] call FUNC(handleUnitVitals); -private _pain = _unit getVariable [QGVAR(pain), 0]; -if (_pain > (_unit getVariable [QGVAR(painSuppress), 0])) then { - [_unit, "moan", PAIN_TO_MOAN(_pain)] call EFUNC(medical_engine,playInjuredSound); +private _painLevel = [_unit] call FUNC(getPainLevel); +if (_painLevel > 0) then { + [_unit, "moan", PAIN_TO_MOAN(_painLevel)] call EFUNC(medical_engine,playInjuredSound); }; diff --git a/addons/medical/functions/fnc_handleStateInjured.sqf b/addons/medical/functions/fnc_handleStateInjured.sqf index 35ad6f62ce..be4c4f9d79 100644 --- a/addons/medical/functions/fnc_handleStateInjured.sqf +++ b/addons/medical/functions/fnc_handleStateInjured.sqf @@ -15,7 +15,7 @@ if (!local _unit) exitWith { [_unit] call FUNC(handleUnitVitals); -private _pain = _unit getVariable [QGVAR(pain), 0]; -if (_pain > (_unit getVariable [QGVAR(painSuppress), 0])) then { - [_unit, "moan", PAIN_TO_MOAN(_pain)] call EFUNC(medical_engine,playInjuredSound); +private _painLevel = [_unit] call FUNC(getPainLevel); +if (_painLevel > 0) then { + [_unit, "moan", PAIN_TO_MOAN(_painLevel)] call EFUNC(medical_engine,playInjuredSound); }; diff --git a/addons/medical/functions/fnc_handleStateUnconscious.sqf b/addons/medical/functions/fnc_handleStateUnconscious.sqf index 35ad6f62ce..be4c4f9d79 100644 --- a/addons/medical/functions/fnc_handleStateUnconscious.sqf +++ b/addons/medical/functions/fnc_handleStateUnconscious.sqf @@ -15,7 +15,7 @@ if (!local _unit) exitWith { [_unit] call FUNC(handleUnitVitals); -private _pain = _unit getVariable [QGVAR(pain), 0]; -if (_pain > (_unit getVariable [QGVAR(painSuppress), 0])) then { - [_unit, "moan", PAIN_TO_MOAN(_pain)] call EFUNC(medical_engine,playInjuredSound); +private _painLevel = [_unit] call FUNC(getPainLevel); +if (_painLevel > 0) then { + [_unit, "moan", PAIN_TO_MOAN(_painLevel)] call EFUNC(medical_engine,playInjuredSound); }; diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index 7775020ff3..ed8af49a56 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -69,9 +69,9 @@ if (_bloodLoss > 0) then { }; }; -private _painStatus = _unit getVariable [QGVAR(pain), 0]; -TRACE_4("ACE_DEBUG",_painStatus,_unit getVariable QGVAR(hasPain),_unit getVariable QGVAR(painSuppress),_unit); -if (_painStatus > (_unit getVariable [QGVAR(painSuppress), 0])) then { +private _painLevel = [_unit] call FUNC(getPainLevel); +TRACE_4("ACE_DEBUG",_painLevel,_unit getVariable QGVAR(hasPain),_unit getVariable QGVAR(painSuppress),_unit); +if (_painLevel > 0) then { if !(_unit getVariable [QGVAR(hasPain), false]) then { _unit setVariable [QGVAR(hasPain), true, true]; }; @@ -81,12 +81,13 @@ if (_painStatus > (_unit getVariable [QGVAR(painSuppress), 0])) then { }; }; -TRACE_6("ACE_DEBUG_ADVANCED_VITALS",_painStatus,_bloodVolume,_unit getVariable QGVAR(hasPain),_unit getVariable QGVAR(morphine),_syncValues,_unit); +TRACE_6("ACE_DEBUG_ADVANCED_VITALS",_painLevel,_bloodVolume,_unit getVariable QGVAR(hasPain),_unit getVariable QGVAR(morphine),_syncValues,_unit); +private _pain = _unit getVariable [QGVAR(pain), 0]; // Handle pain due tourniquets, that have been applied more than 120 s ago private _oldTourniquets = (_unit getVariable [QGVAR(tourniquets), []]) select {_x > 0 && {CBA_missionTime - _x > 120}}; // Increase pain at a rate of 0.001 units/s per old tourniquet -_painStatus = _painStatus + (count _oldTourniquets) * 0.001 * _deltaT; +_pain = _pain + (count _oldTourniquets) * 0.001 * _deltaT; private _heartRate = (_unit getVariable [QGVAR(heartRate), 80]) + ([_unit, _deltaT] call FUNC(getHeartRateChange)); _unit setVariable [QGVAR(heartRate), 0 max _heartRate, _syncValues]; @@ -101,17 +102,16 @@ if (_bloodLoss > BLOOD_LOSS_KNOCK_OUT_THRESHOLD * _cardiacOutput) then { #ifdef DEBUG_MODE_FULL if (!isPlayer _unit) then { - private _cardiacArrest = _unit getVariable [QGVAR(inCardiacArrest), false]; - hintSilent format["blood volume: %1, blood loss: [%2, %3]\nhr: %4, bp: %5, pain: %6", round(_bloodVolume * 100) / 100, round(_bloodLoss * 1000) / 1000, round((_bloodLoss / _cardiacOutput) * 100) / 100, round(_heartRate), _bloodPressure, round(_painStatus * 100) / 100]; + hintSilent format["blood volume: %1, blood loss: [%2, %3]\nhr: %4, bp: %5, pain: %6", round(_bloodVolume * 100) / 100, round(_bloodLoss * 1000) / 1000, round((_bloodLoss / (1 max _cardiacOutput)) * 100) / 100, round(_heartRate), _bloodPressure, round(_painLevel * 100) / 100]; }; #endif -_unit setVariable [QGVAR(pain), 0 max (_painStatus - _deltaT * PAIN_REDUCTION_SPEED), _syncValues]; +_unit setVariable [QGVAR(pain), 0 max (_pain - _deltaT * PAIN_REDUCTION_SPEED), _syncValues]; -TRACE_8("ACE_DEBUG_ADVANCED_VITALS",_painStatus,PAIN_REDUCTION_SPEED,_heartRate,_bloodVolume,_bloodPressure,_deltaT,_syncValues,_unit); +TRACE_8("ACE_DEBUG_ADVANCED_VITALS",_pain,PAIN_REDUCTION_SPEED,_heartRate,_bloodVolume,_bloodPressure,_deltaT,_syncValues,_unit); _bloodPressure params ["_bloodPressureL", "_bloodPressureH"]; -if (_bloodPressureL < 40) then { +if (_bloodPressureL < 40 || {_heartRate < 30}) then { [QGVAR(CriticalVitals), _unit] call CBA_fnc_localEvent; }; if ((_heartRate < 20) || {_heartRate > 220} || {_bloodPressureH < 50}) then { diff --git a/addons/medical/functions/fnc_hasStableVitals.sqf b/addons/medical/functions/fnc_hasStableVitals.sqf index 4afe07faad..83ae9a5de2 100644 --- a/addons/medical/functions/fnc_hasStableVitals.sqf +++ b/addons/medical/functions/fnc_hasStableVitals.sqf @@ -26,7 +26,7 @@ private _bloodPressure = [_unit] call FUNC(getBloodPressure); _bloodPressure params ["_bloodPressureL", "_bloodPressureH"]; if (_bloodPressureL < 50 || {_bloodPressureH < 60}) exitWith { false }; -private _heartRate = (_unit getVariable [QGVAR(heartRate), 80]); +private _heartRate = _unit getVariable [QGVAR(heartRate), 80]; if (_heartRate < 40) exitWith { false }; true diff --git a/addons/medical/functions/fnc_leftStateCardiacArrest.sqf b/addons/medical/functions/fnc_leftStateCardiacArrest.sqf index 8ec63de5d9..fa4c41387a 100644 --- a/addons/medical/functions/fnc_leftStateCardiacArrest.sqf +++ b/addons/medical/functions/fnc_leftStateCardiacArrest.sqf @@ -11,6 +11,10 @@ * Public: No */ #include "script_component.hpp" + params ["_unit"]; +_unit setVariable [QGVAR(inCardiacArrest), false, true]; _unit setVariable [QGVAR(cardiacArrestStart), nil]; +_unit setVariable [QGVAR(heartRate), 40, true]; +_unit setVariable [QGVAR(lastTimeUpdated), CBA_missionTime]; diff --git a/addons/medical/functions/fnc_setCardiacArrest.sqf b/addons/medical/functions/fnc_setCardiacArrest.sqf index 6f11a0c388..0fae5a65aa 100644 --- a/addons/medical/functions/fnc_setCardiacArrest.sqf +++ b/addons/medical/functions/fnc_setCardiacArrest.sqf @@ -17,6 +17,7 @@ params ["_unit"]; if (_unit getVariable [QGVAR(inCardiacArrest), false]) exitWith {}; + _unit setVariable [QGVAR(inCardiacArrest), true, true]; _unit setVariable [QGVAR(heartRate), 0, true]; diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index cf32c1a085..a4b4ed8f5d 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -36,10 +36,6 @@ if (_knockOut isEqualTo (_unit getVariable [QGVAR(isUnconscious), false])) exitW if !(_knockOut) exitWith { _unit setVariable [QGVAR(isUnconscious), false, true]; - if (_unit getVariable [QGVAR(inReviveState), false]) then { - _unit setVariable [QGVAR(inReviveState), nil, true]; - }; - [_unit, false] call EFUNC(medical_engine,setUnconsciousAnim); ["ace_unconscious", [_unit, false]] call CBA_fnc_globalEvent; diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 1d001f1c5f..11fecf22ec 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -2463,19 +2463,6 @@ Heilt vollständig bandagierte Trefferpunkte 包帯は体力を完全に回復する - - Pain is only temporarily suppressed - Schmerzen werden nur vorübergehend unterdrückt - Ból jest tymczasowo zwalczany - Bolest je potlačena pouze dočasně - El dolor se suprime solo temporalmente - Dor é suprimida somente temporáriamente - La douleur est seulement supprimée temporairement - A fájdalom csak ideiglenesen csökken - Боль приглушается только временно - Dolore è soppresso solo temporaneamente - 痛みは一時的な影響 - Pain Effect Type Schmerzeffekt-Typ @@ -2864,32 +2851,6 @@ Considera le unità controllate in remoto come IA e non come giocatori? 遠隔操作された AI は、非プレイヤーとして扱いますか? - - Prevent instant death - Откл. мгновенную смерть - Wyłącz natychmiastową śmierć - Prevenir muerte instantánea - Verhindere direkten Tod - Zabránit okamžité smrti - Previnir morte instantânea - Empêcher la mort instantanée - Azonnali halál kiiktatása - Previeni morte istantanea - 即死の防止 - - - Have a unit move to unconscious instead of death - Бойцы теряют сознание вместо того, чтобы умирать - Spraw, aby jednostka została przeniesiona do stanu nieprzytomności zamiast ginąć na miejscu od śmiertelnych obrażeń - Mover una unidad a inconsciente en vez de a muerta - Lässt eine Einheit bewusstlos werden anstatt zu sterben - Jednotka upadne do bezvědomí namísto smrti - Fazer a unidade ficar inconsciente invés de morrer - Forcer l'inconscience au lieu de la mort instantanée - Egy egység kerüljön eszméletlen állapotba a halott helyett - Imposta un'unità come incosciente invece di morta - ユニットの即死を防止するために、気絶へ移行させます - Bleeding coefficient Коэффициент кровопотери @@ -3467,32 +3428,6 @@ Soigner les plaies entièrement bandées. 包帯によりヒットポイントを完全に回復する - - Pain suppression - Schmerzunterdrückung - Zwalczanie bólu - Potlačení bolesti - Supresión del dolor - Supressão de dor - Suppression de la douleur - Fájdalomcsillapítás - Приглушение боли - Soppressione dolore - 痛みの継続 - - - Pain is only temporarily suppressed, not removed - Schmerzen werden nur vorübergehend unterdrückt, nicht deren Ursache geheilt. - Ból jest tylko tymczasowo zwalczany, nie jest usuwany trwale - Bolest je potlačena, ale jen dočastně - El dolor se suprime solo temporalmente, no se elimina. - Dor é somente temporáriamente suprimida, não removida - La douleur est temporairement supprimée, pas enlevée - A fájdalom csak ideiglenesen csökken, nem távolítódik el - Боль приглушается только временно - Dolore è solo temporaneamente soppresso, non rimosso - 痛みを一時的に継続させ、取り除かない - Configure the treatment settings from ACE Basic Medical Behandlungseinstellungen der Standard ACE-Medizin konfigurieren diff --git a/addons/medical_ai/functions/fnc_isInjured.sqf b/addons/medical_ai/functions/fnc_isInjured.sqf index 6852fc1c58..d989d621df 100644 --- a/addons/medical_ai/functions/fnc_isInjured.sqf +++ b/addons/medical_ai/functions/fnc_isInjured.sqf @@ -15,8 +15,6 @@ if !(alive _this) exitWith {false}; private _bloodLoss = [_this] call EFUNC(medical,getBloodLoss); -private _pain = _this getVariable [QEGVAR(medical,pain), 0]; -// Advanced only? -// private _heartRate = _this getVariable [QEGVAR(medical,heartRate), 70]; +private _pain = [_this] call EFUNC(medical,getPainLevel); -(_bloodLoss > 0) || {_pain > 0.2} // || {_heartRate > 100} || {_heartRate < 40} +((_bloodLoss > 0) || {_pain > 0.2}) diff --git a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp index 90bfdb6b7d..444f71fd03 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp @@ -249,7 +249,7 @@ class GVAR(Actions) { condition = QUOTE(!(_target call EFUNC(common,isAwake)) && EGVAR(medical,enableRevive) > 0); callbackSuccess = QFUNC(treatmentCPR); callbackFailure = ""; - callbackProgress = QUOTE((_this select 0 select 1) call EFUNC(common,isAwake)); + callbackProgress = QUOTE(!([(_this select 0) select 1] call EFUNC(common,isAwake))); animationPatient = ""; animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback"; animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medic"; diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index fae5c717f2..80f859e9f9 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -41,7 +41,6 @@ if (!_foundEntry) then { _target setVariable [QEGVAR(medical,allUsedMedication), _allUsedMedication]; }; - private _usedMeds = _target getVariable [_variable, 0]; if (_usedMeds >= floor (_maxDosage + round(random(2))) && _maxDosage >= 1) then { [QEGVAR(medical,CriticalVitals), _target] call CBA_fnc_localEvent; @@ -73,8 +72,5 @@ if (_hasOverDosed > 0) then { [_target, _className] call _onOverDose; }; -private _decreaseAmount = 1 / _timeInSystem; -private _viscosityAdjustment = _viscosityChange / _timeInSystem; - // Run the loop that computes the effect of the medication over time -[_target, _variable, 0, _decreaseAmount, _viscosityAdjustment, _painReduce / _timeInSystem] call FUNC(medicationEffectLoop); +[_target, _variable, 0, (1 / _timeInSystem), (_viscosityChange / _timeInSystem), (_painReduce / _timeInSystem)] call FUNC(medicationEffectLoop); diff --git a/addons/medical_treatment/functions/fnc_treatmentCPR.sqf b/addons/medical_treatment/functions/fnc_treatmentCPR.sqf index 9ae5657490..0cfb3bddc8 100644 --- a/addons/medical_treatment/functions/fnc_treatmentCPR.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentCPR.sqf @@ -18,7 +18,7 @@ params ["_caller", "_target", "_selectionName", "_className", "_items"]; -if (alive _target && {(_target getVariable [QEGVAR(medical,inCardiacArrest), false] || _target getVariable [QEGVAR(medical,inReviveState), false])}) then { +if (alive _target && {_target getVariable [QEGVAR(medical,inCardiacArrest), false]}) then { [_target, "activity_view", ELSTRING(medical,Activity_cpr), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); [QGVAR(treatmentCPRLocal), [_caller, _target], _target] call CBA_fnc_targetEvent; diff --git a/addons/medical_treatment/functions/fnc_treatmentCPRLocal.sqf b/addons/medical_treatment/functions/fnc_treatmentCPRLocal.sqf index 59f461d920..e4580ed62f 100644 --- a/addons/medical_treatment/functions/fnc_treatmentCPRLocal.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentCPRLocal.sqf @@ -16,19 +16,8 @@ params ["_caller", "_target"]; -if (_target getVariable [QEGVAR(medical,inReviveState), false]) then { - private _reviveStartTime = _target getVariable [QEGVAR(medical,reviveStartTime),0]; - - if (_reviveStartTime > 0) then { - _target setVariable [QEGVAR(medical,reviveStartTime), (_reviveStartTime + random(20)) min CBA_missionTime]; - }; -}; - if ((random 1) >= 0.6) then { - _target setVariable [QEGVAR(medical,inCardiacArrest), nil,true]; - _target setVariable [QEGVAR(medical,heartRate), 40]; - _target setVariable [QEGVAR(medical,bloodPressure), [50,70]]; - [QGVAR(CPRSucceeded), _target] call CBA_fnc_localEvent; + [QEGVAR(medical,CPRSucceeded), _target] call CBA_fnc_localEvent; }; [_target, "activity", ELSTRING(medical,Activity_CPR), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); diff --git a/addons/medical_treatment/functions/fnc_treatmentFullHealLocal.sqf b/addons/medical_treatment/functions/fnc_treatmentFullHealLocal.sqf index fa8c62a4f6..2accb534f5 100644 --- a/addons/medical_treatment/functions/fnc_treatmentFullHealLocal.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentFullHealLocal.sqf @@ -52,7 +52,6 @@ if (_partialHeal) then { _target setDamage ((damage _target) min _persistentDamage); } else { _target setVariable [QEGVAR(medical,pain), 0, true]; - _target setVariable [QEGVAR(medical,morphine), 0, true]; _target setVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME, true]; // tourniquets @@ -77,7 +76,6 @@ if (_partialHeal) then { // generic medical admin _target setVariable [QEGVAR(medical,inCardiacArrest), false, true]; - _target setVariable [QEGVAR(medical,inReviveState), false, true]; _target setVariable [QEGVAR(medical,isUnconscious), false, true]; _target setVariable [QEGVAR(medical,hasLostBlood), 0, true]; _target setVariable [QEGVAR(medical,isBleeding), false, true]; diff --git a/addons/medical_treatment/functions/fnc_treatmentMedicationLocal.sqf b/addons/medical_treatment/functions/fnc_treatmentMedicationLocal.sqf index 70c4a75d53..f7951b124f 100644 --- a/addons/medical_treatment/functions/fnc_treatmentMedicationLocal.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentMedicationLocal.sqf @@ -17,17 +17,10 @@ params ["_target", "_className", "_partIndex"]; TRACE_3("params",_target,_className,_partIndex); -if !(EGVAR(medical,advancedMedication)) exitWith { +if (!EGVAR(medical,advancedMedication)) exitWith { if (_className == "Morphine") exitWith { #define MORPHINEHEAL 0.4 - - params ["_target"]; - - // reduce pain, pain sensitivity - private _morphine = ((_target getVariable [QEGVAR(medical,morphine), 0]) + MORPHINEHEAL) min 1; - _target setVariable [QEGVAR(medical,morphine), _morphine, true]; - - private _pain = ((_target getVariable [QEGVAR(medical,pain), 0]) - MORPHINEHEAL) max 0; + private _pain = 0 max ((_target getVariable [QEGVAR(medical,pain), 0]) - MORPHINEHEAL); _target setVariable [QEGVAR(medical,pain), _pain, true]; }; @@ -90,7 +83,7 @@ if !(_hrCallback isEqualType {}) then { }; // Adjust the heart rate based upon config entry -private _heartRate = _target getVariable [QEGVAR(medical,heartRate), 70]; +private _heartRate = _target getVariable [QEGVAR(medical,heartRate), 80]; if (alive _target) then { if (_heartRate > 0) then { @@ -107,14 +100,8 @@ if (alive _target) then { }; if (_painReduce > 0) then { - // Reduce pain private _painSuppress = _target getVariable [QEGVAR(medical,painSuppress), 0]; _target setVariable [QEGVAR(medical,painSuppress), (_painSuppress + _painReduce) max 0]; - - if (!GVAR(painIsOnlySuppressed)) then { - _pain = _target getVariable [QEGVAR(medical,pain), 0]; - _target setVariable [QEGVAR(medical,pain), (_pain - _painReduce) max 0, true]; - }; }; private _resistance = _target getVariable [QEGVAR(medical,peripheralResistance), 100];