Medical - Add internal variable for wake-up timer and stable blood volume (#9374)

* Medical - Allow changing SPONTANEOUS_WAKE_UP_INTERVAL via var

* add variable for minimum blood volume

* change variable name

* update pain comment

---------

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
Grim 2023-09-09 00:15:43 -04:00 committed by GitHub
parent f644e7516c
commit dbd5fbaf31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 5 deletions

View File

@ -70,7 +70,7 @@ switch (true) do {
_treatmentArgs = [_healer, _target];
_treatmentTime = 15;
};
case (_isMedic && {GET_BLOOD_VOLUME(_target) < BLOOD_VOLUME_CLASS_2_HEMORRHAGE}
case (_isMedic && {GET_BLOOD_VOLUME(_target) < MINIMUM_BLOOD_FOR_STABLE_VITALS}
&& {([_healer, "@iv"] call FUNC(itemCheck)) # 0}): {
// Check if patient's blood volume + remaining IV volume is enough to allow the patient to wake up
private _totalIvVolume = 0; //in ml
@ -79,7 +79,7 @@ switch (true) do {
_totalIvVolume = _totalIvVolume + _volumeRemaining;
} forEach (_target getVariable [QEGVAR(medical,ivBags), []]);
if (GET_BLOOD_VOLUME(_target) + (_totalIvVolume / 1000) > BLOOD_VOLUME_CLASS_2_HEMORRHAGE) exitWith {
if (GET_BLOOD_VOLUME(_target) + (_totalIvVolume / 1000) > MINIMUM_BLOOD_FOR_STABLE_VITALS) exitWith {
_treatmentEvent = "#waitForBlood";
};
_treatmentEvent = QEGVAR(medical_treatment,ivBagLocal);

View File

@ -9,6 +9,8 @@ PREP_RECOMPILE_END;
#include "initSettings.sqf"
// Define "Constants" variables (both are macros defined in script_macros_medical.hpp, look there for actual variable names)
if (isNil QUOTE(SPONTANEOUS_WAKE_UP_INTERVAL)) then {SPONTANEOUS_WAKE_UP_INTERVAL = SPONTANEOUS_WAKE_UP_INTERVAL_DEFAULT};
if (isNil QUOTE(MINIMUM_BLOOD_FOR_STABLE_VITALS)) then {MINIMUM_BLOOD_FOR_STABLE_VITALS = MINIMUM_BLOOD_FOR_STABLE_VITALS_DEFAULT};
if (isNil QUOTE(HEAD_DAMAGE_THRESHOLD)) then {HEAD_DAMAGE_THRESHOLD = HEAD_DAMAGE_THRESHOLD_DEFAULT};
if (isNil QUOTE(ORGAN_DAMAGE_THRESHOLD)) then {ORGAN_DAMAGE_THRESHOLD = ORGAN_DAMAGE_THRESHOLD_DEFAULT};
if (isNil QUOTE(HEART_HIT_CHANCE)) then {HEART_HIT_CHANCE = HEART_HIT_CHANCE_DEFAULT};

View File

@ -54,6 +54,10 @@
#define BLOOD_VOLUME_CLASS_4_HEMORRHAGE 3.600 // lost more than 40% blood, Class IV Hemorrhage
#define BLOOD_VOLUME_FATAL 3.0 // Lost more than 50% blood, Unrecoverable
// Minimum blood volume, in liters, for a patient to have the chance to wake up
#define MINIMUM_BLOOD_FOR_STABLE_VITALS EGVAR(medical,const_stableVitalsBloodThreshold)
#define MINIMUM_BLOOD_FOR_STABLE_VITALS_DEFAULT BLOOD_VOLUME_CLASS_2_HEMORRHAGE
// IV Change per second calculation:
// 250 ml should take 60 seconds to fill. 250 ml / 60 s ~ 4.1667 ml/s.
#define IV_CHANGE_PER_SECOND 4.1667 // in milliliters per second
@ -72,7 +76,7 @@
#define DAMAGE_BLUE_THRESHOLD 0.8
#define DAMAGE_TOTAL_COLORS 10
// --- pain
// Pain above which a unit can go unconscious upon receiving damage
#define PAIN_UNCONSCIOUS EGVAR(medical,painUnconsciousThreshold)
// Pain fade out time (time it takes until pain is guaranteed to be completly gone)
@ -84,7 +88,8 @@
#define PAIN_SUPPRESSION_FADE_TIME 1800
// Chance to wake up when vitals are stable (checked once every SPONTANEOUS_WAKE_UP_INTERVAL seconds)
#define SPONTANEOUS_WAKE_UP_INTERVAL 15
#define SPONTANEOUS_WAKE_UP_INTERVAL EGVAR(medical,const_wakeUpCheckInterval)
#define SPONTANEOUS_WAKE_UP_INTERVAL_DEFAULT 15
// Minimum leg damage required for limping
#define LIMPING_DAMAGE_THRESHOLD EGVAR(medical,const_limpingDamageThreshold)

View File

@ -17,7 +17,7 @@
params ["_unit"];
if (GET_BLOOD_VOLUME(_unit) < BLOOD_VOLUME_CLASS_2_HEMORRHAGE) exitWith { false };
if (GET_BLOOD_VOLUME(_unit) < MINIMUM_BLOOD_FOR_STABLE_VITALS) exitWith { false };
if IN_CRDC_ARRST(_unit) exitWith { false };
private _cardiacOutput = [_unit] call FUNC(getCardiacOutput);