mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Medical - Fix unconsicous problems with minWaitingTime and fullHealLocal (#7030)
* Medical - Fix setUnconsicous minWaitingTime * Fix fullHeallocal restoring unconscious with unstable vitals
This commit is contained in:
parent
8483a4bcdc
commit
2fc11d38e0
@ -2,7 +2,9 @@
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP_RECOMPILE_START;
|
||||
#include "XEH_PREP.hpp"
|
||||
PREP_RECOMPILE_END;
|
||||
|
||||
#include "initSettings.sqf"
|
||||
|
||||
|
@ -31,7 +31,7 @@ if (_painLevel > 0) then {
|
||||
// Handle spontaneous wakeup from unconsciousness
|
||||
if (EGVAR(medical,spontaneousWakeUpChance) > 0) then {
|
||||
if (_unit call EFUNC(medical_status,hasStableVitals)) then {
|
||||
private _lastWakeUpCheck = _unit getVariable [QEGVAR(medical,lastWakeUpCheck), CBA_missionTime];
|
||||
private _lastWakeUpCheck = _unit getVariable [QEGVAR(medical,lastWakeUpCheck), 0];
|
||||
if (CBA_missionTime - _lastWakeUpCheck > SPONTANEOUS_WAKE_UP_INTERVAL) then {
|
||||
TRACE_2("Checking for wake up",_unit,EGVAR(medical,spontaneousWakeUpChance));
|
||||
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), CBA_missionTime];
|
||||
@ -42,6 +42,7 @@ if (EGVAR(medical,spontaneousWakeUpChance) > 0) then {
|
||||
};
|
||||
} else {
|
||||
// Unstable vitals, procrastinate the next wakeup check
|
||||
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), CBA_missionTime];
|
||||
private _lastWakeUpCheck = _unit getVariable [QEGVAR(medical,lastWakeUpCheck), 0];
|
||||
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), _lastWakeUpCheck max CBA_missionTime];
|
||||
};
|
||||
};
|
||||
|
@ -72,6 +72,9 @@ if (_isRespawn) then {
|
||||
|
||||
// medication
|
||||
_unit setVariable [VAR_MEDICATIONS, [], true];
|
||||
|
||||
// Unconscious spontanious wake up chance
|
||||
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), nil];
|
||||
};
|
||||
|
||||
[{
|
||||
|
@ -27,7 +27,8 @@ _unit setVariable [VAR_UNCON, _active, true];
|
||||
if (_active) then {
|
||||
// Don't bother setting this if not used
|
||||
if (EGVAR(medical,spontaneousWakeUpChance) > 0) then {
|
||||
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), CBA_missionTime];
|
||||
private _lastWakeUpCheck = _unit getVariable [QEGVAR(medical,lastWakeUpCheck), 0]; // could be set higher from ace_medical_fnc_setUnconscious
|
||||
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), _lastWakeUpCheck max CBA_missionTime];
|
||||
};
|
||||
|
||||
if (_unit == ACE_player) then {
|
||||
|
@ -13,26 +13,26 @@
|
||||
[_unit] call FUNC(checkItems);
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
["loadout", FUNC(checkItems)] call CBA_fnc_addPlayerEventHandler;
|
||||
["loadout", LINKFUNC(checkItems)] call CBA_fnc_addPlayerEventHandler;
|
||||
|
||||
// Handle body removal and litter on server
|
||||
if (isServer) then {
|
||||
[QGVAR(createLitterServer), FUNC(createLitterServer)] call CBA_fnc_addEventHandler;
|
||||
["ace_placedInBodyBag", FUNC(removeBody)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(createLitterServer), LINKFUNC(createLitterServer)] call CBA_fnc_addEventHandler;
|
||||
["ace_placedInBodyBag", LINKFUNC(removeBody)] call CBA_fnc_addEventHandler;
|
||||
};
|
||||
|
||||
// Treatment events
|
||||
[QGVAR(bandageLocal), FUNC(bandageLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(checkBloodPressureLocal), FUNC(checkBloodPressureLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(checkPulseLocal), FUNC(checkPulseLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(cprLocal), FUNC(cprLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(fullHealLocal), FUNC(fullHealLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(ivBagLocal), FUNC(ivBagLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(medicationLocal), FUNC(medicationLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(placeInBodyBag), FUNC(placeInBodyBag)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(splintLocal), FUNC(splintLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(tourniquetLocal), FUNC(tourniquetLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(bandageLocal), LINKFUNC(bandageLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(checkBloodPressureLocal), LINKFUNC(checkBloodPressureLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(checkPulseLocal), LINKFUNC(checkPulseLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(cprLocal), LINKFUNC(cprLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(fullHealLocal), LINKFUNC(fullHealLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(ivBagLocal), LINKFUNC(ivBagLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(medicationLocal), LINKFUNC(medicationLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(placeInBodyBag), LINKFUNC(placeInBodyBag)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(splintLocal), LINKFUNC(splintLocal)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(tourniquetLocal), LINKFUNC(tourniquetLocal)] call CBA_fnc_addEventHandler;
|
||||
|
||||
// Logging events
|
||||
[QGVAR(addToLog), FUNC(addToLog)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(addToTriageCard), FUNC(addToTriageCard)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(addToLog), LINKFUNC(addToLog)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(addToTriageCard), LINKFUNC(addToTriageCard)] call CBA_fnc_addEventHandler;
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
params ["_patient"];
|
||||
TRACE_1("fullHealLocal",_patient);
|
||||
|
||||
if (!alive _patient) exitWith {};
|
||||
|
||||
@ -26,12 +27,6 @@ if IN_CRDC_ARRST(_patient) then {
|
||||
[QEGVAR(medical,CPRSucceeded), _patient] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
||||
if IS_UNCONSCIOUS(_patient) then {
|
||||
TRACE_1("Waking up",_patient);
|
||||
// Wake patient up first or unconscious variables will be reset
|
||||
[QEGVAR(medical,WakeUp), _patient] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
||||
_patient setVariable [VAR_PAIN, 0, true];
|
||||
_patient setVariable [VAR_BLOOD_VOL, DEFAULT_BLOOD_VOLUME, true];
|
||||
|
||||
@ -59,9 +54,13 @@ _patient setVariable [QEGVAR(medical,ivBags), nil, true];
|
||||
|
||||
// Damage storage
|
||||
_patient setVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0], true];
|
||||
#ifdef DEBUG_TESTRESULTS
|
||||
_patient setVariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0], true];
|
||||
#endif
|
||||
|
||||
// wakeup needs to be done after achieving stable vitals, but before manually reseting unconc var
|
||||
if IS_UNCONSCIOUS(_patient) then {
|
||||
if (!([_patient] call EFUNC(medical_status,hasStableVitals))) then { WARNING_1("fullheal [%1] did not restore stable vitals",_patient); };
|
||||
TRACE_1("Waking up",_patient);
|
||||
[QEGVAR(medical,WakeUp), _patient] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
||||
// Generic medical admin
|
||||
_patient setVariable [VAR_CRDC_ARRST, false, true];
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP_RECOMPILE_START;
|
||||
#include "XEH_PREP.hpp"
|
||||
PREP_RECOMPILE_END;
|
||||
|
||||
ADDON = true;
|
||||
|
@ -45,7 +45,7 @@ switch (false) do {
|
||||
// Heal validated target
|
||||
if (["ace_medical"] call EFUNC(common,isModLoaded)) then {
|
||||
TRACE_1("healing with ace_medical",_unit);
|
||||
[QEGVAR(medical_treatment,treatmentFullHealLocal), [_unit], _unit] call CBA_fnc_targetEvent;
|
||||
[QEGVAR(medical_treatment,fullHealLocal), [_unit], _unit] call CBA_fnc_targetEvent;
|
||||
} else {
|
||||
// BI's scripted revive system
|
||||
if ((missionNamespace getVariable ["bis_revive_mode", 0]) != 0) then {
|
||||
|
Loading…
Reference in New Issue
Block a user