Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Pharmacy - Improve IV flush/blockage/tourniquet behaviour #384

Merged
21 changes: 21 additions & 0 deletions addons/pharma/ACE_Medical_Treatment.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
class ADDON {
class Medication {
class Adenosine {
painReduce = 0;
hrIncreaseLow[] = {-7, -10};
hrIncreaseNormal[] = {-15, -30};
hrIncreaseHigh[] = {-15, -35};
timeInSystem = 120;
timeTillMaxEffect = 15;
maxDose = 6;
incompatibleMedication[] = {};
};
class Morphine {
painReduce = 0.8;
hrIncreaseLow[] = {-10, -20};
hrIncreaseNormal[] = {-10, -30};
hrIncreaseHigh[] = {-10, -35};
timeInSystem = 1800;
timeTillMaxEffect = 30;
maxDose = 4;
incompatibleMedication[] = {};
viscosityChange = -10;
};
class Epinephrine {
painReduce = 0;
hrIncreaseLow[] = {10, 20};
Expand Down
16 changes: 8 additions & 8 deletions addons/pharma/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class ACE_Medical_Treatment_Actions {
treatmentTime = QGVAR(treatmentTime_EACA);
items[] = {"kat_EACA"};
condition = QUOTE(!(GVAR(MedicationsRequireInsIV)) || FUNC(removeIV));
callbackSuccess = QFUNC(treatmentAdvanced_EACA);
callbackSuccess = QFUNC(treatmentAdvanced_medication);
sounds[] = {};
};
class TXA: EACA {
Expand All @@ -121,7 +121,7 @@ class ACE_Medical_Treatment_Actions {
medicRequired = QGVAR(medLvl_TXA);
treatmentTime = QGVAR(treatmentTime_TXA);
items[] = {"kat_TXA"};
callbackSuccess = QFUNC(treatmentAdvanced_TXA);
callbackSuccess = QFUNC(treatmentAdvanced_medication);
sounds[] = {};
};
class SalineFlush: Carbonate {
Expand Down Expand Up @@ -200,7 +200,7 @@ class ACE_Medical_Treatment_Actions {
medicRequired = QGVAR(medLvl_Amiodarone);
treatmentTime = QGVAR(treatmentTime_Amiodarone);
items[] = {"kat_amiodarone"};
callbackSuccess = QFUNC(treatmentAdvanced_Amiodarone);
callbackSuccess = QFUNC(treatmentAdvanced_medication);
sounds[] = {};
};
class Lidocaine: EACA {
Expand All @@ -220,7 +220,7 @@ class ACE_Medical_Treatment_Actions {
medicRequired = QGVAR(medLvl_Atropine);
treatmentTime = QGVAR(treatmentTime_Atropine);
items[] = {"kat_atropine"};
callbackSuccess = QFUNC(treatmentAdvanced_Atropine);
callbackSuccess = QFUNC(treatmentAdvanced_medication);
sounds[] = {};
};
class Ketamine: EACA {
Expand All @@ -230,7 +230,7 @@ class ACE_Medical_Treatment_Actions {
medicRequired = QGVAR(medLvl_Ketamine);
treatmentTime = QGVAR(treatmentTime_Ketamine);
items[] = {"kat_ketamine"};
callbackSuccess = QFUNC(treatmentAdvanced_Ketamine);
callbackSuccess = QFUNC(treatmentAdvanced_medication);
sounds[] = {};
};
class Fentanyl: EACA {
Expand All @@ -240,7 +240,7 @@ class ACE_Medical_Treatment_Actions {
medicRequired = QGVAR(medLvl_Fentanyl);
treatmentTime = QGVAR(treatmentTime_Fentanyl);
items[] = {"kat_fentanyl"};
callbackSuccess = QFUNC(treatmentAdvanced_Fentanyl);
callbackSuccess = QFUNC(treatmentAdvanced_medication);
sounds[] = {};
};
class Nalbuphine: EACA {
Expand Down Expand Up @@ -325,7 +325,7 @@ class ACE_Medical_Treatment_Actions {
medicRequired = QGVAR(medLvl_Lorazepam);
treatmentTime = QGVAR(treatmentTime_Lorazepam);
items[] = {"kat_lorazepam"};
callbackSuccess = QFUNC(treatmentAdvanced_Lorazepam);
callbackSuccess = QFUNC(treatmentAdvanced_medication);
sounds[] = {};
};
class Flumazenil: EACA {
Expand All @@ -337,7 +337,7 @@ class ACE_Medical_Treatment_Actions {
medicRequired = QGVAR(medLvl_Flumezenil);
treatmentTime = QGVAR(treatmentTime_Flumazenil);
items[] = {"kat_flumazenil"};
callbackSuccess = QFUNC(treatmentAdvanced_Flumazenil);
callbackSuccess = QFUNC(treatmentAdvanced_medication);
sounds[] = {};
};
class Dialysis: BasicBandage {
Expand Down
3 changes: 3 additions & 0 deletions addons/pharma/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class CfgFunctions {
class medicationLocal {
file = QPATHTOF(functions\fnc_treatmentAdvanced_medicationLocal.sqf);
};
class tourniquetRemove {
file = QPATHTOF(functions\fnc_tourniquetRemove.sqf);
};
};
};
};
12 changes: 2 additions & 10 deletions addons/pharma/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
PREP(alphaAction);
PREP(applyIV);
PREP(checkIV);
PREP(fentanylPP);
PREP(fluid);
PREP(fluidLocal);
PREP(getBloodLoss);
Expand All @@ -10,31 +9,25 @@ PREP(hasStableVitals);
PREP(init);
PREP(inspectBreath);
PREP(inspectCatheter);
PREP(ketaminePP);
PREP(pervitinPP);
PREP(removeItemfromMag);
PREP(removeIV);
PREP(retrieveIV);
PREP(salineCheck);
PREP(treatmentAdvanced_Amiodarone);
PREP(treatmentAdvanced_AmiodaroneLocal);
PREP(treatmentAdvanced_Atropine);
PREP(treatmentAdvanced_AtropineLocal);
PREP(treatmentAdvanced_Caffeine);
PREP(treatmentAdvanced_CaffeineLocal);
PREP(treatmentAdvanced_Carbonate);
PREP(treatmentAdvanced_CarbonateLocal);
PREP(treatmentAdvanced_Dialysis);
PREP(treatmentAdvanced_DialysisLocal);
PREP(treatmentAdvanced_EACA);
PREP(treatmentAdvanced_EACALocal);
PREP(treatmentAdvanced_Fentanyl);
PREP(treatmentAdvanced_Flumazenil);
PREP(treatmentAdvanced_FentanylLocal);
PREP(treatmentAdvanced_FlumazenilLocal);
PREP(treatmentAdvanced_Flush);
PREP(treatmentAdvanced_FlushLocal);
PREP(treatmentAdvanced_Ketamine);
PREP(treatmentAdvanced_Lorazepam);
PREP(treatmentAdvanced_KetamineLocal);
PREP(treatmentAdvanced_LorazepamLocal);
PREP(treatmentAdvanced_medication);
PREP(treatmentAdvanced_medicationLocal);
Expand All @@ -45,6 +38,5 @@ PREP(treatmentAdvanced_Pervitin);
PREP(treatmentAdvanced_PervitinLocal);
PREP(treatmentAdvanced_Reorientation);
PREP(treatmentAdvanced_ReorientationLocal);
PREP(treatmentAdvanced_TXA);
PREP(treatmentAdvanced_TXALocal);
PREP(vehicleCheckDialysis);
4 changes: 2 additions & 2 deletions addons/pharma/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
[QGVAR(flushLocal), LINKFUNC(treatmentAdvanced_FlushLocal)] call CBA_fnc_addEventHandler;
[QGVAR(pervitinLocal), LINKFUNC(treatmentAdvanced_PervitinLocal)] call CBA_fnc_addEventHandler;
[QGVAR(pervitinPP), LINKFUNC(pervitinPP)] call CBA_fnc_addEventHandler;
[QGVAR(ketaminePP), LINKFUNC(ketaminePP)] call CBA_fnc_addEventHandler;
[QGVAR(fentanylPP), LINKFUNC(fentanylPP)] call CBA_fnc_addEventHandler;
[QGVAR(ketamineLocal), LINKFUNC(ketamineLocal)] call CBA_fnc_addEventHandler;
[QGVAR(fentanylLocal), LINKFUNC(fentanylLocal)] call CBA_fnc_addEventHandler;
[QGVAR(caffeineLocal), LINKFUNC(treatmentAdvanced_CaffeineLocal)] call CBA_fnc_addEventHandler;


Expand Down
66 changes: 66 additions & 0 deletions addons/pharma/functions/fnc_tourniquetRemove.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#include "script_component.hpp"
/*
* Author: Glowbal, mharis001
* Removes the tourniquet from the patient on the given body part.
* Note: Patient may not be local
*
* Arguments:
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
* 2: Body Part <STRING>
*
* Return Value:
* None
*
* Example:
* [player, cursorObject, "LeftLeg"] call ace_medical_treatment_fnc_tourniquetRemove
*
* Public: No
*/

params ["_medic", "_patient", "_bodyPart"];
TRACE_3("tourniquetRemove",_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 {
[ACELSTRING(medical_treatment,noTourniquetOnBodyPart), 1.5] call ACEFUNC(common,displayTextStructured);
};

_tourniquets set [_partIndex, 0];
_patient setVariable [VAR_TOURNIQUET, _tourniquets, true];

[_patient] call ACEFUNC(medical_status,updateWoundBloodLoss);

private _nearPlayers = (_patient nearEntities ["CAManBase", 6]) select {_x call ACEFUNC(common,isPlayer)};
TRACE_1("clearConditionCaches: tourniquetRemove",_nearPlayers);
[QEGVAR(interact_menu,clearConditionCaches), [], _nearPlayers] call CBA_fnc_targetEvent;

// Add tourniquet item to medic or patient
private _receiver = [_patient, _medic, _medic] select ACEGVAR(medical_treatment,allowSharedEquipment);
[_receiver, "ACE_tourniquet"] call ACEFUNC(common,addToInventory);

// Handle occluded medications that were blocked due to tourniquet
private _occludedMedications = _patient getVariable [QEGVAR(medical,occludedMedications), []];
private _arrayModified = false;

if !(((_patient getVariable [QGVAR(IV), [0,0,0,0,0,0]]) select _partIndex) isEqualTo 3) then {
{
_x params ["_bodyPartN", "_medication"];

if (_partIndex == _bodyPartN) then {
TRACE_1("delayed medication call after tourniquet removeal",_x);
BlueTheKing marked this conversation as resolved.
Show resolved Hide resolved
[QGVAR(medicationLocal), [_patient, _bodyPart, _medication], _patient] call CBA_fnc_targetEvent;
_occludedMedications set [_forEachIndex, []];
_arrayModified = true;
};

} forEach _occludedMedications;

if (_arrayModified) then {
_occludedMedications = _occludedMedications - [[]];
_patient setVariable [QACEGVAR(medical,occludedMedications), _occludedMedications, true];
};
};
29 changes: 0 additions & 29 deletions addons/pharma/functions/fnc_treatmentAdvanced_Amiodarone.sqf

This file was deleted.

29 changes: 0 additions & 29 deletions addons/pharma/functions/fnc_treatmentAdvanced_Atropine.sqf

This file was deleted.

29 changes: 0 additions & 29 deletions addons/pharma/functions/fnc_treatmentAdvanced_EACA.sqf

This file was deleted.

29 changes: 0 additions & 29 deletions addons/pharma/functions/fnc_treatmentAdvanced_Fentanyl.sqf

This file was deleted.

29 changes: 0 additions & 29 deletions addons/pharma/functions/fnc_treatmentAdvanced_Flumazenil.sqf

This file was deleted.

Loading
Loading