Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circulation - Add/Change BP and HR default behavior #602

Open
wants to merge 12 commits into
base: dev-Tomcat
Choose a base branch
from
2 changes: 1 addition & 1 deletion addons/breathing/CfgWeapons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class CfgWeapons {
picture = QPATHTOF(ui\steth.paa);
ACE_isMedicalItem = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 5;
mass = 6;
};
};

Expand Down
30 changes: 29 additions & 1 deletion addons/circulation/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
class ACE_Medical_Treatment_Actions {
class FieldDressing;
class Morphine;
class CheckPulse;
class Diagnose;
class CheckPulse: Diagnose {
callbackSuccess = QFUNC(checkPulse);
};
class CPR {
displayNameProgress = "";
treatmentTime = 0.01;
Expand All @@ -27,6 +30,31 @@ class ACE_Medical_Treatment_Actions {
};
class CheckBloodPressure: CheckPulse {
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
callbackSuccess = QFUNC(checkBloodPressure);
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationPatientUnconsciousExcludeOn[] = {"ainjppnemstpsnonwrfldnon", "kat_recoveryposition"};
};
class CheckBloodPressureCuff: CheckBloodPressure {
displayName = CSTRING(Actions_CheckBloodPressureCuff);
displayNameProgress = CSTRING(Actions_CheckingBloodPressureCuff);
treatmentTime = QGVAR(treatmentTime_BPcuff);
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
callbackSuccess = QFUNC(checkBloodPressureCuff);
medicRequired = QGVAR(medLvl_BPCuff);
items[] = {"kat_BPCuff"};
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationPatientUnconsciousExcludeOn[] = {"ainjppnemstpsnonwrfldnon", "kat_recoveryposition"};
};
class CheckPulseSteth: CheckPulse {
displayName = CSTRING(Actions_CheckHRSteth);
displayNameProgress = CSTRING(Actions_CheckingHRSteth);
treatmentTime = QGVAR(treatmentTime_StethHR);
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg", "Body"};
callbackSuccess = QFUNC(checkPulseSteth);
medicRequired = QGVAR(medLvl_StethHR);
items[] = {"kat_stethoscope"};
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationPatientUnconsciousExcludeOn[] = {"ainjppnemstpsnonwrfldnon", "kat_recoveryposition"};
Expand Down
11 changes: 11 additions & 0 deletions addons/circulation/CfgWeapons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@ class CfgWeapons {
mass = 0.1;
};
};
class kat_BPCuff: ACE_ItemCore {
scope = 2;
author = "Cplhardcore";
displayName = CSTRING(BPCuff_display);
descriptionShort = CSTRING(BPCuff_display);
picture = QPATHTOF(ui\BPCuff.paa);
icon = "";
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 8;
};
};
class KAT_bloodSample: ACE_ItemCore {
author = "Mazinski";
scope = 0;
Expand Down
10 changes: 9 additions & 1 deletion addons/circulation/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ PREP(attachBloodGas);
PREP(bloodType);
PREP(bloodTypeLog);
PREP(canDraw);
PREP(checkBloodPressure);
PREP(checkBloodPressureLocal);
PREP(checkBloodPressureCuff);
PREP(checkBloodPressureCuffLocal);
PREP(checkPulse);
PREP(checkPulseLocal);
PREP(checkPulseSteth);
PREP(checkPulseStethLocal);
PREP(compatible);
PREP(cprLocal);
PREP(CPRStart);
Expand Down Expand Up @@ -48,4 +56,4 @@ PREP(treatmentAdvanced_IV);
PREP(updateBloodPressureChange);
PREP(updateHeartRate);
PREP(updateInternalBleeding);
PREP(wrongBloodTreatment);
PREP(wrongBloodTreatment);
4 changes: 4 additions & 0 deletions addons/circulation/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

[QACEGVAR(medical_gui,updateBodyImage), LINKFUNC(gui_updateBodyImage)] call CBA_fnc_addEventHandler;
[QACEGVAR(medical_treatment,fullHealLocalMod), LINKFUNC(fullHealLocal)] call CBA_fnc_addEventHandler;
[QGVAR(checkBloodPressureLocal), LINKFUNC(checkBloodPressureLocal)] call CBA_fnc_addEventHandler;
[QGVAR(checkBloodPressureCuffLocal), LINKFUNC(checkBloodPressureCuffLocal)] call CBA_fnc_addEventHandler;
[QGVAR(checkPulseLocal), LINKFUNC(checkPulseLocal)] call CBA_fnc_addEventHandler;
[QGVAR(checkPulseStethLocal), LINKFUNC(checkPulseStethLocal)] call CBA_fnc_addEventHandler;
["ace_cardiacArrest", LINKFUNC(handleCardiacArrest)] call CBA_fnc_addEventHandler;

GVAR(AEDX_MonitorTarget) = objNull;
Expand Down
36 changes: 36 additions & 0 deletions addons/circulation/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -563,4 +563,40 @@ if (isServer) then {
true
] call CBA_Settings_fnc_init;

[
QGVAR(medLvl_BPCuff),
"LIST",
[LLSTRING(SETTING_BPCuff),LLSTRING(SETTING_BPCuff_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[[0, 1, 2], ["STR_ACE_Medical_Treatment_Anyone", "STR_ACE_Medical_Treatment_Medics", "STR_ACE_Medical_Treatment_Doctors"], 0],
true
] call CBA_settings_fnc_init;

[
QGVAR(treatmentTime_BPCuff),
"SLIDER",
[LLSTRING(treatmentTime_BPCuff)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[0.1, 30, 12, 1],
true
] call CBA_Settings_fnc_init;

[
QGVAR(medLvl_StethHR),
"LIST",
[LLSTRING(SETTING_StethHR),LLSTRING(SETTING_StethHR_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[[0, 1, 2], ["STR_ACE_Medical_Treatment_Anyone", "STR_ACE_Medical_Treatment_Medics", "STR_ACE_Medical_Treatment_Doctors"], 0],
true
] call CBA_settings_fnc_init;

[
QGVAR(treatmentTime_StethHR),
"SLIDER",
[LLSTRING(treatmentTime_StethHR)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[0.1, 30, 8, 1],
true
] call CBA_Settings_fnc_init;

ADDON = true;
22 changes: 22 additions & 0 deletions addons/circulation/functions/fnc_checkBloodPressure.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "..\script_component.hpp"
/*
* Author: Glowbal
* Checks the blood pressure of the patient.
*
* Arguments:
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
* 2: Body Part <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, cursorObject, "LeftArm"] call kat_circulation_fnc_checkBloodPressure
*
* Public: No
*/

params ["_medic", "_patient", "_bodyPart"];

[QGVAR(checkBloodPressureLocal), [_medic, _patient, _bodyPart], _patient] call CBA_fnc_targetEvent;
22 changes: 22 additions & 0 deletions addons/circulation/functions/fnc_checkBloodPressureCuff.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "..\script_component.hpp"
/*
* Author: Glowbal modified by Cplhardcore
* Checks the blood pressure of the patient.
*
* Arguments:
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
* 2: Body Part <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, cursorObject, "LeftArm"] call kat_circulation_fnc_checkBloodPressure
*
* Public: No
*/

params ["_medic", "_patient", "_bodyPart"];

[QGVAR(checkBloodPressureCuffLocal), [_medic, _patient, _bodyPart], _patient] call CBA_fnc_targetEvent;
41 changes: 41 additions & 0 deletions addons/circulation/functions/fnc_checkBloodPressureCuffLocal.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include "..\script_component.hpp"
/*
* Author: Glowbal modified by Cplhardcore
* Local callback for checking the blood pressure of a patient.
*
* Arguments:
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
* 2: Body Part <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, cursorObject, "LeftArm"] call kat_circulation_fnc_checkBloodPressureCuffLocal
*
* Public: No
*/


params ["_medic", "_patient", "_bodyPart"];

private _bloodPressure = [0, 0];

if (alive _patient && {!([_patient, _bodyPart] call ACEFUNC(medical_treatment,hasTourniquetAppliedTo))}) then {
_bloodPressure = [_patient] call FUNC(getBloodPressure);
};

private _bloodPressureOutput = ACELSTRING(medical_treatment,Check_Bloodpressure_Output_6);
private _logOutput = ACELSTRING(medical_treatment,Check_Bloodpressure_NoBloodpressure);

_bloodPressure params ["_bloodPressureLow", "_bloodPressureHigh"];

if (_bloodPressureHigh > 20) then {
_bloodPressureOutput = ACELSTRING(medical_treatment,Check_Bloodpressure_Output_1);
_logOutput = format ["%1/%2", round _bloodPressureHigh, round _bloodPressureLow];
};

[_patient, "quick_view", ACELSTRING(medical_treatment,Check_Bloodpressure_Log), [_medic call ACEFUNC(common,getName), _logOutput]] call ACEFUNC(medical_treatment,addToLog);

[QACEGVAR(common,displayTextStructured), [[_bloodPressureOutput, _patient call ACEFUNC(common,getName), round _bloodPressureHigh, round _bloodPressureLow], 1.75, _medic], _medic] call CBA_fnc_targetEvent;
57 changes: 57 additions & 0 deletions addons/circulation/functions/fnc_checkBloodPressureLocal.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include "..\script_component.hpp"
/*
* Author: Glowbal modified by Cplhardcore
* Local callback for checking the blood pressure of a patient.
*
* Arguments:
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
* 2: Body Part <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, cursorObject, "LeftArm"] call kat_circulation_fnc_checkBloodPressureLocal
*
* Public: No
*/

params ["_medic", "_patient", "_bodyPart"];

private _bloodPressure = [0, 0];

if (alive _patient && {!([_patient, _bodyPart] call ACEFUNC(medical_treatment,hasTourniquetAppliedTo))}) then {
_bloodPressure = [_patient] call FUNC(getBloodPressure);
};

private _bloodPressureOutput = ACELSTRING(medical_treatment,Check_Bloodpressure_Output_6);
private _logOutput = ACELSTRING(medical_treatment,Check_Bloodpressure_NoBloodpressure);

_bloodPressure params ["_bloodPressureLow", "_bloodPressureHigh"];

if (_bloodPressureLow > 40) then {
if (_medic call ACEFUNC(medical_treatment,isMedic)) then {
_bloodPressureOutput = LSTRING(Check_Bloodpressure_Output_Palp);
_logOutput = format [LLSTRING(Bloodpressure_Output_Palp), (round (_bloodPressureLow / 10) * 10) + ([10, -10] select (random 1 > 0.5))];
} else {
if (_bloodPressureHigh > 20) then {
_bloodPressureOutput = ACELSTRING(medical_treatment,Check_Bloodpressure_Output_2);
_logOutput = ACELSTRING(medical_treatment,Check_Bloodpressure_Low);

if (_bloodPressureHigh > 100) then {
_bloodPressureOutput = ACELSTRING(medical_treatment,Check_Bloodpressure_Output_3);
_logOutput = ACELSTRING(medical_treatment,Check_Bloodpressure_Normal);

if (_bloodPressureHigh > 160) then {
_bloodPressureOutput = ACELSTRING(medical_treatment,Check_Bloodpressure_Output_4);
_logOutput = ACELSTRING(medical_treatment,Check_Bloodpressure_High);
};
};
};
};
};

[_patient, "quick_view", ACELSTRING(medical_treatment,Check_Bloodpressure_Log), [_medic call ACEFUNC(common,getName), _logOutput]] call ACEFUNC(medical_treatment,addToLog);

[QACEGVAR(common,displayTextStructured), [[_bloodPressureOutput, _patient call ACEFUNC(common,getName), round _bloodPressureHigh, round _bloodPressureLow], 1.75, _medic], _medic] call CBA_fnc_targetEvent;
22 changes: 22 additions & 0 deletions addons/circulation/functions/fnc_checkPulse.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "..\script_component.hpp"
/*
* Author: Glowbal modified by Cplhardcore
* Checks the pulse or heart rate of the patient.
*
* Arguments:
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
* 2: Body Part <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, cursorObject, "Head"] call kat_circulation_fnc_checkPulse
*
* Public: No
*/

params ["_medic", "_patient", "_bodyPart"];

[QGVAR(checkPulseLocal), [_medic, _patient, _bodyPart], _patient] call CBA_fnc_targetEvent;
61 changes: 61 additions & 0 deletions addons/circulation/functions/fnc_checkPulseLocal.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#include "..\script_component.hpp"
/*
* Author: Glowbal
* Local callback for checking the pulse or heart rate of a patient.
*
* Arguments:
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
* 2: Body Part <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, cursorObject, "Head"] call ace_medical_treatment_fnc_checkPulseLocal
*
* Public: No
*/

params ["_medic", "_patient", "_bodyPart"];

private _heartRate = 0;

if !([_patient, _bodyPart] call ACEFUNC(medical_treatment,hasTourniquetAppliedTo)) then {
_heartRate = switch (true) do {
case (alive _patient): {
GET_HEART_RATE(_patient)
};
case (alive (_patient getVariable [QACEGVAR(medical,CPR_provider), objNull])): {
random [100, 110, 120] // fake heart rate because patient is dead and off state machine
};
default { 0 };
};
};

private _heartRateOutput = ACELSTRING(medical_treatment,Check_Pulse_Output_5);
private _logOutput = ACELSTRING(medical_treatment,Check_Pulse_None);

if (_heartRate > 1) then {
if (_medic call ACEFUNC(medical_treatment,isMedic)) then {
_heartRateOutput = LSTRING(Check_Pulse_Output);
_logOutput = format [LLSTRING(Pulse_Output), (round(_heartRateOutput / 5) * 5)];
} else {
_heartRateOutput = ACELSTRING(medical_treatment,Check_Pulse_Output_2);
_logOutput = ACELSTRING(medical_treatment,Check_Pulse_Weak);

if (_heartRate > 60) then {
if (_heartRate > 100) then {
_heartRateOutput = ACELSTRING(medical_treatment,Check_Pulse_Output_3);
_logOutput = ACELSTRING(medical_treatment,Check_Pulse_Strong);
} else {
_heartRateOutput = ACELSTRING(medical_treatment,Check_Pulse_Output_4);
_logOutput = ACELSTRING(medical_treatment,Check_Pulse_Normal);
};
};
};
};

[_patient, "quick_view", ACELSTRING(medical_treatment,Check_Pulse_Log), [_medic call ACEFUNC(common,getName), _logOutput]] call ACEFUNC(medical_treatment,addToLog);

[QEGVAR(common,displayTextStructured), [[_heartRateOutput, _patient call ACEFUNC(common,getName), round _heartRate], 1.5, _medic], _medic] call CBA_fnc_targetEvent;
Loading
Loading