Various fixes:

* Fixed medication (morphine, epinephrine, ...)
* Fixed CPR
* Improved heart rate simulation
* Removed deprecated ace settings
This commit is contained in:
ulteq 2016-12-06 17:26:11 +01:00
parent 978a81fb0a
commit fa77fb7194
22 changed files with 107 additions and 200 deletions

View File

@ -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);

View File

@ -13,6 +13,7 @@ PREP(getBloodPressure);
PREP(getBloodVolumeChange);
PREP(getCardiacOutput);
PREP(getHeartRateChange);
PREP(getPainLevel);
PREP(handleIncapacitation);
PREP(handleKilled);
PREP(handleLocal);

View File

@ -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);
};
};

View File

@ -0,0 +1,20 @@
/*
* Author: Ruthberg
* Get the total pain level of a unit.
*
* Arguments:
* 0: The Unit <OBJECT>
*
* ReturnValue:
* Pain level (0 .. 1) <NUMBER>
*
* 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)

View File

@ -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;
};

View File

@ -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];
_unit setVariable [QGVAR(pain), 0, true];
_unit setVariable [QGVAR(heartRate), 0, true];
_unit setVariable [QGVAR(bloodPressure), [0, 0], true];

View File

@ -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);
};

View File

@ -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);
};

View File

@ -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);
};

View File

@ -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 {

View File

@ -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

View File

@ -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];

View File

@ -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];

View File

@ -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;

View File

@ -2463,19 +2463,6 @@
<German>Heilt vollständig bandagierte Trefferpunkte</German>
<Japanese>包帯は体力を完全に回復する</Japanese>
</Key>
<Key ID="STR_ACE_Medical_painIsOnlySuppressed">
<English>Pain is only temporarily suppressed</English>
<German>Schmerzen werden nur vorübergehend unterdrückt</German>
<Polish>Ból jest tymczasowo zwalczany</Polish>
<Czech>Bolest je potlačena pouze dočasně</Czech>
<Spanish>El dolor se suprime solo temporalmente</Spanish>
<Portuguese>Dor é suprimida somente temporáriamente</Portuguese>
<French>La douleur est seulement supprimée temporairement</French>
<Hungarian>A fájdalom csak ideiglenesen csökken</Hungarian>
<Russian>Боль приглушается только временно</Russian>
<Italian>Dolore è soppresso solo temporaneamente</Italian>
<Japanese>痛みは一時的な影響</Japanese>
</Key>
<Key ID="STR_ACE_Medical_painEffectType">
<English>Pain Effect Type</English>
<German>Schmerzeffekt-Typ</German>
@ -2864,32 +2851,6 @@
<Italian>Considera le unità controllate in remoto come IA e non come giocatori?</Italian>
<Japanese>遠隔操作された AI は、非プレイヤーとして扱いますか?</Japanese>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_preventInstaDeath_DisplayName">
<English>Prevent instant death</English>
<Russian>Откл. мгновенную смерть</Russian>
<Polish>Wyłącz natychmiastową śmierć</Polish>
<Spanish>Prevenir muerte instantánea</Spanish>
<German>Verhindere direkten Tod</German>
<Czech>Zabránit okamžité smrti</Czech>
<Portuguese>Previnir morte instantânea</Portuguese>
<French>Empêcher la mort instantanée</French>
<Hungarian>Azonnali halál kiiktatása</Hungarian>
<Italian>Previeni morte istantanea</Italian>
<Japanese>即死の防止</Japanese>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_preventInstaDeath_Description">
<English>Have a unit move to unconscious instead of death</English>
<Russian>Бойцы теряют сознание вместо того, чтобы умирать</Russian>
<Polish>Spraw, aby jednostka została przeniesiona do stanu nieprzytomności zamiast ginąć na miejscu od śmiertelnych obrażeń</Polish>
<Spanish>Mover una unidad a inconsciente en vez de a muerta</Spanish>
<German>Lässt eine Einheit bewusstlos werden anstatt zu sterben</German>
<Czech>Jednotka upadne do bezvědomí namísto smrti</Czech>
<Portuguese>Fazer a unidade ficar inconsciente invés de morrer</Portuguese>
<French>Forcer l'inconscience au lieu de la mort instantanée</French>
<Hungarian>Egy egység kerüljön eszméletlen állapotba a halott helyett</Hungarian>
<Italian>Imposta un'unità come incosciente invece di morta</Italian>
<Japanese>ユニットの即死を防止するために、気絶へ移行させます</Japanese>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_bleedingCoefficient_DisplayName">
<English>Bleeding coefficient</English>
<Russian>Коэффициент кровопотери</Russian>
@ -3467,32 +3428,6 @@
<French>Soigner les plaies entièrement bandées.</French>
<Japanese>包帯によりヒットポイントを完全に回復する</Japanese>
</Key>
<Key ID="STR_ACE_Medical_AdvancedMedicalSettings_painIsOnlySuppressed_DisplayName">
<English>Pain suppression</English>
<German>Schmerzunterdrückung</German>
<Polish>Zwalczanie bólu</Polish>
<Czech>Potlačení bolesti</Czech>
<Spanish>Supresión del dolor</Spanish>
<Portuguese>Supressão de dor</Portuguese>
<French>Suppression de la douleur</French>
<Hungarian>Fájdalomcsillapítás</Hungarian>
<Russian>Приглушение боли</Russian>
<Italian>Soppressione dolore</Italian>
<Japanese>痛みの継続</Japanese>
</Key>
<Key ID="STR_ACE_Medical_AdvancedMedicalSettings_painIsOnlySuppressed_Description">
<English>Pain is only temporarily suppressed, not removed</English>
<German>Schmerzen werden nur vorübergehend unterdrückt, nicht deren Ursache geheilt.</German>
<Polish>Ból jest tylko tymczasowo zwalczany, nie jest usuwany trwale</Polish>
<Czech>Bolest je potlačena, ale jen dočastně</Czech>
<Spanish>El dolor se suprime solo temporalmente, no se elimina.</Spanish>
<Portuguese>Dor é somente temporáriamente suprimida, não removida</Portuguese>
<French>La douleur est temporairement supprimée, pas enlevée</French>
<Hungarian>A fájdalom csak ideiglenesen csökken, nem távolítódik el</Hungarian>
<Russian>Боль приглушается только временно</Russian>
<Italian>Dolore è solo temporaneamente soppresso, non rimosso</Italian>
<Japanese>痛みを一時的に継続させ、取り除かない</Japanese>
</Key>
<Key ID="STR_ACE_Medical_BasicMedicalSettings_Module_Description">
<English>Configure the treatment settings from ACE Basic Medical</English>
<German>Behandlungseinstellungen der Standard ACE-Medizin konfigurieren</German>

View File

@ -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})

View File

@ -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";

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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];

View File

@ -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];