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
24 changes: 24 additions & 0 deletions addons/circulation/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,30 @@ class ACE_Medical_Treatment_Actions {
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationPatientUnconsciousExcludeOn[] = {"ainjppnemstpsnonwrfldnon", "kat_recoveryposition"};
};
class CheckBloodPressureCuff: CheckPulse {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo should inherit from 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"};
};
class KAT_DrawBlood500: CheckPulse {
displayName = CSTRING(DrawBlood500_Action_Use);
displayNameProgress = CSTRING(DrawBlood_Action_Progress);
Expand Down
6 changes: 6 additions & 0 deletions addons/circulation/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ class CfgFunctions {
class cprSuccess {
file = QPATHTOF(functions\fnc_cprSuccess.sqf);
};
class CheckBloodPressure {
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
file = QPATHTOF(functions\fnc_checkBloodPressure.sqf);
};
class CheckPulse {
file = QPATHTOF(functions\fnc_checkPulse.sqf);
};
};
};
class overwrite_ace_medical_status {
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
8 changes: 8 additions & 0 deletions addons/circulation/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,11 @@ PREP(updateBloodPressureChange);
PREP(updateHeartRate);
PREP(updateInternalBleeding);
PREP(wrongBloodTreatment);
PREP(checkBloodPressure);
PREP(checkBloodPressureLocal);
PREP(checkBloodPressureCuff);
PREP(checkBloodPressureCuffLocal);
PREP(checkPulse);
PREP(checkPulseLocal);
PREP(checkPulseSteth);
PREP(checkPulseStethLocal);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PREP alphabetical order

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 @@ -561,4 +561,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];
};
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved

[_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 [localize "STR_KAT_Circulation_Bloodpressure_Output_Palp", round ((_bloodPressureLow / 10) * 10) + (if (random 1 > 0.5) then {10} else {-10})];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not using macro for this localization?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because i haven't learned how to do Macro's properly yet

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also ((_bloodPressureLow / 10) * 10)? Aren't you just undoing the division? Why not just pull _bloodPressureLow and then add the random?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also ((_bloodPressureLow / 10) * 10)? Aren't you just undoing the division? Why not just pull _bloodPressureLow and then add the random?

That parenthathese is in the wrong position, it should be (round (_bloodPressureLow / 10) * 10)

} 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 [25, 30, 35] // fake heart rate because patient is dead and off state machine
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt that show bigger number? 100-110 or smth like that we have defined for CPR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont have a heartrate defined for CPR, plus you are not going to get an accurate pulse rate when CPR is happening

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of course we have

_actualHeartRate = random [100, 110, 120];

};
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 [localize "STR_KAT_Circulation_Pulse_Output", round ((_heartRateOutput / 5) * 5)];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once again, whats the point of rounding it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can only get an approximation of the pulse by doing it via palp, so that's why there's a round

} 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;
22 changes: 22 additions & 0 deletions addons/circulation/functions/fnc_checkPulseSteth.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_checkPulseSteth
*
* Public: No
*/

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

[QGVAR(checkPulseStethLocal), [_medic, _patient, _bodyPart], _patient] call CBA_fnc_targetEvent;
Loading
Loading