mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Medical - Various debugging and fix cpr anim speed (#7122)
* Medical - Various debugging and fix cpr anim speed * Update fnc_setCardiacArrest.sqf
This commit is contained in:
parent
75a8ba2b34
commit
f5782fd1ff
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
params ["_state"];
|
||||
TRACE_1("disableUserInput",_state);
|
||||
|
||||
if (_state) then {
|
||||
disableSerialization;
|
||||
|
@ -16,7 +16,8 @@
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
params ["_id", "_disable"];
|
||||
params [["_id", "#", [""]], ["_disable", false, [false]]];
|
||||
TRACE_2("setDisableUserInputStatus",_id,_disable);
|
||||
|
||||
if (isNil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then {
|
||||
GVAR(DISABLE_USER_INPUT_COLLECTION) = [];
|
||||
|
@ -2,6 +2,7 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Public interface to allow external modules to safely adjust pain levels.
|
||||
* Added pain can be positive or negative (Note: ignores painCoefficient setting)
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The patient <OBJECT>
|
||||
|
@ -61,6 +61,7 @@ if (_knockOut) then {
|
||||
}, [_unit], _minWaitingTime] call CBA_fnc_waitAndExecute;
|
||||
};
|
||||
if (EGVAR(medical,spontaneousWakeUpChance) > 0) then {
|
||||
TRACE_1("setting lastWakeUpCheck",_minWaitingTime);
|
||||
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), CBA_missionTime + _minWaitingTime - SPONTANEOUS_WAKE_UP_INTERVAL];
|
||||
};
|
||||
};
|
||||
|
@ -141,6 +141,7 @@
|
||||
// - Unit Functions ---------------------------------------------------
|
||||
// Retrieval macros for common unit values
|
||||
// Defined for easy consistency and speed
|
||||
#define GET_SM_STATE(_unit) ([_unit, EGVAR(medical,STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState)
|
||||
#define GET_BLOOD_VOLUME(unit) (unit getVariable [VAR_BLOOD_VOL, DEFAULT_BLOOD_VOLUME])
|
||||
#define GET_WOUND_BLEEDING(unit) (unit getVariable [VAR_WOUND_BLEEDING, 0])
|
||||
#define GET_HEART_RATE(unit) (unit getVariable [VAR_HEART_RATE, DEFAULT_HEART_RATE])
|
||||
|
@ -30,6 +30,7 @@ GVAR(heartBeatEffectRunning) = false;
|
||||
params ["_unit", "_unconscious"];
|
||||
|
||||
if (_unit != ACE_player) exitWith {};
|
||||
TRACE_1("player unconscious eh",_unconscious);
|
||||
|
||||
if (_unconscious && {cameraView == "GUNNER"} && {(vehicle _unit) != _unit} && {cameraOn == vehicle _unit}) then {
|
||||
TRACE_2("exiting gunner view",cameraOn,cameraView);
|
||||
|
@ -35,6 +35,7 @@ if (EGVAR(medical,spontaneousWakeUpChance) > 0) then {
|
||||
// Handle setting being changed mid-mission and still properly check
|
||||
// already unconscious units, should handle locality changes as well
|
||||
if (isNil "_lastWakeUpCheck") exitWith {
|
||||
TRACE_1("undefined lastWakeUpCheck: setting to current time",_lastWakeUpCheck);
|
||||
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), CBA_missionTime];
|
||||
};
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Interface to allow external modules to affect the pain level
|
||||
* Sets the new pain level to the max between the input and current level
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The patient <OBJECT>
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Check if a unit is in a stable condition
|
||||
* Check if a unit is in a stable condition, needed for PersonalAidKit treatment
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The patient <OBJECT>
|
||||
|
@ -3,13 +3,18 @@
|
||||
* Author: Glowbal
|
||||
* Marks a unit as in cardiac arrest and sets heart rate to 0.
|
||||
* Will put the unit in an unconscious state if not already.
|
||||
* For Internal Use: Called from the state machine entered/leftState funcs.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit that will be put in cardiac arrest state <OBJECT>
|
||||
* 1: Set CardiacArrest <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [player, true] call ace_medical_status_fnc_setCardiacArrest
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
@ -17,7 +22,7 @@ params ["_unit", "_active"];
|
||||
TRACE_2("setCardiacArrest",_unit,_active);
|
||||
|
||||
// No change to make
|
||||
if (_active isEqualTo IN_CRDC_ARRST(_unit)) exitWith {};
|
||||
if (_active isEqualTo IN_CRDC_ARRST(_unit)) exitWith { TRACE_2("no change",_active,IN_CRDC_ARRST(_unit)); };
|
||||
|
||||
// No heart rate in cardiac arrest, low heart rate if revived
|
||||
_unit setVariable [VAR_CRDC_ARRST, _active, true];
|
||||
|
@ -11,13 +11,16 @@
|
||||
* Return Value:
|
||||
* Success <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player, true] call ace_medical_status_fnc_setUnconscious
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_unit", "_active"];
|
||||
|
||||
// No change to make
|
||||
if (_active isEqualTo IS_UNCONSCIOUS(_unit)) exitWith {};
|
||||
if (_active isEqualTo IS_UNCONSCIOUS(_unit)) exitWith { TRACE_2("no change",_active,IS_UNCONSCIOUS(_unit)); };
|
||||
|
||||
_unit setVariable [VAR_UNCON, _active, true];
|
||||
|
||||
@ -31,6 +34,7 @@ if (_active) then {
|
||||
// Don't bother setting this if not used
|
||||
if (EGVAR(medical,spontaneousWakeUpChance) > 0) then {
|
||||
private _lastWakeUpCheck = _unit getVariable [QEGVAR(medical,lastWakeUpCheck), 0]; // could be set higher from ace_medical_fnc_setUnconscious
|
||||
TRACE_2("setting lastWakeUpCheck to max of",_lastWakeUpCheck,CBA_missionTime);
|
||||
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), _lastWakeUpCheck max CBA_missionTime];
|
||||
};
|
||||
|
||||
|
@ -31,7 +31,8 @@ GVAR(animDurations) = [] call CBA_fnc_createNamespace;
|
||||
["AinvPknlMstpSlayWlnrDnon_medicOther", 9],
|
||||
["AinvPknlMstpSlayWpstDnon_medicOther", 10],
|
||||
["AinvPpneMstpSlayWpstDnon_medicOther", 8.5],
|
||||
["AinvPknlMstpSnonWnonDnon_medic1", 10]
|
||||
["AinvPknlMstpSnonWnonDnon_medic1", 10],
|
||||
["AinvPknlMstpSnonWnonDr_medic0", 12]
|
||||
];
|
||||
|
||||
// class names of medical facilities (config case)
|
||||
|
@ -20,11 +20,16 @@ TRACE_1("fullHealLocal",_patient);
|
||||
|
||||
if (!alive _patient) exitWith {};
|
||||
|
||||
private _state = GET_SM_STATE(_patient);
|
||||
TRACE_1("start",_state);
|
||||
|
||||
// Treatment conditions would normally limit full heal to non-unconscious units
|
||||
// However, this may be called externally (through Zeus)
|
||||
if IN_CRDC_ARRST(_patient) then {
|
||||
TRACE_1("Exiting cardiac arrest",_patient);
|
||||
[QEGVAR(medical,CPRSucceeded), _patient] call CBA_fnc_localEvent;
|
||||
_state = GET_SM_STATE(_patient);
|
||||
TRACE_1("after CPRSucceeded",_state);
|
||||
};
|
||||
|
||||
_patient setVariable [VAR_PAIN, 0, true];
|
||||
@ -57,14 +62,17 @@ _patient setVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0], true];
|
||||
|
||||
// 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); };
|
||||
if (!([_patient] call EFUNC(medical_status,hasStableVitals))) then { ERROR_2("fullheal [unit %1][state %2] did not restore stable vitals",_patient,_state); };
|
||||
TRACE_1("Waking up",_patient);
|
||||
[QEGVAR(medical,WakeUp), _patient] call CBA_fnc_localEvent;
|
||||
_state = GET_SM_STATE(_patient);
|
||||
TRACE_1("after WakeUp",_state);
|
||||
if IS_UNCONSCIOUS(_patient) then { ERROR_1("fullheal [unit %1][state %2] failed to wake up patient",_patient,_state); };
|
||||
};
|
||||
|
||||
// Generic medical admin
|
||||
_patient setVariable [VAR_CRDC_ARRST, false, true];
|
||||
_patient setVariable [VAR_UNCON, false, true];
|
||||
// _patient setVariable [VAR_CRDC_ARRST, false, true]; // this should be set by statemachine transition
|
||||
// _patient setVariable [VAR_UNCON, false, true]; // this should be set by statemachine transition
|
||||
_patient setVariable [VAR_HEMORRHAGE, 0, true];
|
||||
_patient setVariable [VAR_IN_PAIN, false, true];
|
||||
_patient setVariable [VAR_PAIN_SUPP, 0, true];
|
||||
@ -81,3 +89,5 @@ _patient setVariable [QEGVAR(medical,triageCard), [], true];
|
||||
_patient setDamage 0;
|
||||
|
||||
[QEGVAR(medical,FullHeal), _patient] call CBA_fnc_localEvent;
|
||||
_state = GET_SM_STATE(_patient);
|
||||
TRACE_1("after FullHeal",_state);
|
||||
|
@ -74,6 +74,10 @@ if (_medicAnim == "AinvPknlMstpSlayWlnrDnon_medic") then {
|
||||
|
||||
// Determine the animation length
|
||||
private _animDuration = GVAR(animDurations) getVariable _medicAnim;
|
||||
if (isNil "_animDuration") then {
|
||||
WARNING_2("animation [%1] for [%2] has no duration defined",_medicAnim,_classname);
|
||||
_animDuration = 10;
|
||||
};
|
||||
|
||||
// These animations have transitions that take a bit longer...
|
||||
if (weaponLowered _medic) then {
|
||||
|
Loading…
Reference in New Issue
Block a user