diff --git a/addons/gui/functions/fnc_updateInjuryList.sqf b/addons/gui/functions/fnc_updateInjuryList.sqf index 663857812..a8b0647b0 100644 --- a/addons/gui/functions/fnc_updateInjuryList.sqf +++ b/addons/gui/functions/fnc_updateInjuryList.sqf @@ -52,7 +52,7 @@ if (IS_BLEEDING(_target)) then { }; }; } else { - _entries pushBack [localize ACELSTRING(medical_gui,NOBLEEDING), _nonissueColor]; + _entries pushBack [localize ACELSTRING(medical_gui,Status_Nobleeding), _nonissueColor]; }; if (ACEGVAR(medical_gui,showBloodlossEntry)) then { @@ -266,4 +266,4 @@ lbClear _ctrl; _ctrl lbSetColor [_ctrl lbAdd _text, _color]; } forEach _entries; -_ctrl lbSetCurSel -1; \ No newline at end of file +_ctrl lbSetCurSel -1; diff --git a/addons/pharma/ACE_Medical_Treatment_Actions.hpp b/addons/pharma/ACE_Medical_Treatment_Actions.hpp index 2bf0fbac3..9b8b75b32 100644 --- a/addons/pharma/ACE_Medical_Treatment_Actions.hpp +++ b/addons/pharma/ACE_Medical_Treatment_Actions.hpp @@ -11,7 +11,7 @@ class ACE_Medical_Treatment_Actions { allowedSelections[] = {"Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"}; medicRequired = QUOTE(ace_medical_treatment_medicIV); condition = QUOTE(!(GVAR(RequireInsIV)) || FUNC(removeIV)); - callbackSuccess = "[_medic, _patient, _bodyPart, _className, _itemUser, _usedItem] call ace_medical_treatment_fnc_ivBag; [_patient, 800, 12] call kat_pharma_fnc_fluid;"; + callbackSuccess = "[_medic, _patient, _bodyPart, _className, _itemUser, _usedItem] call ace_medical_treatment_fnc_ivBag; [_patient, 800, 16] call kat_pharma_fnc_fluid;"; }; class BloodIV_500: BloodIV { callbackSuccess = "[_medic, _patient, _bodyPart, _className, _itemUser, _usedItem] call ace_medical_treatment_fnc_ivBag; [_patient, 400, 8] call kat_pharma_fnc_fluid;"; @@ -29,7 +29,7 @@ class ACE_Medical_Treatment_Actions { callbackSuccess = "[_medic, _patient, _bodyPart, _className, _itemUser, _usedItem] call ace_medical_treatment_fnc_ivBag; [_patient, -150, 0] call kat_pharma_fnc_fluid;"; }; class PlasmaIV: BloodIV { - callbackSuccess = "[_medic, _patient, _bodyPart, _className, _itemUser, _usedItem] call ace_medical_treatment_fnc_ivBag; [_patient, 500, 15] call kat_pharma_fnc_fluid;"; + callbackSuccess = "[_medic, _patient, _bodyPart, _className, _itemUser, _usedItem] call ace_medical_treatment_fnc_ivBag; [_patient, 500, 20] call kat_pharma_fnc_fluid;"; }; class PlasmaIV_500: PlasmaIV { callbackSuccess = "[_medic, _patient, _bodyPart, _className, _itemUser, _usedItem] call ace_medical_treatment_fnc_ivBag; [_patient, 250, 10] call kat_pharma_fnc_fluid;"; @@ -384,4 +384,21 @@ class ACE_Medical_Treatment_Actions { callbackSuccess = QUOTE([ARR_2(_medic,_patient)] call FUNC(treatmentAdvanced_Dialysis)); litter[] = {}; }; + class CheckCoag: CheckPulse { + displayName = CSTRING(CheckCoag_DisplayName); + displayNameProgress = CSTRING(CheckCoag_DisplayNameProgress); + allowedSelections[] = {"LeftArm", "RightArm"}; + treatmentLocations = QGVAR(CheckCoag_Location); + medicRequired = QGVAR(CheckCoag_MedLevel); + treatmentTime = QGVAR(CheckCoag_TreatmentTime); + category = "examine"; + consumeItem = 0; + items[] = {"kat_coag_sense"}; + condition = ""; + callbackProgress = ""; + callbackStart = ""; + callbackFailure = ""; + callbackSuccess = QFUNC(treatmentAdvanced_CheckCoag); + litter[] = {}; + }; }; diff --git a/addons/pharma/CfgWeapons.hpp b/addons/pharma/CfgWeapons.hpp index 1809ab389..d99f8587f 100644 --- a/addons/pharma/CfgWeapons.hpp +++ b/addons/pharma/CfgWeapons.hpp @@ -201,4 +201,15 @@ class CfgWeapons { mass = 0.2; }; }; + class kat_coag_sense: ACE_ItemCore { + scope = 2; + author = "Miss Heda"; + displayName = CSTRING(Coag_Sense_Display); + picture = QPATHTOF(ui\icon_Coag_Sense.paa); + descriptionShort = CSTRING(Coag_Sense_DescShort); + ACE_isMedicalItem = 1; + class ItemInfo: CBA_MiscItem_ItemInfo { + mass = 1; + }; + }; }; diff --git a/addons/pharma/XEH_PREP.hpp b/addons/pharma/XEH_PREP.hpp index 5684f5dcc..362e50ce7 100644 --- a/addons/pharma/XEH_PREP.hpp +++ b/addons/pharma/XEH_PREP.hpp @@ -1,6 +1,8 @@ PREP(alphaAction); PREP(applyIV); PREP(checkIV); +PREP(clotWound); +PREP(coagRegen); PREP(fluid); PREP(fluidLocal); PREP(fullHealLocal); @@ -24,6 +26,7 @@ PREP(treatmentAdvanced_CaffeineLocal); PREP(treatmentAdvanced_Carbonate); PREP(treatmentAdvanced_CWMP); PREP(treatmentAdvanced_CarbonateLocal); +PREP(treatmentAdvanced_CheckCoag); PREP(treatmentAdvanced_Dialysis); PREP(treatmentAdvanced_DialysisLocal); PREP(treatmentAdvanced_EACALocal); @@ -43,4 +46,4 @@ PREP(treatmentAdvanced_PervitinLocal); PREP(treatmentAdvanced_Reorientation); PREP(treatmentAdvanced_ReorientationLocal); PREP(treatmentAdvanced_TXALocal); -PREP(vehicleCheckDialysis); +PREP(vehicleCheckDialysis); \ No newline at end of file diff --git a/addons/pharma/XEH_postInit.sqf b/addons/pharma/XEH_postInit.sqf index 13f040da0..4ff370185 100644 --- a/addons/pharma/XEH_postInit.sqf +++ b/addons/pharma/XEH_postInit.sqf @@ -57,3 +57,6 @@ }; }; }] call CBA_fnc_addEventHandler; + +[QACEGVAR(medical_status,initialized), LINKFUNC(coagRegen)] call CBA_fnc_addEventHandler; +[QACEGVAR(medical_status,initialized), LINKFUNC(clotWound)] call CBA_fnc_addEventHandler; diff --git a/addons/pharma/XEH_preInit.sqf b/addons/pharma/XEH_preInit.sqf index 3b9523ac3..c49d05f5b 100644 --- a/addons/pharma/XEH_preInit.sqf +++ b/addons/pharma/XEH_preInit.sqf @@ -319,6 +319,24 @@ PREP_RECOMPILE_END; // TXA Settings Category +[ + QGVAR(allowStackScript_TXA), + "CHECKBOX", + [LLSTRING(SETTING_allowStackScript_TXA), LLSTRING(SETTING_allowStackScript_TXA_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_TXA)], + [true], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(keepScriptRunning_TXA), + "CHECKBOX", + [LLSTRING(SETTING_keepScriptRunning_TXA), LLSTRING(SETTING_keepScriptRunning_TXA_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_TXA)], + [true], + true +] call CBA_Settings_fnc_init; + [ QGVAR(medLvl_TXA), "LIST", @@ -337,6 +355,15 @@ PREP_RECOMPILE_END; true ] call CBA_Settings_fnc_init; +[ + QGVAR(bandageCycleTime_TXA), + "TIME", + [LLSTRING(SETTING_bandageCycleTime_TXA), LLSTRING(SETTING_bandageCycleTime_TXA_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_TXA)], + [1, 180, 5], + true +] call CBA_Settings_fnc_init; + // Norepinephrine Settings Category [ QGVAR(medLvl_Norepinephrine), @@ -452,6 +479,25 @@ PREP_RECOMPILE_END; ] call CBA_Settings_fnc_init; // EACA Settings Category + +[ + QGVAR(allowStackScript_EACA), + "CHECKBOX", + [LLSTRING(SETTING_allowStackScript_EACA), LLSTRING(SETTING_allowStackScript_EACA_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_EACA)], + [true], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(keepScriptRunning_EACA), + "CHECKBOX", + [LLSTRING(SETTING_keepScriptRunning_EACA), LLSTRING(SETTING_keepScriptRunning_EACA_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_EACA)], + [true], + true +] call CBA_Settings_fnc_init; + [ QGVAR(medLvl_EACA), "LIST", @@ -479,6 +525,15 @@ PREP_RECOMPILE_END; true ] call CBA_Settings_fnc_init; +[ + QGVAR(bandageCycleTime_EACA), + "TIME", + [LLSTRING(SETTING_bandageCycleTime_EACA), LLSTRING(SETTING_bandageCycleTime_EACA_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_EACA)], + [1, 180, 8], + true +] call CBA_Settings_fnc_init; + //Ketamine Settings Category [ QGVAR(medLvl_Ketamine), @@ -591,6 +646,7 @@ PREP_RECOMPILE_END; true ] call CBA_Settings_fnc_init; +// Kidney Settings [ QGVAR(kidneyAction), "CHECKBOX", @@ -600,6 +656,7 @@ PREP_RECOMPILE_END; true ] call CBA_Settings_fnc_init; +// IV Block Chance Settings [ QGVAR(blockChance), "SLIDER", @@ -609,15 +666,182 @@ PREP_RECOMPILE_END; true ] call CBA_Settings_fnc_init; +// Coagulation Settings [ QGVAR(coagulation), "CHECKBOX", [LLSTRING(SETTING_Coagulation), LLSTRING(SETTING_Coagulation_DESC)], - CBA_SETTINGS_CAT, + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [true], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_on_all_Bodyparts), + "CHECKBOX", + [LLSTRING(SETTING_Coagulation_on_all_Bodyparts), LLSTRING(SETTING_Coagulation_on_all_Bodyparts_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [true], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_tourniquetBlock), + "CHECKBOX", + [LLSTRING(SETTING_Coagulation_tourniquetBlock), LLSTRING(SETTING_Coagulation_tourniquetBlock_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [true], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_allow_clot_text), + "CHECKBOX", + [LLSTRING(SETTING_Coagulation_allow_clot_text), LLSTRING(SETTING_Coagulation_allow_clot_text_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [true], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_allow_TXA_script), + "CHECKBOX", + [LLSTRING(SETTING_Coagulation_allow_TXA_script), LLSTRING(SETTING_Coagulation_allow_TXA_script_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [false], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_allow_EACA_script), + "CHECKBOX", + [LLSTRING(SETTING_Coagulation_allow_EACA_script), LLSTRING(SETTING_Coagulation_allow_EACA_script_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [false], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_allowOnAI), + "CHECKBOX", + [LLSTRING(SETTING_Coagulation_allowOnAI), LLSTRING(SETTING_Coagulation_allowOnAI_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], [false], true ] call CBA_Settings_fnc_init; +[ + QGVAR(coagulation_allow_MinorWounds), + "CHECKBOX", + [LLSTRING(SETTING_Coagulation_allow_MinorWounds), LLSTRING(SETTING_Coagulation_allow_MinorWounds_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [true], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_allow_MediumWounds), + "CHECKBOX", + [LLSTRING(SETTING_Coagulation_allow_MediumWounds), LLSTRING(SETTING_Coagulation_allow_MediumWounds_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [true], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_allow_LargeWounds), + "CHECKBOX", + [LLSTRING(SETTING_Coagulation_allow_LargeWounds), LLSTRING(SETTING_Coagulation_allow_LargeWounds_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [true], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_requireHR), + "CHECKBOX", + [LLSTRING(SETTING_Coagulation_requireHR), LLSTRING(SETTING_Coagulation_requireHR_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [true], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_requireBV), + "SLIDER", + [LLSTRING(SETTING_Coagulation_requireBV), LLSTRING(SETTING_Coagulation_requireBV_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [0, 6.0, 3.6, 1], + true +] call CBA_Settings_fnc_init; + + +[ + QGVAR(coagulation_factor_count), + "SLIDER", + [LLSTRING(SETTING_Coagulation_FactorCount), LLSTRING(SETTING_Coagulation_FactorCount_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [0, 100, 15, 0], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_factor_limit), + "SLIDER", + [LLSTRING(SETTING_coagulation_Factor_Limit), LLSTRING(SETTING_coagulation_Factor_Limit_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [1, 200, 30, 0], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_time), + "TIME", + [LLSTRING(SETTING_Coagulation_Time), LLSTRING(SETTING_Coagulation_Time_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [1, 300, 10], + true, + {}, + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_time_minor), + "TIME", + [LLSTRING(SETTING_Coagulation_Time_Minor), LLSTRING(SETTING_Coagulation_Time_Clotting_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [0, 300, 15], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_time_medium), + "TIME", + [LLSTRING(SETTING_Coagulation_Time_Medium), LLSTRING(SETTING_Coagulation_Time_Clotting_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [0, 300, 30], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_time_large), + "TIME", + [LLSTRING(SETTING_Coagulation_Time_Large), LLSTRING(SETTING_Coagulation_Time_Clotting_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [0, 300, 45], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(coagulation_factor_regenerate_time), + "TIME", + [LLSTRING(SETTING_Coagulation_Factor_Regenerate_Time), LLSTRING(SETTING_Coagulation_Factor_Regenerate_Time_DESC)], + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coagulation)], + [1, 900, 150], + true +] call CBA_Settings_fnc_init; + +// Stamina Settings [ QGVAR(staminaMedication), "CHECKBOX", @@ -627,4 +851,32 @@ PREP_RECOMPILE_END; true ] call CBA_Settings_fnc_init; +// Coag Sense setLightnings +[ + QGVAR(CheckCoag_MedLevel), + "LIST", + LLSTRING(SETTING_CheckCoag_MedLevel), + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coag_Sense)], + [[0, 1, 2], ["STR_ACE_Medical_Treatment_Anyone", "STR_ACE_Medical_Treatment_Medics", "STR_ACE_Medical_Treatment_Doctors"], 0], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(CheckCoag_Location), + "LIST", + LLSTRING(SETTING_CheckCoag_Location), + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coag_Sense)], + [[0, 1, 2], ["STR_ACE_Medical_Treatment_Anyone", "STR_ACE_Medical_Treatment_Medics", "STR_ACE_Medical_Treatment_Doctors"], 0], + true +] call CBA_Settings_fnc_init; + +[ + QGVAR(CheckCoag_TreatmentTime), + "TIME", + LLSTRING(SETTING_CheckCoag_treatmentTime), + [CBA_SETTINGS_CAT, LSTRING(SubCategory_Coag_Sense)], + [1, 30, 10], + true +] call CBA_Settings_fnc_init; + ADDON = true; diff --git a/addons/pharma/functions/fnc_clotWound.sqf b/addons/pharma/functions/fnc_clotWound.sqf new file mode 100644 index 000000000..d581d5f99 --- /dev/null +++ b/addons/pharma/functions/fnc_clotWound.sqf @@ -0,0 +1,165 @@ +#include "..\script_component.hpp" +/* + * Author: Miss Heda + * Clots wounds + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [player] call kat_pharma_fnc_clotWound; + * + * Public: No + */ + +params ["_unit"]; + +if !(GVAR(coagulation)) exitWith {}; + +private _fnc_clotWound = { + params ["_unit", "_bodyPart", "_wounds", "_countTXA", "_countEACA"]; + + { + _x params ["_woundClassID", "_amountOf", "_bleeding", "_damage"]; + + private _category = _woundClassID % 10; + private _suffix = ["Minor", "Medium", "Large"] select _category; + private _selectionName = localize format [LSTRING(%1), _bodyPart]; + private _logString = LSTRING(coagulation_Bandaged); + private _woundClotTime = 0; + private _bandageToUse = ""; + private _coagulation_time_minor = missionNamespace getVariable [QGVAR(coagulation_time_minor), 15]; + private _coagulation_time_medium = missionNamespace getVariable [QGVAR(coagulation_time_medium), 30]; + private _coagulation_time_large = missionNamespace getVariable [QGVAR(coagulation_time_large), 45]; + private _factorCountToRemove = 1; + + switch (_suffix) do { + case "Minor": { + _woundClotTime = round ((random (_coagulation_time_minor / 2)) + _coagulation_time_minor / 2); + _bandageToUse = "BloodClotMinor"; + _factorCountToRemove = 1; + + if !(missionNamespace getVariable [QGVAR(coagulation_allow_MinorWounds), true]) then { continue; }; + }; + case "Medium": { + _woundClotTime = round ((random (_coagulation_time_medium / 2)) + _coagulation_time_medium / 2); + _bandageToUse = "BloodClotMedium"; + _factorCountToRemove = 1.5; + + if !(missionNamespace getVariable [QGVAR(coagulation_allow_MediumWounds), true]) then { continue; }; + }; + default { + _woundClotTime = round ((random (_coagulation_time_large / 2)) + _coagulation_time_large / 2); + _bandageToUse = "BloodClotLarge"; + _factorCountToRemove = 2; + + if !(missionNamespace getVariable [QGVAR(coagulation_allow_LargeWounds), true]) then { continue; }; + }; + }; + + if (_amountOf * _bleeding > 0) exitWith { + + if (_countTXA > 0 || _countEACA > 0) then { + _logString = LSTRING(coagulation_Bandaged_TXA); + + if (_countEACA > 0 && _countTXA > 0) exitWith { // If TXA & EACA are in system at same time use EACA bandage + _woundClotTime = round (_woundClotTime / 3 * 2); + _bandageToUse = _bandageToUse + "EACA"; + }; + + _bandageToUse = _bandageToUse + "TXA"; + }; + + [{ + params["_unit", "_bodyPart", "_selectionName", "_bandageToUse", "_logString", "_factorCountToRemove"]; + + private _coagulationFactor = _unit getVariable [QGVAR(coagulationFactor), 15]; + private _openWounds = GET_OPEN_WOUNDS(_unit); + private _openWoundsOnPart = _openWounds getOrDefault [_bodyPart, []]; + private _woundIndex = _openWoundsOnPart findIf {(_x select 1) > 0 && (_x select 2) > 0}; + + if (_coagulationFactor <= 0) exitWith {}; + if (_woundIndex == -1) exitWith {}; + if ([_unit, _bodyPart] call ACEFUNC(medical_treatment,hasTourniquetAppliedTo) && missionNamespace getVariable [QGVAR(coagulation_tourniquetBlock), true]) exitWith {}; + + _unit setVariable [QGVAR(coagulationFactor), (_coagulationFactor - _factorCountToRemove), true]; + [QACEGVAR(medical_treatment,bandageLocal), [_unit, _bodyPart, _bandageToUse, 1], _unit] call CBA_fnc_targetEvent; + if (GVAR(coagulation_allow_clot_text)) then { + [_unit, "activity", _logString, [(toLower _selectionName)]] call ACEFUNC(medical_treatment,addToLog); + }; + }, + [_unit, _bodyPart, _selectionName, _bandageToUse, _logString, _factorCountToRemove], _woundClotTime] call CBA_fnc_waitAndExecute; + }; + } forEach _wounds; +}; + +[{ + params ["_args", "_idPFH"]; + _args params ["_unit", "_fnc_clotWound"]; + + private _alive = alive _unit; + + if !(_alive) exitWith { + [_idPFH] call CBA_fnc_removePerFrameHandler; + }; + + if (!(GVAR(coagulation_allowOnAI)) && ACE_Player != _unit) exitWith { // Check allowOnAI setting to save performance + [_idPFH] call CBA_fnc_removePerFrameHandler; + }; + + private _openWounds = _unit getVariable [VAR_OPEN_WOUNDS, createHashmap]; + private _pulse = _unit getVariable [VAR_HEART_RATE, 80]; + private _coagulationFactor = _unit getVariable [QGVAR(coagulationFactor), 15]; + private _countTXA = [_unit, "TXA"] call ACEFUNC(medical_status,getMedicationCount); + private _countEACA = [_unit, "EACA"] call ACEFUNC(medical_status,getMedicationCount); + private _hasWoundToBandageArray = []; + + if (_openWounds isEqualTo createHashmap) exitWith {}; // Exit when hashmap not initialized (Will not work when hashmap is set, cause ace only changes value of "woundCount" to 0) + if (_coagulationFactor <= 0) exitWith {}; // Exit when no coagFactors left + if (_unit getVariable [QACEGVAR(medical,bloodVolume), 6.0] < GVAR(coagulation_requireBV)) exitWith {}; // Blood volume check + if ((_pulse < 20) && GVAR(coagulation_requireHR)) exitWith {}; // Has pulse & require setting + + private _shuffledKeys = keys _openWounds call BIS_fnc_arrayShuffle; // Shuffel Keys to switch bodypart after each bandage for on_all_Bodyparts setting + + { + if ([_unit, _x] call ACEFUNC(medical_treatment,hasTourniquetAppliedTo) && missionNamespace getVariable [QGVAR(coagulation_tourniquetBlock), true]) then { // Check for tourniqet + continue; + }; + + { + _x params ["_woundClassID", "_amountOf", "_bleeding", "_damage"]; + + private _category = _woundClassID % 10; + private _suffix = ["Minor", "Medium", "Large"] select _category; + + switch (_suffix) do { + case "Minor": { + if (missionNamespace getVariable [QGVAR(coagulation_allow_MinorWounds), true] && _amountOf * _bleeding > 0) then { + _hasWoundToBandageArray pushBack true; + }; + }; + case "Medium": { + if (missionNamespace getVariable [QGVAR(coagulation_allow_MediumWounds), true] && _amountOf * _bleeding > 0) then { + _hasWoundToBandageArray pushBack true; + }; + }; + default { + if (missionNamespace getVariable [QGVAR(coagulation_allow_LargeWounds), true] && _amountOf * _bleeding > 0) then { + _hasWoundToBandageArray pushBack true; + }; + }; + }; + } forEach (_openWounds get _x); // Sets array that specifies if there is a open wound that coag can bandage in body part (here for performance so that the fnc does not get called every time) + + if (!(GVAR(coagulation_on_all_Bodyparts)) && true in _hasWoundToBandageArray) exitWith { // Check if coag should be present on all body party simultaneously, if not use this exitWith to block next interiation of forEach + [_unit, _x, _openWounds get _x, _countTXA, _countEACA] call _fnc_clotWound; + }; + + if (true in _hasWoundToBandageArray) then { // Check if there is a wound to bandage for coag, if not loop through next interiation of forEach + [_unit, _x, _openWounds get _x, _countTXA, _countEACA] call _fnc_clotWound; + }; + } forEach _shuffledKeys; +}, missionNamespace getVariable [QGVAR(coagulation_time), 5], [_unit, _fnc_clotWound]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/pharma/functions/fnc_coagRegen.sqf b/addons/pharma/functions/fnc_coagRegen.sqf new file mode 100644 index 000000000..ee6f696b8 --- /dev/null +++ b/addons/pharma/functions/fnc_coagRegen.sqf @@ -0,0 +1,85 @@ +#include "..\script_component.hpp" +/* + * Author: Miss Heda + * Regenerates clots + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [player] call kat_pharma_fnc_clotWound; + * + * Public: No + */ + +params ["_unit"]; + +if !(GVAR(coagulation)) exitWith {}; + +[{ + params ["_args", "_idPFH"]; + _args params ["_unit"]; + + private _alive = alive _unit; + + if !(_alive) exitWith { + [_idPFH] call CBA_fnc_removePerFrameHandler; + }; + + if (!GVAR(coagulation_allowOnAI) && ACE_Player != _unit) exitWith { // Check allowOnAI setting to save performance + [_idPFH] call CBA_fnc_removePerFrameHandler; + }; + + if (_unit getVariable [QACEGVAR(medical,bloodVolume), 6.0] < GVAR(coagulation_requireBV)) exitWith {}; // Blood volume check + if ((_pulse < 20) && GVAR(coagulation_requireHR)) exitWith {}; // Has pulse & require setting + + private _currentCoagFactors = _unit getVariable [QGVAR(coagulationFactor), 15]; + private _savedCoagFactors = _unit getVariable [QGVAR(coagulationSavedFactors), (_unit getVariable [QGVAR(coagulationFactor), 15])]; + private _limitRegenCoagFactors = missionNamespace getVariable [QGVAR(coagulation_factor_count), 15]; + private _cooldownON = _unit getVariable [QGVAR(coagulationRegenCooldown), false]; + private _countTXA = [_unit, "TXA"] call ACEFUNC(medical_status,getMedicationCount); + private _countEACA = [_unit, "EACA"] call ACEFUNC(medical_status,getMedicationCount); + private _ammountToAdd = 1; + + if (_currentCoagFactors < _savedCoagFactors) exitWith { + [{ + params["_unit"]; + _unit setVariable [QGVAR(coagulationSavedFactors), _unit getVariable [QGVAR(coagulationFactor), 15], true]; + }, + [_unit], ((missionNamespace getVariable [QGVAR(coagulation_factor_regenerate_time), 150]) / 2)] call CBA_fnc_waitAndExecute; // Block regen PFH instance from happening + }; + + if (_currentCoagFactors == _savedCoagFactors && _currentCoagFactors < _limitRegenCoagFactors) exitWith { + + if (_countTXA > 0 || _countEACA > 0) then { // If TXA or EACA are in system add more factors + if (_countTXA > 0 && _countEACA > 0) exitWith { + _ammountToAdd = 4; + }; + _ammountToAdd = 2; + }; + + _unit setVariable [QGVAR(coagulationFactor), (_currentCoagFactors + _ammountToAdd), true]; + _unit setVariable [QGVAR(coagulationSavedFactors), (_currentCoagFactors + _ammountToAdd), true]; + }; + + if (_currentCoagFactors > _limitRegenCoagFactors && !(_cooldownON)) exitWith { + + if (_countTXA > 0 || _countEACA > 0) exitWith {}; // If TXA or EACA is in system don't remove factor + + _unit setVariable [QGVAR(coagulationFactor), (_currentCoagFactors - 1), true]; + _unit setVariable [QGVAR(coagulationSavedFactors), (_currentCoagFactors - 1), true]; + _unit setVariable [QGVAR(coagulationRegenCooldown), true, true]; + + [{ + params["_unit"]; + _unit setVariable [QGVAR(coagulationRegenCooldown), false, true]; + }, + [_unit], missionNamespace getVariable [QGVAR(coagulation_factor_regenerate_time), 150]] call CBA_fnc_waitAndExecute; + }; + + _unit setVariable [QGVAR(coagulationSavedFactors), _currentCoagFactors, true]; + +}, missionNamespace getVariable [QGVAR(coagulation_factor_regenerate_time), 150], [_unit]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/pharma/functions/fnc_fluidLocal.sqf b/addons/pharma/functions/fnc_fluidLocal.sqf index 905158a4f..6e9c4a6d8 100644 --- a/addons/pharma/functions/fnc_fluidLocal.sqf +++ b/addons/pharma/functions/fnc_fluidLocal.sqf @@ -24,6 +24,7 @@ private _final = (_current + _ph) max 0; _final min 1500; _patient setVariable [QGVAR(pH), (_final), true]; +private _coagFactorMax = missionNamespace getVariable [QGVAR(coagulation_factor_limit), 30]; private _factor = _patient getVariable [QGVAR(coagulationFactor), 10]; -private _final2 = (_factor + _coagulation) min 30; +private _final2 = (_factor + _coagulation) min _coagFactorMax; _patient setVariable [QGVAR(coagulationFactor), (_final2), true]; diff --git a/addons/pharma/functions/fnc_fullHealLocal.sqf b/addons/pharma/functions/fnc_fullHealLocal.sqf index 427957e0d..388b62417 100644 --- a/addons/pharma/functions/fnc_fullHealLocal.sqf +++ b/addons/pharma/functions/fnc_fullHealLocal.sqf @@ -36,7 +36,7 @@ _patient setVariable [QGVAR(pH), 1500, true]; _patient setVariable [QGVAR(kidneyFail), false, true]; _patient setVariable [QGVAR(kidneyArrest), false, true]; _patient setVariable [QGVAR(kidneyPressure), false, true]; -_patient setVariable [QGVAR(coagulationFactor), 10, true]; +_patient setVariable [QGVAR(coagulationFactor), missionNamespace getVariable [QGVAR(coagulation_factor_count), 15], true]; /// Clear Stamina & weapon sway if (ACEGVAR(advanced_fatigue,enabled)) then { diff --git a/addons/pharma/functions/fnc_handleRespawn.sqf b/addons/pharma/functions/fnc_handleRespawn.sqf index 7097c5d4d..8a2b99bd9 100644 --- a/addons/pharma/functions/fnc_handleRespawn.sqf +++ b/addons/pharma/functions/fnc_handleRespawn.sqf @@ -91,52 +91,3 @@ if (GVAR(kidneyAction)) then { _unit setVariable [QGVAR(pH), _ph, true]; }, 20, [_unit]] call CBA_fnc_addPerFrameHandler; }; - -if (GVAR(coagulation)) then { - [{ - params ["_args", "_idPFH"]; - _args params ["_unit"]; - - private _alive = alive _unit; - - if !(_alive) exitWith { - [_idPFH] call CBA_fnc_removePerFrameHandler; - }; - - private _openWounds = _unit getVariable [VAR_OPEN_WOUNDS, createHashMap]; - private _pulse = _unit getVariable [VAR_HEART_RATE, 80]; - private _coagulationFactor = _unit getVariable [QGVAR(coagulationFactor), 10]; - - if (_openWounds isEqualTo []) exitWith {}; - if (_pulse < 20) exitWith {}; - if (_coagulationFactor == 0) exitWith {}; - - private _count = [_unit, "TXA"] call ACEFUNC(medical_status,getMedicationCount); - - if (_count == 0) exitWith { - { - private _part = _x; - { - _x params ["", "_amountOf", "_bleeding"]; - if (_amountOf * _bleeding > 0) exitWith { - [QACEGVAR(medical_treatment,bandageLocal), [_unit, _part, "UnstableClot"], _unit] call CBA_fnc_targetEvent; - _unit setVariable [QGVAR(coagulationFactor), (_coagulationFactor - 1), true]; - }; - } forEach _y; - } forEach _openWounds; - }; - - if (_count > 0) exitWith { - { - private _part = _x; - { - _x params ["", "_amountOf", "_bleeding"]; - if (_amountOf * _bleeding > 0) exitWith { - [QACEGVAR(medical_treatment,bandageLocal), [_unit, _part, "PackingBandage"], _unit] call CBA_fnc_targetEvent; - _unit setVariable [QGVAR(coagulationFactor), (_coagulationFactor - 1), true]; - }; - } forEach _y; - } forEach _openWounds; - }; - }, 8, [_unit]] call CBA_fnc_addPerFrameHandler; -}; diff --git a/addons/pharma/functions/fnc_init.sqf b/addons/pharma/functions/fnc_init.sqf index 81799e5f6..bfdd09d48 100644 --- a/addons/pharma/functions/fnc_init.sqf +++ b/addons/pharma/functions/fnc_init.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author: Katalam + * Author: Katalam, Miss Heda * Initializes unit variables. * * Arguments: @@ -54,6 +54,7 @@ if (!local _unit) exitWith {}; if !(_alpha) then { _unit setVariable [QGVAR(alphaAction), 1]; }; + if !(_opioid) then { _unit setVariable [QGVAR(opioidFactor), 1]; }; @@ -109,52 +110,3 @@ if (GVAR(kidneyAction)) then { _unit setVariable [QGVAR(pH), _ph, true]; }, 20, [_unit]] call CBA_fnc_addPerFrameHandler; }; - -if (GVAR(coagulation)) then { - [{ - params ["_args", "_idPFH"]; - _args params ["_unit"]; - - private _alive = alive _unit; - - if !(_alive) exitWith { - [_idPFH] call CBA_fnc_removePerFrameHandler; - }; - - private _openWounds = _unit getVariable [VAR_OPEN_WOUNDS, createHashMap]; - private _pulse = _unit getVariable [VAR_HEART_RATE, 80]; - private _coagulationFactor = _unit getVariable [QGVAR(coagulationFactor), 10]; - - if (_openWounds isEqualTo []) exitWith {}; - if (_pulse < 20) exitWith {}; - if (_coagulationFactor == 0) exitWith {}; - - private _count = [_unit, "TXA"] call ACEFUNC(medical_status,getMedicationCount); - - if (_count == 0) exitWith { - { - private _part = _x; - { - _x params ["", "_amountOf", "_bleeding"]; - if (_amountOf * _bleeding > 0) exitWith { - [QACEGVAR(medical_treatment,bandageLocal), [_unit, _part, "UnstableClot"], _unit] call CBA_fnc_targetEvent; - _unit setVariable [QGVAR(coagulationFactor), (_coagulationFactor - 1), true]; - }; - } forEach _y; - } forEach _openWounds; - }; - - if (_count > 0) exitWith { - { - private _part = _x; - { - _x params ["", "_amountOf", "_bleeding"]; - if (_amountOf * _bleeding > 0) exitWith { - [QACEGVAR(medical_treatment,bandageLocal), [_unit, _part, "PackingBandage"], _unit] call CBA_fnc_targetEvent; - _unit setVariable [QGVAR(coagulationFactor), (_coagulationFactor - 1), true]; - }; - } forEach _y; - } forEach _openWounds; - }; - }, 8, [_unit]] call CBA_fnc_addPerFrameHandler; -}; diff --git a/addons/pharma/functions/fnc_treatmentAdvanced_CheckCoag.sqf b/addons/pharma/functions/fnc_treatmentAdvanced_CheckCoag.sqf new file mode 100644 index 000000000..c5be4be38 --- /dev/null +++ b/addons/pharma/functions/fnc_treatmentAdvanced_CheckCoag.sqf @@ -0,0 +1,37 @@ +#include "..\script_component.hpp" +/* + * Author: Miss Heda + * Checks the Coag Factors and displays it to the player + * + * Arguments: + * 0: Medic + * 1: Patient + * + * Return Value: + * None + *` + * Example: + * [player, cursorTarget] call kat_pharma_fnc_treatmentAdvanced_CheckCoag; + * + * Public: No + */ + +params ["_medic", "_patient"]; + +private _coagFactors = _patient getVariable [QGVAR(coagulationFactor), 15]; +private _missionCoagFactors = missionNamespace getVariable [QGVAR(coagulationFactor), 15]; +private _slowINR = (_missionCoagFactors / 100) * 75; +private _shighINR = (_missionCoagFactors / 100) * 125; +private _hlowINR = (_missionCoagFactors / 100) * 50; +private _hhighINR = (_missionCoagFactors / 100) * 150; +private _output = ""; + +switch (true) do { + case (_coagFactors < _slowINR && _coagFactors > _hlowINR): { _output = LLSTRING(CheckCoag_slightly_lowINR)}; + case (_coagFactors > _shighINR && _coagFactors < _hhighINR): { _output = LLSTRING(CheckCoag_slightly_aboveINR)}; + case (_coagFactors < _hlowINR): { _output = LLSTRING(CheckCoag_highly_lowINR)}; + case (_coagFactors > _hhighINR): { _output = LLSTRING(CheckCoag_highly_aboveINR)}; + default { _output = LLSTRING(CheckCoag_normalINR)}; +}; + +[_patient, "quick_view", LLSTRING(Coag_Sense_Log), [_output]] call ACEFUNC(medical_treatment,addToLog); diff --git a/addons/pharma/functions/fnc_treatmentAdvanced_EACALocal.sqf b/addons/pharma/functions/fnc_treatmentAdvanced_EACALocal.sqf index 60ec0047e..502b608c9 100644 --- a/addons/pharma/functions/fnc_treatmentAdvanced_EACALocal.sqf +++ b/addons/pharma/functions/fnc_treatmentAdvanced_EACALocal.sqf @@ -21,16 +21,24 @@ params ["_patient", "_bodyPart"]; private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; private _IVarray = _patient getVariable [QGVAR(IV), [0,0,0,0,0,0]]; private _IVactual = _IVarray select _partIndex; -private _block = false; +private _countEACA = [_patient, "EACA"] call ACEFUNC(medical_status,getMedicationCount); +private _allowStack = missionNamespace getVariable [QGVAR(allowStackScript_EACA), true]; +private _keepRunning = missionNamespace getVariable [QGVAR(keepScriptRunning_EACA), false]; +private _cycleTime = missionNamespace getVariable [QGVAR(bandageCycleTime_EACA), 5]; if (_IVactual > 1) then { private _randomNumber = random 100; if (_IVactual != 4) exitWith { if (_randomNumber < GVAR(blockChance)) then { - _IVarray set [_partIndex, 3]; - _patient setVariable [QGVAR(IV), _IVarray, true]; - _block = true; + [{ + params ["_patient", "_IVarray", "_partIndex"]; + + if (_IVactual > 1 && _IVactual != 4) exitWith {}; + _IVarray set [_partIndex, 3]; + _patient setVariable [QGVAR(IV), _IVarray, true]; + }, + [_patient, _IVarray, _partIndex], (random 300)] call CBA_fnc_waitAndExecute; }; }; @@ -38,72 +46,89 @@ if (_IVactual > 1) then { _patient setVariable [QGVAR(IV), _IVarray, true]; }; -[{ - params ["_args", "_idPFH"]; - _args params ["_patient"]; +if (!(GVAR(coagulation)) || GVAR(coagulation_allow_EACA_script)) then { - private _alive = alive _patient; - private _exit = true; + if (_IVactual != 3) then { - private _random = random 750; - private _ph = (_patient getVariable [QGVAR(pH), 1500]) - 750; + if (_countEACA > 1 && !(_allowStack)) exitWith {}; - if (_random <= _ph) then { - { - _x params ["_targetBodyPart"]; + [{ + params ["_args", "_idPFH"]; + _args params ["_patient", "_keepRunning"]; - private _bandagedWounds = GET_BANDAGED_WOUNDS(_patient); - private _bandagedWoundsOnPart = _bandagedWounds getOrDefault [_targetBodyPart, []]; + private _alive = alive _patient; + private _exit = true; - if (_bandagedWoundsOnPart isEqualTo [] || [_patient,_x] call ACEFUNC(medical_treatment,hasTourniquetAppliedTo)) then { - continue; + private _random = random 750; + private _ph = (_patient getVariable [QGVAR(pH), 1500]) - 750; + + if !(_alive) exitWith { + [_idPFH] call CBA_fnc_removePerFrameHandler; }; - private _index = _bandagedWoundsOnPart findIf {!((_x select 0) in [20,21,22])}; + if (_random <= _ph) then { + { + _x params ["_targetBodyPart"]; + + private _bandagedWounds = GET_BANDAGED_WOUNDS(_patient); + private _bandagedWoundsOnPart = _bandagedWounds getOrDefault [_targetBodyPart, []]; + + if (_bandagedWoundsOnPart isEqualTo [] || [_patient,_x] call ACEFUNC(medical_treatment,hasTourniquetAppliedTo)) then { + continue; + }; + + private _index = _bandagedWoundsOnPart findIf {!((_x select 0) in [20,21,22])}; + + if (_index != -1) exitWith { + (_bandagedWoundsOnPart select _index) params ["_classID", "_amountOf", "", "_damageOf"]; - if (_index != -1) exitWith { - (_bandagedWoundsOnPart select _index) params ["_classID", "_amountOf", "", "_damageOf"]; + private _treatedWound = [_classID, _amountOf, 0, _damageOf]; - private _treatedWound = [_classID, _amountOf, 0, _damageOf]; + private _stitchedWounds = GET_STITCHED_WOUNDS(_patient); + private _stitchedWoundsOnPart = _stitchedWounds getOrDefault [_targetBodyPart, []]; - private _stitchedWounds = GET_STITCHED_WOUNDS(_patient); - private _stitchedWoundsOnPart = _stitchedWounds getOrDefault [_targetBodyPart, []]; + private _woundIndex = _stitchedWoundsOnPart findIf {(_x select 0) isEqualTo _classID}; - private _woundIndex = _stitchedWoundsOnPart findIf {(_x select 0) isEqualTo _classID}; + if (_woundIndex == -1) then { + _stitchedWoundsOnPart pushBack _treatedWound; + } else { + private _wound = _stitchedWoundsOnPart select _woundIndex; + _stitchedWoundsOnPart set [_woundIndex, [(_wound select 1) + _amountOf, _wound select 2, _wound select 3]]; + }; + _stitchedWounds set [_targetBodyPart, _stitchedWoundsOnPart]; + _patient setVariable [VAR_STITCHED_WOUNDS, _stitchedWounds, true]; - if (_woundIndex == -1) then { - _stitchedWoundsOnPart pushBack _treatedWound; - } else { - private _wound = _stitchedWoundsOnPart select _woundIndex; - _stitchedWoundsOnPart set [_woundIndex,[(_wound select 1) + _amountOf, _wound select 2, _wound select 3]]; - }; - _stitchedWounds set [_targetBodyPart, _stitchedWoundsOnPart]; - _patient setVariable [VAR_STITCHED_WOUNDS, _stitchedWounds, true]; + _bandagedWoundsOnPart deleteAt _index; + _bandagedWounds set [_targetBodyPart, _bandagedWoundsOnPart]; - _bandagedWoundsOnPart deleteAt _index; - _bandagedWounds set [_targetBodyPart, _bandagedWoundsOnPart]; + _patient setVariable [VAR_BANDAGED_WOUNDS, _bandagedWounds, true]; - _patient setVariable [VAR_BANDAGED_WOUNDS, _bandagedWounds, true]; + private _partIndex = ALL_BODY_PARTS find _targetBodyPart; + private _bodyPartDamage = _patient getVariable [QACEGVAR(medical,bodyPartDamage), []]; + private _damage = (_bodyPartDamage select _partIndex) - (_damageOf * _amountOf); + + if (_damage < 0.05) then { + _bodyPartDamage set [_partIndex, 0]; + } else { + _bodyPartDamage set [_partIndex, _damage]; + }; + _patient setVariable [QACEGVAR(medical,bodyPartDamage), _bodyPartDamage, true]; - if (GVAR(eacaClearTrauma)) then { - private _partIndex = ALL_BODY_PARTS find _targetBodyPart; - private _bodyPartDamage = _patient getVariable [QACEGVAR(medical,bodyPartDamage), []]; - private _damage = (_bodyPartDamage select _partIndex) - (_damageOf * _amountOf); - if (_damage < 0.05) then { - _bodyPartDamage set [_partIndex, 0]; - } else { - _bodyPartDamage set [_partIndex, _damage]; + _exit = false; }; - _patient setVariable [QACEGVAR(medical,bodyPartDamage), _bodyPartDamage, true]; - }; - - _exit = false; + } forEach ALL_BODY_PARTS_PRIORITY; }; - } forEach ALL_BODY_PARTS_PRIORITY; - }; - if (!(_alive) || (_exit)) exitWith { - [_idPFH] call CBA_fnc_removePerFrameHandler; - }; + [{ + params ["_patient", "_idPFH"]; + [_idPFH] call CBA_fnc_removePerFrameHandler; + }, + [_patient, _idPFH], 300] call CBA_fnc_waitAndExecute; + + if (_exit && !(_keepRunning)) exitWith { + [_idPFH] call CBA_fnc_removePerFrameHandler; + }; -}, 5, [_patient]] call CBA_fnc_addPerFrameHandler; + }, _cycleTime,[_patient, _keepRunning]] call CBA_fnc_addPerFrameHandler; + }; +}; diff --git a/addons/pharma/functions/fnc_treatmentAdvanced_TXALocal.sqf b/addons/pharma/functions/fnc_treatmentAdvanced_TXALocal.sqf index 6b6ea77e5..7f74eec37 100644 --- a/addons/pharma/functions/fnc_treatmentAdvanced_TXALocal.sqf +++ b/addons/pharma/functions/fnc_treatmentAdvanced_TXALocal.sqf @@ -21,16 +21,24 @@ params ["_patient", "_bodyPart"]; private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; private _IVarray = _patient getVariable [QGVAR(IV), [0,0,0,0,0,0]]; private _IVactual = _IVarray select _partIndex; -private _block = false; +private _countTXA = [_patient, "TXA"] call ACEFUNC(medical_status,getMedicationCount); +private _allowStack = missionNamespace getVariable [QGVAR(allowStackScript_TXA), true]; +private _keepRunning = missionNamespace getVariable [QGVAR(keepScriptRunning_TXA), false]; +private _cycleTime = missionNamespace getVariable [QGVAR(bandageCycleTime_TXA), 5]; if (_IVactual > 1) then { private _randomNumber = random 100; if (_IVactual != 4) exitWith { if (_randomNumber < GVAR(blockChance)) then { - _IVarray set [_partIndex, 3]; - _patient setVariable [QGVAR(IV), _IVarray, true]; - _block = true; + [{ + params["_patient", "_IVarray", "_partIndex"]; + + if (_IVactual > 1 && _IVactual != 4) exitWith {}; + _IVarray set [_partIndex, 3]; + _patient setVariable [QGVAR(IV), _IVarray, true]; + }, + [_patient, _IVarray, _partIndex], (random 300)] call CBA_fnc_waitAndExecute; }; }; @@ -38,15 +46,23 @@ if (_IVactual > 1) then { _patient setVariable [QGVAR(IV), _IVarray, true]; }; -if !(GVAR(coagulation)) then { - if !(_block) then { +if (!(GVAR(coagulation)) || GVAR(coagulation_allow_TXA_script)) then { + + if (_IVactual != 3) then { + + if (_countTXA > 1 && !(_allowStack)) exitWith {}; + [{ params ["_args", "_idPFH"]; - _args params ["_patient"]; + _args params ["_patient", "_keepRunning"]; private _alive = alive _patient; private _exit = true; + if !(_alive) exitWith { + [_idPFH] call CBA_fnc_removePerFrameHandler; + }; + if !(GVAR(kidneyAction)) then { _patient setVariable [QGVAR(pH), 1500, true]; }; @@ -74,10 +90,16 @@ if !(GVAR(coagulation)) then { } forEach ALL_BODY_PARTS_PRIORITY; }; - if (!(_alive) || (_exit)) exitWith { + [{ + params["_patient", "_idPFH"]; + [_idPFH] call CBA_fnc_removePerFrameHandler; + }, + [_patient, _idPFH], 300] call CBA_fnc_waitAndExecute; + + if (_exit && !(_keepRunning)) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; }; - }, 5, [_patient]] call CBA_fnc_addPerFrameHandler; + }, _cycleTime, [_patient, _keepRunning]] call CBA_fnc_addPerFrameHandler; }; -}; +}; \ No newline at end of file diff --git a/addons/pharma/stringtable.xml b/addons/pharma/stringtable.xml index 13b608db3..9d6c8d3b6 100644 --- a/addons/pharma/stringtable.xml +++ b/addons/pharma/stringtable.xml @@ -3221,5 +3221,326 @@ EACAによる効果として縫合に加え、外傷の除去を可能にします。 Autorise le soin complet des traumatismes par l'EACA en plus de la suture + + Allow Stacking + 重複の許可 + + + If enabled TXA will be stackable and double it's efficiency + 有効にすると、TXAの重複が可能になり、効率が2倍になる。 + + + Keep Bandaging Until Out Of System + 体内に効果が無くなるまで"包帯"を適用する + + + If enabled TXA will keep bandaging until it's out of your system\nIf disabled TXA will stop working after bandaging the last wound it can find + 有効にすると、TXAが体内から無くなるまで傷口に"包帯"を巻きます。 \n無効にすると、TXAが判定済の最後の創傷に"包帯"を適用した後に、その作用を終了します。 + + + TXA Cycle Time + TXAサイクル時間 + + + The time it takes for TXA to close a wound + TXAが創傷を塞ぐのに掛かる時間 + + + Coagulation Settings + 凝固設定 + + + Require Heart Rate + 心拍を要求する + + + Should coagulation require a heart rate above 20BPM? (Doing CPR will keep HR above 20BPM) + 凝固が作用するのに20BPM以上の心拍数を必要とさせます (CPRを行うことで心拍数は20BPM以上を保つことが出来ます) + + + Required Blood Volume + 血液量を要求する + + + Minimum volume of blood required for coagulation to work + 凝固の作用に最低限必要な血液の量 + + + Coagulation Factors + 凝固因子 + + + The amount of coagulation factors that get set on unit spawn & be kept as limit for factor regeneration + ユニットのスポーン時に定義される凝固因子の量と、因子の再生限界値 + + + Clotting Cycle Time + 凝血サイクル時間 + + + The time between each wound clotting cycle that start wound clotting. (low number may cause lag) + 創傷の凝血を開始する各凝血サイクル間の時間の長さ。(低い数値はラグを招く恐れがあります) + + + Minor Wounds Clotting Time + 小さな創傷の凝血時間 + + + Medium Wounds Clotting Time + 中くらいの創傷の凝血時間 + + + Large Wounds Clotting Time + 大きな創傷の凝血時間 + + + This time gets divided by 2, randomized & added with the same value devided by 2. \n For example, if the value was set to 10s this would be one possible varriation: (random (10 / 2)) + (10 / 2) = 8s + この時間を2で割って、同じ値を2で割った値をランダムに加算する。\n例えば、値を10秒に設定した場合、次のようなバリエーションが考えられる: (ランダム値 (10秒 / 2)) + (10秒 / 2) = 8秒 + + + Coagulation Factor Regeneration Cycle + 凝固因子再生サイクル + + + The time between coagulation factor regeneration checks. Will add +1 factor on successful check. Uses Setting: "Coagulation Factors" as limit.\n Note: If the limit is exceeded, this time will be used and then remove -1 factor until Setting: "Coagulation Factors" is reached. Tipp: TXA or EACA stop losing factors\nRequirements for regeneration to work:\n- No wound being clotted in the last cycle check from this setting\n- Setting: "Require Heart Rate"\n- Setting: "Required Blood Volume" + 凝固因子再生チェックの間隔。チェックに成功すると因子が+1されます。設定 "凝固因子の限界値" を限界値として使用します。 \n注:制限を超えた場合、この時間が経過した後、設定"凝固因子の限界値"に達するまで因子を1つ取り除きます。 \nヒント: TXAまたはEACAは因子の消失を止めます。\n因子再生が機能するための条件: \n-ここで設定されたサイクル時間の最後のチェックで傷口が凝血していないこと \n-設定: "心拍を要求する" \n-設定: "血液量を要求する" + + + Affect AI + AIへの影響 + + + Allow coagulation to affect AI units. \nEvery other value will still be required if turned on. (May cause lag if many AI is present) + 凝固がAIに影響するようにします。\nONにしても他の値は必要です。(多くのAIが存在する場合、ラグが発生する可能性があります。) + + + Tournique Blocks Blood Clotting + 止血帯による血液凝固の妨げ + + + If enabled a applied tourniquet will stop wounds from being closed from coagulation on that bodypart + 有効にすると、止血帯を適用中の部位で凝固によって傷口が塞がらないようになります。 + + + Affect Minor Wounds + 小さな創傷への影響 + + + Allow coagulation to affect minor wounds when clotting + 小さな創傷に対して凝固が影響することを許可する + + + Affect Medium Wounds + 中くらいの創傷への影響 + + + Allow coagulation to affect medium wounds when clotting + 中くらいの創傷に対して凝固が影響することを許可する + + + Affect Large Wounds + 大きな創傷への影響 + + + Allow coagulation to affect large wounds when clotting + 大きな創傷に対して凝固が影響することを許可する + + + Allow Additional TXA Bandaging + TXAによる追加の"包帯"を許可する + + + If enabled TXA will keep all functionality and start bandaging wounds itself + 有効にすると、TXAがすべての機能を保持し、自身に"包帯"を適用するようになります。 + + + Allow Additional EACA Stiching + EACAによる追加の"縫合"を許可する + + + If enabled EACA will keep all functionality and start stitching bandaged wounds + 有効にすると、EACAがすべての機能を保持し、自身に"縫合"を適用するようになります。 + + + Simultaneous Bodypart Coagulation + 身体部位の同時凝固 + + + If enabled each bodypart will be treated simultaneously by coagulation.\nMeaning if you have a wound on the head and body they will both be treated in the same coagulation cycle. + 有効にすると、各部位が同時に凝固処理されます。\nつまり、頭部と胴体に傷がある場合、同じ凝固サイクルで両方が治癒されます。 + + + Coagulation Factor Limit + 凝固因子の限界値 + + + The limit for how many coagulation factors can be present inside a units body at once. Meaning if you administer plasma this is the maximum attainable value. + 血液凝固因子が一度にどれだけ体内に存在できるかの限界値。つまり、血漿を投与した場合における保持可能な因子の最大値。 + + + Allow Clots To Be Shown in Menu + メニューに血栓を表示する + + + If enabled, when coagulation is bandaging a wound it will add a interaction log to the medical menu. + 有効にすると、凝固が傷に包帯を適用しているときに、医療メニューのログに追加されます。 + + + Blood clotting temporarily closed a wound on %1 + 血液凝固が一時的に %1 の創傷を塞いだ + + + Blood clotting permanently closed a wound on %1 + 血液凝固が完全に %1 の創傷を塞いだ + + + Head + Kopf + Голова + Cabeza + Tête + Głowa + Cabeça + Hlava + Testa + 頭部 + 머리 + 头部 + 頭部 + Kafa + + + Torso + Torso + Торс + Torse + Tors + Torso + Trup + Torso + Torso + 胴体 + 몸통 + 躯干 + 身體 + Gövde + + + Left Arm + Linker Arm + Левая рука + Brazo Izquierdo + Bras gauche + Lewa ręka + Braço Esquerdo + Levá Ruka + Braccio Sinistro + 左腕 + 왼팔 + 左臂 + 左手 + Sol Kol + + + Right Arm + Rechter Arm + Правая рука + Brazo Derecho + Bras droit + Prawa ręka + Braço Direito + Pravá Ruka + Braccio Destro + 右腕 + 오른팔 + 右臂 + 右手 + Sağ Kol + + + Left Leg + Linkes Bein + Левая нога + Pierna Izquierda + Jambe gauche + Lewa noga + Perna Esquerda + Levá Noha + Gamba Sinistra + 左足 + 왼다리 + 左腿 + 左腳 + Sol Bacak + + + Right Leg + Rechtes Bein + Правая нога + Pierna Derecha + Jambe droite + Prawa noga + Perna Direita + Pravá Noha + Gamba Destra + 右足 + 오른다리 + 右腿 + 右腳 + Sağ Bacak + + + Coag-Sense + Coag-Sense + + + The Coag-Sense is a PT/INR monitoring system that can measure the efficiency of your blood clotting + Coag-Senseは血液凝固の効率を測定できる PT/INR モニタリングシステムです。 + + + Coag-Sense conclutes: %1 + Coag-Senseの結果: %1 + + + Measure PT/INR + PT/INRを測定する + + + Taking Blood Sample, + 血液サンプルを取っています、 + + + slightly below normal INR + 正常INRより少し低い + + + sligtly above normal INR + 正常INRより少し高い + + + highly below normal INR + 正常INRよりかなり低い + + + highly above normal INR + 正常INRよりかなり高い + + + normal INR + 正常INR + + + Coag-Sense Settings + Coag-Sense設定 + + + Medical level required for using Coag-Sense + + + Locations Coag-Sense + + + Treatment time for Coag-Sense + diff --git a/addons/pharma/ui/icon_Coag_Sense.paa b/addons/pharma/ui/icon_Coag_Sense.paa new file mode 100644 index 000000000..40858fa4a Binary files /dev/null and b/addons/pharma/ui/icon_Coag_Sense.paa differ diff --git a/addons/surgery/ACE_Medical_Treatment.hpp b/addons/surgery/ACE_Medical_Treatment.hpp index 47c7ba3b6..d308a73de 100644 --- a/addons/surgery/ACE_Medical_Treatment.hpp +++ b/addons/surgery/ACE_Medical_Treatment.hpp @@ -47,113 +47,297 @@ class ACE_Medical_Treatment { class PunctureWoundMedium: PunctureWound {}; class PunctureWoundLarge: PunctureWound {}; }; - class UnstableClot: FieldDressing { - effectiveness = 1; - reopeningChance = 0.4; - reopeningMinDelay = 60; - reopeningMaxDelay = 240; + class BloodClotMinor: FieldDressing { class Abrasion { - effectiveness = 1; + effectiveness = 0; reopeningChance = 0.3; - reopeningMinDelay = 360; - reopeningMaxDelay = 1000; + reopeningMinDelay = 300; + reopeningMaxDelay = 900; }; class AbrasionMinor: Abrasion { effectiveness = 1; }; - class AbrasionMedium: Abrasion {}; - class AbrasionLarge: Abrasion {}; + class AbrasionMedium: Abrasion { + effectiveness = 0; + }; + class AbrasionLarge: Abrasion { + effectiveness = 0; + }; + + class Avulsion: Abrasion {}; + class AvulsionMinor: AbrasionMinor {}; + class AvulsionMedium: Avulsion {}; + class AvulsionLarge: Avulsion {}; + + class Contusion: Abrasion {}; + class ContusionMinor: AbrasionMinor {}; + class ContusionMedium: Contusion {}; + class ContusionLarge: Contusion {}; + + class Crush: Abrasion {}; + class CrushMinor: AbrasionMinor {}; + class CrushMedium: Crush {}; + class CrushLarge: Crush {}; + + class Cut: Abrasion {}; + class CutMinor: AbrasionMinor {}; + class CutMedium: Cut {}; + class CutLarge: Cut {}; + + class Laceration: Abrasion {}; + class LacerationMinor: AbrasionMinor {}; + class LacerationMedium: Laceration {}; + class LacerationLarge: Laceration {}; - class Avulsion: Abrasion { - effectiveness = 0.5; + class VelocityWound: Abrasion {}; + class VelocityWoundMinor: AbrasionMinor {}; + class VelocityWoundMedium: VelocityWound {}; + class VelocityWoundLarge: VelocityWound {}; + + class PunctureWound: Abrasion {}; + class PunctureWoundMinor: AbrasionMinor {}; + class PunctureWoundMedium: PunctureWound {}; + class PunctureWoundLarge: PunctureWound {}; + }; + + class BloodClotMedium: FieldDressing { + class Abrasion { + effectiveness = 0; reopeningChance = 0.5; - reopeningMinDelay = 100; - reopeningMaxDelay = 300; + reopeningMinDelay = 300; + reopeningMaxDelay = 600; + }; + class AbrasionMinor: Abrasion { + effectiveness = 0; + }; + class AbrasionMedium: Abrasion { + effectiveness = 1; + reopeningChance = 0.6; }; + class AbrasionLarge: Abrasion { + effectiveness = 0; + }; + + class Avulsion: Abrasion {}; class AvulsionMinor: Avulsion {}; - class AvulsionMedium: Avulsion { - effectiveness = 0.3; + class AvulsionMedium: AbrasionMedium { + reopeningChance = 0.4; + }; + class AvulsionLarge: Avulsion {}; + + class Contusion: Abrasion {}; + class ContusionMinor: Contusion {}; + class ContusionMedium: AbrasionMedium { + reopeningChance = 2; + }; + class ContusionLarge: Contusion {}; + + class Crush: Abrasion {}; + class CrushMinor: Crush {}; + class CrushMedium: AbrasionMedium { reopeningChance = 0.5; - reopeningMinDelay = 100; - reopeningMaxDelay = 300; }; - class AvulsionLarge: Avulsion { - effectiveness = 0.1; + class CrushLarge: Crush {}; + + class Cut: Abrasion {}; + class CutMinor: Cut {}; + class CutMedium: AbrasionMedium { reopeningChance = 0.5; - reopeningMinDelay = 60; - reopeningMaxDelay = 200; }; + class CutLarge: Cut {}; - class Contusion: Abrasion { - effectiveness = 2; - reopeningChance = 0; - reopeningMinDelay = 0; - reopeningMaxDelay = 0; + class Laceration: Abrasion {}; + class LacerationMinor: Laceration {}; + class LacerationMedium: AbrasionMedium { + reopeningChance = 0.5; + }; + class LacerationLarge: Laceration {}; + + class VelocityWound: Abrasion {}; + class VelocityWoundMinor: VelocityWound {}; + class VelocityWoundMedium: AbrasionMedium { + reopeningChance = 0.5; + }; + class VelocityWoundLarge: VelocityWound {}; + + class PunctureWound: Abrasion {}; + class PunctureWoundMinor: PunctureWound {}; + class PunctureWoundMedium: AbrasionMedium { + reopeningChance = 0.5; + }; + class PunctureWoundLarge: PunctureWound {}; + }; + + class BloodClotLarge: FieldDressing { + class Abrasion { + effectiveness = 0; + reopeningChance = 0.8; + reopeningMinDelay = 150; + reopeningMaxDelay = 600; + }; + class AbrasionMinor: Abrasion {}; + class AbrasionMedium: Abrasion{}; + class AbrasionLarge: Abrasion { + effectiveness = 1; + }; + + class Avulsion: Abrasion {}; + class AvulsionMinor: Avulsion {}; + class AvulsionMedium: Avulsion {}; + class AvulsionLarge: AbrasionLarge { + reopeningChance = 1; }; + + class Contusion: Abrasion {}; class ContusionMinor: Contusion {}; class ContusionMedium: Contusion {}; - class ContusionLarge: Contusion {}; + class ContusionLarge: AbrasionLarge {}; - class Crush: Abrasion { - effectiveness = 2; - reopeningChance = 0.2; - reopeningMinDelay = 200; - reopeningMaxDelay = 1000; - }; + class Crush: Abrasion {}; class CrushMinor: Crush {}; class CrushMedium: Crush {}; - class CrushLarge: Crush {}; + class CrushLarge: AbrasionLarge {}; - class Cut: Abrasion { - effectiveness = 2; - reopeningChance = 0.1; - reopeningMinDelay = 360; - reopeningMaxDelay = 1000; - }; + class Cut: Abrasion {}; class CutMinor: Cut {}; class CutMedium: Cut {}; - class CutLarge: Cut {}; - - class Laceration: Abrasion { - effectiveness = 2; - reopeningChance = 0.3; - reopeningMinDelay = 300; - reopeningMaxDelay = 800; + class CutLarge: AbrasionLarge { + reopeningChance = 0.7; }; + + class Laceration: Abrasion {}; class LacerationMinor: Laceration {}; class LacerationMedium: Laceration {}; - class LacerationLarge: Laceration { - effectiveness = 1; + class LacerationLarge: AbrasionLarge { reopeningChance = 0.7; - reopeningMinDelay = 100; - reopeningMaxDelay = 800; }; - class VelocityWound: Abrasion { - effectiveness = 0.5; - reopeningChance = 0.5; - reopeningMinDelay = 120; - reopeningMaxDelay = 500; - }; + class VelocityWound: Abrasion {}; class VelocityWoundMinor: VelocityWound {}; class VelocityWoundMedium: VelocityWound {}; - class VelocityWoundLarge: VelocityWound { - effectiveness = 0.2; + class VelocityWoundLarge: AbrasionLarge { reopeningChance = 0.7; - reopeningMinDelay = 120; - reopeningMaxDelay = 500; }; - class PunctureWound: Abrasion { - effectiveness = 2; - reopeningChance = 0.5; - reopeningMinDelay = 200; - reopeningMaxDelay = 850; - }; + class PunctureWound: Abrasion {}; class PunctureWoundMinor: PunctureWound {}; class PunctureWoundMedium: PunctureWound {}; - class PunctureWoundLarge: PunctureWound {}; + class PunctureWoundLarge: AbrasionLarge {}; + }; + + class BloodClotMinorTXA: BloodClotMinor { + class Abrasion { + effectiveness = 0; + reopeningChance = 0; + reopeningMinDelay = 300; + reopeningMaxDelay = 600; + }; + class AbrasionMinor: Abrasion { + effectiveness = 1; + }; + class AvulsionMinor: AbrasionMinor {}; + class ContusionMinor: AbrasionMinor {}; + class CrushMinor: AbrasionMinor {}; + class CutMinor: AbrasionMinor {}; + class LacerationMinor: AbrasionMinor {}; + class VelocityWoundMinor: AbrasionMinor {}; + class PunctureWoundMinor: AbrasionMinor {}; + }; + + class BloodClotMediumTXA: BloodClotMedium { + class Abrasion { + effectiveness = 0; + reopeningChance = 0; + reopeningMinDelay = 300; + reopeningMaxDelay = 600; + }; + class AbrasionMedium: Abrasion { + effectiveness = 1; + }; + class AvulsionMedium: AbrasionMedium {}; + class ContusionMedium: AbrasionMedium {}; + class CrushMedium: AbrasionMedium {}; + class CutMedium: AbrasionMedium {}; + class LacerationMedium: AbrasionMedium {}; + class VelocityWoundMedium: AbrasionMedium {}; + class PunctureWoundMedium: AbrasionMedium {}; + }; + + class BloodClotLargeTXA: BloodClotLarge { + class Abrasion { + effectiveness = 0; + reopeningChance = 0; + reopeningMinDelay = 300; + reopeningMaxDelay = 600; + }; + class AbrasionLarge: Abrasion { + effectiveness = 1; + }; + class AvulsionLarge: AbrasionLarge {}; + class ContusionLarge: AbrasionLarge {}; + class CrushLarge: AbrasionLarge {}; + class CutLarge: AbrasionLarge {}; + class LacerationLarge: AbrasionLarge {}; + class VelocityWoundLarge: AbrasionLarge {}; + class PunctureWoundLarge: AbrasionLarge {}; + }; + + class BloodClotMinorEACA: BloodClotMinor { + class Abrasion { + effectiveness = 0; + reopeningChance = 0; + reopeningMinDelay = 300; + reopeningMaxDelay = 600; + }; + class AbrasionMinor: Abrasion { + effectiveness = 2; + }; + class AvulsionMinor: AbrasionMinor {}; + class ContusionMinor: AbrasionMinor {}; + class CrushMinor: AbrasionMinor {}; + class CutMinor: AbrasionMinor {}; + class LacerationMinor: AbrasionMinor {}; + class VelocityWoundMinor: AbrasionMinor {}; + class PunctureWoundMinor: AbrasionMinor {}; + }; + + class BloodClotMediumEACA: BloodClotMedium { + class Abrasion { + effectiveness = 0; + reopeningChance = 0; + reopeningMinDelay = 300; + reopeningMaxDelay = 600; + }; + class AbrasionMedium: Abrasion { + effectiveness = 2; + }; + class AvulsionMedium: AbrasionMedium {}; + class ContusionMedium: AbrasionMedium {}; + class CrushMedium: AbrasionMedium {}; + class CutMedium: AbrasionMedium {}; + class LacerationMedium: AbrasionMedium {}; + class VelocityWoundMedium: AbrasionMedium {}; + class PunctureWoundMedium: AbrasionMedium {}; + }; + + class BloodClotLargeEACA: BloodClotLarge { + class Abrasion { + effectiveness = 0; + reopeningChance = 0; + reopeningMinDelay = 300; + reopeningMaxDelay = 600; + }; + class AbrasionLarge: Abrasion { + effectiveness = 2; + }; + class AvulsionLarge: AbrasionLarge {}; + class ContusionLarge: AbrasionLarge {}; + class CrushLarge: AbrasionLarge {}; + class CutLarge: AbrasionLarge {}; + class LacerationLarge: AbrasionLarge {}; + class VelocityWoundLarge: AbrasionLarge {}; + class PunctureWoundLarge: AbrasionLarge {}; }; }; };