From 0155c435bd97aac67c1ff9ee21d8245ed5eff63c Mon Sep 17 00:00:00 2001 From: mharis001 Date: Thu, 11 Apr 2019 07:25:20 -0400 Subject: [PATCH] Modernize and cleanup medical_treatment --- addons/common/stringtable.xml | 2 +- addons/medical/XEH_preInit.sqf | 3 +- addons/medical/initSettings.sqf | 2 +- addons/medical/script_component.hpp | 2 +- addons/medical/stringtable.xml | 2 +- .../functions/fnc_playTreatmentAnim.sqf | 2 +- addons/medical_blood/initSettings.sqf | 2 +- addons/medical_damage/initSettings.sqf | 2 +- addons/medical_feedback/initSettings.sqf | 2 +- addons/medical_gui/CfgVehicles.hpp | 2 +- addons/medical_gui/initSettings.sqf | 10 +- addons/medical_gui/stringtable.xml | 4 +- addons/medical_statemachine/initSettings.sqf | 2 +- addons/medical_status/initSettings.sqf | 2 +- .../ACE_Medical_Treatment.hpp | 10 +- .../ACE_Medical_Treatment_Actions.hpp | 203 ++--- .../{CfgEden.hpp => Cfg3DEN.hpp} | 57 +- addons/medical_treatment/CfgWeapons.hpp | 59 +- addons/medical_treatment/XEH_PREP.hpp | 43 +- addons/medical_treatment/XEH_postInit.sqf | 6 +- addons/medical_treatment/XEH_preInit.sqf | 19 + addons/medical_treatment/config.cpp | 2 +- .../fnc_actionCheckBloodPressure.sqf | 21 - .../fnc_actionCheckBloodPressureLocal.sqf | 57 -- .../functions/fnc_actionCheckPulse.sqf | 21 - .../functions/fnc_actionCheckPulseLocal.sqf | 54 -- .../functions/fnc_actionCheckResponse.sqf | 26 - .../functions/fnc_actionDiagnose.sqf | 45 -- .../functions/fnc_addToLog.sqf | 47 +- .../functions/fnc_addToTriageCard.sqf | 41 +- .../functions/fnc_bandage.sqf | 25 + ...tBandageLocal.sqf => fnc_bandageLocal.sqf} | 29 +- .../fnc_canAccessMedicalEquipment.sqf | 28 - .../functions/fnc_canBandage.sqf | 16 +- .../functions/fnc_canTreat.sqf | 129 +-- .../functions/fnc_canTreatCached.sqf | 17 +- .../functions/fnc_checkBloodPressure.sqf | 22 + .../functions/fnc_checkBloodPressureLocal.sqf | 57 ++ .../functions/fnc_checkItems.sqf | 2 +- .../functions/fnc_checkPulse.sqf | 22 + .../functions/fnc_checkPulseLocal.sqf | 53 ++ .../functions/fnc_checkResponse.sqf | 24 + .../functions/fnc_createLitter.sqf | 70 ++ .../functions/fnc_createLitterServer.sqf | 59 ++ .../functions/fnc_diagnose.sqf | 49 ++ .../functions/fnc_getTriageStatus.sqf | 10 +- .../functions/fnc_hasItem.sqf | 41 +- .../functions/fnc_hasItems.sqf | 36 - .../functions/fnc_hasTourniquetAppliedTo.sqf | 10 +- .../functions/fnc_isInMedicalFacility.sqf | 56 +- .../functions/fnc_isInMedicalVehicle.sqf | 11 +- .../functions/fnc_isMedic.sqf | 17 +- .../functions/fnc_isMedicalVehicle.sqf | 8 +- .../medical_treatment/functions/fnc_ivBag.sqf | 28 + .../functions/fnc_ivBagLocal.sqf | 38 + .../functions/fnc_litterCleanupLoop.sqf | 35 +- .../functions/fnc_litterCreate.sqf | 98 --- .../functions/fnc_litterHandleCreate.sqf | 68 -- .../functions/fnc_medication.sqf | 28 + .../functions/fnc_medicationLocal.sqf | 69 ++ .../functions/fnc_surgicalKitProgress.sqf | 38 + .../functions/fnc_tourniquet.sqf | 33 + .../functions/fnc_tourniquetLocal.sqf | 25 + .../functions/fnc_tourniquetRemove.sqf | 55 ++ .../functions/fnc_treatment.sqf | 220 ++---- .../functions/fnc_treatmentBandage.sqf | 26 - .../functions/fnc_treatmentFailure.sqf | 46 ++ .../functions/fnc_treatmentIV.sqf | 31 - .../functions/fnc_treatmentIVLocal.sqf | 48 -- .../functions/fnc_treatmentMedication.sqf | 34 - .../fnc_treatmentMedicationLocal.sqf | 107 --- .../functions/fnc_treatmentSuccess.sqf | 47 ++ .../fnc_treatmentSurgicalKit_onProgress.sqf | 39 - .../functions/fnc_treatmentTourniquet.sqf | 40 - .../fnc_treatmentTourniquetLocal.sqf | 26 - .../fnc_treatmentTourniquetRemove.sqf | 54 -- .../functions/fnc_treatment_failure.sqf | 56 -- .../functions/fnc_treatment_success.sqf | 71 -- .../functions/fnc_useItem.sqf | 47 +- .../functions/fnc_useItems.sqf | 50 -- addons/medical_treatment/initSettings.sqf | 371 +++++---- addons/medical_treatment/script_component.hpp | 37 +- addons/medical_treatment/stringtable.xml | 740 ++++++------------ .../adenosine_x_ca.paa => adenosine_ca.paa} | Bin .../atropine_x_ca.paa => atropine_ca.paa} | Bin .../bloodiv_x_ca.paa => bloodiv_ca.paa} | Bin .../bodybag_x_ca.paa => bodybag_ca.paa} | Bin ...bandage_x_ca.paa => elasticbandage_ca.paa} | Bin ...pinephrine_x_ca.paa => epinephrine_ca.paa} | Bin ...dressing_x_ca.paa => fielddressing_ca.paa} | Bin .../morphine_x_ca.paa => morphine_ca.paa} | Bin ...bandage_x_ca.paa => packingbandage_ca.paa} | Bin ...d_kit_x_ca.paa => personal_aid_kit_ca.paa} | Bin .../plasmaiv_x_ca.paa => plasmaiv_ca.paa} | Bin .../quickclot_x_ca.paa => quickclot_ca.paa} | Bin .../salineiv_x_ca.paa => salineiv_ca.paa} | Bin ...urgicalkit_x_ca.paa => surgicalkit_ca.paa} | Bin .../tourniquet_x_ca.paa => tourniquet_ca.paa} | Bin 98 files changed, 1763 insertions(+), 2383 deletions(-) rename addons/medical_treatment/{CfgEden.hpp => Cfg3DEN.hpp} (60%) delete mode 100644 addons/medical_treatment/functions/fnc_actionCheckBloodPressure.sqf delete mode 100644 addons/medical_treatment/functions/fnc_actionCheckBloodPressureLocal.sqf delete mode 100644 addons/medical_treatment/functions/fnc_actionCheckPulse.sqf delete mode 100644 addons/medical_treatment/functions/fnc_actionCheckPulseLocal.sqf delete mode 100644 addons/medical_treatment/functions/fnc_actionCheckResponse.sqf delete mode 100644 addons/medical_treatment/functions/fnc_actionDiagnose.sqf create mode 100644 addons/medical_treatment/functions/fnc_bandage.sqf rename addons/medical_treatment/functions/{fnc_treatmentBandageLocal.sqf => fnc_bandageLocal.sqf} (54%) delete mode 100644 addons/medical_treatment/functions/fnc_canAccessMedicalEquipment.sqf create mode 100644 addons/medical_treatment/functions/fnc_checkBloodPressure.sqf create mode 100644 addons/medical_treatment/functions/fnc_checkBloodPressureLocal.sqf create mode 100644 addons/medical_treatment/functions/fnc_checkPulse.sqf create mode 100644 addons/medical_treatment/functions/fnc_checkPulseLocal.sqf create mode 100644 addons/medical_treatment/functions/fnc_checkResponse.sqf create mode 100644 addons/medical_treatment/functions/fnc_createLitter.sqf create mode 100644 addons/medical_treatment/functions/fnc_createLitterServer.sqf create mode 100644 addons/medical_treatment/functions/fnc_diagnose.sqf delete mode 100644 addons/medical_treatment/functions/fnc_hasItems.sqf create mode 100644 addons/medical_treatment/functions/fnc_ivBag.sqf create mode 100644 addons/medical_treatment/functions/fnc_ivBagLocal.sqf delete mode 100644 addons/medical_treatment/functions/fnc_litterCreate.sqf delete mode 100644 addons/medical_treatment/functions/fnc_litterHandleCreate.sqf create mode 100644 addons/medical_treatment/functions/fnc_medication.sqf create mode 100644 addons/medical_treatment/functions/fnc_medicationLocal.sqf create mode 100644 addons/medical_treatment/functions/fnc_surgicalKitProgress.sqf create mode 100644 addons/medical_treatment/functions/fnc_tourniquet.sqf create mode 100644 addons/medical_treatment/functions/fnc_tourniquetLocal.sqf create mode 100644 addons/medical_treatment/functions/fnc_tourniquetRemove.sqf delete mode 100644 addons/medical_treatment/functions/fnc_treatmentBandage.sqf create mode 100644 addons/medical_treatment/functions/fnc_treatmentFailure.sqf delete mode 100644 addons/medical_treatment/functions/fnc_treatmentIV.sqf delete mode 100644 addons/medical_treatment/functions/fnc_treatmentIVLocal.sqf delete mode 100644 addons/medical_treatment/functions/fnc_treatmentMedication.sqf delete mode 100644 addons/medical_treatment/functions/fnc_treatmentMedicationLocal.sqf create mode 100644 addons/medical_treatment/functions/fnc_treatmentSuccess.sqf delete mode 100644 addons/medical_treatment/functions/fnc_treatmentSurgicalKit_onProgress.sqf delete mode 100644 addons/medical_treatment/functions/fnc_treatmentTourniquet.sqf delete mode 100644 addons/medical_treatment/functions/fnc_treatmentTourniquetLocal.sqf delete mode 100644 addons/medical_treatment/functions/fnc_treatmentTourniquetRemove.sqf delete mode 100644 addons/medical_treatment/functions/fnc_treatment_failure.sqf delete mode 100644 addons/medical_treatment/functions/fnc_treatment_success.sqf delete mode 100644 addons/medical_treatment/functions/fnc_useItems.sqf rename addons/medical_treatment/ui/{items/adenosine_x_ca.paa => adenosine_ca.paa} (100%) rename addons/medical_treatment/ui/{items/atropine_x_ca.paa => atropine_ca.paa} (100%) rename addons/medical_treatment/ui/{items/bloodiv_x_ca.paa => bloodiv_ca.paa} (100%) rename addons/medical_treatment/ui/{items/bodybag_x_ca.paa => bodybag_ca.paa} (100%) rename addons/medical_treatment/ui/{items/elasticbandage_x_ca.paa => elasticbandage_ca.paa} (100%) rename addons/medical_treatment/ui/{items/epinephrine_x_ca.paa => epinephrine_ca.paa} (100%) rename addons/medical_treatment/ui/{items/fielddressing_x_ca.paa => fielddressing_ca.paa} (100%) rename addons/medical_treatment/ui/{items/morphine_x_ca.paa => morphine_ca.paa} (100%) rename addons/medical_treatment/ui/{items/packingbandage_x_ca.paa => packingbandage_ca.paa} (100%) rename addons/medical_treatment/ui/{items/personal_aid_kit_x_ca.paa => personal_aid_kit_ca.paa} (100%) rename addons/medical_treatment/ui/{items/plasmaiv_x_ca.paa => plasmaiv_ca.paa} (100%) rename addons/medical_treatment/ui/{items/quickclot_x_ca.paa => quickclot_ca.paa} (100%) rename addons/medical_treatment/ui/{items/salineiv_x_ca.paa => salineiv_ca.paa} (100%) rename addons/medical_treatment/ui/{items/surgicalkit_x_ca.paa => surgicalkit_ca.paa} (100%) rename addons/medical_treatment/ui/{items/tourniquet_x_ca.paa => tourniquet_ca.paa} (100%) diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index 303064ef3a..2e514bd5e8 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -1030,7 +1030,7 @@ 기본 - Medical vehicles + Medical Vehicles В медицинском транспорте Pojazdy medyczne Vehiculos médicos diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index aac77adab9..b17dbb52e2 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -11,7 +11,6 @@ PREP_RECOMPILE_END; // Add warning for old functions that were technically public, Remove at 3.14.0 { missionNamespace setVariable [_x, compileFinal format ['diag_log text "ACE Medical WARNING: Formerly public function [%1] has no effect in medical rewrite."; nil', _x]]; -} forEach ["ace_medical_fnc_actionPlaceInBodyBag","ace_medical_fnc_actionRemoveTourniquet","ace_medical_fnc_addHeartRateAdjustment","ace_medical_fnc_addToLog","ace_medical_fnc_addToTriageCard -","ace_medical_fnc_addUnconsciousCondition","ace_medical_fnc_addVitalLoop","ace_medical_fnc_canAccessMedicalEquipment","ace_medical_fnc_canTreat","ace_medical_fnc_displayTriageCard","ace_medical_fnc_dropDownTriageCard","ace_medical_fnc_getTriageStatus","ace_medical_fnc_getUnconsciousCondition","ace_medical_fnc_hasItem","ace_medical_fnc_hasItems","ace_medical_fnc_hasTourniquetAppliedTo","ace_medical_fnc_isInMedicalFacility","ace_medical_fnc_isInMedicalVehicle","ace_medical_fnc_isMedic","ace_medical_fnc_isMedicalVehicle","ace_medical_fnc_itemCheck","ace_medical_fnc_selectionNameToNumber","ace_medical_fnc_setCardiacArrest","ace_medical_fnc_setDead","ace_medical_fnc_setHitPointDamage","ace_medical_fnc_showBloodEffect","ace_medical_fnc_treatment","ace_medical_fnc_treatmentAdvanced_bandage","ace_medical_fnc_treatmentAdvanced_CPR","ace_medical_fnc_treatmentAdvanced_CPRLocal","ace_medical_fnc_treatmentAdvanced_medication","ace_medical_fnc_treatmentAdvanced_medicationLocal","ace_medical_fnc_treatmentIV","ace_medical_fnc_treatmentIVLocal","ace_medical_fnc_unconsciousPFH","ace_medical_fnc_useItem","ace_medical_fnc_useItems"]; +} forEach ["ace_medical_fnc_actionPlaceInBodyBag","ace_medical_fnc_actionRemoveTourniquet","ace_medical_fnc_addHeartRateAdjustment","ace_medical_fnc_addToLog","ace_medical_fnc_addToTriageCard","ace_medical_fnc_addUnconsciousCondition","ace_medical_fnc_addVitalLoop","ace_medical_fnc_canAccessMedicalEquipment","ace_medical_fnc_canTreat","ace_medical_fnc_displayTriageCard","ace_medical_fnc_dropDownTriageCard","ace_medical_fnc_getTriageStatus","ace_medical_fnc_getUnconsciousCondition","ace_medical_fnc_hasItem","ace_medical_fnc_hasItems","ace_medical_fnc_hasTourniquetAppliedTo","ace_medical_fnc_isInMedicalFacility","ace_medical_fnc_isInMedicalVehicle","ace_medical_fnc_isMedic","ace_medical_fnc_isMedicalVehicle","ace_medical_fnc_itemCheck","ace_medical_fnc_selectionNameToNumber","ace_medical_fnc_setCardiacArrest","ace_medical_fnc_setDead","ace_medical_fnc_setHitPointDamage","ace_medical_fnc_showBloodEffect","ace_medical_fnc_treatment","ace_medical_fnc_treatmentAdvanced_bandage","ace_medical_fnc_treatmentAdvanced_CPR","ace_medical_fnc_treatmentAdvanced_CPRLocal","ace_medical_fnc_treatmentAdvanced_medication","ace_medical_fnc_treatmentAdvanced_medicationLocal","ace_medical_fnc_treatmentIV","ace_medical_fnc_treatmentIVLocal","ace_medical_fnc_unconsciousPFH","ace_medical_fnc_useItem","ace_medical_fnc_useItems"]; ADDON = true; diff --git a/addons/medical/initSettings.sqf b/addons/medical/initSettings.sqf index 0ae2c0e9f1..ea61eec532 100644 --- a/addons/medical/initSettings.sqf +++ b/addons/medical/initSettings.sqf @@ -1,6 +1,6 @@ // CBA Settings [ADDON: ace_medical]: -private _categoryArray = [LELSTRING(medical,Category_DisplayName), "?"]; +private _categoryArray = [LELSTRING(medical,Category), "?"]; // todo: Check the description is still accurate [ diff --git a/addons/medical/script_component.hpp b/addons/medical/script_component.hpp index d29a19b332..be9b76ee68 100644 --- a/addons/medical/script_component.hpp +++ b/addons/medical/script_component.hpp @@ -2,7 +2,7 @@ #define COMPONENT_BEAUTIFIED Medical Core #include "\z\ace\addons\main\script_mod.hpp" -// #define DEBUG_MODE_FULL +#define DEBUG_MODE_FULL // #define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 081e000d92..d20f6a9e17 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -1,7 +1,7 @@ - + ACE Medical ACE: медицина ACE Opcje medyczne diff --git a/addons/medical_ai/functions/fnc_playTreatmentAnim.sqf b/addons/medical_ai/functions/fnc_playTreatmentAnim.sqf index 72a4116137..0a2587cd00 100644 --- a/addons/medical_ai/functions/fnc_playTreatmentAnim.sqf +++ b/addons/medical_ai/functions/fnc_playTreatmentAnim.sqf @@ -26,7 +26,7 @@ private _animConfig = if (_isBandage) then { configFile >> "ACE_Medical_Actions" >> "Basic" >> "Morphine"; }; -private _configProperty = "animationCaller"; +private _configProperty = "animationMedic"; if (_isSelfTreatment) then { _configProperty = _configProperty + "Self"; }; diff --git a/addons/medical_blood/initSettings.sqf b/addons/medical_blood/initSettings.sqf index e743002ffa..2ba5edccbf 100644 --- a/addons/medical_blood/initSettings.sqf +++ b/addons/medical_blood/initSettings.sqf @@ -1,6 +1,6 @@ // CBA Settings [ADDON: ace_medical_blood]: -private _categoryArray = [LELSTRING(medical,Category_DisplayName), LLSTRING(subCategory)]; +private _categoryArray = [LELSTRING(medical,Category), LLSTRING(subCategory)]; [ QGVAR(enabledFor), "LIST", diff --git a/addons/medical_damage/initSettings.sqf b/addons/medical_damage/initSettings.sqf index 88a1283cf7..0982be17d2 100644 --- a/addons/medical_damage/initSettings.sqf +++ b/addons/medical_damage/initSettings.sqf @@ -1,6 +1,6 @@ // CBA Settings [ADDON: ace_medical_damage]: -private _categoryArray = [LELSTRING(medical,Category_DisplayName), LLSTRING(subCategory)]; +private _categoryArray = [LELSTRING(medical,Category), LLSTRING(subCategory)]; [ QEGVAR(medical,playerDamageThreshold), "SLIDER", diff --git a/addons/medical_feedback/initSettings.sqf b/addons/medical_feedback/initSettings.sqf index 9dd0e957c4..e22a953f76 100644 --- a/addons/medical_feedback/initSettings.sqf +++ b/addons/medical_feedback/initSettings.sqf @@ -1,6 +1,6 @@ // CBA Settings [ADDON: ace_medical_feedback]: -private _categoryArray = [LELSTRING(medical,Category_DisplayName), LLSTRING(subCategory)]; +private _categoryArray = [LELSTRING(medical,Category), LLSTRING(subCategory)]; [ QGVAR(painEffectType), diff --git a/addons/medical_gui/CfgVehicles.hpp b/addons/medical_gui/CfgVehicles.hpp index 3d11924bf3..7b41c5f4ca 100644 --- a/addons/medical_gui/CfgVehicles.hpp +++ b/addons/medical_gui/CfgVehicles.hpp @@ -44,7 +44,7 @@ class CfgVehicles { #include "InteractionBodyParts.hpp" #undef ACTION_CONDITION }; - class ACE_LoadPatient { + class ACE_LoadPatient { displayName = CSTRING(LoadPatient); condition = QUOTE(_target getVariable [ARR_2('ACE_isUnconscious',false)] && {alive _target} && {vehicle _target == _target}); exceptions[] = {"isNotDragging", "isNotCarrying"}; diff --git a/addons/medical_gui/initSettings.sqf b/addons/medical_gui/initSettings.sqf index 6066d073af..245b3fd5ca 100644 --- a/addons/medical_gui/initSettings.sqf +++ b/addons/medical_gui/initSettings.sqf @@ -2,7 +2,7 @@ QGVAR(enableActions), "LIST", [LSTRING(EnableActions_DisplayName), LSTRING(EnableActions_Description)], - LSTRING(Category), + [ELSTRING(medical,Category), LSTRING(SubCategory)], [[0, 1, 2], [LSTRING(Selections3D), LSTRING(Radial), ELSTRING(common,Disabled)], 0], false ] call CBA_settings_fnc_init; @@ -11,7 +11,7 @@ QGVAR(enableSelfActions), "CHECKBOX", [LSTRING(EnableSelfActions_DisplayName), LSTRING(EnableSelfActions_Description)], - LSTRING(Category), + [ELSTRING(medical,Category), LSTRING(SubCategory)], true, false ] call CBA_settings_fnc_init; @@ -20,7 +20,7 @@ QGVAR(enableMedicalMenu), "LIST", [LSTRING(EnableMedicalMenu_DisplayName), LSTRING(EnableMedicalMenu_Description)], - LSTRING(Category), + [ELSTRING(medical,Category), LSTRING(SubCategory)], [[0, 1, 2], [ELSTRING(common,Disabled), ELSTRING(common,Enabled), ELSTRING(common,VehiclesOnly)], 1], false ] call CBA_settings_fnc_init; @@ -29,7 +29,7 @@ QGVAR(openAfterTreatment), "CHECKBOX", [LSTRING(OpenAfterTreatment_DisplayName), LSTRING(OpenAfterTreatment_Description)], - LSTRING(Category), + [ELSTRING(medical,Category), LSTRING(SubCategory)], true, false ] call CBA_settings_fnc_init; @@ -38,7 +38,7 @@ QGVAR(maxDistance), "SLIDER", [LSTRING(MaxDistance_DisplayName), LSTRING(MaxDistance_Description)], - LSTRING(Category), + [ELSTRING(medical,Category), LSTRING(SubCategory)], [0, 10, 3, 1], false ] call CBA_settings_fnc_init; diff --git a/addons/medical_gui/stringtable.xml b/addons/medical_gui/stringtable.xml index 3359f08bd5..2703cfacc5 100644 --- a/addons/medical_gui/stringtable.xml +++ b/addons/medical_gui/stringtable.xml @@ -1,8 +1,8 @@ - - ACE Medical GUI + + GUI Enable Medical Actions diff --git a/addons/medical_statemachine/initSettings.sqf b/addons/medical_statemachine/initSettings.sqf index 268902a0f1..34f5b487bb 100644 --- a/addons/medical_statemachine/initSettings.sqf +++ b/addons/medical_statemachine/initSettings.sqf @@ -1,6 +1,6 @@ // CBA Settings [ADDON: ace_medical_statemachine]: -private _categoryArray = [LELSTRING(medical,Category_DisplayName), LLSTRING(subCategory)]; +private _categoryArray = [LELSTRING(medical,Category), LLSTRING(subCategory)]; [ QGVAR(fatalInjuryCondition), "LIST", diff --git a/addons/medical_status/initSettings.sqf b/addons/medical_status/initSettings.sqf index 1118973f37..32d6193a7d 100644 --- a/addons/medical_status/initSettings.sqf +++ b/addons/medical_status/initSettings.sqf @@ -1,6 +1,6 @@ // CBA Settings [ADDON: ace_medical_status]: -private _categoryArray = [LELSTRING(medical,Category_DisplayName), LLSTRING(subCategory)]; +private _categoryArray = [LELSTRING(medical,Category), LLSTRING(subCategory)]; [ QEGVAR(medical,bleedingCoefficient), "SLIDER", diff --git a/addons/medical_treatment/ACE_Medical_Treatment.hpp b/addons/medical_treatment/ACE_Medical_Treatment.hpp index 88a2e46663..d09713f0d2 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment.hpp @@ -582,7 +582,7 @@ class ADDON { timeInSystem = 1800; timeTillMaxEffect = 30; maxDose = 4; - inCompatableMedication[] = {}; + incompatableMedication[] = {}; viscosityChange = -10; }; class Epinephrine { @@ -593,7 +593,7 @@ class ADDON { timeInSystem = 120; timeTillMaxEffect = 10; maxDose = 10; - inCompatableMedication[] = {}; + incompatableMedication[] = {}; }; class Adenosine { painReduce = 0; @@ -603,7 +603,7 @@ class ADDON { timeInSystem = 120; timeTillMaxEffect = 15; maxDose = 6; - inCompatableMedication[] = {}; + incompatableMedication[] = {}; }; class Atropine { painReduce = 0; @@ -613,14 +613,14 @@ class ADDON { timeInSystem = 120; timeTillMaxEffect = 15; maxDose = 6; - inCompatableMedication[] = {}; + incompatableMedication[] = {}; }; class PainKillers { painReduce = 0.1; timeInSystem = 600; timeTillMaxEffect = 60; maxDose = 10; - inCompatableMedication[] = {}; + incompatableMedication[] = {}; viscosityChange = 5; }; }; diff --git a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp index a66379e3a0..47bc429f1f 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp @@ -1,39 +1,46 @@ - -class GVAR(Actions) { - // --- bandages +class GVAR(actions) { + // - Bandages ------------------------------------------------------------- class BasicBandage { displayName = CSTRING(Bandage); displayNameProgress = CSTRING(Bandaging); icon = QPATHTOEF(medical_gui,ui\bandage.paa); category = "bandage"; - treatmentLocations[] = {"All"}; - allowedSelections[] = {"All"}; - allowSelfTreatment = 1; - requiredMedic = 0; - treatmentTime = QFUNC(getBandageTime); - treatmentTimeSelfCoef = 1; - items[] = {{"ACE_fieldDressing", "ACE_packingBandage", "ACE_elasticBandage", "ACE_quikclot"}}; - condition = QFUNC(canBandage); - itemConsumed = 1; - callbackSuccess = QFUNC(treatmentBandage); - callbackFailure = ""; - callbackProgress = ""; - animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medicOther"; - animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther"; - animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic"; - animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; + consumeItem = 1; + items[] = {"ACE_fieldDressing", "ACE_packingBandage", "ACE_elasticBandage", "ACE_quikclot"}; + + medicRequired = 0; + allowSelfTreatment = 1; + allowedSelections[] = {"All"}; + condition = QFUNC(canBandage); + treatmentLocations = TREATMENT_LOCATIONS_ALL; + + treatmentTime = QFUNC(getBandageTime); + treatmentTimeSelfCoef = 1; // todo: this isn't used anywhere, remove? + + callbackStart = ""; + callbackProgress = ""; + callbackSuccess = QFUNC(bandage); + callbackFailure = ""; + + animationMedic = "AinvPknlMstpSlayW[wpn]Dnon_medicOther"; + animationMedicProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther"; + animationMedicSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic"; + animationMedicSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; + litter[] = { - {"All", "_bloodLossOnBodyPart > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, - {"All", "_bloodLossOnBodyPart <= 0", {"ACE_MedicalLitter_clean"}} + {}, + {"ACE_MedicalLitter_clean"}, + {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}} }; }; class FieldDressing: BasicBandage { displayName = CSTRING(Actions_FieldDressing); items[] = {"ACE_fieldDressing"}; litter[] = { - {"All", "_bloodLossOnBodyPart > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, - {"All", "_bloodLossOnBodyPart <= 0", {"ACE_MedicalLitter_clean"}} + {}, + {"ACE_MedicalLitter_clean"}, + {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}} }; }; class PackingBandage: BasicBandage { @@ -41,50 +48,51 @@ class GVAR(Actions) { icon = QPATHTOEF(medical_gui,ui\packing_bandage.paa); items[] = {"ACE_packingBandage"}; litter[] = { - {"All", "", {"ACE_MedicalLitter_packingBandage"}}, - {"All", "_bloodLossOnBodyPart > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, - {"All", "_bloodLossOnBodyPart <= 0", {"ACE_MedicalLitter_clean"}} + {"ACE_MedicalLitter_packingBandage"}, + {"ACE_MedicalLitter_clean"}, + {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}} }; }; class ElasticBandage: BasicBandage { displayName = CSTRING(Actions_ElasticBandage); items[] = {"ACE_elasticBandage"}; litter[] = { - {"All", "_bloodLossOnBodyPart > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, - {"All", "_bloodLossOnBodyPart <= 0", {"ACE_MedicalLitter_clean"}} + {}, + {"ACE_MedicalLitter_clean"}, + {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}} }; }; class QuikClot: BasicBandage { displayName = CSTRING(Actions_QuikClot); items[] = {"ACE_quikclot"}; litter[] = { - {"All", "", {"ACE_MedicalLitter_QuickClot"}}, - {"All", "_bloodLossOnBodyPart > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, - {"All", "_bloodLossOnBodyPart <= 0", {"ACE_MedicalLitter_clean"}} + {"ACE_MedicalLitter_QuickClot"}, + {"ACE_MedicalLitter_clean"}, + {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}} }; }; - // --- tourniquet - class Tourniquet: BasicBandage { + // - Tourniquets ---------------------------------------------------------- + class ApplyTourniquet: BasicBandage { displayName = CSTRING(Apply_Tourniquet); displayNameProgress = CSTRING(Applying_Tourniquet); icon = QPATHTOEF(medical_gui,ui\tourniquet.paa); allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"}; items[] = {"ACE_tourniquet"}; treatmentTime = 7; - callbackSuccess = QFUNC(treatmentTourniquet); - condition = QUOTE(!([ARR_2(_target,_bodyPart)] call FUNC(hasTourniquetAppliedTo))); + condition = QUOTE(!([ARR_2(_patient,_bodyPart)] call FUNC(hasTourniquetAppliedTo))); + callbackSuccess = QFUNC(tourniquet); litter[] = {}; }; - class RemoveTourniquet: Tourniquet { + class RemoveTourniquet: ApplyTourniquet { displayName = CSTRING(Actions_RemoveTourniquet); displayNameProgress = CSTRING(RemovingTourniquet); items[] = {}; - callbackSuccess = QFUNC(treatmentTourniquetRemove); - condition = QUOTE([ARR_2(_target,_bodyPart)] call FUNC(hasTourniquetAppliedTo)); + condition = QUOTE([ARR_2(_patient,_bodyPart)] call FUNC(hasTourniquetAppliedTo)); + callbackSuccess = QFUNC(tourniquetRemove); }; - // --- syringes + // - Syringes ------------------------------------------------------------- class Morphine: FieldDressing { displayName = CSTRING(Inject_Morphine); displayNameProgress = CSTRING(Injecting_Morphine); @@ -95,34 +103,34 @@ class GVAR(Actions) { condition = ""; treatmentTime = 5; callbackSuccess = QFUNC(treatmentMedication); - animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; - litter[] = { {"All", "", {"ACE_MedicalLitter_morphine"}} }; + animationMedic = "AinvPknlMstpSnonWnonDnon_medic1"; sounds[] = {{QPATHTO_R(sounds\Inject.ogg),1,1,50}}; + litter[] = {{"ACE_MedicalLitter_morphine"}}; }; class Adenosine: Morphine { displayName = CSTRING(Inject_Adenosine); displayNameProgress = CSTRING(Injecting_Adenosine); condition = QGVAR(advancedMedication); items[] = {"ACE_adenosine"}; - litter[] = { {"All", "", {"ACE_MedicalLitter_adenosine"}} }; + litter[] = {{"ACE_MedicalLitter_adenosine"}}; }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); displayNameProgress = CSTRING(Injecting_Atropine); condition = QGVAR(advancedMedication); items[] = {"ACE_atropine"}; - litter[] = { {"All", "", {"ACE_MedicalLitter_atropine"}} }; + litter[] = {{"ACE_MedicalLitter_atropine"}}; }; class Epinephrine: Morphine { displayName = CSTRING(Inject_Epinephrine); displayNameProgress = CSTRING(Injecting_Epinephrine); - requiredMedic = QEGVAR(medical,medicSetting_Epi); + medicRequired = QGVAR(medicEpinephrine); items[] = {"ACE_epinephrine"}; - litter[] = { {"All", "", {"ACE_MedicalLitter_epinephrine"}} }; - treatmentLocations[] = {QEGVAR(medical,useLocation_Epi)}; + treatmentLocations = QGVAR(locationEpinephrine); + litter[] = {{"ACE_MedicalLitter_epinephrine"}}; }; - // --- iv bags + // - IV Bags -------------------------------------------------------------- class BloodIV: BasicBandage { displayName = CSTRING(Actions_Blood4_1000); displayNameProgress = CSTRING(Transfusing_Blood); @@ -130,12 +138,12 @@ class GVAR(Actions) { allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"}; allowSelfTreatment = QGVAR(allowSelfIV); category = "advanced"; - requiredMedic = 1; + medicRequired = 1; treatmentTime = 12; items[] = {"ACE_bloodIV"}; condition = ""; - callbackSuccess = QFUNC(treatmentIV); - animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; + callbackSuccess = QFUNC(ivBag); + animationMedic = "AinvPknlMstpSnonWnonDnon_medic1"; litter[] = {}; }; class BloodIV_500: BloodIV { @@ -150,7 +158,7 @@ class GVAR(Actions) { displayName = CSTRING(Actions_Plasma4_1000); displayNameProgress = CSTRING(Transfusing_Plasma); items[] = {"ACE_plasmaIV"}; - animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; + animationMedic = "AinvPknlMstpSnonWnonDnon_medic1"; }; class PlasmaIV_500: PlasmaIV { displayName = CSTRING(Actions_Plasma4_500); @@ -164,7 +172,7 @@ class GVAR(Actions) { displayName = CSTRING(Actions_Saline4_1000); displayNameProgress = CSTRING(Transfusing_Saline); items[] = {"ACE_salineIV"}; - animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; + animationMedic = "AinvPknlMstpSnonWnonDnon_medic1"; }; class SalineIV_500: SalineIV { displayName = CSTRING(Actions_Saline4_500); @@ -175,23 +183,23 @@ class GVAR(Actions) { items[] = {"ACE_salineIV_250"}; }; - // --- diagnose + // - Diagnose ------------------------------------------------------------- class Diagnose: BasicBandage { displayName = CSTRING(Actions_Diagnose); displayNameProgress = CSTRING(Actions_Diagnosing); icon = ""; category = "examine"; - treatmentLocations[] = {"All"}; + treatmentLocations = TREATMENT_LOCATIONS_ALL; allowedSelections[] = {"Head", "Body"}; - requiredMedic = 0; + medicRequired = 0; treatmentTime = 2.5; items[] = {}; condition = QUOTE(!GVAR(advancedDiagnose)); - callbackSuccess = QFUNC(actionDiagnose); + callbackSuccess = QFUNC(diagnose); callbackFailure = ""; callbackProgress = ""; - animationCaller = ""; // TODO - itemConsumed = 0; + animationMedic = ""; // TODO + consumeItem = 0; litter[] = {}; }; class CheckPulse: Diagnose { @@ -199,40 +207,40 @@ class GVAR(Actions) { displayNameProgress = CSTRING(Check_Pulse_Content); allowedSelections[] = {"All"}; condition = QGVAR(advancedDiagnose); - callbackSuccess = QFUNC(actionCheckPulse); - animationCallerProne = ""; - animationCallerSelfProne = ""; + callbackSuccess = QFUNC(checkPulse); + animationMedicProne = ""; + animationMedicSelfProne = ""; }; class CheckBloodPressure: CheckPulse { displayName = CSTRING(Actions_CheckBloodPressure); displayNameProgress = CSTRING(Check_Bloodpressure_Content); allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"}; - callbackSuccess = QFUNC(actionCheckBloodPressure); + callbackSuccess = QFUNC(checkBloodPressure); }; class CheckResponse: CheckPulse { displayName = CSTRING(Check_Response); displayNameProgress = CSTRING(Check_Response_Content); allowedSelections[] = {"Head"}; allowSelfTreatment = 0; - callbackSuccess = QFUNC(actionCheckResponse); + callbackSuccess = QFUNC(checkResponse); }; - // --- misc + // - Misc ----------------------------------------------------------------- class BodyBag: BasicBandage { displayName = CSTRING(PlaceInBodyBag); displayNameProgress = CSTRING(PlacingInBodyBag); icon = QPATHTOEF(medical_gui,ui\bodybag.paa); category = "advanced"; - treatmentLocations[] = {"All"}; + treatmentLocations = TREATMENT_LOCATIONS_ALL; allowSelfTreatment = 0; - requiredMedic = 0; + medicRequired = 0; treatmentTime = 15; items[] = {"ACE_bodyBag"}; - condition = "!alive _target"; + condition = "!alive _patient"; callbackSuccess = QFUNC(actionPlaceInBodyBag); callbackFailure = ""; callbackProgress = ""; - itemConsumed = 1; + consumeItem = 1; litter[] = {}; }; class CPR: BasicBandage { @@ -240,22 +248,22 @@ class GVAR(Actions) { displayNameProgress = CSTRING(Actions_PerformingCPR); icon = ""; category = "advanced"; - treatmentLocations[] = {"All"}; + treatmentLocations = TREATMENT_LOCATIONS_ALL; allowedSelections[] = {"Body"}; allowSelfTreatment = 0; - requiredMedic = 0; + medicRequired = 0; treatmentTime = 15; items[] = {}; - condition = QUOTE(!(_target call EFUNC(common,isAwake)) && {!(_target getVariable [ARR_2('GVAR(receiveCPR)', false)])}); + condition = QUOTE(!(_patient call EFUNC(common,isAwake)) && {!(_patient getVariable [ARR_2('GVAR(receiveCPR)', false)])}); callbackSuccess = QFUNC(treatmentCPR); callbackFailure = QFUNC(treatmentCPR_failure); callbackProgress = QFUNC(treatmentCPR_progress); callbackStart = QFUNC(treatmentCPR_start); - animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medic"; - animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; - animationCallerSelf = ""; - animationCallerSelfProne = ""; - itemConsumed = 0; + animationMedic = "AinvPknlMstpSlayW[wpn]Dnon_medic"; + animationMedicProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; + animationMedicSelf = ""; + animationMedicSelfProne = ""; + consumeItem = 0; litter[] = {}; }; @@ -265,36 +273,39 @@ class GVAR(Actions) { icon = QPATHTOEF(medical_gui,ui\surgical_kit.paa); category = "advanced"; items[] = {"ACE_surgicalKit"}; - treatmentLocations[] = {QEGVAR(medical,useLocation_SurgicalKit)}; + treatmentLocations = QGVAR(locationSurgicalKit); allowSelfTreatment = 0; - requiredMedic = QEGVAR(medical,medicSetting_SurgicalKit); - treatmentTime = QUOTE(count (_target getVariable [ARR_2('EGVAR(medical,bandagedWounds)',[])]) * 5); + medicRequired = QGVAR(medicSurgicalKit); + treatmentTime = QUOTE(count (_patient getVariable [ARR_2('EGVAR(medical,bandagedWounds)',[])]) * 5); callbackSuccess = ""; - callbackProgress = QFUNC(treatmentSurgicalKit_onProgress); - itemConsumed = QEGVAR(medical,consumeItem_SurgicalKit); - animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; - litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"} }}; + callbackProgress = QFUNC(surgicalKitProgress); + consumeItem = QGVAR(consumeSurgicalKit); + animationMedic = "AinvPknlMstpSnonWnonDnon_medic1"; + litter[] = {{"ACE_MedicalLitter_gloves"}}; }; class PersonalAidKit: BasicBandage { displayName = CSTRING(Use_Aid_Kit); displayNameProgress = CSTRING(TreatmentAction); icon = ""; category = "advanced"; - condition = QUOTE(_target call EFUNC(medical_status,isInStableCondition)); + condition = QUOTE(_patient call EFUNC(medical_status,isInStableCondition)); items[] = {"ACE_personalAidKit"}; - treatmentLocations[] = {QEGVAR(medical,useLocation_PAK)}; - requiredMedic = QEGVAR(medical,medicSetting_PAK); - treatmentTime = QUOTE(_target call FUNC(healTime)); + treatmentLocations = QGVAR(locationPAK); + medicRequired = QGVAR(medicPAK); + treatmentTime = QUOTE(_patient call FUNC(healTime)); callbackSuccess = QFUNC(treatmentFullHeal); - itemConsumed = QEGVAR(medical,consumeItem_PAK); - animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medicOther"; - animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther"; - animationCallerSelf = ""; - animationCallerSelfProne = ""; - litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"}}, - {"All", "_bloodLossOnBodyPart > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, - {"All", "_bloodLossOnBodyPart > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, - {"All", "_bloodLossOnBodyPart <= 0", {"ACE_MedicalLitter_clean"}} + consumeItem = QGVAR(consumePAK); + animationMedic = "AinvPknlMstpSlayW[wpn]Dnon_medicOther"; + animationMedicProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther"; + animationMedicSelf = ""; + animationMedicSelfProne = ""; + litter[] = { + {"ACE_MedicalLitter_gloves"}, + {"ACE_MedicalLitter_clean"}, + { + {"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}, + {"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"} + } }; }; }; diff --git a/addons/medical_treatment/CfgEden.hpp b/addons/medical_treatment/Cfg3DEN.hpp similarity index 60% rename from addons/medical_treatment/CfgEden.hpp rename to addons/medical_treatment/Cfg3DEN.hpp index d3c2f6c721..74e2730c3e 100644 --- a/addons/medical_treatment/CfgEden.hpp +++ b/addons/medical_treatment/Cfg3DEN.hpp @@ -1,3 +1,10 @@ + +#define GRID_3DEN_W (pixelW * pixelGrid * 0.5) +#define GRID_3DEN_H (pixelH * pixelGrid * 0.5) + +#define DEFAULT_IS_MEDIC (parseNumber (_this getUnitTrait 'medic')) +#define DEFAULT_IS_MEDICAL_VEHICLE (getNumber (configFile >> 'CfgVehicles' >> typeOf _this >> 'attendant') > 0) + class ctrlToolbox; class Cfg3DEN { @@ -9,19 +16,23 @@ class Cfg3DEN { }; }; class GVAR(isMedicControl): Title { - attributeLoad = "(_this controlsGroupCtrl 100) lbSetCurSel (((_value + 1) min 3) max 0);"; - attributeSave = "(lbCurSel (_this controlsGroupCtrl 100)) - 1"; + attributeLoad = QUOTE((_this controlsGroupCtrl 100) lbSetCurSel (0 max (_value + 1) min 3)); + attributeSave = QUOTE(lbCurSel (_this controlsGroupCtrl 100) - 1); class Controls: Controls { - class Title: Title{}; + class Title: Title {}; class Value: ctrlToolbox { idc = 100; - style = "0x02"; - x = "48 * (pixelW * pixelGrid * 0.50)"; - w = "82 * (pixelW * pixelGrid * 0.50)"; - h = "5 * (pixelH * pixelGrid * 0.50)"; + x = 48 * GRID_3DEN_W; + w = 82 * GRID_3DEN_W; + h = 5 * GRID_3DEN_H; rows = 1; columns = 4; - strings[] = {"$STR_3DEN_Attributes_Lock_Default_text", CSTRING(AssignMedicRoles_role_none), CSTRING(AssignMedicRoles_role_medic), CSTRING(AssignMedicRoles_role_doctorShort)}; + strings[] = { + "$STR_3DEN_Attributes_Lock_Default_text", + CSTRING(AssignMedicRoles_role_none), + CSTRING(AssignMedicRoles_role_medic), + CSTRING(AssignMedicRoles_role_doctorShort) + }; }; }; }; @@ -31,36 +42,34 @@ class Cfg3DEN { class ace_attributes { class Attributes { class ace_isMedic { - property = QUOTE(ace_isMedic); - control = QGVAR(isMedicControl); displayName = CSTRING(AssignMedicRoles_role_DisplayName); tooltip = CSTRING(Attributes_isMedic_Description); - expression = QUOTE(if (_value > -1) then {_this setVariable [ARR_3(QQEGVAR(medical,medicClass),_value,true)];};); - typeName = "NUMBER"; + property = QUOTE(ace_isMedic); + control = QGVAR(isMedicControl); + expression = QUOTE(if (_value != -1 && {_value != DEFAULT_IS_MEDIC}) then {_this setVariable [ARR_3(QQEGVAR(medical,medicClass),_value,true)]}); + defaultValue = QUOTE(DEFAULT_IS_MEDIC); condition = "objectBrain"; - defaultValue = "-1"; + typeName = "NUMBER"; }; class ace_isMedicalVehicle { - property = QUOTE(ace_isMedicalVehicle); - value = 0; - control = "CheckboxNumber"; displayName = CSTRING(AssignMedicVehicle_enabled_DisplayName); tooltip = CSTRING(Attributes_isMedicalVehicle_Description); - expression = QUOTE(_this setVariable [ARR_3(QQEGVAR(medical,medicClass),_value,true)];); - typeName = "NUMBER"; + property = QUOTE(ace_isMedicalVehicle); + control = "Checkbox"; + expression = QUOTE(_this setVariable [ARR_3(QQEGVAR(medical,isMedicalVehicle),_value,true)]); + defaultValue = QUOTE(DEFAULT_IS_MEDICAL_VEHICLE); condition = "objectVehicle"; - defaultValue = 0; + typeName = "BOOL"; }; class ace_isMedicalFacility { - property = QUOTE(ace_isMedicalFacility); - value = 0; - control = "Checkbox"; displayName = CSTRING(AssignMedicalFacility_enabled_DisplayName); tooltip = CSTRING(AssignMedicalFacility_enabled_Description); + property = QUOTE(ace_isMedicalFacility); + control = "Checkbox"; expression = QUOTE(_this setVariable [ARR_3(QQEGVAR(medical,isMedicalFacility),_value,true)];); - typeName = "BOOL"; - condition = "(1 - objectBrain) * (1 - objectVehicle)"; defaultValue = "false"; + condition = "(1 - objectBrain) * (1 - objectVehicle)"; + typeName = "BOOL"; }; }; }; diff --git a/addons/medical_treatment/CfgWeapons.hpp b/addons/medical_treatment/CfgWeapons.hpp index 17ed52fd4f..329b2ab061 100644 --- a/addons/medical_treatment/CfgWeapons.hpp +++ b/addons/medical_treatment/CfgWeapons.hpp @@ -1,32 +1,31 @@ class CfgWeapons { class ItemCore; + class ACE_ItemCore; class CBA_MiscItem_ItemInfo; class InventoryFirstAidKitItem_Base_F; class MedikitItem; - // ITEMS class FirstAidKit: ItemCore { type = 0; - ace_arsenal_hide = 1; + EGVAR(arsenal,hide) = 1; class ItemInfo: InventoryFirstAidKitItem_Base_F { mass = 4; }; }; class Medikit: ItemCore { type = 0; - ace_arsenal_hide = 1; + EGVAR(arsenal,hide) = 1; class ItemInfo: MedikitItem { mass = 60; }; }; - class ACE_ItemCore; class ACE_fieldDressing: ACE_ItemCore { scope = 2; author = ECSTRING(common,ACETeam); model = QPATHTOF(data\bandage.p3d); - picture = QPATHTOF(ui\items\fieldDressing_x_ca.paa); + picture = QPATHTOF(ui\fieldDressing_ca.paa); displayName = CSTRING(Bandage_Basic_Display); descriptionShort = CSTRING(Bandage_Basic_Desc_Short); descriptionUse = CSTRING(Bandage_Basic_Desc_Use); @@ -38,7 +37,7 @@ class CfgWeapons { scope = 2; author = ECSTRING(common,ACETeam); displayName = CSTRING(Packing_Bandage_Display); - picture = QPATHTOF(ui\items\packingBandage_x_ca.paa); + picture = QPATHTOF(ui\packingBandage_ca.paa); model = QPATHTOF(data\packingbandage.p3d); descriptionShort = CSTRING(Packing_Bandage_Desc_Short); descriptionUse = CSTRING(Packing_Bandage_Desc_Use); @@ -50,7 +49,7 @@ class CfgWeapons { scope = 2; author = ECSTRING(common,ACETeam); displayName = CSTRING(Bandage_Elastic_Display); - picture = QPATHTOF(ui\items\elasticBandage_x_ca.paa); + picture = QPATHTOF(ui\elasticBandage_ca.paa); model = "\A3\Structures_F_EPA\Items\Medical\Bandage_F.p3d"; descriptionShort = CSTRING(Bandage_Elastic_Desc_Short); descriptionUse = CSTRING(Bandage_Elastic_Desc_Use); @@ -62,7 +61,7 @@ class CfgWeapons { scope = 2; author = ECSTRING(common,ACETeam); displayName = CSTRING(Tourniquet_Display); - picture = QPATHTOF(ui\items\tourniquet_x_ca.paa); + picture = QPATHTOF(ui\tourniquet_ca.paa); model = QPATHTOF(data\tourniquet.p3d); descriptionShort = CSTRING(Tourniquet_Desc_Short); descriptionUse = CSTRING(Tourniquet_Desc_Use); @@ -74,7 +73,7 @@ class CfgWeapons { scope = 2; author = ECSTRING(common,ACETeam); displayName = CSTRING(Morphine_Display); - picture = QPATHTOF(ui\items\morphine_x_ca.paa); + picture = QPATHTOF(ui\morphine_ca.paa); model = QPATHTOF(data\morphine.p3d); descriptionShort = CSTRING(Morphine_Desc_Short); descriptionUse = CSTRING(Morphine_Desc_Use); @@ -86,7 +85,7 @@ class CfgWeapons { scope = 2; author = ECSTRING(common,ACETeam); displayName = CSTRING(Adenosine_Display); - picture = QPATHTOF(ui\items\adenosine_x_ca.paa); + picture = QPATHTOF(ui\adenosine_ca.paa); model = QPATHTOF(data\adenosine.p3d); descriptionShort = CSTRING(adenosine_Desc_Short); descriptionUse = CSTRING(adenosine_Desc_Use); @@ -98,7 +97,7 @@ class CfgWeapons { scope = 2; author = ECSTRING(common,ACETeam); displayName = CSTRING(Atropine_Display); - picture = QPATHTOF(ui\items\atropine_x_ca.paa); + picture = QPATHTOF(ui\atropine_ca.paa); model = QPATHTOF(data\atropine.p3d); descriptionShort = CSTRING(Atropine_Desc_Short); descriptionUse = CSTRING(Atropine_Desc_Use); @@ -110,7 +109,7 @@ class CfgWeapons { scope = 2; author = ECSTRING(common,ACETeam); displayName = CSTRING(Epinephrine_Display); - picture = QPATHTOF(ui\items\epinephrine_x_ca.paa); + picture = QPATHTOF(ui\epinephrine_ca.paa); model = QPATHTOF(data\epinephrine.p3d); descriptionShort = CSTRING(Epinephrine_Desc_Short); descriptionUse = CSTRING(Epinephrine_Desc_Use); @@ -125,8 +124,8 @@ class CfgWeapons { displayName = CSTRING(Plasma_IV); model = QPATHTOF(data\IVBag_1000ml.p3d); hiddenSelections[] = {"camo"}; - hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_plasma_1000ml_ca.paa) }; - picture = QPATHTOF(ui\items\plasmaIV_x_ca.paa); + hiddenSelectionsTextures[] = {QPATHTOF(data\IVBag_plasma_1000ml_ca.paa)}; + picture = QPATHTOF(ui\plasmaIV_ca.paa); descriptionShort = CSTRING(Plasma_IV_Desc_Short); descriptionUse = CSTRING(Plasma_IV_Desc_Use); class ItemInfo: CBA_MiscItem_ItemInfo { @@ -136,7 +135,7 @@ class CfgWeapons { class ACE_plasmaIV_500: ACE_plasmaIV { displayName = CSTRING(Plasma_IV_500); model = QPATHTOF(data\IVBag_500ml.p3d); - hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_plasma_500ml_ca.paa) }; + hiddenSelectionsTextures[] = {QPATHTOF(data\IVBag_plasma_500ml_ca.paa)}; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 5; }; @@ -144,7 +143,7 @@ class CfgWeapons { class ACE_plasmaIV_250: ACE_plasmaIV { displayName = CSTRING(Plasma_IV_250); model = QPATHTOF(data\IVBag_250ml.p3d); - hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_plasma_250ml_ca.paa) }; + hiddenSelectionsTextures[] = {QPATHTOF(data\IVBag_plasma_250ml_ca.paa)}; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 2.5; }; @@ -154,9 +153,9 @@ class CfgWeapons { author = ECSTRING(common,ACETeam); model = QPATHTOF(data\IVBag_1000ml.p3d); displayName = CSTRING(Blood_IV); - picture = QPATHTOF(ui\items\bloodIV_x_ca.paa); + picture = QPATHTOF(ui\bloodIV_ca.paa); hiddenSelections[] = {"camo"}; - hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_blood_1000ml_ca.paa) }; + hiddenSelectionsTextures[] = {QPATHTOF(data\IVBag_blood_1000ml_ca.paa)}; descriptionShort = CSTRING(Blood_IV_Desc_Short); descriptionUse = CSTRING(Blood_IV_Desc_Use); class ItemInfo: CBA_MiscItem_ItemInfo { @@ -166,7 +165,7 @@ class CfgWeapons { class ACE_bloodIV_500: ACE_bloodIV { displayName = CSTRING(Blood_IV_500); model = QPATHTOF(data\IVBag_500ml.p3d); - hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_blood_500ml_ca.paa) }; + hiddenSelectionsTextures[] = {QPATHTOF(data\IVBag_blood_500ml_ca.paa)}; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 5; }; @@ -174,7 +173,7 @@ class CfgWeapons { class ACE_bloodIV_250: ACE_bloodIV { displayName = CSTRING(Blood_IV_250); model = QPATHTOF(data\IVBag_250ml.p3d); - hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_blood_250ml_ca.paa) }; + hiddenSelectionsTextures[] = {QPATHTOF(data\IVBag_blood_250ml_ca.paa)}; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 2.5; }; @@ -185,8 +184,8 @@ class CfgWeapons { displayName = CSTRING(Saline_IV); model = QPATHTOF(data\IVBag_1000ml.p3d); hiddenSelections[] = {"camo"}; - hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_saline_1000ml_ca.paa) }; - picture = QPATHTOF(ui\items\salineIV_x_ca.paa); + hiddenSelectionsTextures[] = {QPATHTOF(data\IVBag_saline_1000ml_ca.paa)}; + picture = QPATHTOF(ui\salineIV_ca.paa); descriptionShort = CSTRING(Saline_IV_Desc_Short); descriptionUse = CSTRING(Saline_IV_Desc_Use); class ItemInfo: CBA_MiscItem_ItemInfo { @@ -196,7 +195,7 @@ class CfgWeapons { class ACE_salineIV_500: ACE_salineIV { displayName = CSTRING(Saline_IV_500); model = QPATHTOF(data\IVBag_500ml.p3d); - hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_saline_500ml_ca.paa) }; + hiddenSelectionsTextures[] = {QPATHTOF(data\IVBag_saline_500ml_ca.paa)}; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 5; }; @@ -204,7 +203,7 @@ class CfgWeapons { class ACE_salineIV_250: ACE_salineIV { displayName = CSTRING(Saline_IV_250); model = QPATHTOF(data\IVBag_250ml.p3d); - hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_saline_250ml_ca.paa) }; + hiddenSelectionsTextures[] = {QPATHTOF(data\IVBag_saline_250ml_ca.paa)}; class ItemInfo: CBA_MiscItem_ItemInfo { mass = 2.5; }; @@ -214,7 +213,7 @@ class CfgWeapons { author = ECSTRING(common,ACETeam); displayName = CSTRING(QuikClot_Display); model = QPATHTOF(data\QuikClot.p3d); - picture = QPATHTOF(ui\items\quickclot_x_ca.paa); + picture = QPATHTOF(ui\quickclot_ca.paa); descriptionShort = CSTRING(QuikClot_Desc_Short); descriptionUse = CSTRING(QuikClot_Desc_Use); class ItemInfo: CBA_MiscItem_ItemInfo { @@ -225,7 +224,7 @@ class CfgWeapons { scope = 2; author = ECSTRING(common,ACETeam); displayName = CSTRING(Aid_Kit_Display); - picture = QPATHTOF(ui\items\personal_aid_kit_x_ca.paa); + picture = QPATHTOF(ui\personal_aid_kit_ca.paa); descriptionShort = CSTRING(Aid_Kit_Desc_Short); descriptionUse = CSTRING(Aid_Kit_Desc_Use); class ItemInfo: CBA_MiscItem_ItemInfo { @@ -233,11 +232,11 @@ class CfgWeapons { }; }; class ACE_surgicalKit: ACE_ItemCore { - scope=2; + scope = 2; author = ECSTRING(common,ACETeam); displayName= CSTRING(SurgicalKit_Display); model = QPATHTOF(data\surgical_kit.p3d); - picture = QPATHTOF(ui\items\surgicalKit_x_ca.paa); + picture = QPATHTOF(ui\surgicalKit_ca.paa); descriptionShort = CSTRING(SurgicalKit_Desc_Short); descriptionUse = CSTRING(SurgicalKit_Desc_Use); class ItemInfo: CBA_MiscItem_ItemInfo { @@ -245,11 +244,11 @@ class CfgWeapons { }; }; class ACE_bodyBag: ACE_ItemCore { - scope=2; + scope = 2; author = ECSTRING(common,ACETeam); displayName= CSTRING(Bodybag_Display); model = QPATHTOF(data\bodybagItem.p3d); - picture = QPATHTOF(ui\items\bodybag_x_ca.paa); + picture = QPATHTOF(ui\bodybag_ca.paa); descriptionShort = CSTRING(Bodybag_Desc_Short); descriptionUse = CSTRING(Bodybag_Desc_Use); class ItemInfo: CBA_MiscItem_ItemInfo { diff --git a/addons/medical_treatment/XEH_PREP.hpp b/addons/medical_treatment/XEH_PREP.hpp index 389b4b4d82..affc5e238a 100644 --- a/addons/medical_treatment/XEH_PREP.hpp +++ b/addons/medical_treatment/XEH_PREP.hpp @@ -1,11 +1,11 @@ // actions -PREP(actionCheckBloodPressure); -PREP(actionCheckBloodPressureLocal); -PREP(actionCheckPulse); -PREP(actionCheckPulseLocal); -PREP(actionCheckResponse); -PREP(actionDiagnose); +PREP(checkBloodPressure); +PREP(checkBloodPressureLocal); +PREP(checkPulse); +PREP(checkPulseLocal); +PREP(checkResponse); +PREP(diagnose); PREP(actionLoadUnit); PREP(actionPlaceInBodyBag); PREP(actionUnloadUnit); @@ -15,11 +15,11 @@ PREP(addLoadPatientActions); PREP(canTreat); PREP(canTreatCached); PREP(treatment); -PREP(treatment_failure); -PREP(treatment_success); +PREP(treatmentFailure); +PREP(treatmentSuccess); -PREP(treatmentBandage); -PREP(treatmentBandageLocal); +PREP(bandage); +PREP(bandageLocal); PREP(treatmentCPR); PREP(treatmentCPR_failure); PREP(treatmentCPR_progress); @@ -27,21 +27,20 @@ PREP(treatmentCPR_start); PREP(treatmentCPRLocal); PREP(treatmentFullHeal); PREP(treatmentFullHealLocal); -PREP(treatmentIV); -PREP(treatmentIVLocal); -PREP(treatmentMedication); -PREP(treatmentMedicationLocal); -PREP(treatmentSurgicalKit_onProgress); -PREP(treatmentTourniquet); -PREP(treatmentTourniquetLocal); -PREP(treatmentTourniquetRemove); +PREP(ivBag); +PREP(ivBagLocal); +PREP(medication); +PREP(medicationLocal); +PREP(surgicalKitProgress); +PREP(tourniquet); +PREP(tourniquetLocal); +PREP(tourniquetRemove); // misc PREP(addToLog); PREP(addToTriageCard); PREP(bodyCleanupLoop); PREP(calculateBlood); -PREP(canAccessMedicalEquipment); PREP(canBandage); PREP(findMostEffectiveWound); PREP(getBandageTime); @@ -60,11 +59,9 @@ PREP(setTriageStatus); // items PREP(checkItems); PREP(hasItem); -PREP(hasItems); PREP(useItem); -PREP(useItems); // litter +PREP(createLitter); +PREP(createLitterServer); PREP(litterCleanupLoop); -PREP(litterCreate); -PREP(litterHandleCreate); diff --git a/addons/medical_treatment/XEH_postInit.sqf b/addons/medical_treatment/XEH_postInit.sqf index ea8dbefea4..13d3903a26 100644 --- a/addons/medical_treatment/XEH_postInit.sqf +++ b/addons/medical_treatment/XEH_postInit.sqf @@ -5,7 +5,7 @@ // Handle bodybags and litter on server if (isServer) then { - [QGVAR(createLitterServer), FUNC(litterHandleCreate)] call CBA_fnc_addEventHandler; + [QGVAR(createLitterServer), FUNC(createLitterServer)] call CBA_fnc_addEventHandler; ["ace_placedInBodyBag", FUNC(serverRemoveBody)] call CBA_fnc_addEventHandler; }; @@ -18,6 +18,6 @@ if (isServer) then { [QGVAR(treatmentFullHealLocal), FUNC(treatmentFullHealLocal)] call CBA_fnc_addEventHandler; // action events -[QGVAR(actionCheckPulseLocal), FUNC(actionCheckPulseLocal)] call CBA_fnc_addEventHandler; -[QGVAR(actionCheckBloodPressureLocal), FUNC(actionCheckBloodPressureLocal)] call CBA_fnc_addEventHandler; +[QGVAR(checkPulseLocal), FUNC(checkPulseLocal)] call CBA_fnc_addEventHandler; +[QGVAR(checkBloodPressureLocal), FUNC(checkBloodPressureLocal)] call CBA_fnc_addEventHandler; [QGVAR(actionPlaceInBodyBag), FUNC(actionPlaceInBodyBag)] call CBA_fnc_addEventHandler; diff --git a/addons/medical_treatment/XEH_preInit.sqf b/addons/medical_treatment/XEH_preInit.sqf index a4ddb9f082..db333a79e2 100644 --- a/addons/medical_treatment/XEH_preInit.sqf +++ b/addons/medical_treatment/XEH_preInit.sqf @@ -34,4 +34,23 @@ GVAR(animDurations) = [] call CBA_fnc_createNamespace; ["AinvPknlMstpSnonWnonDnon_medic1", 10] ]; +// class names of medical facilities +// global variable so it can be accessed by mission makers +GVAR(facilityClasses) = [ + "TK_GUE_WarfareBFieldhHospital_Base_EP1", + "TK_GUE_WarfareBFieldhHospital_EP1", + "TK_WarfareBFieldhHospital_Base_EP1", + "TK_WarfareBFieldhHospital_EP1", + "US_WarfareBFieldhHospital_Base_EP1", + "US_WarfareBFieldhHospital_EP1", + "MASH_EP1", + "MASH", + "Land_A_Hospital", + "CDF_WarfareBFieldhHospital", + "GUE_WarfareBFieldhHospital", + "INS_WarfareBFieldhHospital", + "RU_WarfareBFieldhHospital", + "USMC_WarfareBFieldhHospital" +]; + ADDON = true; diff --git a/addons/medical_treatment/config.cpp b/addons/medical_treatment/config.cpp index 30ea36a861..cc87738c01 100644 --- a/addons/medical_treatment/config.cpp +++ b/addons/medical_treatment/config.cpp @@ -17,7 +17,7 @@ class CfgPatches { #include "ACE_Medical_Treatment.hpp" #include "ACE_Medical_Treatment_Actions.hpp" #include "ACE_Settings.hpp" -#include "CfgEden.hpp" +#include "Cfg3DEN.hpp" #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" diff --git a/addons/medical_treatment/functions/fnc_actionCheckBloodPressure.sqf b/addons/medical_treatment/functions/fnc_actionCheckBloodPressure.sqf deleted file mode 100644 index 6c5c17a151..0000000000 --- a/addons/medical_treatment/functions/fnc_actionCheckBloodPressure.sqf +++ /dev/null @@ -1,21 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Action for checking the blood pressure of the patient - * - * Arguments: - * 0: The medic - * 1: The patient - * 2: Body part - * - * Return Value: - * None - * - * Public: No - */ - -params ["_caller", "_target", "_bodyPart"]; - -[QGVAR(actionCheckBloodPressureLocal), [_caller, _target, _bodyPart], _target] call CBA_fnc_targetEvent; - -true diff --git a/addons/medical_treatment/functions/fnc_actionCheckBloodPressureLocal.sqf b/addons/medical_treatment/functions/fnc_actionCheckBloodPressureLocal.sqf deleted file mode 100644 index c0a995e3cd..0000000000 --- a/addons/medical_treatment/functions/fnc_actionCheckBloodPressureLocal.sqf +++ /dev/null @@ -1,57 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Local callback for checking the blood pressure of a patient - * - * Arguments: - * 0: The medic - * 1: The patient - * 2: Body part - * - * Return Value: - * None - * - * Public: No - */ - -params ["_caller", "_target", "_bodyPart"]; - -private _bloodPressure = [0, 0]; - -if (alive _target && {!([_target, _bodyPart] call FUNC(hasTourniquetAppliedTo))}) then { - _bloodPressure = GET_BLOOD_PRESSURE(_target); -}; - -private _bloodPressureOutput = ELSTRING(medical_treatment,Check_Bloodpressure_Output_6); -private _logOutPut = ELSTRING(medical_treatment,Check_Bloodpressure_NoBloodpressure); - -_bloodPressure params ["_bloodPressureLow", "_bloodPressureHigh"]; - -if (_bloodPressureHigh > 20) then { - if (_caller call FUNC(isMedic)) then { - _bloodPressureOutput = ELSTRING(medical_treatment,Check_Bloodpressure_Output_1); - _logOutPut = format ["%1/%2", round _bloodPressureHigh, round _bloodPressureLow]; - } else { - if (_bloodPressureHigh > 20) then { - _bloodPressureOutput = ELSTRING(medical_treatment,Check_Bloodpressure_Output_2); - _logOutPut = ELSTRING(medical_treatment,Check_Bloodpressure_Low); - - if (_bloodPressureHigh > 100) then { - _bloodPressureOutput = ELSTRING(medical_treatment,Check_Bloodpressure_Output_3); - _logOutPut = ELSTRING(medical_treatment,Check_Bloodpressure_Normal); - - if (_bloodPressureHigh > 160) then { - _bloodPressureOutput = ELSTRING(medical_treatment,Check_Bloodpressure_Output_4); - _logOutPut = ELSTRING(medical_treatment,Check_Bloodpressure_High); - }; - }; - }; - }; -}; - -[QEGVAR(common,displayTextStructured), [[_bloodPressureOutput, _target call EFUNC(common,getName), round _bloodPressureHigh, round _bloodPressureLow], 1.75, _caller], _caller] call CBA_fnc_targetEvent; - -if (_logOutPut != "") then { - [_target, "activity", ELSTRING(medical_treatment,Check_Bloodpressure_Log), [_caller call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); - [_target, "quick_view", ELSTRING(medical_treatment,Check_Bloodpressure_Log), [_caller call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); -}; diff --git a/addons/medical_treatment/functions/fnc_actionCheckPulse.sqf b/addons/medical_treatment/functions/fnc_actionCheckPulse.sqf deleted file mode 100644 index 29afe8a60e..0000000000 --- a/addons/medical_treatment/functions/fnc_actionCheckPulse.sqf +++ /dev/null @@ -1,21 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Action for checking the pulse or heart rate of the patient - * - * Arguments: - * 0: The medic - * 1: The patient - * 2: Body part - * - * Return Value: - * None - * - * Public: No - */ - -params ["_caller", "_target", "_bodyPart"]; - -[QGVAR(actionCheckPulseLocal), [_caller, _target, _bodyPart], _target] call CBA_fnc_targetEvent; - -true diff --git a/addons/medical_treatment/functions/fnc_actionCheckPulseLocal.sqf b/addons/medical_treatment/functions/fnc_actionCheckPulseLocal.sqf deleted file mode 100644 index 585ba4c7d8..0000000000 --- a/addons/medical_treatment/functions/fnc_actionCheckPulseLocal.sqf +++ /dev/null @@ -1,54 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Local callback for checking the pulse of a patient - * - * Arguments: - * 0: The medic - * 1: The patient - * 2: Body part - * - * Return Value: - * None - * - * Public: No - */ - -params ["_caller", "_target", "_bodyPart"]; - -private _heartRate = 0; - -if (alive _target && {!([_target, _bodyPart] call FUNC(hasTourniquetAppliedTo))}) then { - _heartRate = GET_HEART_RATE(_target); -}; - -private _heartRateOutput = ELSTRING(medical_treatment,Check_Pulse_Output_5); -private _logOutPut = ELSTRING(medical_treatment,Check_Pulse_None); - -if (_heartRate > 1.0) then { - if (_caller call FUNC(isMedic)) then { - _heartRateOutput = ELSTRING(medical_treatment,Check_Pulse_Output_1); - _logOutPut = format ["%1", round(_heartRate)]; - } else { - // non medical personel will only find a pulse/HR - _heartRateOutput = ELSTRING(medical_treatment,Check_Pulse_Output_2); - _logOutPut = ELSTRING(medical_treatment,Check_Pulse_Weak); - - if (_heartRate > 60) then { - if (_heartRate > 100) then { - _heartRateOutput = ELSTRING(medical_treatment,Check_Pulse_Output_3); - _logOutPut = ELSTRING(medical_treatment,Check_Pulse_Strong); - } else { - _heartRateOutput = ELSTRING(medical_treatment,Check_Pulse_Output_4); - _logOutPut = ELSTRING(medical_treatment,Check_Pulse_Normal); - }; - }; - }; -}; - -[QEGVAR(common,displayTextStructured), [[_heartRateOutput, _target call EFUNC(common,getName), round _heartRate], 1.5, _caller], _caller] call CBA_fnc_targetEvent; - -if (_logOutPut != "") then { - [_target, "activity", ELSTRING(medical_treatment,Check_Pulse_Log), [_caller call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); - [_target, "quick_view", ELSTRING(medical_treatment,Check_Pulse_Log), [_caller call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); -}; diff --git a/addons/medical_treatment/functions/fnc_actionCheckResponse.sqf b/addons/medical_treatment/functions/fnc_actionCheckResponse.sqf deleted file mode 100644 index 7bf7cf7c5c..0000000000 --- a/addons/medical_treatment/functions/fnc_actionCheckResponse.sqf +++ /dev/null @@ -1,26 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Action for checking the response status of the patient - * - * Arguments: - * 0: The medic - * 1: The patient - * - * Return Value: - * None - * - * Example: - * [bob, kevin] call ace_medical_treatment_fnc_actionCheckResponse - * - * Public: No - */ - -params ["_caller", "_target"]; - -private _output = [ELSTRING(medical_treatment,Check_Response_Unresponsive), ELSTRING(medical_treatment,Check_Response_Responsive)] select (_target call EFUNC(common,isAwake)); - -[QEGVAR(common,displayTextStructured), [[_output, _target call EFUNC(common,getName)], 2, _caller], _caller] call CBA_fnc_targetEvent; - -[_target ,"activity", _output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); -[_target, "quick_view", _output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); diff --git a/addons/medical_treatment/functions/fnc_actionDiagnose.sqf b/addons/medical_treatment/functions/fnc_actionDiagnose.sqf deleted file mode 100644 index 6e9eda9610..0000000000 --- a/addons/medical_treatment/functions/fnc_actionDiagnose.sqf +++ /dev/null @@ -1,45 +0,0 @@ -#include "script_component.hpp" -/* -* Author: Glowbal -* Action for diagnosing in basic medical -* -* Arguments: -* 0: The medic -* 1: The patient -* -* Return Value: -* None -* -* Public: No -*/ - -params ["_caller", "_target"]; - -private _genericMessages = [ELSTRING(medical_treatment,diagnoseMessage), _target call EFUNC(common,getName)]; - -if (alive _target) then { - _genericMessages pushBack ELSTRING(medical_treatment,diagnoseAlive); -} else { - _genericMessages pushBack ELSTRING(medical_treatment,diagnoseDead); -}; - -private _hemorrhage = GET_HEMORRHAGE(_target); -if (_hemorrhage > 0) then { - if (_hemorrhage > 1) then { - _genericMessages pushBack ELSTRING(medical_treatment,lostBloodALot); - } else { - _genericMessages pushBack ELSTRING(medical_treatment,lostBlood); - }; -} else { - _genericMessages pushBack ELSTRING(medical_treatment,noBloodloss); -}; - -if (alive _target) then { - if IS_IN_PAIN(_target) then { - _genericMessages pushBack ELSTRING(medical_treatment,inPain); - } else { - _genericMessages pushBack ELSTRING(medical_treatment,noPain); - }; -}; - -[QEGVAR(common,displayTextStructured), [_genericMessages, 3.0, _caller], _caller] call CBA_fnc_targetEvent; diff --git a/addons/medical_treatment/functions/fnc_addToLog.sqf b/addons/medical_treatment/functions/fnc_addToLog.sqf index 077cfc73ab..917b9fbb72 100644 --- a/addons/medical_treatment/functions/fnc_addToLog.sqf +++ b/addons/medical_treatment/functions/fnc_addToLog.sqf @@ -1,56 +1,45 @@ #include "script_component.hpp" /* - * Author: Glowbal - * Add an entry to the specified log + * Author: Glowbal, mharis001 + * Adds an entry to the specified medical log of the unit. * * Arguments: - * 0: The patient - * 1: The log type - * 2: The message - * 3: The arguments for localization + * 0: Unit + * 1: Log Type + * 2: Message + * 3: Formatting Arguments * * Return Value: * None * * Example: - * [bob, "type", "message", [_args]] call ace_medical_treatment_fnc_addToLog + * [player, "activity", "Message %1", ["Name"]] call ace_medical_treatment_fnc_addToLog * * Public: No */ -params ["_unit", "_type", "_message", "_arguments"]; +params ["_unit", "_logType", "_message", "_arguments"]; if (!local _unit) exitWith { - [QGVAR(addToMedicalLog), _this, _unit] call CBA_fnc_targetEvent; + [QGVAR(addToLog), _this, _unit] call CBA_fnc_targetEvent; }; date params ["", "", "", "_hour", "_minute"]; +private _timeStamp = format ["%1:%2", _hour, [_minute, 2] call CBA_fnc_formatNumber]; -private _moment = format [["%1:%2", "%1:0%2"] select (_minute < 10), _hour, _minute]; -private _logVarName = format [QEGVAR(medical,logFile_%1), _type]; +private _logVarName = LOG_VARNAME(_logType); private _log = _unit getVariable [_logVarName, []]; -if (count _log >= 8) then { - private _newLog = []; - - { - // ensure the first element will not be added - if (_forEachIndex > 0) then { - _newLog pushBack _x; - }; - } forEach _log; - - _log = _newLog; +if (count _log >= MAX_LOG_ENTRIES) then { + _log deleteAt 0; }; -_log pushBack [_message, _moment, _type, _arguments]; - +_log pushBack [_message, _timeStamp, _arguments, _logType]; _unit setVariable [_logVarName, _log, true]; -["ace_medicalLogEntryAdded", [_unit, _type, _message, _arguments]] call CBA_fnc_localEvent; -private _logs = _unit getVariable [QEGVAR(medical,allLogs), []]; +private _allLogs = _unit getVariable [QEGVAR(medical,allLogs), []]; -if !(_logVarName in _logs) then { - _logs pushBack _logVarName; - _unit setVariable [QEGVAR(medical,allLogs), _logs, true]; +if !(_logVarName in _allLogs) then { + _allLogs pushBack _logVarName; + _unit setVariable [QEGVAR(medical,allLogs), _allLogs, true]; }; diff --git a/addons/medical_treatment/functions/fnc_addToTriageCard.sqf b/addons/medical_treatment/functions/fnc_addToTriageCard.sqf index 3d67d3288c..75cbc76b26 100644 --- a/addons/medical_treatment/functions/fnc_addToTriageCard.sqf +++ b/addons/medical_treatment/functions/fnc_addToTriageCard.sqf @@ -1,46 +1,37 @@ #include "script_component.hpp" /* - * Author: Glowbal - * Add an entry to the triage card + * Author: Glowbal, mharis001 + * Adds an entry to the unit's triage card. * * Arguments: - * 0: The patient - * 1: The new item class name + * 0: Unit + * 1: Item Classname * * Return Value: * None * * Example: - * [bob, "bandage"] call ace_medical_treatment_fnc_addToTriageCard + * [player, "ACE_morphine"] call ace_medical_treatment_fnc_addToTriageCard * * Public: No */ -params ["_unit", "_newItem"]; +params ["_unit", "_item"]; if (!local _unit) exitWith { [QGVAR(addToTriageCard), _this, _unit] call CBA_fnc_targetEvent; }; -private _log = _unit getVariable [QEGVAR(medical,triageCard), []]; -private _inList = false; -private _amount = 1; +private _triageCard = _unit getVariable [QEGVAR(medical,triageCard), []]; +private _index = _triageCard findIf {_x select 0 == _item}; -{ - if (_x select 0 == _newItem) exitWith { - private _info = _log select _forEachIndex; - _info set [1, (_info select 1) + 1]; - _info set [2, CBA_missionTime]; - _log set [_forEachIndex, _info]; - - _amount = _info select 1; - _inList = true; - }; -} forEach _log; - -if (!_inList) then { - _log pushBack [_newItem, 1, CBA_missionTime]; +if (_index == -1) then { + _triageCard pushBack [_item, 1, CBA_missionTime]; +} else { + _triageCard set [_index, [_item, (_triageCard select _index select 1) + 1, CBA_missionTime]]; }; -_unit setVariable [QEGVAR(medical,triageCard), _log, true]; -["ace_triageCardItemAdded", [_unit, _newItem, _amount]] call CBA_fnc_localEvent; +_unit setVariable [QEGVAR(medical,triageCard), _triageCard, true]; + +// todo: add amount of item to event args? +["ace_triageCardItemAdded", [_unit, _item]] call CBA_fnc_localEvent; diff --git a/addons/medical_treatment/functions/fnc_bandage.sqf b/addons/medical_treatment/functions/fnc_bandage.sqf new file mode 100644 index 0000000000..1a7dd4f818 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_bandage.sqf @@ -0,0 +1,25 @@ +#include "script_component.hpp" +/* + * Author: Glowbal + * Bandages open wounds on the given body part of the patient. + * + * Arguments: + * 0: Medic + * 1: Patient + * 2: Body Part + * 3: Treatment + * + * Return Value: + * None + * + * Example: + * [player, cursorObject, "Head", "FieldDressing"] call ace_medical_treatment_fnc_bandage + * + * Public: No + */ + +params ["_medic", "_patient", "_bodyPart", "_classname"]; + +[_patient, "activity", LSTRING(Activity_bandagedPatient), [[_medic, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); + +[QGVAR(bandageLocal), [_patient, _bodyPart, _classname], _patient] call CBA_fnc_targetEvent; diff --git a/addons/medical_treatment/functions/fnc_treatmentBandageLocal.sqf b/addons/medical_treatment/functions/fnc_bandageLocal.sqf similarity index 54% rename from addons/medical_treatment/functions/fnc_treatmentBandageLocal.sqf rename to addons/medical_treatment/functions/fnc_bandageLocal.sqf index f3cd43cbdf..f9d090bee7 100644 --- a/addons/medical_treatment/functions/fnc_treatmentBandageLocal.sqf +++ b/addons/medical_treatment/functions/fnc_bandageLocal.sqf @@ -1,30 +1,33 @@ #include "script_component.hpp" /* * Author: Glowbal - * Handles the bandage of a patient. + * Local callback for bandaging a patient's open wounds. * * Arguments: - * 0: The patient - * 1: Treatment class name - * 2: Body part + * 0: Patient + * 1: Body Part + * 2: Treatment * * Return Value: - * Succesful treatment started + * None + * + * Example: + * [player, "Head", "FieldDressing"] call ace_medical_treatment_fnc_bandageLocal * * Public: No */ -params ["_target", "_bandage", "_bodyPart"]; +params ["_patient", "_bodyPart", "_bandage"]; private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; -if (_partIndex < 0) exitWith { false }; +if (_partIndex < 0) exitWith {false}; -private _openWounds = _target getVariable [QEGVAR(medical,openWounds), []]; -if (_openWounds isEqualTo []) exitWith { false }; +private _openWounds = _patient getVariable [QEGVAR(medical,openWounds), []]; +if (_openWounds isEqualTo []) exitWith {false}; // Figure out which injury for this bodypart is the best choice to bandage // TODO also use up the remainder on left over injuries -private _targetWound = [_target, _bandage, _partIndex] call FUNC(findMostEffectiveWound); +private _targetWound = [_patient, _bandage, _partIndex] call FUNC(findMostEffectiveWound); _targetWound params ["_wound", "_woundIndex", "_effectiveness"]; // Everything is patched up on this body part already @@ -36,11 +39,9 @@ private _impact = _effectiveness min _amountOf; _wound set [3, _amountOf - _impact]; _openWounds set [_woundIndex, _wound]; -_target setVariable [QEGVAR(medical,openWounds), _openWounds, true]; +_patient setVariable [QEGVAR(medical,openWounds), _openWounds, true]; // Handle the reopening of bandaged wounds if (_impact > 0 && {GVAR(advancedBandages) && {GVAR(woundReopening)}}) then { - [_target, _impact, _partIndex, _woundIndex, _wound, _bandage] call FUNC(handleBandageOpening); + [_patient, _impact, _partIndex, _woundIndex, _wound, _bandage] call FUNC(handleBandageOpening); }; - -true diff --git a/addons/medical_treatment/functions/fnc_canAccessMedicalEquipment.sqf b/addons/medical_treatment/functions/fnc_canAccessMedicalEquipment.sqf deleted file mode 100644 index 3544022c2b..0000000000 --- a/addons/medical_treatment/functions/fnc_canAccessMedicalEquipment.sqf +++ /dev/null @@ -1,28 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Check if caller can access targets medical equipment, based upon accessLevel. - * - * Arguments: - * 0: The caller - * 1: The target - * - * Return Value: - * Can Treat - * - * Example: - * [bob, target] call ace_medical_treatment_fnc_canAccessMedicalEquipment - * - * Public: No - */ - -params ["_caller", "_target"]; - -private _accessLevel = _target getVariable [QGVAR(allowSharedEquipmentAccess), -1]; - -switch (_accessLevel) do { - case 0: { true }; - case 1: { side _target == side _caller }; - case 2: { group _target == group _caller }; - default { false }; -}; diff --git a/addons/medical_treatment/functions/fnc_canBandage.sqf b/addons/medical_treatment/functions/fnc_canBandage.sqf index ad7aabf42a..4674c2cdf1 100644 --- a/addons/medical_treatment/functions/fnc_canBandage.sqf +++ b/addons/medical_treatment/functions/fnc_canBandage.sqf @@ -5,23 +5,23 @@ * Toggles between showing all or only basic bandage action for advanced setting. * * Arguments: - * 0: The medic - * 1: The patient - * 2: Body part - * 3: Treatment class name + * 0: Medic + * 1: Patient + * 2: Body Part + * 3: Treatment * - * ReturnValue: + * Return Value: * Can Bandage * * Public: No */ -params ["_medic", "_patient", "_bodypart", "_bandage"]; +params ["_medic", "_patient", "_bodyPart", "_bandage"]; // Bandage type and bandage setting XNOR to show only active actions -if ((_bandage == "BasicBandage") isEqualTo GVAR(advancedBandages)) exitWith { false }; +if ((_bandage == "BasicBandage") isEqualTo GVAR(advancedBandages)) exitWith {false}; -private _index = ALL_BODY_PARTS find toLower _bodypart; +private _index = ALL_BODY_PARTS find toLower _bodyPart; private _canBandage = false; { diff --git a/addons/medical_treatment/functions/fnc_canTreat.sqf b/addons/medical_treatment/functions/fnc_canTreat.sqf index 26c981a02c..2d4be68283 100644 --- a/addons/medical_treatment/functions/fnc_canTreat.sqf +++ b/addons/medical_treatment/functions/fnc_canTreat.sqf @@ -1,77 +1,39 @@ #include "script_component.hpp" /* - * Author: Glowbal - * Check if the treatment action can be performed. + * Author: Glowbal, mharis001 + * Checks if the given treatment can be performed. * * Arguments: - * 0: The caller - * 1: The target - * 2: Body part - * 3: Treatment class name + * 0: Medic + * 1: Patient + * 2: Body Part + * 3: Treatment * - * ReturnValue: + * Return Value: * Can Treat * * Example: - * [player, cursorTarget, "Head", "SurgicalKit"] call ace_medical_treatment_fnc_canTreat + * [player, cursorObject, "Head", "SurgicalKit"] call ace_medical_treatment_fnc_canTreat * * Public: No */ -params ["_caller", "_target", "_bodyPart", "_className"]; +params ["_medic", "_patient", "_bodyPart", "_classname"]; -if !(_target isKindOf "CAManBase") exitWith {false}; +private _config = configFile >> QGVAR(actions) >> _classname; -private _config = configFile >> QGVAR(Actions) >> _className; - -if !(isClass _config) exitWith {false}; - -// allow self treatment check -private _isSelf = _caller isEqualTo _target; -private _allowSelf = 0; - -if (_isSelf) then { - if (isNumber (_config >> "allowSelfTreatment")) then { - _allowSelf = getNumber (_config >> "allowSelfTreatment"); - } else { - if (isText (_config >> "allowSelfTreatment")) then { - _allowSelf = missionNamespace getVariable [getText (_config >> "allowSelfTreatment"), 0]; - }; - }; -}; - -if (_isSelf && {_allowSelf == 0}) exitWith {false}; - -private _medicRequired = 0; - -if (isNumber (_config >> "requiredMedic")) then { - _medicRequired = getNumber (_config >> "requiredMedic"); -} else { - if (isText (_config >> "requiredMedic")) then { - _medicRequired = missionNamespace getVariable [getText (_config >> "requiredMedic"), 0]; - }; -}; - -if !([_caller, _medicRequired] call FUNC(isMedic)) exitWith {false}; - -// check selection -private _allowedSelections = getArray (_config >> "allowedSelections") apply {toLower _x}; - -if !("all" in _allowedSelections || {(_bodyPart in _allowedSelections)}) exitWith {false}; - -// check item -private _items = getArray (_config >> "items"); - -if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitWith {false}; - -private _condition = true; - -if (isText (_config >> "condition")) then { - _condition = getText (_config >> "condition"); - - if (_condition isEqualTo "") exitWith { - _condition = true; - }; +isClass _config +&& {_patient isKindOf "CAManBase"} +&& {_medic != _patient || {GET_NUMBER_ENTRY(_config >> "allowSelfTreatment") == 1}} +&& {[_medic, GET_NUMBER_ENTRY(_config >> "medicRequired")] call FUNC(isMedic)} +&& { + private _selections = getArray (_config >> "allowedSelections") apply {toLower _x}; + "all" in _selections || {_bodyPart in _selections} +} && { + private _items = getArray (_config >> "items"); + _items isEqualTo [] || {[_medic, _patient, _items] call FUNC(hasItem)} +} && { + private _condition = getText (_config >> "condition"); if (isNil _condition) then { _condition = compile _condition; @@ -79,38 +41,23 @@ if (isText (_config >> "condition")) then { _condition = missionNamespace getVariable _condition; }; - if !(_condition isEqualType false) then { + if (_condition isEqualType {}) then { _condition = call _condition; }; -}; -if !(_condition) exitWith {false}; - -// check allowed locations -private _locations = getArray (_config >> "treatmentLocations") apply {toLower _x}; - -if ("all" in _locations) then { - _locations = true; -} else { - private _medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))}; - private _medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isInMedicalVehicle))}; - - { - if (_x == "field") exitWith { _locations = true; }; - if (_x == "MedicalFacility" && _medFacility) exitWith { _locations = true; }; - if (_x == "MedicalVehicle" && _medVeh) exitWith { _locations = true; }; - if !(isNil _x) exitWith { - _locations = missionNamespace getVariable _x; - - if !(_locations isEqualType false) then { - if (_locations isEqualTo 0) exitWith { _locations = true; }; //AdvancedMedicalSettings_anywhere - if (_locations isEqualTo 1) exitWith { _locations = call _medVeh; }; //AdvancedMedicalSettings_vehicle - if (_locations isEqualTo 2) exitWith { _locations = call _medFacility; }; //AdvancedMedicalSettings_facility - if (_locations isEqualTo 3) exitWith { _locations = call _medFacility || {call _medVeh}; }; //AdvancedMedicalSettings_vehicleAndFacility - _locations = false; //Disabled - }; + _condition +} && { + switch (GET_NUMBER_ENTRY(_config >> "treatmentLocations")) do { + case TREATMENT_LOCATIONS_ALL: {true}; + case TREATMENT_LOCATIONS_VEHICLES: { + IN_MED_VEHICLE(_medic) || {IN_MED_VEHICLE(_patient)} }; - } forEach _locations; -}; - -_locations + case TREATMENT_LOCATIONS_FACILITIES: { + IN_MED_FACILITY(_medic) || {IN_MED_FACILITY(_patient)} + }; + case TREATMENT_LOCATIONS_VEHICLES_AND_FACILITIES: { + IN_MED_VEHICLE(_medic) || {IN_MED_VEHICLE(_patient)} || {IN_MED_FACILITY(_medic)} || {IN_MED_FACILITY(_patient)} + }; + default {false}; + }; +} diff --git a/addons/medical_treatment/functions/fnc_canTreatCached.sqf b/addons/medical_treatment/functions/fnc_canTreatCached.sqf index 53ad59cdf4..d70f041c17 100644 --- a/addons/medical_treatment/functions/fnc_canTreatCached.sqf +++ b/addons/medical_treatment/functions/fnc_canTreatCached.sqf @@ -1,24 +1,23 @@ #include "script_component.hpp" /* * Author: Glowbal - * Cached Check if the treatment action can be performed. + * Cached check to determine if given treatment can be performed. * * Arguments: - * 0: The caller - * 1: The target - * 2: Selection name - * 3: ACE_Medical_Treatment Classname + * 0: Medic + * 1: Patient + * 2: Body Part + * 3: Treatment * * Return Value: * Can Treat * * Example: - * [bob, kevin, "selection", "classname"] call ace_medical_treatment_fnc_canTreatCached + * [player, cursorObject, "Head", "SurgicalKit"] call ace_medical_treatment_fnc_canTreatCached * * Public: No */ -params ["", "_target", "_selection", "_classname"]; +params ["", "_patient", "_bodyPart", "_classname"]; -// parameters, function, namespace, uid -[_this, DFUNC(canTreat), _target, format [QGVAR(canTreat_%1_%2), _selection, _classname], CAN_TREAT_CONDITION_CACHE_EXPIRY, QEGVAR(interact_menu,clearConditionCaches)] call EFUNC(common,cachedCall); +[_this, FUNC(canTreat), _patient, format [QGVAR(canTreat_%1_%2), _bodyPart, _classname], CAN_TREAT_CONDITION_CACHE_EXPIRY, QEGVAR(interact_menu,clearConditionCaches)] call EFUNC(common,cachedCall); diff --git a/addons/medical_treatment/functions/fnc_checkBloodPressure.sqf b/addons/medical_treatment/functions/fnc_checkBloodPressure.sqf new file mode 100644 index 0000000000..b708b7e50f --- /dev/null +++ b/addons/medical_treatment/functions/fnc_checkBloodPressure.sqf @@ -0,0 +1,22 @@ +#include "script_component.hpp" +/* + * Author: Glowbal + * Checks the blood pressure of the patient. + * + * Arguments: + * 0: Medic + * 1: Patient + * 2: Body Part + * + * Return Value: + * None + * + * Example: + * [player, cursorObject, "LeftArm"] call ace_medical_treatment_fnc_checkBloodPressure + * + * Public: No + */ + +params ["_medic", "_patient", "_bodyPart"]; + +[QGVAR(checkBloodPressureLocal), [_medic, _patient, _bodyPart], _patient] call CBA_fnc_targetEvent; diff --git a/addons/medical_treatment/functions/fnc_checkBloodPressureLocal.sqf b/addons/medical_treatment/functions/fnc_checkBloodPressureLocal.sqf new file mode 100644 index 0000000000..87bff6aac5 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_checkBloodPressureLocal.sqf @@ -0,0 +1,57 @@ +#include "script_component.hpp" +/* + * Author: Glowbal + * Local callback for checking the blood pressure of a patient. + * + * Arguments: + * 0: Medic + * 1: Patient + * 2: Body Part + * + * Return Value: + * None + * + * Example: + * [player, cursorObject, "LeftArm"] call ace_medical_treatment_fnc_checkBloodPressureLocal + * + * Public: No + */ + +params ["_medic", "_patient", "_bodyPart"]; + +private _bloodPressure = [0, 0]; + +if (alive _patient && {!([_patient, _bodyPart] call FUNC(hasTourniquetAppliedTo))}) then { + _bloodPressure = GET_BLOOD_PRESSURE(_patient); +}; + +private _bloodPressureOutput = LSTRING(Check_Bloodpressure_Output_6); +private _logOutPut = LSTRING(Check_Bloodpressure_NoBloodpressure); + +_bloodPressure params ["_bloodPressureLow", "_bloodPressureHigh"]; + +if (_bloodPressureHigh > 20) then { + if (_medic call FUNC(isMedic)) then { + _bloodPressureOutput = LSTRING(Check_Bloodpressure_Output_1); + _logOutPut = format ["%1/%2", round _bloodPressureHigh, round _bloodPressureLow]; + } else { + if (_bloodPressureHigh > 20) then { + _bloodPressureOutput = LSTRING(Check_Bloodpressure_Output_2); + _logOutPut = LSTRING(Check_Bloodpressure_Low); + + if (_bloodPressureHigh > 100) then { + _bloodPressureOutput = LSTRING(Check_Bloodpressure_Output_3); + _logOutPut = LSTRING(Check_Bloodpressure_Normal); + + if (_bloodPressureHigh > 160) then { + _bloodPressureOutput = LSTRING(Check_Bloodpressure_Output_4); + _logOutPut = LSTRING(Check_Bloodpressure_High); + }; + }; + }; + }; +}; + +[_patient, "quick_view", LSTRING(Check_Bloodpressure_Log), [_medic call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); + +[QEGVAR(common,displayTextStructured), [[_bloodPressureOutput, _patient call EFUNC(common,getName), round _bloodPressureHigh, round _bloodPressureLow], 1.75, _medic], _medic] call CBA_fnc_targetEvent; diff --git a/addons/medical_treatment/functions/fnc_checkItems.sqf b/addons/medical_treatment/functions/fnc_checkItems.sqf index 4c2278a408..2447df18d2 100644 --- a/addons/medical_treatment/functions/fnc_checkItems.sqf +++ b/addons/medical_treatment/functions/fnc_checkItems.sqf @@ -6,7 +6,7 @@ * Arguments: * 0: The unit * - * ReturnValue: + * Return Value: * None * * Public: No diff --git a/addons/medical_treatment/functions/fnc_checkPulse.sqf b/addons/medical_treatment/functions/fnc_checkPulse.sqf new file mode 100644 index 0000000000..6c5b628fae --- /dev/null +++ b/addons/medical_treatment/functions/fnc_checkPulse.sqf @@ -0,0 +1,22 @@ +#include "script_component.hpp" +/* + * Author: Glowbal + * Checks the pulse or heart rate of the patient. + * + * Arguments: + * 0: Medic + * 1: Patient + * 2: Body Part + * + * Return Value: + * None + * + * Example: + * [player, cursorObject, "Head"] call ace_medical_treatment_fnc_checkPulse + * + * Public: No + */ + +params ["_medic", "_patient", "_bodyPart"]; + +[QGVAR(checkPulseLocal), [_medic, _patient, _bodyPart], _patient] call CBA_fnc_targetEvent; diff --git a/addons/medical_treatment/functions/fnc_checkPulseLocal.sqf b/addons/medical_treatment/functions/fnc_checkPulseLocal.sqf new file mode 100644 index 0000000000..ad574e73a0 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_checkPulseLocal.sqf @@ -0,0 +1,53 @@ +#include "script_component.hpp" +/* + * Author: Glowbal + * Local callback for checking the pulse or heart rate of a patient. + * + * Arguments: + * 0: Medic + * 1: Patient + * 2: Body Part + * + * Return Value: + * None + * + * Example: + * [player, cursorObject, "Head"] call ace_medical_treatment_fnc_checkPulseLocal + * + * Public: No + */ + +params ["_medic", "_patient", "_bodyPart"]; + +private _heartRate = 0; + +if (alive _patient && {!([_patient, _bodyPart] call FUNC(hasTourniquetAppliedTo))}) then { + _heartRate = GET_HEART_RATE(_patient); +}; + +private _heartRateOutput = LSTRING(Check_Pulse_Output_5); +private _logOutPut = LSTRING(Check_Pulse_None); + +if (_heartRate > 1) then { + if (_medic call FUNC(isMedic)) then { + _heartRateOutput = LSTRING(Check_Pulse_Output_1); + _logOutPut = format ["%1", round _heartRate]; + } else { + _heartRateOutput = LSTRING(Check_Pulse_Output_2); + _logOutPut = LSTRING(Check_Pulse_Weak); + + if (_heartRate > 60) then { + if (_heartRate > 100) then { + _heartRateOutput = LSTRING(Check_Pulse_Output_3); + _logOutPut = LSTRING(Check_Pulse_Strong); + } else { + _heartRateOutput = LSTRING(Check_Pulse_Output_4); + _logOutPut = LSTRING(Check_Pulse_Normal); + }; + }; + }; +}; + +[_patient, "quick_view", LSTRING(Check_Pulse_Log), [_medic call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); + +[QEGVAR(common,displayTextStructured), [[_heartRateOutput, _patient call EFUNC(common,getName), round _heartRate], 1.5, _medic], _medic] call CBA_fnc_targetEvent; diff --git a/addons/medical_treatment/functions/fnc_checkResponse.sqf b/addons/medical_treatment/functions/fnc_checkResponse.sqf new file mode 100644 index 0000000000..c95eabd978 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_checkResponse.sqf @@ -0,0 +1,24 @@ +#include "script_component.hpp" +/* + * Author: Glowbal + * Checks the response status of the patient. + * + * Arguments: + * 0: Medic + * 1: Patient + * + * Return Value: + * None + * + * Example: + * [player, cursorObject] call ace_medical_treatment_fnc_checkResponse + * + * Public: No + */ + +params ["_medic", "_patient"]; + +private _output = [LSTRING(Check_Response_Unresponsive), LSTRING(Check_Response_Responsive)] select (_patient call EFUNC(common,isAwake)); +[[_output, _patient call EFUNC(common,getName)], 2] call EFUNC(common,displayTextStructured); + +[_patient, "quick_view", _output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); diff --git a/addons/medical_treatment/functions/fnc_createLitter.sqf b/addons/medical_treatment/functions/fnc_createLitter.sqf new file mode 100644 index 0000000000..e202a3daa8 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_createLitter.sqf @@ -0,0 +1,70 @@ +#include "script_component.hpp" +/* + * Author: Glowbal, mharis001 + * Creates litter around the patient based on the treatment. + * + * Arguments: + * 0: Medic + * 1: Patient + * 2: Body Part + * 3: Treatment + * + * Return Value: + * None + * + * Example: + * [player, cursorObject, "Head", "BasicBandage"] call ace_medical_fnc_createLitter + * + * Public: No + */ + +// Exit if litter creation is disabled +if (!GVAR(allowLitterCreation)) exitWith {}; + +params ["_medic", "_patient", "_bodyPart", "_classname"]; + +// Don't create litter if medic or patient are inside a vehicle +if (vehicle _medic != _medic || {vehicle _patient != _patient}) exitWith {}; + +// Determine if treated body part is bleeding +private _index = ALL_BODY_PARTS find toLower _bodyPart; +private _isBleeding = (_patient getVariable [QEGVAR(medical,openWounds), []]) findIf { + _x params ["", "", "_bodyPartN", "_amountOf", "_bleeding"]; + + _bodyPartN == _index && {_amountOf * _bleeding > 0} +} != -1; + +// Get litter config for the treatment +private _litter = getArray (configFile >> QGVAR(actions) >> _classname >> "litter"); +_litter params [["_alwaysLitter", [], [[]]], ["_cleanLitter", [], [[]]], ["_bloodyLitter", [], [[]]]]; + +private _fnc_createLitter = { + params ["_litterOptions"]; + + private _position = getPosASL _patient; + + // For now, don't spawn litter over water to avoid floating litter + // todo: handle carriers over water + if (surfaceIsWater _position) exitWith {}; + + { + if (_x isEqualType []) then { + _x = selectRandom _x; + }; + + // Randomize position XY +/- 1 m + private _position = _position vectorAdd [ + random 2 - 1, + random 2 - 1, + 0 + ]; + + // Create litter on server which will also handle cleanup + [QGVAR(createLitterServer), [_x, _position, random 360]] call CBA_fnc_serverEvent; + } forEach _litterOptions; +}; + +private _conditionalLitter = [_cleanLitter, _bloodyLitter] select _isBleeding; + +[_alwaysLitter] call _fnc_createLitter; +[_conditionalLitter] call _fnc_createLitter; diff --git a/addons/medical_treatment/functions/fnc_createLitterServer.sqf b/addons/medical_treatment/functions/fnc_createLitterServer.sqf new file mode 100644 index 0000000000..69f684b5a6 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_createLitterServer.sqf @@ -0,0 +1,59 @@ +#include "script_component.hpp" +/* + * Author: Glowbal, mharis001 + * Creates a litter object and handles its cleanup. Only execute on server. + * + * Arguments: + * 0: Litter Class + * 1: Position ASL + * 2: Direction + * + * Return Value: + * None + * + * Example: + * ["Litter_1", [100, 100, 0], 90] call ace_medical_fnc_createLitterServer + * + * Public: No + */ + +params ["_litterClass", "_position", "_direction"]; + +if (isNil QGVAR(litterObjects)) then { + GVAR(litterObjects) = []; + GVAR(litterCleanup) = false; +}; + +private _model = getText (configFile >> "CfgVehicles" >> _litterClass >> "model"); +if (_model == "") exitWith {}; + +// createSimpleObject expects a path without the leading slash +if (_model select [0, 1] == "\") then { + _model = _model select [1]; +}; + +private _object = createSimpleObject [_model, [0, 0, 0]]; +_object setPosASL _position; +_object setDir _direction; + +systemChat str [_litterClass, _object]; + +// Set the litter object's position next frame to correct HORRIBLE spacing (fixes #1112) +[{ + params ["_object", "_position"]; + _object setPosASL _position; +}, [_object, _position]] call CBA_fnc_execNextFrame; + +// Delete oldest litter object if max count reached +if (count GVAR(litterObjects) > GVAR(maxLitterObjects)) then { + private _litterToDelete = GVAR(litterObjects) deleteAt 0; + deleteVehicle (_litterToDelete select 0); +}; + +GVAR(litterObjects) pushBack [_object, CBA_missionTime]; + +// Start cleanup loop if not already running and litter lifetime is not forever +if (!GVAR(litterCleanup) && {GVAR(litterCleanUpDelay) > 0}) then { + [] call FUNC(litterCleanupLoop); + GVAR(litterCleanup) = true; +}; diff --git a/addons/medical_treatment/functions/fnc_diagnose.sqf b/addons/medical_treatment/functions/fnc_diagnose.sqf new file mode 100644 index 0000000000..531827302d --- /dev/null +++ b/addons/medical_treatment/functions/fnc_diagnose.sqf @@ -0,0 +1,49 @@ +#include "script_component.hpp" +/* + * Author: Glowbal + * Action for diagnosing in basic medical + * + * Arguments: + * 0: Medic + * 1: Patient + * + * Return Value: + * None + * + * Example: + * [player, cursorObject] call ace_medical_treatment_fnc_diagnose + * + * Public: No + */ + +params ["_medic", "_patient"]; + +private _messages = [LSTRING(diagnoseMessage), _patient call EFUNC(common,getName)]; + +if (alive _patient) then { + _messages pushBack LSTRING(diagnoseAlive); +} else { + _messages pushBack LSTRING(diagnoseDead); +}; + +private _hemorrhage = GET_HEMORRHAGE(_patient); +if (_hemorrhage > 0) then { + if (_hemorrhage > 1) then { + _messages pushBack LSTRING(lostBloodALot); + } else { + _messages pushBack LSTRING(lostBlood); + }; +} else { + _messages pushBack LSTRING(noBloodloss); +}; + +// todo: mirror pain visualization logic of medical_gui? +if (alive _patient) then { + if IS_IN_PAIN(_patient) then { + _messages pushBack LSTRING(inPain); + } else { + _messages pushBack LSTRING(noPain); + }; +}; + +[_messages, 3] call EFUNC(common,displayTextStructured); diff --git a/addons/medical_treatment/functions/fnc_getTriageStatus.sqf b/addons/medical_treatment/functions/fnc_getTriageStatus.sqf index de4f78a853..6db6484b8f 100644 --- a/addons/medical_treatment/functions/fnc_getTriageStatus.sqf +++ b/addons/medical_treatment/functions/fnc_getTriageStatus.sqf @@ -7,11 +7,11 @@ * 0: Unit * * Return Value: - * Triage info - * 0: Status ID - * 1: Name - * 2: Color - * 3: Text color + * Triage Info + * 0: Status ID + * 1: Name + * 2: Color + * 3: Text Color * * Example: * [player] call ace_medical_treatment_fnc_getTriageStatus diff --git a/addons/medical_treatment/functions/fnc_hasItem.sqf b/addons/medical_treatment/functions/fnc_hasItem.sqf index f6e07b576e..564e7c4be2 100644 --- a/addons/medical_treatment/functions/fnc_hasItem.sqf +++ b/addons/medical_treatment/functions/fnc_hasItem.sqf @@ -1,44 +1,31 @@ #include "script_component.hpp" /* - * Author: Glowbal - * Check if the item is present between the patient and the medic + * Author: Glowbal, mharis001 + * Checks if one of the given items are present between the medic and patient. + * Does not respect the priority defined by the allowSharedEquipment setting. + * Will check medic first and then patient if shared equipment is allowed. * * Arguments: * 0: Medic * 1: Patient - * 2: Item + * 2: Items * * Return Value: - * Has the items + * Has Item * * Example: - * [bob, patient, "bandage"] call ace_medical_treatment_fnc_hasItem + * [player, cursorObject, ["ACE_fieldDressing"]] call ace_medical_treatment_fnc_hasItems * * Public: No */ -params ["_medic", "_patient", "_item"]; +params ["_medic", "_patient", "_items"]; -if (isNil QEGVAR(medical,setting_allowSharedEquipment)) then { - EGVAR(medical,setting_allowSharedEquipment) = true; +private _fnc_checkItems = { + params ["_unit"]; + + private _unitItems = _unit call EFUNC(common,uniqueItems); + _items findIf {_x in _unitItems} != -1 }; -if (EGVAR(medical,setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitWith { - true -}; - -if ([_medic, _item] call EFUNC(common,hasItem)) exitWith { - true -}; - -private _hasItem = false; - -if (vehicle _medic != _medic && {vehicle _medic call FUNC(isMedicalVehicle)}) then { - { - if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {[_x, _item] call EFUNC(common,hasItem)}) exitWith { - _hasItem = true; - }; - } forEach crew vehicle _medic; -}; - -_hasItem +_medic call _fnc_checkItems || {GVAR(allowSharedEquipment) != 2 && {_patient call _fnc_checkItems}} diff --git a/addons/medical_treatment/functions/fnc_hasItems.sqf b/addons/medical_treatment/functions/fnc_hasItems.sqf deleted file mode 100644 index c55ad47e34..0000000000 --- a/addons/medical_treatment/functions/fnc_hasItems.sqf +++ /dev/null @@ -1,36 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Check if all items are present between the patient and the medic. - * - * Arguments: - * 0: Medic - * 1: Patient - * 2: Items > - * - * Return Value: - * Has the items - * - * Example: - * [bob, patient, ["bandage", "morphine"]] call ace_medical_treatment_fnc_hasItems - * - * Public: No - */ - -params ["_medic", "_patient", "_items"]; - -private _return = true; - -{ - // handle a one of type use item - if (_x isEqualType [] && {{[_medic, _patient, _x] call FUNC(hasItem)} count _x == 0}) exitWith { - _return = false; - }; - - // handle required item - if (_x isEqualType "" && {!([_medic, _patient, _x] call FUNC(hasItem))}) exitWith { - _return = false; - }; -} forEach _items; - -_return diff --git a/addons/medical_treatment/functions/fnc_hasTourniquetAppliedTo.sqf b/addons/medical_treatment/functions/fnc_hasTourniquetAppliedTo.sqf index d3f573cb55..a2a103432d 100644 --- a/addons/medical_treatment/functions/fnc_hasTourniquetAppliedTo.sqf +++ b/addons/medical_treatment/functions/fnc_hasTourniquetAppliedTo.sqf @@ -1,14 +1,14 @@ #include "script_component.hpp" /* * Author: Glowbal - * Check if unit has a tourniquet applied to the specified bodypart + * Checks if the unit has a tourniquet applied on the specified body part. * * Arguments: - * 0: The Unit + * 0: Unit * 1: Body Part * * Return Value: - * Has tourniquet applied + * Has Tourniquet Applied * * Example: * [player, "leftleg"] call ace_medical_treatment_fnc_hasTourniquetAppliedTo @@ -16,8 +16,8 @@ * Public: No */ -params ["_target", "_bodyPart"]; +params ["_unit", "_bodyPart"]; private _index = ALL_BODY_PARTS find toLower _bodyPart; -_index >= 0 && {HAS_TOURNIQUET_APPLIED_ON(_target,_index)} +_index >= 0 && {HAS_TOURNIQUET_APPLIED_ON(_unit,_index)} diff --git a/addons/medical_treatment/functions/fnc_isInMedicalFacility.sqf b/addons/medical_treatment/functions/fnc_isInMedicalFacility.sqf index a9b01345b8..fe144ea78a 100644 --- a/addons/medical_treatment/functions/fnc_isInMedicalFacility.sqf +++ b/addons/medical_treatment/functions/fnc_isInMedicalFacility.sqf @@ -1,13 +1,13 @@ #include "script_component.hpp" /* - * Author: Glowbal - * Checks if a unit is in a designated medical facility + * Author: Glowbal, mharis001 + * Checks if the unit is in a medical facility. * * Arguments: - * 0: The Unit + * 0: Unit * * Return Value: - * Is in medical facility + * In Medical Facility * * Example: * [player] call ace_medical_treatment_fnc_isInMedicalFacility @@ -15,49 +15,13 @@ * Public: No */ +#define CHECK_OBJECTS(var) ((var) findIf {typeOf _x in GVAR(facilityClasses) || {_x getVariable [QEGVAR(medical,isMedicalFacility), false]}} != -1) + params ["_unit"]; -//Cache the results as this function could be called rapidly -(_unit getVariable [QGVAR(cacheInFacility), [-9, false]]) params ["_expireTime", "_lastResult"]; -if (CBA_missionTime < _expireTime) exitWith {_lastResult}; - -private _eyePos = eyePos _unit; -private _isInBuilding = false; - -private _medicalFacility = - [ - "TK_GUE_WarfareBFieldhHospital_Base_EP1", - "TK_GUE_WarfareBFieldhHospital_EP1", - "TK_WarfareBFieldhHospital_Base_EP1", - "TK_WarfareBFieldhHospital_EP1", - "US_WarfareBFieldhHospital_Base_EP1", - "US_WarfareBFieldhHospital_EP1", - "MASH_EP1", - "MASH", - "Land_A_Hospital", - "CDF_WarfareBFieldhHospital", - "GUE_WarfareBFieldhHospital", - "INS_WarfareBFieldhHospital", - "RU_WarfareBFieldhHospital", - "USMC_WarfareBFieldhHospital" - ]; - -private _objects = (lineIntersectsWith [_unit modelToWorldVisual [0, 0, (_eyePos select 2)], _unit modelToWorldVisual [0, 0, (_eyePos select 2) +10], _unit]); -{ - if (((typeOf _x) in _medicalFacility) || {_x getVariable [QEGVAR(medical,isMedicalFacility),false]}) exitWith { - _isInBuilding = true; - }; -} forEach _objects; - -if (!_isInBuilding) then { - _objects = _unit nearObjects 7.5; - { - if (((typeOf _x) in _medicalFacility) || {_x getVariable [QEGVAR(medical,isMedicalFacility),false]}) exitWith { - _isInBuilding = true; - }; - } forEach _objects; +private _fnc_check = { + private _position = _unit modelToWorldVisual [0, 0, eyePos _unit select 2]; + CHECK_OBJECTS(ARR_5(lineIntersectsWith [_position, _position vectorAdd [0, 0, 10], _unit])) || {CHECK_OBJECTS(_unit nearObjects 7.5)} }; -_unit setVariable [QGVAR(cacheInFacility), [CBA_missionTime + IN_MEDICAL_FACILITY_CACHE_EXPIRY, _isInBuilding]]; - -_isInBuilding; +[[], _fnc_check, _unit, QGVAR(inMedicalFacilityCache), IN_MEDICAL_FACILITY_CACHE_EXPIRY] call EFUNC(common,cachedCall); diff --git a/addons/medical_treatment/functions/fnc_isInMedicalVehicle.sqf b/addons/medical_treatment/functions/fnc_isInMedicalVehicle.sqf index 6c4d895492..2f76f04f99 100644 --- a/addons/medical_treatment/functions/fnc_isInMedicalVehicle.sqf +++ b/addons/medical_treatment/functions/fnc_isInMedicalVehicle.sqf @@ -1,13 +1,13 @@ #include "script_component.hpp" /* * Author: KoffeinFlummi - * Checks if a unit is in a medical vehicle. + * Checks if the unit is in a medical vehicle. * * Arguments: - * 0: unit to be checked + * 0: Unit * * Return Value: - * Is unit in medical vehicle? + * In Medical Vehicle * * Example: * [player] call ace_medical_treatment_fnc_isInMedicalVehicle @@ -19,7 +19,4 @@ params ["_unit"]; private _vehicle = vehicle _unit; -if (_unit == _vehicle) exitWith {false}; -if (_unit in [driver _vehicle, gunner _vehicle, commander _vehicle]) exitWith {false}; - -[_vehicle] call FUNC(isMedicalVehicle); +_unit != _vehicle && {!(_unit in [driver _vehicle, gunner _vehicle, commander _vehicle])} && {[_vehicle] call FUNC(isMedicalVehicle)} diff --git a/addons/medical_treatment/functions/fnc_isMedic.sqf b/addons/medical_treatment/functions/fnc_isMedic.sqf index 65bbdcc853..561b52a37e 100644 --- a/addons/medical_treatment/functions/fnc_isMedic.sqf +++ b/addons/medical_treatment/functions/fnc_isMedic.sqf @@ -1,14 +1,15 @@ #include "script_component.hpp" /* * Author: Glowbal, KoffeinFlummi - * Check if a unit is any medical class + * Checks if the unit is a medic of the given level. + * Medic Levels: 0 - None, 1 - Medic, 2 - Doctor * * Arguments: - * 0: The Unit - * 1: Class (default: 1) + * 0: Unit + * 1: Medic Level (default: 1) * * Return Value: - * Is in of medic class + * Is Medic * * Example: * [player] call ace_medical_treatment_fnc_isMedic @@ -18,13 +19,13 @@ params ["_unit", ["_medicN", 1]]; -private _class = _unit getVariable [QEGVAR(medical,medicClass), [0, 1] select (_unit getUnitTrait "medic")]; +private _class = _unit getVariable [QEGVAR(medical,medicClass), parseNumber (_unit getUnitTrait "medic")]; if (_class >= _medicN) exitWith {true}; -if (!EGVAR(medical,increaseTrainingInLocations)) exitWith {false}; +if (!GVAR(locationsBoostTraining)) exitWith {false}; -if (([_unit] call FUNC(isInMedicalVehicle)) || {[_unit] call FUNC(isInMedicalFacility)}) then { - _class = _class + 1; //boost by one: untrained becomes medic, medic becomes doctor +if ([_unit] call FUNC(isInMedicalVehicle) || {[_unit] call FUNC(isInMedicalFacility)}) then { + _class = _class + 1; // Boost medical training by one: untrained becomes medic, medic becomes doctor }; _class >= _medicN diff --git a/addons/medical_treatment/functions/fnc_isMedicalVehicle.sqf b/addons/medical_treatment/functions/fnc_isMedicalVehicle.sqf index d109a14e87..4b06ffdb55 100644 --- a/addons/medical_treatment/functions/fnc_isMedicalVehicle.sqf +++ b/addons/medical_treatment/functions/fnc_isMedicalVehicle.sqf @@ -1,13 +1,13 @@ #include "script_component.hpp" /* * Author: Glowbal - * Check if vehicle is a medical vehicle + * Checks if the vehicle is a medical vehicle. * * Arguments: - * 0: The Vehicle + * 0: Vehicle * * Return Value: - * Is in of medic class + * Is Medical Vehicle * * Example: * [cursorObject] call ace_medical_treatment_fnc_isMedicalVehicle @@ -17,4 +17,4 @@ params ["_vehicle"]; -(_vehicle getVariable [QEGVAR(medical,medicClass), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "attendant")]) > 0 +_vehicle getVariable [QEGVAR(medical,isMedicalVehicle), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "attendant") > 0] diff --git a/addons/medical_treatment/functions/fnc_ivBag.sqf b/addons/medical_treatment/functions/fnc_ivBag.sqf new file mode 100644 index 0000000000..bfc149564e --- /dev/null +++ b/addons/medical_treatment/functions/fnc_ivBag.sqf @@ -0,0 +1,28 @@ +#include "script_component.hpp" +/* + * Author: Glowbal, mharis001 + * Administers an IV bag treatment to the patient. + * + * Arguments: + * 0: Medic + * 1: Patient + * 2: Body Part + * 3: Treatment + * 4: Item User (not used) + * 5: Used Item + * + * Return Value: + * None + * + * Example: + * [player, cursorObject, "RightArm", "BloodIV", objNull, "ACE_bloodIV"] call ace_medical_treatment_fnc_ivBag + * + * Public: No + */ + +params ["_medic", "_patient", "_bodyPart", "_classname", "", "_usedItem"]; + +[_patient, _usedItem] call FUNC(addToTriageCard); +[_patient, "activity", LSTRING(Activity_gaveIV), [[_medic, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); + +[QGVAR(ivBagLocal), [_patient, _bodyPart, _classname], _patient] call CBA_fnc_targetEvent; diff --git a/addons/medical_treatment/functions/fnc_ivBagLocal.sqf b/addons/medical_treatment/functions/fnc_ivBagLocal.sqf new file mode 100644 index 0000000000..5017e74aae --- /dev/null +++ b/addons/medical_treatment/functions/fnc_ivBagLocal.sqf @@ -0,0 +1,38 @@ +#include "script_component.hpp" +/* + * Author: Glowbal, mharis001 + * Local callback for administering an IV bag to a patient. + * + * Arguments: + * 0: Patient + * 1: Body Part + * 2: Treatment + * + * Return Value: + * None + * + * Example: + * [player, "RightArm", "BloodIV"] call ace_medical_treatment_fnc_ivBagLocal + * + * Public: No + */ + +params ["_patient", "_bodyPart", "_classname"]; + +// Exit if patient has max blood volume +private _bloodVolume = GET_BLOOD_VOLUME(_patient); +if (_bloodVolume >= DEFAULT_BLOOD_VOLUME) exitWith {}; + +private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; + +// Get attributes for the used IV +private _defaultConfig = configFile >> QUOTE(ADDON) >> "IV"; +private _ivConfig = _defaultConfig >> _classname; + +private _volume = GET_NUMBER(_ivConfig >> "volume",getNumber (_defaultConfig >> "volume")); +private _type = GET_STRING(_ivConfig >> "type",getText (_defaultConfig >> "type")); + +// Add IV bag to patient's ivBags array +private _ivBags = _patient getVariable [QEGVAR(medical,ivBags), []]; +_ivBags pushBack [_volume, _type, _partIndex]; +_ivBags setVariable [QEGVAR(medical,ivBags), _ivBags, true]; diff --git a/addons/medical_treatment/functions/fnc_litterCleanupLoop.sqf b/addons/medical_treatment/functions/fnc_litterCleanupLoop.sqf index 20b2cc20ec..9b6740f501 100644 --- a/addons/medical_treatment/functions/fnc_litterCleanupLoop.sqf +++ b/addons/medical_treatment/functions/fnc_litterCleanupLoop.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* - * Author: Glowbal, esteldunedain - * Loop that cleans up litter + * Author: Glowbal, esteldunedain, mharis001 + * Handles cleaning up litter objects that have reached their lifetime. * * Arguments: * None @@ -10,31 +10,28 @@ * None * * Example: - * call ace_medical_treatment_fnc_litterCleanupLoop + * [] call ace_medical_treatment_fnc_litterCleanupLoop * * Public: No */ { - _x params ["_time", "_objects"]; + _x params ["_object", "_timeCreated"]; - // Older elements are always at the begining of the array - if (CBA_missionTime - _time < GVAR(litterCleanUpDelay)) exitWith {}; + // Litter array has older objects at the beginning + // Can exit on first element that still has lifetime remaining + if (CBA_missionTime - _timeCreated < GVAR(litterCleanUpDelay)) exitWith {}; - TRACE_2("deleting",_time,_objects); - { - deleteVehicle _x; - } forEach _objects; + deleteVehicle _object; + GVAR(litterObjects) set [_forEachIndex, objNull]; +} forEach GVAR(litterObjects); - GVAR(allCreatedLitter) set [_forEachIndex, objNull]; -} forEach GVAR(allCreatedLitter); +GVAR(litterObjects) = GVAR(litterObjects) - [objNull]; -GVAR(allCreatedLitter) = GVAR(allCreatedLitter) - [objNull]; - -// If no more litter remain, exit the loop -if (GVAR(allCreatedLitter) isEqualTo []) exitWith { - GVAR(litterPFHRunning) = false; +// Exit the loop if no litter objects left +if (GVAR(litterObjects) isEqualTo []) exitWith { + GVAR(litterCleanup) = false; }; -// Schedule the loop to be executed again 30 sec later -[FUNC(litterCleanupLoop), [], 30] call CBA_fnc_waitAndExecute; +// Schedule cleanup loop to executed again +[FUNC(litterCleanupLoop), [], LITTER_CLEANUP_CHECK_DELAY] call CBA_fnc_waitAndExecute; diff --git a/addons/medical_treatment/functions/fnc_litterCreate.sqf b/addons/medical_treatment/functions/fnc_litterCreate.sqf deleted file mode 100644 index c923a6461e..0000000000 --- a/addons/medical_treatment/functions/fnc_litterCreate.sqf +++ /dev/null @@ -1,98 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Spawns litter for the treatment action on the ground around the target - * - * Arguments: - * 0: The Caller - * 1: The target - * 2: The treatment Selection Name - * 3: The treatment classname - * 4: ? - * 5: Users of Items - * 6: Blood Loss on selection (previously called _previousDamage) - * - * Return Value: - * None - * - * Public: No - */ - -#define MIN_ENTRIES_LITTER_CONFIG 3 - -params ["_caller", "_target", "_selectionName", "_className", "", "_usersOfItems", "_bloodLossOnSelection"]; -TRACE_6("params",_caller,_target,_selectionName,_className,_usersOfItems,_bloodLossOnSelection); - -// Ensures comptibilty with other possible medical treatment configs -private _previousDamage = _bloodLossOnSelection; - -// Exit if litter is disabled by setting -if !(EGVAR(medical,allowLitterCreation)) exitWith {}; - -// Don't create litter if medic or patient are inside a vehicle -if (vehicle _caller != _caller || {vehicle _target != _target}) exitWith {}; - -private _config = configFile >> QGVAR(Actions) >> _className; -if !(isClass _config) exitWith {TRACE_1("No action config",_className);}; - -if !(isArray (_config >> "litter")) exitWith {TRACE_1("No litter config",_className);}; -private _litter = getArray (_config >> "litter"); - -private _createLitter = { - params ["_unit", "_litterClass"]; - - private _position = getPosASL _unit; - - // @TODO: handle carriers over water - // For now, don't spawn litter if we are over water to avoid floating litter - if (surfaceIsWater _position) exitWith {false}; - - _position = _position vectorAdd [ - random 2 - 1, - random 2 - 1, - 0 - ]; - - private _direction = random 360; - - // Create the litter, and timeout the event based on the cleanup delay - // The cleanup delay for events in MP is handled by the server side - TRACE_3("Creating Litter on server",_litterClass,_position,_direction); - [QGVAR(createLitterServer), [_litterClass, _position, _direction]] call CBA_fnc_serverEvent; - - true -}; - -{ - if (count _x < MIN_ENTRIES_LITTER_CONFIG) then { - WARNING_2("Wrong litter array: %1",_x); - } else { - _x params [ - ["_selection", "", [""]], - ["_litterCondition", "", [""]], - ["_litterOptions", [], [[]]] - ]; - - if (toLower _selection in [toLower _selectionName, "all"]) then { - if (_litterCondition isEqualTo "") then { - _litterCondition = {true}; - } else { - _litterCondition = compile _litterCondition; - }; - - // existing configs seem to use carried over magic variables. we pass them as arguments (_this) anyway - if !([_caller, _target, _selectionName, _className, _usersOfItems, _bloodLossOnSelection] call _litterCondition) exitWith {}; - - // Loop through through the litter options and place the litter - { - if (_x isEqualType "") then { - [_target, _x] call _createLitter; - }; - - if (_x isEqualType [] && {count _x > 0}) then { - [_target, selectRandom _x] call _createLitter; - }; - } foreach _litterOptions; - }; - }; -} foreach _litter; diff --git a/addons/medical_treatment/functions/fnc_litterHandleCreate.sqf b/addons/medical_treatment/functions/fnc_litterHandleCreate.sqf deleted file mode 100644 index 10cbc1f580..0000000000 --- a/addons/medical_treatment/functions/fnc_litterHandleCreate.sqf +++ /dev/null @@ -1,68 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * handle Litter Create - * - * Arguments: - * 0: Litter Class - * 1: Position - * 2: Unit - * - * Return Value: - * None - * - * Example: - * ["litter", [2, 5, 6], bob] call ace_medical_treatment_fnc_handleCreateLitter - * - * Public: No - */ - -params ["_litterClass", "_position", "_direction"]; -TRACE_3("params",_litterClass,_position,_direction); - -//IGNORE_PRIVATE_WARNING ["_values"]; - -if (isNil QGVAR(allCreatedLitter)) then { - GVAR(allCreatedLitter) = []; - GVAR(litterPFHRunning) = false; -}; - -private _model = getText (configFile >> "CfgVehicles" >> _litterClass >> "model"); -if (_model == "") exitWith {TRACE_2("no model",_litterClass,_model)}; - -// createSimpleObject expects a path without the leading slash -if (_model select [0,1] == "\") then { - _model = _model select [1]; -}; - -private _litterObject = createSimpleObject [_model, [0,0,0]]; -TRACE_2("created",_litterClass,_litterObject); - -_litterObject setDir _direction; -_litterObject setPosASL _position; - -// Move the litter next frame to get rid of HORRIBLE spacing, fixes #1112 -[{ - params ["_object", "_position"]; - - _object setPosASL _position; -}, [_litterObject, _position]] call CBA_fnc_execNextFrame; - -private _maxLitterCount = getArray (configFile >> "ACE_Settings" >> QEGVAR(medical,litterSimulationDetail) >> "_values") select EGVAR(medical,litterSimulationDetail); - -if (count GVAR(allCreatedLitter) > _maxLitterCount) then { - // gank the first litter object, and spawn ours. - private _oldLitter = GVAR(allCreatedLitter) deleteAt 0; - - { - deleteVehicle _x; - } forEach (_oldLitter select 1); -}; - -GVAR(allCreatedLitter) pushBack [CBA_missionTime, [_litterObject]]; - -if (!GVAR(litterPFHRunning) && {GVAR(litterCleanUpDelay) > 0}) then { - // Start the litter cleanup loop - GVAR(litterPFHRunning) = true; - call FUNC(litterCleanupLoop); -}; diff --git a/addons/medical_treatment/functions/fnc_medication.sqf b/addons/medical_treatment/functions/fnc_medication.sqf new file mode 100644 index 0000000000..32124c23a4 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_medication.sqf @@ -0,0 +1,28 @@ +#include "script_component.hpp" +/* + * Author: Glowbal, mharis001 + * Administers medication to the patient on the given body bodypart. + * + * Arguments: + * 0: Medic + * 1: Patient + * 2: Body Part + * 3: Treatment + * 4: Item User (not used) + * 5: Used Item + * + * Return Value: + * None + * + * Example: + * [player, cursorObject, "RightArm", "Morphine", objNull, "ACE_morphine"] call ace_medical_treatment_fnc_medication + * + * Public: No + */ + +params ["_medic", "_patient", "_bodyPart", "_classname", "", "_usedItem"]; + +[_patient, _usedItem] call FUNC(addToTriageCard); +[_patient, "activity", LSTRING(Activity_usedItem), [[_medic, false, true] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _usedItem >> "displayName")]] call FUNC(addToLog); + +[QGVAR(medicationLocal), [_patient, _bodyPart, _classname]] call CBA_fnc_targetEvent; diff --git a/addons/medical_treatment/functions/fnc_medicationLocal.sqf b/addons/medical_treatment/functions/fnc_medicationLocal.sqf new file mode 100644 index 0000000000..de11cf317e --- /dev/null +++ b/addons/medical_treatment/functions/fnc_medicationLocal.sqf @@ -0,0 +1,69 @@ +#include "script_component.hpp" +/* + * Author: Glowbal, mharis001 + * Local callback for administering medication to a patient. + * + * Arguments: + * 0: Patient + * 1: Body Part + * 2: Treatment + * + * Return Value: + * None + * + * Example: + * [player, "RightArm", "Morphine"] call ace_medical_treatment_fnc_medicationLocal + * + * Public: No + */ + +// todo: move this macro to script_macros_medical.hpp? +#define MORPHINE_PAIN_SUPPRESSION 0.6 + +params ["_patient", "_bodyPart", "_classname"]; + +// Medication has no effects on dead units +if (!alive _patient) exitWith {}; + +// Exit with basic medication handling if advanced medication not enabled +if (!GVAR(advancedMedication)) exitWith { + switch (_classname) do { + case "Morphine": { + private _painSuppress = GET_PAIN_SUPPRESS(_patient); + _patient setVariable [VAR_PAIN_SUPP, (_painSuppress + MORPHINE_PAIN_SUPPRESSION) min 1, true]; + }; + case "Epinephrine": { + [QEGVAR(medical,WakeUp), _patient] call CBA_fnc_localEvent; + }; + }; +}; + +// Handle tourniquet on body part blocking blood flow at injection site +private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; + +if (HAS_TOURNIQUET_APPLIED_ON(_patient,_partIndex)) exitWith { + private _occludedMedications = _patient getVariable [QEGVAR(medical,occludedMedications), []]; + _occludedMedications pushBack [_partIndex, _classname]; + _patient setVariable [QEGVAR(medical,occludedMedications), _occludedMedications, true]; +}; + +// Get adjustment attributes for used medication +private _defaultConfig = configFile >> QUOTE(ADDON) >> "Medication"; +private _medicationConfig = _defaultConfig >> _classname; + +private _painReduce = GET_NUMBER(_medicationConfig >> "painReduce",getNumber (_defaultConfig >> "painReduce")); +private _timeInSystem = GET_NUMBER(_medicationConfig >> "timeInSystem",getNumber (_defaultConfig >> "timeInSystem")); +private _timeTillMaxEffect = GET_NUMBER(_medicationConfig >> "timeTillMaxEffect",getNumber (_defaultConfig >> "timeTillMaxEffect")); +private _maxDose = GET_NUMBER(_medicationConfig >> "maxDose",getNumber (_defaultConfig >> "maxDose")); +private _viscosityChange = GET_NUMBER(_medicationConfig >> "viscosityChange",getNumber (_defaultConfig >> "viscosityChange")); +private _hrIncreaseLow = GET_ARRAY(_medicationConfig >> "hrIncreaseLow",getArray (_defaultConfig >> "hrIncreaseLow")); +private _hrIncreaseNormal = GET_ARRAY(_medicationConfig >> "hrIncreaseNormal",getArray (_defaultConfig >> "hrIncreaseNormal")); +private _hrIncreaseHigh = GET_ARRAY(_medicationConfig >> "hrIncreaseHigh",getArray (_defaultConfig >> "hrIncreaseHigh")); +private _incompatableMedication = GET_ARRAY(_medicationConfig >> "incompatableMedication",getArray (_defaultConfig >> "incompatableMedication")); + +private _heartRate = GET_HEART_RATE(_patient); +private _hrIncrease = [_hrIncreaseLow, _hrIncreaseNorm, _hrIncreaseHigh] select (floor ((0 max _heartRate min 110) / 55)); +_hrIncrease params ["_minIncrease", "_maxIncrease"]; +private _heartRateChange = _minIncrease + random (_maxIncrease - _minIncrease); + +// todo: finish when medication rework PR is complete diff --git a/addons/medical_treatment/functions/fnc_surgicalKitProgress.sqf b/addons/medical_treatment/functions/fnc_surgicalKitProgress.sqf new file mode 100644 index 0000000000..a9473c43b9 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_surgicalKitProgress.sqf @@ -0,0 +1,38 @@ +#include "script_component.hpp" +/* + * Author: BaerMitUmlaut + * Handles the surgical kit treatment by periodically closing bandaged wounds. + * + * Arguments: + * 0: Arguments + * 0: Medic (not used) + * 1: Patient + * 1: Elapsed Time + * 2: Total Time + * + * Return Value: + * Continue Treatment + * + * Example: + * [[objNull, player], 5, 10] call ace_medical_treatment_fnc_surgicalKitProgress + * + * Public: No + */ + +params ["_args", "_elapsedTime", "_totalTime"]; +_args params ["", "_patient"]; + +private _bandagedWounds = _patient getVariable [QEGVAR(medical,bandagedWounds), []]; +private _stitchedWounds = _patient getVariable [QEGVAR(medical,stitchedWounds), []]; + +// Stop treatment if there are no wounds that can be stitched remaining +if (_bandagedWounds isEqualTo []) exitWith {false}; + +// Check if enough time has elapsed to stitch another wound +if (_totalTime - _elapsedTime <= (count _bandagedWounds - 1) * 5) then { + _stitchedWounds pushBack (_bandagedWounds deleteAt 0); + _patient setVariable [QEGVAR(medical,bandagedWounds), _bandagedWounds, true]; + _patient setVariable [QEGVAR(medical,stitchedWounds), _stitchedWounds, true]; +}; + +true diff --git a/addons/medical_treatment/functions/fnc_tourniquet.sqf b/addons/medical_treatment/functions/fnc_tourniquet.sqf new file mode 100644 index 0000000000..cd1a4c8267 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_tourniquet.sqf @@ -0,0 +1,33 @@ +#include "script_component.hpp" +/* + * Author: Glowbal, mharis001 + * Applies a tourniquet to the patient on the given body part. + * + * Arguments: + * 0: Medic + * 1: Patient + * 2: Body Part + * 3: Treatment (not used) + * 4: Item User (not used) + * 5: Used Item + * + * Return Value: + * None + * + * Example: + * [player, cursorObject, "LeftLeg", "", objNull, "ACE_tourniquet"] call ace_medical_treatment_fnc_tourniquet + * + * Public: No + */ + +params ["_medic", "_patient", "_bodyPart", "", "", "_usedItem"]; + +// Exit if there is a tourniquet already applied to body part +if ([_patient, _bodyPart] call FUNC(hasTourniquetAppliedTo)) exitWith { + ["There is already a tourniquet on this body part!", 1.5] call EFUNC(common,displayTextStructured); // todo: localize +}; + +[_patient, _usedItem] call FUNC(addToTraigeCard); +[_patient, "activity", LSTRING(Activity_appliedTourniquet), [[_medic, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); + +[QGVAR(tourniquetLocal), [_patient, _bodyPart], _patient] call CBA_fnc_targetEvent; diff --git a/addons/medical_treatment/functions/fnc_tourniquetLocal.sqf b/addons/medical_treatment/functions/fnc_tourniquetLocal.sqf new file mode 100644 index 0000000000..cfe8f1596c --- /dev/null +++ b/addons/medical_treatment/functions/fnc_tourniquetLocal.sqf @@ -0,0 +1,25 @@ +#include "script_component.hpp" +/* + * Author: Glowbal + * Local callback for applying a tourniquet to a patient. + * + * Arguments: + * 0: Patient + * 1: Body Part + * + * Return Value: + * None + * + * Example: + * [player, "LeftLeg"] call ace_medical_treatment_fnc_tourniquetLocal + * + * Public: No + */ + +params ["_patient", "_bodyPart"]; + +private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; + +private _tourniquets = GET_TOURNIQUETS(_patient); +_tourniquets set [_partIndex, CBA_missionTime]; +_patient setVariable [VAR_TOURNIQUET, _tourniquets, true]; diff --git a/addons/medical_treatment/functions/fnc_tourniquetRemove.sqf b/addons/medical_treatment/functions/fnc_tourniquetRemove.sqf new file mode 100644 index 0000000000..d219b8456b --- /dev/null +++ b/addons/medical_treatment/functions/fnc_tourniquetRemove.sqf @@ -0,0 +1,55 @@ +#include "script_component.hpp" +/* + * Author: Glowbal, mharis001 + * Removes the tourniquet from the patient on the given body part. + * + * Arguments: + * 0: Medic + * 1: Patient + * 2: Body Part + * + * Return Value: + * None + * + * Example: + * [player, cursorObject, "LeftLeg"] call ace_medical_treatment_fnc_tourniquetRemove + * + * Public: No + */ + +params ["_medic", "_patient", "_bodyPart"]; + +// Remove tourniquet from body part, exit if no tourniquet applied +private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; +private _tourniquets = GET_TOURNIQUETS(_patient); + +if (_tourniquets select _partIndex == 0) exitWith { + [LSTRING(noTourniquetOnBodyPart), 1.5] call EFUNC(common,displayTextStructured); +}; + +_tourniquets set [_partIndex, 0]; +_patient setVariable [VAR_TOURNIQUET, _tourniquets, true]; + +// Add tourniquet item to medic's inventory +// todo: should there be a setting to select who receives the removed tourniquet? +[_medic, "ACE_tourniquet", true] call EFUNC(common,addToInventory); + +// Handle occluded medications that were blocked due to tourniquet +private _occludedMedications = _patient getVariable [QEGVAR(medical,occludedMedications), []]; +private _arrayModified = false; + +{ + _x params ["_bodyPartN", "_medication"]; + + if (_partIndex == _bodyPartN) then { + [QGVAR(medicationLocal), [_patient, _bodyPart, _medication], _patient] call CBA_fnc_targetEvent; + _occludedMedications set [_forEachIndex, []]; + _arrayModified = true; + }; + +} forEach _occludedMedications; + +if (_arrayModified) then { + _occludedMedications = _occludedMedications - [[]]; + _patient setVariable [QEGVAR(medical,occludedMedications), _occludedMedications, true]; +}; diff --git a/addons/medical_treatment/functions/fnc_treatment.sqf b/addons/medical_treatment/functions/fnc_treatment.sqf index b76e6799ee..12a4f7c298 100644 --- a/addons/medical_treatment/functions/fnc_treatment.sqf +++ b/addons/medical_treatment/functions/fnc_treatment.sqf @@ -1,199 +1,147 @@ #include "script_component.hpp" /* - * Author: Glowbal, KoffeinFlummi - * Starts the treatment process + * Author: Glowbal, KoffeinFlummi, mharis001 + * Starts the treatment process. * * Arguments: - * 0: The medic - * 1: The patient - * 2: Body part - * 3: Treatment class name + * 0: Medic + * 1: Patient + * 2: Body Part + * 3: Treatment * * Return Value: - * Succesful treatment started + * Treatment Started + * + * Example: + * [player, cursorObject, "Head", "BasicBandage"] call ace_medical_treatment_fnc_treatment * * Public: No */ -params ["_caller", "_target", "_bodyPart", "_className"]; +params ["_medic", "_patient", "_bodyPart", "_classname"]; -// if the cursorMenu is open, the loading bar will fail. If we execute the function one frame later, it will work fine +// Delay by a frame if cursor menu is open to prevent progress bar failing if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened), false]) exitWith { - [DFUNC(treatment), _this] call CBA_fnc_execNextFrame; + [FUNC(treatment), _this] call CBA_fnc_execNextFrame; }; -if !([_caller, _target, _bodyPart, _className] call FUNC(canTreat)) exitWith {false}; +if !(_this call FUNC(canTreat)) exitWith {false}; -private _config = configFile >> QGVAR(Actions) >> _className; -private _isSelf = _caller isEqualTo _target; +private _config = configFile >> QGVAR(actions) >> _classname; -// handle items -private _items = getArray (_config >> "items"); +// Get treatment time from config, exit if treatment time is zero +// Supports number config entries and string entries of code or missionNamespace variables +private _treatmentTime = 0; -private _consumeItems = 0; +if (isText (_config >> "treatmentTime")) then { + _treatmentTime = getText (_config >> "treatmentTime"); -if (isNumber (_config >> "itemConsumed")) then { - _consumeItems = getNumber (_config >> "itemConsumed"); -} else { - if (isText (_config >> "itemConsumed")) then { - _consumeItems = missionNamespace getVariable [getText (_config >> "itemConsumed"), 0]; + if (isNil _treatmentTime) then { + _treatmentTime = compile _treatmentTime; + } else { + _treatmentTime = missionNamespace getVariable _treatmentTime; }; -}; -private _usersOfItems = []; - -if (_consumeItems > 0) then { - _usersOfItems = ([_caller, _target, _items] call FUNC(useItems)) select 1; -}; - -// parse the config for the progress callback -private _callbackProgress = getText (_config >> "callbackProgress"); - -if (_callbackProgress isEqualTo "") then { - _callbackProgress = "true"; -}; - -if (isNil _callbackProgress) then { - _callbackProgress = compile _callbackProgress; + if (_treatmentTime isEqualType {}) then { + _treatmentTime = call _treatmentTime; + }; } else { - _callbackProgress = missionNamespace getVariable _callbackProgress; + _treatmentTime = getNumber (_config >> "treatmentTime"); }; -// play animation -private _callerAnim = if (_isSelf) then { - getText (_config >> ["animationCallerSelf", "animationCallerSelfProne"] select (stance _caller == "PRONE")); +if (_treatmentTime == 0) exitWith {false}; + +// Consume one of the treatment items if needed +// Store item user so that used item can be returned on failure +private _userAndItem = if (GET_NUMBER_ENTRY(_config >> "consumeItem") == 1) then { + [_medic, _patient, getArray (_config >> "items")] call FUNC(useItem); } else { - getText (_config >> ["animationCaller", "animationCallerProne"] select (stance _caller == "PRONE")); + [objNull, ""]; // Treatment does not require items to be consumed }; -_caller setVariable [QGVAR(selectedWeaponOnTreatment), weaponState _caller]; +_userAndItem params ["_itemUser", "_usedItem"]; -private _wpn = ["non", "rfl", "lnr", "pst"] param [["", primaryWeapon _caller, secondaryWeapon _caller, handgunWeapon _caller] find currentWeapon _caller, "non"]; - -_callerAnim = [_callerAnim, "[wpn]", _wpn] call CBA_fnc_replace; - -// this one is missing -if (_callerAnim == "AinvPknlMstpSlayWlnrDnon_medic") then { - _callerAnim = "AinvPknlMstpSlayWlnrDnon_medicOther"; +// Get treatment animation for the medic +private _medicAnim = if (_medic isEqualTo _patient) then { + getText (_config >> ["animationMedicSelf", "animationMedicSelfProne"] select (stance _medic == "PRONE")); +} else { + getText (_config >> ["animationMedic", "animationMedicProne"] select (stance _medic == "PRONE")); }; -private _animDuration = GVAR(animDurations) getVariable _callerAnim; +_medic setVariable [QGVAR(selectedWeaponOnTreatment), weaponState _medic]; -// these animations have transitions that take a bit longer... -if (weaponLowered _caller) then { +// Adjust animation based on the current weapon of the medic +private _wpn = ["non", "rfl", "lnr", "pst"] param [["", primaryWeapon _medic, secondaryWeapon _medic, handgunWeapon _medic] find currentWeapon _medic, "non"]; +_medicAnim = [_medicAnim, "[wpn]", _wpn] call CBA_fnc_replace; + +// This animation is missing, use alternative +if (_medicAnim == "AinvPknlMstpSlayWlnrDnon_medic") then { + _medicAnim = "AinvPknlMstpSlayWlnrDnon_medicOther"; +}; + +// Determine the animation length +private _animDuration = GVAR(animDurations) getVariable _medicAnim; + +// These animations have transitions that take a bit longer... +if (weaponLowered _medic) then { _animDuration = _animDuration + 0.5; - // fix problems with lowered weapon transitions by raising the weapon first - if (currentWeapon _caller != "" && {_callerAnim != ""}) then { - _caller action ["WeaponInHand", _caller]; + // Fix problems with lowered weapon transitions by raising the weapon first + if (currentWeapon _medic != "" && {_medicAnim != ""}) then { + _medic action ["WeaponInHand", _medic]; }; }; -if (binocular _caller != "" && {binocular _caller == currentWeapon _caller}) then { - _animDuration = _animDuration + 1.0; +if (binocular _medic != "" && {binocular _medic == currentWeapon _medic}) then { + _animDuration = _animDuration + 1; }; -if (vehicle _caller == _caller && {_callerAnim != ""}) then { +// Play treatment animation for medic and determine the ending animation +if (vehicle _medic == _medic && {_medicAnim != ""}) then { private _endInAnim = "AmovP[pos]MstpS[stn]W[wpn]Dnon"; - private _pos = ["knl", "pne"] select (stance _caller == "PRONE"); + private _pos = ["knl", "pne"] select (stance _medic == "PRONE"); private _stn = "non"; if (_wpn != "non") then { - _stn = ["ras", "low"] select (weaponLowered _caller); + _stn = ["ras", "low"] select (weaponLowered _medic); }; _endInAnim = [_endInAnim, "[pos]", _pos] call CBA_fnc_replace; _endInAnim = [_endInAnim, "[stn]", _stn] call CBA_fnc_replace; _endInAnim = [_endInAnim, "[wpn]", _wpn] call CBA_fnc_replace; - TRACE_1("",_endInAnim); - [_caller, _callerAnim] call EFUNC(common,doAnimation); - [_caller, _endInAnim] call EFUNC(common,doAnimation); - _caller setVariable [QGVAR(endInAnim), _endInAnim]; + [_medic, _medicAnim] call EFUNC(common,doAnimation); + [_medic, _endInAnim] call EFUNC(common,doAnimation); + _medic setVariable [QGVAR(endInAnim), _endInAnim]; + + // Speed up animation based on treatment time + [QEGVAR(common,setAnimSpeedCoef), [_medic, _animDuration / _treatmentTime]] call CBA_fnc_globalEvent; }; -// get treatment time from config - also supports variables and code expressions -private _treatmentTime = 0; - -if (isNumber (_config >> "treatmentTime")) then { - _treatmentTime = getNumber (_config >> "treatmentTime"); -} else { - if (isText (_config >> "treatmentTime")) then { - _treatmentTime = getText (_config >> "treatmentTime"); - - if (isNil _treatmentTime) then { - _treatmentTime = compile _treatmentTime; - } else { - _treatmentTime = missionNamespace getVariable _treatmentTime; - }; - - if !(_treatmentTime isEqualType 0) then { - _treatmentTime = call _treatmentTime; - }; - }; -}; -TRACE_1("",_treatmentTime); - -if (_treatmentTime == 0) exitWith { false }; - -// speed up animation depending on treatment time -if (!isNil "_animDuration") then { - [QEGVAR(common,setAnimSpeedCoef), [_caller, _animDuration / _treatmentTime]] call CBA_fnc_globalEvent; - TRACE_2("",_animDuration,_treatmentTime); -}; - -// play sound +// Play a random treatment sound globally if defined if (isArray (_config >> "sounds")) then { - selectRandom getArray (_config >> "sounds") params ["_file", ["_volume", 1], ["_pitch", 1], ["_distance", 0]]; - TRACE_4("playSound3D",_file,_volume,_pitch,_distance); - playSound3D [ - _file, - objNull, - false, - getPosASL _caller, - _volume, - _pitch, - _distance - ]; + selectRandom getArray (_config >> "sounds") params ["_file", ["_volume", 1], ["_pitch", 1], ["_distance", 10]]; + playSound3D [_file, objNull, false, getPosASL _medic, _volume, _pitch, _distance]; }; -private _startCallback = getText (_config >> "callbackStart"); -if (isNil _startCallback) then { - _startCallback = compile _startCallback; -} else { - _startCallback = missionNamespace getVariable _startCallback; +GET_FUNCTION(_callbackStart,_config >> "callbackStart"); +GET_FUNCTION(_callbackProgress,_config >> "callbackProgress"); + +if (_callbackProgress isEqualTo {}) then { + _callbackProgress = {true}; }; -if !(_startCallback isEqualType {}) then { - _startCallback = {TRACE_1("startCallback was NOT code",_startCallback)}; -}; +[_medic, _patient, _bodyPart, _classname, _itemUser, _usedItem] call _callbackStart; -[_caller, _target, _bodyPart, _className, _items, _usersOfItems] call _startCallback; - -// start treatment [ _treatmentTime, - [_caller, _target, _bodyPart, _className, _items, _usersOfItems], - DFUNC(treatment_success), - DFUNC(treatment_failure), + [_medic, _patient, _bodyPart, _classname, _itemUser, _usedItem], + FUNC(treatmentSuccess), + FUNC(treatmentFailure), getText (_config >> "displayNameProgress"), _callbackProgress, - ["isnotinside"] + ["isNotInside"] ] call EFUNC(common,progressBar); -// display icon -private _iconDisplayed = getText (_config >> "actionIconPath"); - -if (_iconDisplayed != "") then { - [QGVAR(treatmentActionIcon), true, _iconDisplayed, [1,1,1,1], getNumber (_config >> "actionIconDisplayTime")] call EFUNC(common,displayIcon); -}; - -// handle display of text/hints -private _displayText = getText (_config >> ["displayTextOther", "displayTextSelf"] select _isSelf); - -if (_displayText != "") then { - [QEGVAR(common,displayTextStructured), [[_displayText, _caller call EFUNC(common,getName), _target call EFUNC(common,getName)], 1.5, _caller], _caller] call CBA_fnc_targetEvent; -}; - true diff --git a/addons/medical_treatment/functions/fnc_treatmentBandage.sqf b/addons/medical_treatment/functions/fnc_treatmentBandage.sqf deleted file mode 100644 index bb4ac5ed9b..0000000000 --- a/addons/medical_treatment/functions/fnc_treatmentBandage.sqf +++ /dev/null @@ -1,26 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Bandage treatment callback - * - * Arguments: - * 0: The medic - * 1: The patient - * 2: Body part - * 3: Treatment class name - * 4: Item - * - * Return Value: - * Succesful treatment started - * - * Public: No - */ - -params ["_caller", "_target", "_bodyPart", "_className", "_items"]; - -[_target, "activity", ELSTRING(medical_treatment,Activity_bandagedPatient), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); -[_target, "activity_view", ELSTRING(medical_treatment,Activity_bandagedPatient), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message - -[QGVAR(treatmentBandageLocal), [_target, _className, _bodyPart], _target] call CBA_fnc_targetEvent; - -true diff --git a/addons/medical_treatment/functions/fnc_treatmentFailure.sqf b/addons/medical_treatment/functions/fnc_treatmentFailure.sqf new file mode 100644 index 0000000000..518414c459 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_treatmentFailure.sqf @@ -0,0 +1,46 @@ +#include "script_component.hpp" +/* + * Author: KoffeinFlummi, Glowbal, mharis001 + * Handles treatment process failure. + * + * Arguments: + * 0: Arguments + * 0: Medic + * 1: Patient + * 2: Body Part + * 3: Treatment + * 4: Item User + * 5: Used Item + * + * Return Value: + * None + * + * Public: No + */ + +params ["_args"]; +_args params ["_medic", "_patient", "_bodyPart", "_classname", "_itemUser", "_usedItem"]; + +// Return used item to user (if used) +if (!isNull _itemUser) then { + [_itemUser, _usedItem] call EFUNC(common,addToInventory); +}; + +// Switch medic to end animation immediately +private _endInAnim = _medic getVariable QGVAR(endInAnim); + +if (!isNil "_endInAnim") then { + if (animationState _medic != _endInAnim) then { + [_medic, _endInAnim, 2] call EFUNC(common,doAnimation); + }; + + _medic setVariable [QGVAR(endInAnim), nil]; +}; + +// Reset medic animation speed coefficient +[QEGVAR(common,setAnimSpeedCoef), [_medic, 1]] call CBA_fnc_globalEvent; + +// Call treatment specific failure callback +GET_FUNCTION(_callbackFailure,configFile >> QGVAR(actions) >> _classname >> "callbackFailure"); + +_args call _callbackFailure; diff --git a/addons/medical_treatment/functions/fnc_treatmentIV.sqf b/addons/medical_treatment/functions/fnc_treatmentIV.sqf deleted file mode 100644 index e6f6be0e16..0000000000 --- a/addons/medical_treatment/functions/fnc_treatmentIV.sqf +++ /dev/null @@ -1,31 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Patient IV Treatment callback - * - * Arguments: - * 0: The medic - * 1: The patient - * 2: Body part - * 3: Treatment class name - * 4: Item - * - * Return Value: - * Succesful treatment started - * - * Public: No - */ - -params ["_caller", "_target", "_bodyPart", "_className", "_items"]; - -if (_items isEqualTo []) exitWith {false}; - -_items params ["_removeItem"]; - -[QGVAR(treatmentIVLocal), [_target, _className, _bodyPart], _target] call CBA_fnc_targetEvent; - -[_target, _removeItem] call FUNC(addToTriageCard); -[_target, "activity", ELSTRING(medical_treatment,Activity_gaveIV), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); -[_target, "activity_view", ELSTRING(medical_treatment,Activity_gaveIV), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message - -true diff --git a/addons/medical_treatment/functions/fnc_treatmentIVLocal.sqf b/addons/medical_treatment/functions/fnc_treatmentIVLocal.sqf deleted file mode 100644 index a7c3914313..0000000000 --- a/addons/medical_treatment/functions/fnc_treatmentIVLocal.sqf +++ /dev/null @@ -1,48 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * IV Treatment local callback - * - * Arguments: - * 0: The patient - * 1: Treatment class name - * 2: Body part - * - * Return Value: - * None - * - * Public: No - */ - -params ["_target", "_treatmentClassname", "_bodyPart"]; - -private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; -if (_partIndex < 0) exitWith { false }; - -private _bloodVolume = GET_BLOOD_VOLUME(_target); - -if (_bloodVolume >= DEFAULT_BLOOD_VOLUME) exitWith {}; - -// Find the proper attributes for the used IV -private _config = configFile >> QUOTE(ADDON) >> "IV"; -private _volumeAdded = getNumber (_config >> "volume"); -private _type = getText (_config >> "type"); - -if (isClass (_config >> _treatmentClassname)) then { - _config = _config >> _treatmentClassname; - - if (isNumber (_config >> "volume")) then { - _volumeAdded = getNumber (_config >> "volume"); - }; - - if (isText (_config >> "type")) then { - _type = getText (_config >> "type"); - }; -} else { - ERROR("IV Treatment Classname not found"); -}; - -private _bloodBags = _target getVariable [QEGVAR(medical,ivBags), []]; -_bloodBags pushBack [_volumeAdded, _type, _partIndex]; - -_target setVariable [QEGVAR(medical,ivBags), _bloodBags, true]; diff --git a/addons/medical_treatment/functions/fnc_treatmentMedication.sqf b/addons/medical_treatment/functions/fnc_treatmentMedication.sqf deleted file mode 100644 index 77fabe5bf8..0000000000 --- a/addons/medical_treatment/functions/fnc_treatmentMedication.sqf +++ /dev/null @@ -1,34 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * IV Treatment callback - * - * Arguments: - * 0: The medic - * 1: The patient - * 2: Body part - * 3: Treatment class name - * 4: Items Used - * - * Return Value: - * Succesful treatment started - * - * Public: No - */ - -params ["_caller", "_target", "_bodyPart", "_className", "_items"]; -TRACE_5("params",_caller,_target,_bodyPart,_className,_items); - -private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; - -[QGVAR(treatmentMedicationLocal), [_target, _className, _partIndex], _target] call CBA_fnc_targetEvent; - -{ - if (_x != "") then { - [_target, _x] call FUNC(addToTriageCard); - [_target, "activity", ELSTRING(medical_treatment,Activity_usedItem), [[_caller, false, true] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog); - [_target, "activity_view", ELSTRING(medical_treatment,Activity_usedItem), [[_caller, false, true] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog); - }; -} forEach _items; - -true diff --git a/addons/medical_treatment/functions/fnc_treatmentMedicationLocal.sqf b/addons/medical_treatment/functions/fnc_treatmentMedicationLocal.sqf deleted file mode 100644 index b8b4dfb3d8..0000000000 --- a/addons/medical_treatment/functions/fnc_treatmentMedicationLocal.sqf +++ /dev/null @@ -1,107 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Handles the medication given to a patient. - * - * Arguments: - * 0: The patient - * 1: Treatment class name - * 2: Injection Site Part Number - * - * Return Value: - * Succesful treatment started - * - * Public: No - */ -#define MORPHINE_PAIN_SUPPRESSION 0.6 - -params ["_target", "_className", "_partIndex"]; -TRACE_3("params",_target,_className,_partIndex); - -if (!GVAR(advancedMedication)) exitWith { - TRACE_1("MedicalSettingAdvancedMedication is:", GVAR(advancedMedication)); - if (_className == "Morphine") exitWith { - private _painSupress = GET_PAIN_SUPPRESS(_target); - _target setVariable [VAR_PAIN_SUPP, (_painSupress + MORPHINE_PAIN_SUPPRESSION) min 1, true]; - }; - if (_className == "Epinephrine") exitWith { - [QEGVAR(medical,WakeUp), _target] call CBA_fnc_localEvent; - }; -}; -TRACE_1("Running treatmentMedicationLocal with Advanced configuration for", _target); - -private _tourniquets = GET_TOURNIQUETS(_target); - -if (_tourniquets select _partIndex > 0) exitWith { - TRACE_1("unit has tourniquets blocking blood flow on injection site",_tourniquets); - private _delayedMedications = _target getVariable [QEGVAR(medical,occludedMedications), []]; - - _delayedMedications pushBack _this; - _target setVariable [QEGVAR(medical,occludedMedications), _delayedMedications, true]; - - true -}; - -// We have added a new dose of this medication to our system, so let's increase it -private _varName = format [QGVAR(%1_inSystem), _className]; -private _currentInSystem = _target getVariable [_varName, 0]; -_target setVariable [_varName, _currentInSystem + 1]; - -// Find the proper attributes for the used medication -private _medicationConfig = configFile >> QUOTE(ADDON) >> "Medication"; -private _painReduce = getNumber (_medicationConfig >> "painReduce"); -private _hrIncreaseLow = getArray (_medicationConfig >> "hrIncreaseLow"); -private _hrIncreaseNorm = getArray (_medicationConfig >> "hrIncreaseNormal"); -private _hrIncreaseHigh = getArray (_medicationConfig >> "hrIncreaseHigh"); -private _timeInSystem = getNumber (_medicationConfig >> "timeInSystem"); -private _timeTillMaxEffect = getNumber (_medicationConfig >> "timeTillMaxEffect"); -private _maxDose = getNumber (_medicationConfig >> "maxDose"); -private _viscosityChange = getNumber (_medicationConfig >> "viscosityChange"); - -private _inCompatableMedication = []; - -if (isClass (_medicationConfig >> _className)) then { - _medicationConfig = _medicationConfig >> _className; - if (isNumber (_medicationConfig >> "painReduce")) then { _painReduce = getNumber (_medicationConfig >> "painReduce");}; - if (isArray (_medicationConfig >> "hrIncreaseLow")) then { _hrIncreaseLow = getArray (_medicationConfig >> "hrIncreaseLow"); }; - if (isArray (_medicationConfig >> "hrIncreaseNormal")) then { _hrIncreaseNorm = getArray (_medicationConfig >> "hrIncreaseNormal"); }; - if (isArray (_medicationConfig >> "hrIncreaseHigh")) then { _hrIncreaseHigh = getArray (_medicationConfig >> "hrIncreaseHigh"); }; - if (isNumber (_medicationConfig >> "timeInSystem")) then { _timeInSystem = getNumber (_medicationConfig >> "timeInSystem"); }; - if (isNumber (_medicationConfig >> "timeTillMaxEffect")) then { _timeTillMaxEffect = getNumber (_medicationConfig >> "timeTillMaxEffect"); }; - if (isNumber (_medicationConfig >> "maxDose")) then { _maxDose = getNumber (_medicationConfig >> "maxDose"); }; - if (isArray (_medicationConfig >> "inCompatableMedication")) then { _inCompatableMedication = getArray (_medicationConfig >> "inCompatableMedication"); }; - if (isNumber (_medicationConfig >> "viscosityChange")) then { _viscosityChange = getNumber (_medicationConfig >> "viscosityChange"); }; -}; - -if (alive _target) then { - private _heartRate = GET_HEART_RATE(_target); - private _hrIncrease = [_hrIncreaseLow, _hrIncreaseNorm, _hrIncreaseHigh] select (floor ((0 max _heartRate min 110) / 55)); - _hrIncrease params ["_minIncrease", "_maxIncrease"]; - private _heartRateChange = _minIncrease + random (_maxIncrease - _minIncrease); - - // Adjust the heart rate based upon config entry - if (_heartRateChange != 0) then { - TRACE_1("heartRateChange", _heartRateChange); - private _adjustments = _target getVariable [VAR_HEART_RATE_ADJ,[]]; - _adjustments pushBack [_heartRateChange, _timeTillMaxEffect, _timeInSystem, 0]; - _target setVariable [VAR_HEART_RATE_ADJ, _adjustments]; - }; - - // Adjust the pain suppression based upon config entry - if (_painReduce > 0) then { - TRACE_1("painReduce", _painReduce); - private _adjustments = _target getVariable [VAR_PAIN_SUPP_ADJ,[]]; - _adjustments pushBack [_painReduce, _timeTillMaxEffect, _timeInSystem, 0]; - _target setVariable [VAR_PAIN_SUPP_ADJ, _adjustments]; - }; - - // Adjust the peripheral resistance based upon config entry - if (_viscosityChange != 0) then { - TRACE_1("viscosityChange", _viscosityChange); - private _adjustments = _target getVariable [VAR_PERIPH_RES_ADJ,[]]; - _adjustments pushBack [_viscosityChange, _timeTillMaxEffect, _timeInSystem, 0]; - _target setVariable [VAR_PERIPH_RES_ADJ, _adjustments]; - }; -}; - -true diff --git a/addons/medical_treatment/functions/fnc_treatmentSuccess.sqf b/addons/medical_treatment/functions/fnc_treatmentSuccess.sqf new file mode 100644 index 0000000000..d4c652ab49 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_treatmentSuccess.sqf @@ -0,0 +1,47 @@ +#include "script_component.hpp" +/* + * Author: KoffeinFlummi, Glowbal, mharis001 + * Handles treatment process success. + * + * Arguments: + * 0: Arguments + * 0: Medic + * 1: Patient + * 2: Body Part + * 3: Treatment + * 4: Item User + * 5: Used Item + * + * Return Value: + * None + * + * Public: No + */ + +params ["_args"]; +_args params ["_medic", "_patient", "_bodyPart", "_classname"]; + +// Switch medic to end animation immediately +private _endInAnim = _medic getVariable QGVAR(endInAnim); + +if (!isNil "_endInAnim") then { + if (animationState _medic != _endInAnim) then { + [_medic, _endInAnim, 2] call EFUNC(common,doAnimation); + }; + + _medic setVariable [QGVAR(endInAnim), nil]; +}; + +// Reset medic animation speed coefficient +[QEGVAR(common,setAnimSpeedCoef), [_medic, 1]] call CBA_fnc_globalEvent; + +// Call treatment specific success callback +GET_FUNCTION(_callbackSuccess,configFile >> QGVAR(actions) >> _classname >> "callbackSuccess"); + +_args call _callbackSuccess; + +// Call litter creation handler +_args call FUNC(createLitter); + +// Emit local event for medical API +["ace_treatmentSucceded", [_medic, _patient, _bodyPart, _classname]] call CBA_fnc_localEvent; diff --git a/addons/medical_treatment/functions/fnc_treatmentSurgicalKit_onProgress.sqf b/addons/medical_treatment/functions/fnc_treatmentSurgicalKit_onProgress.sqf deleted file mode 100644 index f57b035598..0000000000 --- a/addons/medical_treatment/functions/fnc_treatmentSurgicalKit_onProgress.sqf +++ /dev/null @@ -1,39 +0,0 @@ -#include "script_component.hpp" -/* - * Author: BaerMitUmlaut - * Handles treatment via surgical kit per frame - * - * Arguments: - * 0: Arguments - * 0: Caller - * 1: Target - * 1: Elapsed Time - * 2: Total Time - * - * Return Value: - * Succesful treatment started - * - * Example: - * [[bob, kevin], 5, 5] call ace_medical_treatment_fnc_treatmentAdvanced_surgicalKit_onProgress - * - * Public: No - */ - -params ["_args", "_elapsedTime", "_totalTime"]; -_args params ["_caller", "_target"]; - -private _bandagedWounds = _target getVariable [QEGVAR(medical,bandagedWounds), []]; -private _stitchedWounds = _target getVariable [QEGVAR(medical,stitchedWounds), []]; - -//In case two people stitch up one patient and the last wound has already been closed we can stop already -if (count _bandagedWounds == 0) exitWith { false }; - -//Has enough time elapsed that we can close another wound? -if (_totalTime - _elapsedTime <= (count _bandagedWounds - 1) * 5) then { - private _treatedWound = _bandagedWounds deleteAt 0; - _stitchedWounds pushBack _treatedWound; - _target setVariable [QEGVAR(medical,bandagedWounds), _bandagedWounds, true]; - _target setVariable [QEGVAR(medical,stitchedWounds), _stitchedWounds, true]; -}; - -true diff --git a/addons/medical_treatment/functions/fnc_treatmentTourniquet.sqf b/addons/medical_treatment/functions/fnc_treatmentTourniquet.sqf deleted file mode 100644 index 595d55d589..0000000000 --- a/addons/medical_treatment/functions/fnc_treatmentTourniquet.sqf +++ /dev/null @@ -1,40 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Apply a tourniquet to the patient - * - * Arguments: - * 0: The medic - * 1: The patient - * 2: Body part - * 3: Treatment class name - * - * Return Value: - * Succesful treatment started - * - * Public: No - */ - -params ["_caller", "_target", "_bodyPart", "_className", "_items"]; - -if (count _items == 0) exitWith {false}; - -private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; - -private _tourniquets = GET_TOURNIQUETS(_target); - -if (_tourniquets select _partIndex > 0) exitWith { - private _output = "There is already a tourniquet on this body part!"; // TODO localization - [QEGVAR(common,displayTextStructured), [_output, 1.5, _caller], _caller] call CBA_fnc_targetEvent; - false -}; - -private _removeItem = _items select 0; - -[QGVAR(treatmentTourniquetLocal), [_target, _removeItem, _bodyPart], _target] call CBA_fnc_targetEvent; - -[_target, _removeItem] call FUNC(addToTriageCard); -[_target, "activity", ELSTRING(medical_treatment,Activity_appliedTourniquet), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); -[_target, "activity_view", ELSTRING(medical_treatment,Activity_appliedTourniquet), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message - -true diff --git a/addons/medical_treatment/functions/fnc_treatmentTourniquetLocal.sqf b/addons/medical_treatment/functions/fnc_treatmentTourniquetLocal.sqf deleted file mode 100644 index 32dc6566ac..0000000000 --- a/addons/medical_treatment/functions/fnc_treatmentTourniquetLocal.sqf +++ /dev/null @@ -1,26 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Apply a tourniquet to the patient, local callback. - * - * Arguments: - * 0: The patient - * 1: Item used classname - * 2: Body part - * - * Return Value: - * None - * - * Public: No - */ - -params ["_target", "_tourniquetItem", "_bodyPart"]; - -private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; - -// Place a tourniquet on the bodypart -private _tourniquets = GET_TOURNIQUETS(_target); - -_tourniquets set [_partIndex, CBA_missionTime]; - -_target setVariable [VAR_TOURNIQUET, _tourniquets, true]; diff --git a/addons/medical_treatment/functions/fnc_treatmentTourniquetRemove.sqf b/addons/medical_treatment/functions/fnc_treatmentTourniquetRemove.sqf deleted file mode 100644 index 762c429a5c..0000000000 --- a/addons/medical_treatment/functions/fnc_treatmentTourniquetRemove.sqf +++ /dev/null @@ -1,54 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Action for removing the tourniquet on specified selection - * - * Arguments: - * 0: The medic - * 1: The patient - * 2: Body part - * - * Return Value: - * None - * - * Public: No - */ - -params ["_caller", "_target", "_bodyPart"]; -TRACE_3("params",_caller,_target,_bodyPart); - -// grab the required data -private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; -private _tourniquets = GET_TOURNIQUETS(_target); - -// Check if there is a tourniquet on this bodypart -if (_tourniquets select _partIndex == 0) exitWith { - [QEGVAR(common,displayTextStructured), [ELSTRING(medical_treatment,noTourniquetOnBodyPart), 1.5, _caller], [_caller]] call CBA_fnc_targetEvent; -}; - -// Removing the tourniquet -_tourniquets set [_partIndex, 0]; -_target setVariable [VAR_TOURNIQUET, _tourniquets, true]; - -// Adding the tourniquet item to the caller -[_caller, "ACE_tourniquet", true] call CBA_fnc_addItem; - -//Handle all injected medications now that blood is flowing -private _delayedMedications = _target getVariable [QEGVAR(medical,occludedMedications), []]; -private _updatedArray = false; -TRACE_2("meds",_partIndex,_delayedMedications); - -{ - _x params ["", "", "_medPartNum"]; - if (_partIndex == _medPartNum) then { - TRACE_1("delayed medication call after tourniquet removeal",_x); - [QGVAR(treatmentMedicationLocal), _x, _target] call CBA_fnc_targetEvent; - _delayedMedications set [_forEachIndex, -1]; - _updatedArray = true; - }; -} forEach _delayedMedications; - -if (_updatedArray) then { - _delayedMedications = _delayedMedications - [-1]; - _target setVariable [QEGVAR(medical,occludedMedications), _delayedMedications, true]; -}; diff --git a/addons/medical_treatment/functions/fnc_treatment_failure.sqf b/addons/medical_treatment/functions/fnc_treatment_failure.sqf deleted file mode 100644 index 8b3114cc66..0000000000 --- a/addons/medical_treatment/functions/fnc_treatment_failure.sqf +++ /dev/null @@ -1,56 +0,0 @@ -#include "script_component.hpp" -/* - * Author: KoffeinFlummi, Glowbal - * Callback when the treatment fails - * - * Arguments: - * 0: The medic - * 1: The patient - * 2: Body part - * 3: Treatment class name - * 4: Items available > - * - * Return Value: - * None - * - * Public: No - */ - -params ["_args"]; -_args params ["_caller", "_target", "_bodyPart", "_className", "_items", "_usersOfItems"]; - -// switch to end anim immediately -private _endInAnim = _caller getVariable QGVAR(endInAnim); - -if (!isNil "_endInAnim") then { - if (animationState _caller != _endInAnim) then { - [_caller, _endInAnim, 2] call EFUNC(common,doAnimation); - }; - _caller setVariable [QGVAR(endInAnim), nil]; - TRACE_1("abort",_endInAnim); -}; - -// reset sped up animations -[QEGVAR(common,setAnimSpeedCoef), [_caller, 1]] call CBA_fnc_globalEvent; - -{ - _x params ["_unit", "_item"]; - _unit addItem _item; -} forEach _usersOfItems; - -// Record specific callback -private _config = configFile >> QGVAR(Actions) >> _className; - -private _callback = getText (_config >> "callbackFailure"); - -if (isNil _callback) then { - _callback = compile _callback; -} else { - _callback = missionNamespace getVariable _callback; -}; - -if !(_callback isEqualType {}) then { - _callback = {TRACE_1("callback was NOT code",_callback)}; -}; - -_args call _callback; diff --git a/addons/medical_treatment/functions/fnc_treatment_success.sqf b/addons/medical_treatment/functions/fnc_treatment_success.sqf deleted file mode 100644 index 903e32e677..0000000000 --- a/addons/medical_treatment/functions/fnc_treatment_success.sqf +++ /dev/null @@ -1,71 +0,0 @@ -#include "script_component.hpp" -/* - * Author: KoffeinFlummi, Glowbal - * Callback when the treatment is completed - * - * Arguments: - * 0: The medic - * 1: The patient - * 2: Body part - * 3: Treatment class name - * 4: Items available > - * - * Return Value: - * None - * - * Public: No - */ - -params ["_args"]; -_args params ["_caller", "_target", "_bodyPart", "_className", "_items", "_usersOfItems"]; - -// switch to end anim immediately -private _endInAnim = _caller getVariable QGVAR(endInAnim); - -if (!isNil "_endInAnim") then { - if (animationState _caller != _endInAnim) then { - [_caller, _endInAnim, 2] call EFUNC(common,doAnimation); - }; - _caller setVariable [QGVAR(endInAnim), nil]; - TRACE_1("abort",_endInAnim); -}; - -// reset sped up animations -[QEGVAR(common,setAnimSpeedCoef), [_caller, 1]] call CBA_fnc_globalEvent; - -// Record specific callback -private _config = configFile >> QGVAR(Actions) >> _className; - -private _callback = getText (_config >> "callbackSuccess"); - -if (isNil _callback) then { - _callback = compile _callback; -} else { - _callback = missionNamespace getVariable _callback; -}; - -if !(_callback isEqualType {}) then { - _callback = {TRACE_1("callback was NOT code",_callback)}; -}; - -//Get current blood loose on limb (for "bloody" litter) -private _bloodLossOnBodyPart = 0; -private _partIndex = (ALL_BODY_PARTS find toLower _bodyPart) max 0; - -// Add all bleeding from wounds on selection -private _openWounds = _target getVariable [QEGVAR(medical,openWounds), []]; - -{ - _x params ["", "", "_bodyPartN", "_amountOf", "_percentageOpen"]; - - if (_bodyPartN isEqualTo _partIndex) then { - _bloodLossOnBodyPart = _bloodLossOnBodyPart + (_amountOf * _percentageOpen); - }; -} forEach _openWounds; -TRACE_1("advanced",_bloodLossOnBodyPart); - -_args call _callback; -_args pushBack _bloodLossOnBodyPart; -_args call FUNC(litterCreate); - -["ace_treatmentSucceded", [_caller, _target, _bodyPart, _className]] call CBA_fnc_localEvent; diff --git a/addons/medical_treatment/functions/fnc_useItem.sqf b/addons/medical_treatment/functions/fnc_useItem.sqf index 6977052209..a7484639da 100644 --- a/addons/medical_treatment/functions/fnc_useItem.sqf +++ b/addons/medical_treatment/functions/fnc_useItem.sqf @@ -1,45 +1,38 @@ #include "script_component.hpp" /* - * Author: Glowbal - * Use Equipment if any is available. Priority: 1) Medic, 2) Patient. If in vehicle: 3) Crew + * Author: Glowbal, mharis001 + * Uses one of the treatment items. Respects the priority defined by the allowSharedEquipment setting. * * Arguments: * 0: Medic * 1: Patient - * 2: Item + * 2: Items * - * ReturnValue: - * 0: success - * 1: Unit + * Return Value: + * User and Item + * + * Example: + * [player, cursorObject, ["bandage"]] call ace_medical_treatment_fnc_useItems * * Public: No */ -params ["_medic", "_patient", "_item"]; +params ["_medic", "_patient", "_items"]; -if (isNil QEGVAR(medical,setting_allowSharedEquipment)) then { - EGVAR(medical,setting_allowSharedEquipment) = true; -}; +scopeName "Main"; -if (EGVAR(medical,setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitWith { - ["ace_useItem", [_patient, _item], _patient] call CBA_fnc_targetEvent; - [true, _patient] -}; +private _useOrder = [[_patient, _medic], [_medic, _patient], [_medic]] select GVAR(allowSharedEquipment); -if ([_medic, _item] call EFUNC(common,hasItem)) exitWith { - ["ace_useItem", [_medic, _item], _medic] call CBA_fnc_targetEvent; - [true, _medic] -}; +{ + private _unit = _x; + private _unitItems = _x call EFUNC(common,uniqueItems); -private _return = [false, objNull]; - -if (vehicle _medic != _medic && {vehicle _medic call FUNC(isMedicalVehicle)}) then { { - if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {[_x, _item] call EFUNC(common,hasItem)}) exitWith { - ["ace_useItem", [_x, _item], _x] call CBA_fnc_targetEvent; - _return = [true, _x]; + if (_x in _unitItems) then { + _unit removeItem _x; + [_unit, _x] breakOut "Main"; }; - } forEach crew vehicle _medic; -}; + } forEach _items; +} forEach _useOrder; -_return +[objNull, ""] diff --git a/addons/medical_treatment/functions/fnc_useItems.sqf b/addons/medical_treatment/functions/fnc_useItems.sqf deleted file mode 100644 index 13ccf627b0..0000000000 --- a/addons/medical_treatment/functions/fnc_useItems.sqf +++ /dev/null @@ -1,50 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Glowbal - * Use Equipment items if any is available. Priority: 1) Medic, 2) Patient. If in vehicle: 3) Crew - * - * Arguments: - * 0: Medic - * 1: Patient - * 2: Items > - * - * Return Value: - * 0: success - * 1: Unit - * - * Example: - * [unit, patient, ["bandage"]] call ace_medical_treatment_fnc_useItems - * - * Public: No - */ - -#define HAS_USED_ITEM(itemUsedInfo) (itemUsedInfo select 0) -#define GET_ITEM_USED_BY(itemUsedInfo) (itemUsedInfo select 1) - -params ["_medic", "_patient", "_items"]; - -private _itemsUsedBy = []; - -{ - // handle a one of type use item - if (_x isEqualType []) then { - { - private _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); - - if (HAS_USED_ITEM(_itemUsedInfo)) exitWith { - _itemsUsedBy pushBack [GET_ITEM_USED_BY(_itemUsedInfo), _x]; - }; - } forEach _x; - }; - - // handle required item - if (_x isEqualType "") then { - private _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); - - if (HAS_USED_ITEM(_itemUsedInfo)) exitWith { - _itemsUsedBy pushBack [GET_ITEM_USED_BY(_itemUsedInfo), _x]; - }; - }; -} forEach _items; - -[count _items == count _itemsUsedBy, _itemsUsedBy]; diff --git a/addons/medical_treatment/initSettings.sqf b/addons/medical_treatment/initSettings.sqf index 6cd3f8c897..2a22f4e853 100644 --- a/addons/medical_treatment/initSettings.sqf +++ b/addons/medical_treatment/initSettings.sqf @@ -1,206 +1,203 @@ -// CBA Settings [ADDON: ace_medical_treatment]: + +// todo: this setting just disables some treatment options, remove? +[ + QGVAR(advancedDiagnose), + "CHECKBOX", + [LSTRING(AdvancedDiagnose_DisplayName), LSTRING(AdvancedDiagnose_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + true, + true +] call CBA_settings_fnc_init; + +[ + QGVAR(advancedBandages), + "CHECKBOX", + [LSTRING(AdvancedBandages_DisplayName), LSTRING(AdvancedBandages_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + true, + true +] call CBA_settings_fnc_init; + +// todo: verify that this setting does not require a restart +// todo: this setting requires advanced bandages to be enabled, they should be independent +[ + QGVAR(woundReopening), + "CHECKBOX", + [LSTRING(WoundReopening_DisplayName), LSTRING(WoundReopening_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + true, + true +] call CBA_settings_fnc_init; + +[ + QGVAR(advancedMedication), + "CHECKBOX", + [LSTRING(AdvancedMedication_DisplayName), LSTRING(AdvancedMedication_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + true, + true +] call CBA_settings_fnc_init; + +// todo: should this setting differentiate between medical vehicles and facilities? +[ + QGVAR(locationsBoostTraining), + "CHECKBOX", + [LSTRING(LocationsBoostTraining_DisplayName), LSTRING(LocationsBoostTraining_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + false, + true +] call CBA_settings_fnc_init; + +[ + QGVAR(allowSelfIV), + "LIST", + [LSTRING(AllowSelfIV_DisplayName), LSTRING(AllowSelfIV_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1], [ELSTRING(common,No), ELSTRING(common,Yes)], 0], + true +] call CBA_settings_fnc_init; + +[ + QGVAR(allowSharedEquipment), + "LIST", + [LSTRING(AllowSharedEquipment_DisplayName), LSTRING(AllowSharedEquipment_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1, 2], [LSTRING(AllowSharedEquipment_PriorityPatient), LSTRING(AllowSharedEquipment_PriorityMedic), ELSTRING(common,No)], 0], + true +] call CBA_settings_fnc_init; + +[ + QGVAR(convertItems), + "LIST", + [LSTRING(ConvertItems_DisplayName), LSTRING(ConvertItems_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1, 2], [ELSTRING(common,Enabled), LSTRING(ConvertItems_RemoveOnly), ELSTRING(common,Disabled)], 0], + true +] call CBA_settings_fnc_init; + +[ + QGVAR(medicEpinephrine), + "LIST", + [LSTRING(MedicEpinephrine_DisplayName), LSTRING(MedicEpinephrine_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1, 2], [LSTRING(Anyone), LSTRING(Medics), LSTRING(Doctors)], 0], + true +] call CBA_settings_fnc_init; + +[ + QGVAR(locationEpinephrine), + "LIST", + [LSTRING(LocationEpinephrine_DisplayName), LSTRING(LocationEpinephrine_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1, 2, 3, 4], [ELSTRING(common,Anywhere), ELSTRING(common,Vehicle), LSTRING(MedicalFacilities), LSTRING(VehiclesAndFacilities), ELSTRING(common,Disabled)], 0], + true +] call CBA_settings_fnc_init; + +[ + QGVAR(medicPAK), + "LIST", + [LSTRING(MedicPAK_DisplayName), LSTRING(MedicPAK_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1, 2], [LSTRING(Anyone), LSTRING(Medics), LSTRING(Doctors)], 1], + true +] call CBA_settings_fnc_init; + +[ + QGVAR(locationPAK), + "LIST", + [LSTRING(LocationPAK_DisplayName), LSTRING(LocationPAK_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1, 2, 3, 4], [ELSTRING(common,Anywhere), ELSTRING(common,Vehicle), LSTRING(MedicalFacilities), LSTRING(VehiclesAndFacilities), ELSTRING(common,Disabled)], 3], + true +] call CBA_settings_fnc_init; + +[ + QGVAR(consumePAK), + "LIST", + [LSTRING(ConsumePAK_DisplayName), LSTRING(ConsumePAK_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1], [ELSTRING(common,No), ELSTRING(common,Yes)], 0], + true +] call CBA_settings_fnc_init; + +[ + QGVAR(medicSurgicalKit), + "LIST", + [LSTRING(MedicSurgicalKit_DisplayName), LSTRING(MedicSurgicalKit_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1, 2], [LSTRING(Anyone), LSTRING(Medics), LSTRING(Doctors)], 1], + true +] call CBA_settings_fnc_init; + +[ + QGVAR(locationSurgicalKit), + "LIST", + [LSTRING(LocationSurgicalKit_DisplayName), LSTRING(LocationSurgicalKit_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1, 2, 3, 4], [ELSTRING(common,Anywhere), ELSTRING(common,Vehicle), LSTRING(MedicalFacilities), LSTRING(VehiclesAndFacilities), ELSTRING(common,Disabled)], 2], + true +] call CBA_settings_fnc_init; + +[ + QGVAR(consumeSurgicalKit), + "LIST", + [LSTRING(ConsumeSurgicalKit_DisplayName), LSTRING(ConsumeSurgicalKit_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1], [ELSTRING(common,No), ELSTRING(common,Yes)], 0], + true +] call CBA_settings_fnc_init; + +[ + QGVAR(allowLitterCreation), + "CHECKBOX", + [LSTRING(AllowLitterCreation_DisplayName), LSTRING(AllowLitterCreation_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Litter)], + true, + true +] call CBA_settings_fnc_init; + +[ + QGVAR(maxLitterObjects), + "LIST", + [LSTRING(MaxLitterObjects_DisplayName), LSTRING(MaxLitterObjects_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Litter)], + [[50, 100, 200, 300, 400, 500, 1000, 2000, 3000, 4000, 5000], [/* settings function will auto create names */], 5], + true +] call CBA_settings_fnc_init; + +[ + QGVAR(litterCleanUpDelay), + "SLIDER", + [LSTRING(LitterCleanUpDelay_DisplayName), LSTRING(LitterCleanUpDelay_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Litter)], + [-1, 3600, 600, 0], + true +] call CBA_settings_fnc_init; + +/* private _categoryArray = [LELSTRING(medical,Category_DisplayName), LLSTRING(subCategory)]; -// todo: the strings for all three advanced bandages/medication/diagnose settings are terribly ambigious - -[// todo: I don't like that wound reopening requires this setting to be enabled, they should be independent - QGVAR(advancedBandages), "CHECKBOX", - [LSTRING(advancedBandages_DisplayName), LSTRING(advancedBandages_Description)], - _categoryArray, - true, // default value - true, // isGlobal - {[QGVAR(advancedBandages), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[// todo: this setting just disables some treatment options, remove? - QGVAR(advancedDiagnose), "CHECKBOX", - [LSTRING(advancedDiagnose_DisplayName), LSTRING(advancedDiagnose_Description)], - _categoryArray, - true, // default value - true, // isGlobal - {[QGVAR(advancedDiagnose), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[ - QGVAR(advancedMedication), "CHECKBOX", - [LSTRING(advancedMedication_DisplayName), LSTRING(advancedMedication_Description)], - _categoryArray, - true, // default value - true, // isGlobal - {[QGVAR(advancedMedication), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[ - QGVAR(woundReopening), "CHECKBOX", - [LSTRING(woundReopening_DisplayName), LSTRING(woundReopening_Description)], - _categoryArray, - true, // default value - true, // isGlobal - {[QGVAR(woundReopening), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[ - QGVAR(allowSelfIV), "LIST", // This setting is list because we want number for treatment config - [LSTRING(allowSelfIV_DisplayName), LSTRING(allowSelfIV_Description)], - _categoryArray, - [[0,1],["No","Yes"],0], // [values, titles, defaultIndex] - true, // isGlobal - {[QGVAR(allowSelfIV), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - // Ported Settings: -[ - QEGVAR(medical,convertItems), "LIST", - [LSTRING(convertItems_DisplayName), LSTRING(convertItems_Description)], - _categoryArray, - [[0,1,2],[LELSTRING(common,Enabled),LLSTRING(convertItems_remove),LELSTRING(common,Disabled)],0], // [values, titles, defaultIndex] - true, // isGlobal - {[QEGVAR(medical,convertItems), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[ - QEGVAR(medical,allowLitterCreation), "CHECKBOX", - [LSTRING(allowLitterCreation), LSTRING(allowLitterCreation_Description)], - _categoryArray, - true, // default value - true, // isGlobal - {[QEGVAR(medical,allowLitterCreation), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; [ QEGVAR(medical,CPRcreatesPulse), "CHECKBOX", [LSTRING(CPRcreatesPulse), LSTRING(CPRcreatesPulse_Description)], _categoryArray, - true, // default value - true, // isGlobal + true, + true, {[QEGVAR(medical,CPRcreatesPulse), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[ - QEGVAR(medical,litterCleanUpDelay), "SLIDER", - [LSTRING(litterCleanUpDelay), LSTRING(litterCleanUpDelay_Description)], - _categoryArray, - [-1,5000,0,1], // [min, max, default value, trailing decimals (-1 for whole numbers only)] - true, // isGlobal - {[QEGVAR(medical,litterCleanUpDelay), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[ - QEGVAR(medical,litterSimulationDetail), "LIST", - [LSTRING(litterSimulationDetail), LSTRING(litterSimulationDetail_Description)], - _categoryArray, - [[0,1,2,3,4],["Off","Low","Medium","High","Ultra"],3], // [values, titles, defaultIndex] - true, // isGlobal - {[QEGVAR(medical,litterSimulationDetail), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[ - QEGVAR(medical,increaseTrainingInLocations), "CHECKBOX", - [LSTRING(increaseTrainingInLocations_DisplayName), LSTRING(increaseTrainingInLocations_Description)], - _categoryArray, - false, // default value - true, // isGlobal - {[QEGVAR(medical,increaseTrainingInLocations), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart + true ] call CBA_settings_fnc_init; [ QEGVAR(medical,PAKTime), "SLIDER", [LSTRING(PAKTime), LSTRING(PAKTime_Description)], _categoryArray, - [-1,5000,0,1], // [min, max, default value, trailing decimals (-1 for whole numbers only)] - true, // isGlobal + [-1,5000,0,1], + true, {[QEGVAR(medical,PAKTime), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart + true ] call CBA_settings_fnc_init; -[ - QEGVAR(medical,medicSetting_Epi), "LIST", - [LSTRING(medicSetting_Epi_DisplayName), LSTRING(medicSetting_Epi_Description)], - _categoryArray, - [[0,1,2],["Anyone","Medics only","Doctors only"],0], // [values, titles, defaultIndex] - true, // isGlobal - {[QEGVAR(medical,medicSetting_Epi), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[ - QEGVAR(medical,medicSetting_PAK), "LIST", - [LSTRING(medicSetting_PAK_DisplayName), LSTRING(medicSetting_PAK_Description)], - _categoryArray, - [[0,1,2],["Anyone","Medics only","Doctors only"],0], // [values, titles, defaultIndex] - true, // isGlobal - {[QEGVAR(medical,medicSetting_PAK), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[ - QEGVAR(medical,medicSetting_SurgicalKit), "LIST", - [LSTRING(MedicalSettings_medicSetting_SurgicalKit_DisplayName), LSTRING(MedicalSettings_medicSetting_SurgicalKit_Description)], - _categoryArray, - [[0,1,2],["Anyone","Medics only","Doctors only"],0], // [values, titles, defaultIndex] - true, // isGlobal - {[QEGVAR(medical,medicSetting_SurgicalKit), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[ - QEGVAR(medical,consumeItem_PAK), "LIST", - [LSTRING(MedicalSettings_consumeItem_PAK_DisplayName), LSTRING(MedicalSettings_consumeItem_PAK_Description)], - _categoryArray, - [[0,1],["No","Yes"],1], // [values, titles, defaultIndex] - true, // isGlobal - {[QEGVAR(medical,consumeItem_PAK), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[ - QEGVAR(medical,consumeItem_SurgicalKit), "LIST", - [LSTRING(MedicalSettings_consumeItem_SurgicalKit_DisplayName), LSTRING(MedicalSettings_consumeItem_SurgicalKit_Description)], - _categoryArray, - [[0,1],["No","Yes"],1], // [values, titles, defaultIndex] - true, // isGlobal - {[QEGVAR(medical,consumeItem_SurgicalKit), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[ - QEGVAR(medical,useLocation_Epi), "LIST", - [LSTRING(MedicalSettings_useLocation_Epi_DisplayName), LSTRING(MedicalSettings_useLocation_Epi_Description)], - _categoryArray, - [[0,1,2,3,4],[LELSTRING(common,Anywhere), LELSTRING(common,Vehicle), LLSTRING(medicalFacility), LLSTRING(vehicleAndFacility), LELSTRING(common,Disabled)],0], // [values, titles, defaultIndex] - true, // isGlobal - {[QEGVAR(medical,useLocation_Epi), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[ - QEGVAR(medical,useLocation_PAK), "LIST", - [LSTRING(MedicalSettings_useLocation_PAK_DisplayName), LSTRING(MedicalSettings_useLocation_PAK_Description)], - _categoryArray, - [[0,1,2,3,4],[LELSTRING(common,Anywhere), LELSTRING(common,Vehicle), LLSTRING(medicalFacility), LLSTRING(vehicleAndFacility), LELSTRING(common,Disabled)],0], // [values, titles, defaultIndex] - true, // isGlobal - {[QEGVAR(medical,useLocation_PAK), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; - -[ - QEGVAR(medical,useLocation_SurgicalKit), "LIST", - [LSTRING(MedicalSettings_useLocation_SurgicalKit_DisplayName), LSTRING(MedicalSettings_useLocation_SurgicalKit_Description)], - _categoryArray, - [[0,1,2,3,4],[LELSTRING(common,Anywhere), LELSTRING(common,Vehicle), LLSTRING(medicalFacility), LLSTRING(vehicleAndFacility), LELSTRING(common,Disabled)],0], // [values, titles, defaultIndex] - true, // isGlobal - {[QEGVAR(medical,useLocation_SurgicalKit), _this] call EFUNC(common,cbaSettings_settingChanged)}, - true // Needs mission restart -] call CBA_settings_fnc_init; +*/ diff --git a/addons/medical_treatment/script_component.hpp b/addons/medical_treatment/script_component.hpp index ff7360dfc5..913571642a 100644 --- a/addons/medical_treatment/script_component.hpp +++ b/addons/medical_treatment/script_component.hpp @@ -2,8 +2,8 @@ #define COMPONENT_BEAUTIFIED Medical Treatment #include "\z\ace\addons\main\script_mod.hpp" -// #define DEBUG_MODE_FULL -// #define DISABLE_COMPILE_CACHE +#define DEBUG_MODE_FULL +#define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_MEDICAL_TREATMENT @@ -16,3 +16,36 @@ #include "\z\ace\addons\main\script_macros.hpp" #include "\z\ace\addons\medical_engine\script_macros_medical.hpp" + +#define GET_FUNCTION(var,cfg) \ + private var = getText (cfg); \ + if (isNil var) then { \ + var = compile var; \ + } else { \ + var = missionNamespace getVariable var; \ + } + +// Returns a number config entry with default value of 0 +// If entry is a string, will get the variable from missionNamespace +#define GET_NUMBER_ENTRY(cfg) \ + if (isText (cfg)) then { \ + missionNamespace getVariable [getText (cfg), 0]; \ + } else { \ + getNumber (cfg); \ + } + +// Macros for checking if unit is in medical vehicle or facility +// Defined mostly to make location check in canTreat more readable +#define IN_MED_VEHICLE(unit) (unit call FUNC(isInMedicalVehicle)) +#define IN_MED_FACILITY(unit) (unit call FUNC(isInMedicalFacility)) + +#define TREATMENT_LOCATIONS_NONE 0 +#define TREATMENT_LOCATIONS_VEHICLES 1 +#define TREATMENT_LOCATIONS_FACILITIES 2 +#define TREATMENT_LOCATIONS_VEHICLES_AND_FACILITIES 3 +#define TREATMENT_LOCATIONS_ALL 4 + +#define LITTER_CLEANUP_CHECK_DELAY 30 + +#define MAX_LOG_ENTRIES 8 +#define LOG_VARNAME(type) (format [QEGVAR(medical,log_%1), type]) diff --git a/addons/medical_treatment/stringtable.xml b/addons/medical_treatment/stringtable.xml index 75b9dffc8d..d062c881b4 100644 --- a/addons/medical_treatment/stringtable.xml +++ b/addons/medical_treatment/stringtable.xml @@ -1,64 +1,238 @@ + + Treatment + + + Litter + + + Advanced Diagnose + + + Enables the Check Pulse, Check Blood Pressure, and Check Response treatment actions instead of the generic Diagnose action. + + + Advanced Bandages + + + Enables treatment actions for different bandage types instead of the generic Bandage action. + + + Wound Reopening + + + Enables the reopening of bandaged wounds. Requires Advanced Bandages to be enabled. + + + Advanced Medication + + + Enables extended, more in-depth medication handling. Also, enables the use of Adenosine and Atropine. + + + Locations Boost Training + Místa pro vylepšení zkušeností + Località aumentano addestramento + Örtliche Trainingssteigerung + Ubicación mejora entrenamiento. + Miejsca zwiększają wyszkolenie + Localização melhora treinamento + Le lieu améliore l'efficacité + Места ускоренного обучения + 衛生兵としての能力を与える場所 + 교육 증가 지역 + 受所在位置影响提升医疗能力 + 受所在位置影響提升醫療能力 + + + Boost medical training when in medical vehicles or facilities. Untrained becomes medic, medic becomes doctor. + + + Self IV Transfusion + + + Enables the use of IV Transfusions on oneself. + + + Allow Shared Equipment + + + Controls whether medical equipment can be shared between the patient and the medic. + + + Patient's Equipment First + + + Medic's Equipment First + + + Allow Epinephrine + Erlaube Epiniphrin + Permitir Epinefrina + Ograniczenia adrenaliny + Activer l'épinéphrine + Permette epinefrina + Povolit adrenalin + Permitir Epinefrina + Разрешить Адреналин + アドレナリンの許可 + 에피네프린 활성화 + 允许使用肾上腺素 + 允許使用腎上腺素 + + + Training level required to use Epinephrine. + + + Locations Epinephrine + Orte für Epiniphrin + Ubicaciones epinefrina + Ograniczenia adrenaliny + Utilisation de l'épinéphrine + Ubicazione epinefrina + Oblast k použití adrenalinu + Localizações de Epinefrina + Место использования адреналина + アドレナリンをつかう場所 + 에피네프린 사용 장소 + 肾上腺素使用地点 + 腎上腺素使用地點 + + + Controls where Epinephrine can be used. + + + Allow PAK + Использование аптечки + Ustawienie apteczek osobistych + Permitir EPA + Erlaube Erste-Hilfe-Set + Povolit osobní lékárničky (PAK) + Permitir Kit de Primeiros Socorros + Activer la trousse sanitaire + Elsősegélycsomag engedélyezése + Consenti Kit di Pronto Soccorso + 応急処置キットの許可 + 개인응급키트 활성화 + 允许使用个人急救包 + 允許使用個人急救包 + + + Training level required to use a PAK. + + + Locations PAK + Место использования аптечки + Ograniczenie apteczek osobistych + Ubicaciones del EPA + Orte für Erste-Hilfe-Set + Oblast k použití PAK + Localizações do KPS + Lieu d'utilisation da trousse sanitaire + Elsősegélycsomag helyek + Locazioni Kit Pronto Soccorso + 応急処置キットを使う場所 + 개인응급키트 사용 장소 + 个人急救包使用地点 + 個人急救包使用地點 + + + Controls where a PAK can be used. + + + Consume PAK + + + Controls whether a PAK should be consumed after use. + + + Allow Surgical Kit + + + Training level required to use a Surgical Kit. + + + Locations Surgical Kit + + + Controls where a Surgical Kit can be used. + + + Consume Surgical Kit + + + Controls whether a Surgical Kit should be consumed after use. + + + Convert Vanilla Items + + + Controls whether vanilla medical items are converted to ACE Medical items, removed only, or ignored. + + + Remove Only + + + Enable Litter + Включить мусор + Aktywuj odpadki + Activar restos médicos + Abfälle aktivieren + Povolit odpadky + Ativar lixo médico + Activer les détritus + Szemét engedélyezése + Abilita Barella + 医療廃棄物の表示を有効化 + + + Enables the creation of litter upon treatment. + + + Max Litter Objects + + + Sets the maximum number of litter objects which can be spawned, excessive amounts can cause FPS lag. + + + Litter Lifetime + + + Controls the lifetime of litter objects, in seconds. -1 is forever. + + + + Anyone + Кем угодно + Wszyscy + Nadie + Jeder + Kdokoliv + Qualquer um + Tous + Akárki + Chiunque + だれでも + 모두 + 任何人 + 任何人 + + + Medics + + + Doctors + + + Medical Facilities + + + Vehicles & Facilities + + - - Treatment - - - Advanced Bandages - - - Enable advanced bandages (required for wound reopening) - - - Advanced Diagnose - - - Enable advanced diagnose - - - Advanced Medication - - - Enable advanced medication - - - Locations boost training - Místa pro vylepšení zkušeností - Località aumentano addestramento - Örtliche Trainingssteigerung - Ubicación mejora entrenamiento. - Miejsca zwiększają wyszkolenie - Localização melhora treinamento - Le lieu améliore l'efficacité - Места ускоренного обучения - 衛生兵としての能力を与える場所 - 교육 증가 지역 - 受所在位置影响提升医疗能力 - 受所在位置影響提升醫療能力 - - - Boost medic rating in medical vehicles or near medical facilities [untrained becomes medic, medic becomes doctor] - Zlepšit zkušenosti zdravotníka v medickém vozidle nebo poblíž zdravotního zařízení [nezkušení se stane zdravotníkem, zdravotník se stane doktorem] - Aumenta il rating medico in veicoli medici o vicino strutture mediche [non addestrato diventa medico, medico diventa dottore] - Steigert die medizinische Einstufung eines Soldaten in Sanitätsfarhzeugen oder in der Nähe von Sanitätseinrichtungen [untrainiert wird zu Sanitäter, Sanitäter zu Doktor] - Mejora el entrenamiento médico dentro de vehículos médicos o cerca de instalaciones médicas (no entrenados se convierten en médicos, médicos se convierten en doctores) - Zwiększa poziom wyszkolenia medyków wewnątrz pojazdów medycznych lub w pobliżu budynków medycznych [niedoświadczony zostaje medykiem, medyk zostaje doktorem] - Aumenta a classificação do médico dentro de veículos médicos ou perto de instalações médicas [sem treinamento vira médico, médico vira doutor] - Améliore l'efficacité des soins dans les véhicules ou structures de soins [non formés deviennent médecins, médecins deviennent docteurs] - Улучшает медицинскую подготовку в мед. транспорте и около мед. строений [нетренированные становятся медиками, медики становятся врачами] - 医療車両や医療施設の近くは衛生兵としての能力を与える場所となり、衛生兵の訓練を受けていないのに衛生兵としてなる (未訓練は衛生兵に、衛生兵は医師に) - 의무병의 수준이 주변의 차량이나 의료시설에 따라 증가합니다. [비교육자가 의무병이되고, 의무병이 의사가 됩니다] - 当人员在医疗载具或是医护设施旁进行医疗时, 该员医疗能力将会有所提升 (未受训人员提升为医疗兵, 医疗兵提升为军医) - 當人員在醫療載具或是醫護設施旁進行醫療時, 該員醫療能力將會有所提升 (未受訓人員提升為醫療兵, 醫療兵提升為軍醫) - - - Self IV Transfusion - - - Allows using IV Transfusions on yourself - CPR creates pulse HLW erzeugt einen Puls @@ -67,307 +241,14 @@ CPR will create a pulse for the patient while performing HLW erzeugt während der Behandlung beim Patienten einen Puls - - Enable Advanced wounds - Усложненные раны - Aktywuj zaawansowane rany - Activa heridas avanzadas - Aktiviere erweiterte Wunden - Povolit pokročilé zranění - Ativar ferimentos avançados - Activer les plaies compliquées - Komplex sebek engedélyezése - Abilita ferite Avanzate - アドバンスドな傷を有効化 - 고급 부상 활성화 - 启用进阶伤口系统 - 啟用進階傷口系統 - - - Allow reopening of bandaged wounds? - Будут ли открываться уже перевязанные раны? - Pozwól na otwieranie się zabandażowanych ran? - Permitir la reapertura de las heridas vendadas? - Erlaube das Öffnen von bandagierten Wunden? - Umožnit znovuotevření zavázané rány? - Permitr reabertura de ferimentos enfaixados? - Les plaies peuvent se rouvrir - Visszanyílhatnak a bekötözött sebek? - Permetti la riapertura di ferite bendate? - 包帯で巻かれた傷を再び開くようにしますか? - 붕대가 풀리는것을 활성화합니까? - 启用进阶伤口系统会使已被包扎的伤口有机率裂开 - 啟用進階傷口系統會使已被包紮的傷口有機率裂開 - - - - - Allow Epinephrine - Erlaube Epiniphrin - Permitir Epinefrina - Ograniczenia adrenaliny - Activer l'épinéphrine - Permette epinefrina - Povolit adrenalin - Permitir Epinefrina - Разрешить Адреналин - アドレナリンの許可 - 에피네프린 활성화 - 允许使用肾上腺素 - 允許使用腎上腺素 - - - Who can use Epinephrine? - - - Allow PAK - Использование аптечки - Ustawienie apteczek osobistych - Permitir EPA - Erlaube Erste-Hilfe-Set - Povolit osobní lékárničky (PAK) - Permitir Kit de Primeiros Socorros - Activer la trousse sanitaire - Elsősegélycsomag engedélyezése - Consenti Kit di Pronto Soccorso - 応急処置キットの許可 - 개인응급키트 활성화 - 允许使用个人急救包 - 允許使用個人急救包 - - - Who can use the PAK for full heal? - Кому разрешено выполнять полное лечение с помощью аптечки? - Kto może skorzystać z apteczki osobistej w celu pełnego uleczenia? - ¿Quién puede utilizar el EPA para una cura completa? - Wer kann das Erste-Hilfe-Set für eine Endheilung verwenden? - Kdo může použít osobní lékárničku pro plné vyléčení? - Quem pode usar o KPS para cura completa? - Qui peut utilier la trousse sanitaire pour des soins complets? - Ki használhatja az elsősegélycsomagot teljes gyógyításra? - Chi può usare il KPS per cura completa? - 完全に回復できるよう誰しもが応急処置キットを使えるようにしますか? - 완전한 체력회복을 위해 어느 인원이 개인응급키트을 쓸 수 있습니까? (기본 의료 전용) - 谁能够使用个人急救包来达到完整医疗? - 誰能夠使用個人急救包來達到完整醫療? - - - Anyone - Кем угодно - Wszyscy - Nadie - Jeder - Kdokoliv - Qualquer um - Tous - Akárki - Chiunque - だれでも - 모두 - 任何人 - 任何人 - - - Medics only - Только медиками - Tylko medycy - Solo médicos - Nur Sanitäter - Pouze zdravotník - Somente médicos - Infirmiers uniquement - Csak orvosok - Solo medici - 衛生兵のみ - 의무병만 - 只限医疗兵 - 只限醫療兵 - - - Doctors only - Только врачами - Tylko doktorzy - Solo doctores - Nur Ärzte - Pouze doktor - Somente doutores - Médecins uniquement - Csak doktorok - Solo dottori - 医師のみ - 오직 의사만 - 只限军医 - 只限軍醫 - - - Medical facility - В госпитале - Budynki medyczne - Centro médico - Medizinische Einrichtungen - Zdravotnické zařízení - Instalação médica - Dans les structures sanitaires - Orvosi létesítmény - Strutture mediche - 医療施設でのみ - 의료시설 - 医疗设施 - 醫療設施 - - - Vehicles & facility - В транспорте и госпитале - Pojazdy i budynki medyczne - Vehículos y centros - Fahrzeuge & Einrichtungen - Vozidla a zařízení - Veículos e instalações - Dans les véhicules et les structures sanitaires - Járművek & létesítmény - Veicoli e Strutture - 車両 & 施設 - 차량 및 시설 - 医疗载具 & 医疗设施 - 醫療載具 & 醫療設施 - - - Remove PAK on use - Удалять аптечки после использования - Usuń apteczkę po użyciu - Eliminar EPA después del uso - Entf. Erste-Hilfe-Set bei Verwendung - Odebrat osobní lékárničku po použití - Remover o KPS depois do uso - Utilisation unique de la trousse sanitaire - Elsősegélycsomag eltávolítása használatkor - Rimuovi Kit Pronto Soccorso dopo l'uso - 応急処置キットの削除 - 개인응급키트 사용후 사라짐 - 在使用后删除个人急救包 - 在使用後刪除個人急救包 - - - Should PAK be removed on usage? - Нужно ли удалять аптечки после использования? - Czy apteczka osobista powinna zniknąć z ekwipunku po jej użyciu? - El EPA será eliminado después de usarlo - Sollen Erste-Hilfe-Sets bei Verwendung entfernt werden? - Má se osobní lékárnička odstranit po použití? - Deve o KPS ser removido depois do uso? - La trousse sanitaire doit être consommée à l'utilisation? - Eltávolítódjon az elsősegélycsomag használatkor? - Il Kit Pronto Soccorso dev'essere rimosso dopo l'utilizzo? - 応急処置キットを使うと削除しますか? - 개인응급키트를 사용하고 나서 제거합니까? - 要在使用后删除个人急救包吗? - 要在使用後刪除個人急救包嗎? - - - Locations Epinephrine - Orte für Epiniphrin - Ubicaciones epinefrina - Ograniczenia adrenaliny - Utilisation de l'épinéphrine - Ubicazione epinefrina - Oblast k použití adrenalinu - Localizações de Epinefrina - Место использования адреналина - アドレナリンをつかう場所 - 에피네프린 사용 장소 - 肾上腺素使用地点 - 腎上腺素使用地點 - - - Where can the Epinephrine be used? - - - How long should PAK take to apply? - - - How long should PAK take to apply? Use 0 for default (based on damage) - - - - - Enable Litter - Включить мусор - Aktywuj odpadki - Activar restos médicos - Abfälle aktivieren - Povolit odpadky - Ativar lixo médico - Activer les détritus - Szemét engedélyezése - Abilita Barella - 医療廃棄物の表示を有効化 - - - Enable litter being created upon treatment - Включить появление мусора после лечения - Twórz odpadki medyczne podczas leczenia - Activar los restos médicos que se crean en el tratamiento - Aktiviere Abfälle, wenn eine Behandlung durchgeführt wurde - Vytváří odpad zdravotnického materiálu pří léčení - Ativar lixo ser criado após tratamento - Activer la création de détrimus au début des traitements - Engedélyezi a szemét keletkezését ellátáskor - Abilita la creazione della barella dopo trattamento - 治療を始めると、医療廃棄物の作成を有効化する - - - Litter Simulation Detail - Detale zużytych medykamentów - Detalle de simulación de basura - Количество мусора от медицины - Dettagli Simulazione Rifiuti - Niveau de simulation des détritus - Abfall-Detaillevel - Hulladékszimuláció részletessége - Detalhe da simulação de sujeira - Počet zobrazených předmětů po použití zdravotnického materiálu - 医療廃棄物を再現する詳細度 - - - Litter simulation detail level sets the number of litter items which will be locally spawned in the client. Excessive amounts in local areas could cause FPS lag, so this is a client only setting. - Opcja ta ustawia liczbę zużytych medykamentów, jakie pojawiają się lokalnie wokół gracza. Ich zbyt duża ilość może spowodować spadki FPS, dlatego jest to ustawienie tylko po stronie klienta. - Detalle simulación de basura establece el número de artículos de basura que se generan a nivel local en el cliente. Las cantidades excesivas en áreas locales podrían causar caída de rendimiento, así que esto es un ajuste de cliente únicamente. - Устанавливает количество мусора, который появляется после использования мед. препаратов. Большое количество мусора может уменьшить производительность, поэтому данная настройка локальна для клиента. - Il numero di rifiuti che verranno creati localmente. La creazione di troppi rifiuti in aree locali potrebbe causare lag e calo di FPS. Questo è un settaggio lato client. - Le niveau de simulation des détritus règle la quantité de déchets qui vont être créés localement chez le client. Des quantitées excessive chez certains clients peuvent causer des chutes de FPS, c'est donc une option client uniquement. - Die Einstellung für das Abfall-Detaillevel stellt die Menge des lokal angezeigten medizinischen Abfalls ein. Zuviel Abfall kann FPS-Einbrüche erzeugen, weswegen diese Einstellung nur clientseitig ist. - A hulladékszimuláció részletessége megszabja a kliens által megjelenített hulladékobjektumok mennyiségét. Súlyos mennyiségek izolált területeken alacsony FPS-t okozhatnak, így ez egy kliensoldali beállítás. - O nível de detalhe de sujeira determina o número de itens que irão aparecer no cliente. Quantidades excessivas em áreas locais podem aumentar o lag do FPS, então esta é uma opção somente para o cliente. - Počet zobrazených předmětů po použití zdravotnického materiálu ovlivňuje počet objektů, které budou zobrazeny klientovi v místě použití zdravotnického materiálu. Vyšší množství objektů může způsobovat poklesy FPS a proto je toto nastavení čistě na klientovi. - 医療廃棄物再現度は各クライアントでローカルに作成される、医療廃棄物への詳細度を決定できます。ローカルで多くのアイテムがあると FPS の低下を引き起こすため、クライアント側のみの設定です。 - - - Life time of litter objects - Время удаления мусора - Długość życia odpadków - Tiempo de vida de los restos médicos - Dauer des angezeigten Abfalls - Životnost pro odpadky - Tempo de vida dos objetos do lixo - Durée d'affichage des détritus - Szemétobjektumok élettartama - Tempo di vita delle barelle - 医療廃棄物の作成限界数を設定 - - - How long should litter objects stay? In seconds. -1 is forever. - Как долго мусор будет оставаться на земле? В секундах. -1 означает бесконечное время. - Ile czasu musi upłynąć, aby odpadki zaczęły znikać? W sekundach. -1 dla nieskończoności. - ¿Por cuánto tiempo deben permanecer los restos médicos? En segundos. -1 es para siempre. - Wie lange sollen Abfälle am Boden liegen (in Sekunden)? -1 ist für immer. - Za jak dlouho začnou odpadky mizet? V sekundách. -1 navždy. - Quanto tempo os objetos do lixo devem ficar? Em segundos. -1 é para sempre. - Combien de temps doivent rester affiché les détritus? En secondes. -1 pour tout le temps - Milyen sokáig legyenek jelen a szemétobjektumok (másodpercben)? A -1 végtelen időt jelent. - Per quanto devono restare le barelle? In secondi. -1 è permanente - 医療廃棄物オブジェクトが表示されつづける時間を設定しますか?-1 は永遠です。 - + + + How long should PAK take to apply? + + + How long should PAK take to apply? Use 0 for default (based on damage) + [ACE] Medical Supply Crate (Basic) [ACE] Ящик с медикаментами (базовая медицина) @@ -478,7 +359,7 @@ - Regular medic + Regular Medic Обычный медик Zwykły medyk Médico regular @@ -3440,95 +3321,9 @@ 移除军用止血带中... 移除軍用止血帶中... - - Convert vanilla items - - - Enables or disables whether vanilla medical items are converted to ACE medical items or just removed - - - Just remove vanilla medical - - - Locations PAK - Место использования аптечки - Ograniczenie apteczek osobistych - Ubicaciones del EPA - Orte für Erste-Hilfe-Set - Oblast k použití PAK - Localizações do KPS - Lieu d'utilisation da trousse sanitaire - Elsősegélycsomag helyek - Locazioni Kit Pronto Soccorso - 応急処置キットを使う場所 - 개인응급키트 사용 장소 - 个人急救包使用地点 - 個人急救包使用地點 - - - Remove Surgical Kit (Adv) - Удалять хирургический набор (усл.) - Usuń zestaw chirurgiczny po użyciu - Eliminar equipo quirúrgico (Avanzado) - Entferne Operationskasten (erweitert) - Odebrat chirurgickou soupravu (Pokr.) - Remover kit cirúrgico (avançado) - Consommer les trousses chirurgicales (Av.) - Sebészkészlet (Fejlett) eltávolítása - Rimuovi Kit Chirurgico (Avanzato) - 縫合キットを削除 (アド) - 봉합키트 제거 (고급) - 在使用后删除手术包 (进阶伤口) - 在使用後刪除手術包 (進階傷口) - - - Should Surgical kit be removed on usage? - Нужно ли удалять хирургический набор после использования? - Czy zestaw chirurgiczny powinien zniknąć z ekwipunku po jego użyciu? - Eliminar el equipo quirúrgico después del uso - Entferne Operationskästen bei Verwendung? - Odebrat chirurgickou soupravu po použití? - Deve o kit cirúrgico ser removido após o uso? - La trousse chirurgicale doit être consommée à l'utilisation? - Eltávolítódjon a sebészkészlet használatkor? - Il Kit Chirurgico dev'essere rimosso dopo l'uso? - 縫合キットを使った後に削除しますか? - 봉합키트를 사용하고 나서 제거합니까? - 手术包会在使用后被删除吗? - 手術包會在使用後被刪除嗎? - - - Allow Surgical Kit (Adv) - Хирургический набор может использоваться (усл.) - Ustawienia zestawu chirurgicznego - Permitir equipo quirúrgico (Avanzado) - Erlaube Operationskasten - Povolit chirurgickou soupravu (Pokr.) - Permite kit cirúrgico (avançado) - Permettre les trousses chirurgicales (Avancé) - Sebészkészlet (Fejlett) engedélyezése - Permetti Kit Chirurgico (Avanzato) - 縫合キットの許可 (アド) - 봉합키트 활성화 (고급) - 允许使用手术包 (进阶伤口) - 允許使用手術包 (進階傷口) - - - Who can use the Surgical Kit? - Кто может использовать хирургический набор? - Kto może skorzystać z zestawu chirurgicznego w celu zszycia ran? - ¿Quién puede utilizar el equipo quirúrgico? - Wer kann den Operationskasten verwenden? - Kdo může použít chirurgickou soupravu? - Quem pode usar o kit cirúrgico? - Qui peut utiliser les trousses chirurgicales? - Ki használhatja a sebészkészletet? - Chi può usare il Kit Chirurgico? - だれでも縫合キットを使えるようにしますか? - 어느 인원이 봉합키트를 사용할 수 있습니까? - 谁能够使用手术包? - 誰能夠使用手術包? - + + + There is no tourniquet on this body part! An diesem Körperteil befindet sich kein Tourniquet! @@ -3560,38 +3355,8 @@ 何时可以使用个人急救包? 何時可以使用個人急救包? - - Locations Surgical Kit (Adv) - Место использования хирургического набора (усл.) - Ograniczenie zestawu chirurgicznego - Ubicaciones del equipo quirúrgico (Avanzado) - Orte für Operationskästen (erweitert) - Lokace chirurgické soupravy (Pokr.) - Localizações do kit cirúrgico (avançado) - Lieu d'utilisation des trousses chirurgicales - Sebészkészlet (Fejlett) helyei - Località Kit Chirurgico (Avanzato) - 縫合キットをつかう場所 (アド) - 봉합키트 사용 장소 (고급) - 手术包使用地点 (进阶伤口) - 手術包使用地點 (進階傷口) - - - Where can the Surgical Kit be used? - Где может использоваться хирургический набор? - Gdzie można korzystać z zestawu chirurgicznego? - Dónde se puede utilizar el equipo quirúrgico - Wo kann der Operationskasten verwendet werden? - Kde může být použita chirurgická souprava? - Onde o kit cirúrgico pode ser utilizado? - Où peut être utilisé les trousses chirurgicales? - Hol lehet a sebészkészletet használni? - Dove può essere usato il Kit Chirurgico? - どこでも縫合キットを使えるようにしますか? - 어디에서 봉합키트를 사용할 수 있게 합니까? - 定义手术包可被使用的地方? - 定義手術包可被使用的地方? - + + Condition Surgical Kit (Adv) Beding. für d. Operationskasten (erw.) @@ -3624,22 +3389,7 @@ 何时可以使用手术工具包? 何時可以使用手術工具包? - - Where can the PAK be used? - Где может использоваться аптечка? - Gdzie można korzystać z apteczek osobistych? - ¿Dónde se puede utilizar el equipo de primeros auxilios? - Wo kann das Erste-Hilfe-Set verwendet werden? - Kde může být použita osobní lékárnička (PAK)? - Onde o kit de primeiros socorros pode ser utilizado? - Où la trousse sanitaire peut être utilisée ? - Hol lehet az elsősegélycsomagot használni? - Dove può essere usato il Kit Pronto Soccorso? - どこでも応急処置キットを使えるようにしますか? - 어디에서 개인응급키트를 사용할 수 있습니까? - 在哪里可以使用个人急救包? - 在哪裡可以使用個人急救包? - + Condition PAK Bedingungen für d. Erste-Hilfe-Set diff --git a/addons/medical_treatment/ui/items/adenosine_x_ca.paa b/addons/medical_treatment/ui/adenosine_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/adenosine_x_ca.paa rename to addons/medical_treatment/ui/adenosine_ca.paa diff --git a/addons/medical_treatment/ui/items/atropine_x_ca.paa b/addons/medical_treatment/ui/atropine_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/atropine_x_ca.paa rename to addons/medical_treatment/ui/atropine_ca.paa diff --git a/addons/medical_treatment/ui/items/bloodiv_x_ca.paa b/addons/medical_treatment/ui/bloodiv_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/bloodiv_x_ca.paa rename to addons/medical_treatment/ui/bloodiv_ca.paa diff --git a/addons/medical_treatment/ui/items/bodybag_x_ca.paa b/addons/medical_treatment/ui/bodybag_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/bodybag_x_ca.paa rename to addons/medical_treatment/ui/bodybag_ca.paa diff --git a/addons/medical_treatment/ui/items/elasticbandage_x_ca.paa b/addons/medical_treatment/ui/elasticbandage_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/elasticbandage_x_ca.paa rename to addons/medical_treatment/ui/elasticbandage_ca.paa diff --git a/addons/medical_treatment/ui/items/epinephrine_x_ca.paa b/addons/medical_treatment/ui/epinephrine_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/epinephrine_x_ca.paa rename to addons/medical_treatment/ui/epinephrine_ca.paa diff --git a/addons/medical_treatment/ui/items/fielddressing_x_ca.paa b/addons/medical_treatment/ui/fielddressing_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/fielddressing_x_ca.paa rename to addons/medical_treatment/ui/fielddressing_ca.paa diff --git a/addons/medical_treatment/ui/items/morphine_x_ca.paa b/addons/medical_treatment/ui/morphine_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/morphine_x_ca.paa rename to addons/medical_treatment/ui/morphine_ca.paa diff --git a/addons/medical_treatment/ui/items/packingbandage_x_ca.paa b/addons/medical_treatment/ui/packingbandage_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/packingbandage_x_ca.paa rename to addons/medical_treatment/ui/packingbandage_ca.paa diff --git a/addons/medical_treatment/ui/items/personal_aid_kit_x_ca.paa b/addons/medical_treatment/ui/personal_aid_kit_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/personal_aid_kit_x_ca.paa rename to addons/medical_treatment/ui/personal_aid_kit_ca.paa diff --git a/addons/medical_treatment/ui/items/plasmaiv_x_ca.paa b/addons/medical_treatment/ui/plasmaiv_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/plasmaiv_x_ca.paa rename to addons/medical_treatment/ui/plasmaiv_ca.paa diff --git a/addons/medical_treatment/ui/items/quickclot_x_ca.paa b/addons/medical_treatment/ui/quickclot_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/quickclot_x_ca.paa rename to addons/medical_treatment/ui/quickclot_ca.paa diff --git a/addons/medical_treatment/ui/items/salineiv_x_ca.paa b/addons/medical_treatment/ui/salineiv_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/salineiv_x_ca.paa rename to addons/medical_treatment/ui/salineiv_ca.paa diff --git a/addons/medical_treatment/ui/items/surgicalkit_x_ca.paa b/addons/medical_treatment/ui/surgicalkit_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/surgicalkit_x_ca.paa rename to addons/medical_treatment/ui/surgicalkit_ca.paa diff --git a/addons/medical_treatment/ui/items/tourniquet_x_ca.paa b/addons/medical_treatment/ui/tourniquet_ca.paa similarity index 100% rename from addons/medical_treatment/ui/items/tourniquet_x_ca.paa rename to addons/medical_treatment/ui/tourniquet_ca.paa