diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 303834d1d0..f77fffd013 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -134,6 +134,28 @@ class ACE_Medical_Actions { callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_aidKit)); itemConsumed = 0; }; + class CheckPulse: fieldDressing { + treatmentLocations[] = {"All"}; + requiredMedic = 0; + treatmentTime = 2; + items[] = {}; + callbackSuccess = QUOTE(DFUNC(actionCheckPulse)); + callbackFailure = ""; + callbackProgress = ""; + animationPatient = ""; + animationCaller = ""; // TODO + itemConsumed = 0; + }; + class CheckBloodPressure: CheckPulse { + callbackSuccess = QUOTE(DFUNC(actionCheckBloodPressure)); + }; + class CheckResponse: CheckPulse { + callbackSuccess = QUOTE(DFUNC(actionCheckResponse)); + }; + class RemoveTourniquet: CheckPulse { + treatmentTime = 2.5; + callbackSuccess = QUOTE(DFUNC(actionRemoveTourniquet)); + }; }; }; diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 07daf04b5e..52eb9e78d3 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -40,6 +40,12 @@ PREP(treatmentTourniquetLocal); PREP(addToLog); PREP(addToTriageCard); PREP(actionPlaceInBodyBag); +PREP(actionCheckBloodPressure); +PREP(actionCheckBloodPressureLocal); +PREP(actionCheckPulse); +PREP(actionCheckPulseLocal); +PREP(actionCheckResponse); +PREP(actionRemoveTourniquet); PREP(onTreatmentCompleted); PREP(onMedicationUsed); PREP(reactionToDamage); diff --git a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf new file mode 100644 index 0000000000..c0f292db5d --- /dev/null +++ b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf @@ -0,0 +1,61 @@ +/* + * Author: Glowbal + * Local callback for checking the blood pressure of a patient + * + * Arguments: + * 0: The medic + * 1: The patient + * + * Return Value: + * NONE + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_caller","_target","_bloodPressure","_bloodPressureHigh","_bloodPressureLow","_title","_content"]; +_caller = _this select 0; +_target = _this select 1; + +_bloodPressure = [_target] call FUNC(getBloodPressure); +if (!alive _target) then { + _bloodPressure = [0,0]; +}; + +_bloodPressureHigh = _bloodPressure select 1; +_bloodPressureLow = _bloodPressure select 0; +_output = ""; +_logOutPut = ""; +if ([_caller] call FUNC(isMedic)) then { + _output = "STR_ACE_CHECK_BLOODPRESSURE_OUTPUT_1"; + _logOutPut = format["%1/%2",round(_bloodPressureHigh),round(_bloodPressureLow)]; +} else { + if (_bloodPressureHigh > 20) then { + _output = "STR_ACE_CHECK_BLOODPRESSURE_OUTPUT_2"; + _logOutPut = "Low"; + if (_bloodPressureHigh > 100) then { + _output = "STR_ACE_CHECK_BLOODPRESSURE_OUTPUT_3"; + _logOutPut = "Normal"; + if (_bloodPressureHigh > 160) then { + _output = "STR_ACE_CHECK_BLOODPRESSURE_OUTPUT_4"; + _logOutPut = "High"; + }; + + }; + } else { + if (random(10) > 3) then { + _output = "STR_ACE_CHECK_BLOODPRESSURE_OUTPUT_5"; + _logOutPut = "No Blood Pressure"; + } else { + _output = "STR_ACE_CHECK_BLOODPRESSURE_OUTPUT_6"; + }; + }; +}; + +// TODO build support in displayText for sending it across to a different client with localization + format support. +// [format[_output, [_target] call EFUNC(common,getName), round(_bloodPressureHigh),round(_bloodPressureLow)]] call EFUNC(common,displayTextStructured); + +if (_logOutPut != "") then { + [_target,"examine", format["%1 checked Blood Pressure: %2", [_caller] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); +}; diff --git a/addons/medical/functions/fnc_actionCheckPulse.sqf b/addons/medical/functions/fnc_actionCheckPulse.sqf new file mode 100644 index 0000000000..e55cf90e51 --- /dev/null +++ b/addons/medical/functions/fnc_actionCheckPulse.sqf @@ -0,0 +1,21 @@ +/* + * Author: Glowbal + * Action for checking the pulse or heart rate of the patient + * + * Arguments: + * 0: The medic + * 1: The patient + * + * Return Value: + * NONE + * + * Public: No + */ + + #include "script_component.hpp" + +private ["_caller","_target","_title","_content"]; +_caller = _this select 0; +_target = _this select 1; + +[[_caller, _target], QUOTE(FUNC(actionCheckPulseLocal)), _target] call EFUNC(common,execRemoteFnc); diff --git a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf new file mode 100644 index 0000000000..210b3193d6 --- /dev/null +++ b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf @@ -0,0 +1,55 @@ +/* + * Author: Glowbal + * Local callback for checking the pulse of a patient + * + * Arguments: + * 0: The medic + * 1: The patient + * + * Return Value: + * NONE + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_caller","_unit", "_heartRateOutput", "_heartRate","_logOutPut","_content"]; +_caller = _this select 0; +_unit = _this select 1; + + +_heartRate = [_unit,QGVAR(heartRate)] call EFUNC(common,getDefinedVariable); +if (!alive _unit) then { + _heartRate = 0; +}; +_heartRateOutput = "STR_ACE_CHECK_PULSE_OUTPUT_5"; +_logOutPut = "No heart rate"; + +if (_heartRate > 1.0) then { + if ([_caller] call FUNC(isMedic)) then { + _heartRateOutput = "STR_ACE_CHECK_PULSE_OUTPUT_1"; + _logOutPut = format["%1",round(_heartRate)]; + } else { + // non medical personel will only find a pulse/HR + _heartRateOutput = "STR_ACE_CHECK_PULSE_OUTPUT_2"; + _logOutPut = "Weak"; + if (_heartRate > 60) then { + if (_heartRate > 100) then { + _heartRateOutput = "STR_ACE_CHECK_PULSE_OUTPUT_3"; + _logOutPut = "Strong"; + } else { + _heartRateOutput = "STR_ACE_CHECK_PULSE_OUTPUT_4"; + _logOutPut = "Normal"; + }; + }; + }; +}; + +_content = ["STR_ACE_CHECK_PULSE_CHECKED_MEDIC",_heartRateOutput]; +// TODO build support in displayText for sending it across to a different client with localization + format support. +// [format[_content, [_unit] call EFUNC(common,getName), round(_heartRate)]] call EFUNC(common,displayTextStructured); + +if (_logOutPut != "") then { + [_unit,"examine",format["%1 checked Heart Rate: %2",[_caller] call EFUNC(common,getName),_logOutPut]] call FUNC(addToLog); +}; diff --git a/addons/medical/functions/fnc_actionCheckResponse.sqf b/addons/medical/functions/fnc_actionCheckResponse.sqf new file mode 100644 index 0000000000..47bdf1e8a5 --- /dev/null +++ b/addons/medical/functions/fnc_actionCheckResponse.sqf @@ -0,0 +1,29 @@ +/* + * Author: Glowbal + * Action for checking the response status of the patient + * + * Arguments: + * 0: The medic + * 1: The patient + * + * Return Value: + * NONE + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_caller","_target"]; +_caller = _this select 0; +_target = _this select 1; + +_output = ""; +if ([_target] call EFUNC(common,isAwake)) then { + _output = format[localize "STR_ACE_CHECK_REPONSE_RESPONSIVE",[_target] call EFUNC(common,getName)]; +} else { + _output = format[localize "STR_ACE_CHECK_REPONSE_UNRESPONSIVE",[_target] call EFUNC(common,getName)]; +}; + +[_output] call EFUNC(common,displayTextStructured); +[_target,"examine",_output] call FUNC(addToLog); diff --git a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf new file mode 100644 index 0000000000..0e75737e18 --- /dev/null +++ b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf @@ -0,0 +1,40 @@ +/* + * Author: Glowbal + * Action for removing the tourniquet on specified selection + * + * Arguments: + * 0: The medic + * 1: The patient + * 2: SelectionName + * + * Return Value: + * NONE + * + * Public: Yes + */ + +#include "script_component.hpp" + +private ["_caller","_target","_part","_selectionName","_removeItem","_tourniquets"]; +_caller = _this select 0; +_target = _this select 1; +_selectionName = _this select 2; + +// grab the required data +_part = [_selectionName] call FUNC(selectionNameToNumber); +_tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; + +// Check if there is a tourniquet on this bodypart +if ((_tourniquets select _part) == 0) exitwith { + // TODO localization + ["There is no tourniquet on this body part!"] call EFUNC(common,displayTextStructured); +}; + +// Removing the tourniquet +_tourniquets set[_part, 0]; +_target setvariable [QGVAR(tourniquets), _tourniquets, true]; + +// Adding the tourniquet item to the caller +_caller addItem "ACE_tourniquet"; + +// "AinvPknlMstpSlayWrflDnon_medic diff --git a/addons/medical/functions/fnc_actioncheckBloodPressure.sqf b/addons/medical/functions/fnc_actioncheckBloodPressure.sqf new file mode 100644 index 0000000000..37c28c86c9 --- /dev/null +++ b/addons/medical/functions/fnc_actioncheckBloodPressure.sqf @@ -0,0 +1,21 @@ +/* + * Author: Glowbal + * Action for checking the blood pressure of the patient + * + * Arguments: + * 0: The medic + * 1: The patient + * + * Return Value: + * NONE + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_caller","_target"]; +_caller = _this select 0; +_target = _this select 1; + +[[_caller, _target], QUOTE(DFUNC(actionCheckBloodPressureLocal)), _target] call EFUNC(common,execRemoteFnc);