setting for basic/advanced syringes

This commit is contained in:
commy2 2016-10-20 02:14:11 +02:00
parent 519ea25fc7
commit 7e498ab762
9 changed files with 78 additions and 142 deletions

View File

@ -28,4 +28,13 @@ GVAR(STATE_MACHINE) = (configFile >> "ACE_Medical_StateMachine") call FUNC(creat
true
] call CBA_Settings_fnc_init;
[
QGVAR(advancedMedication),
"CHECKBOX",
["Advanced Medication", "Enables advanced simulation of Morphine, Epinephrine etc."], //@todo
"ACE Medical", // @todo
false,
true
] call CBA_Settings_fnc_init;
ADDON = true;

View File

@ -93,10 +93,10 @@ if (GVAR(level) == 1) then {
_unit setVariable [QGVAR(pain), (_painStatus - 0.001 * _interval) max 0, _syncValues];
};
// reduce painkillers
if (_unit getVariable [QGVAR(morphine), 0] > 0) then {
_unit setVariable [QGVAR(morphine), ((_unit getVariable [QGVAR(morphine), 0]) - 0.0015 * _interval) max 0, _syncValues];
};
//// reduce painkillers
//if (_unit getVariable [QGVAR(morphine), 0] > 0) then {
// _unit setVariable [QGVAR(morphine), ((_unit getVariable [QGVAR(morphine), 0]) - 0.0015 * _interval) max 0, _syncValues];
//};
};
*/

View File

@ -90,28 +90,37 @@ class GVAR(Actions) {
};
// --- syringes
class Morphine: BasicBandage {
class Morphine: fieldDressing {
displayName = ECSTRING(medical,Inject_Morphine);
displayNameProgress = ECSTRING(medical,Injecting_Morphine);
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
allowSelfTreatment = 1;
category = "medication";
treatmentTime = 10;
items[] = {"ACE_morphine"};
condition = "";
callbackSuccess = QFUNC(treatmentMorphine);
treatmentTime = 10;
callbackSuccess = QFUNC(treatmentMedication);
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = { {"All", "", {"ACE_MedicalLitter_morphine"}} };
sounds[] = {{QPATHTO_R(sounds\Inject.ogg),1,1,50}};
};
class Adenosine: Morphine {
displayName = ECSTRING(medical,Inject_Adenosine);
displayNameProgress = ECSTRING(medical,Injecting_Adenosine);
items[] = {"ACE_adenosine"};
litter[] = { {"All", "", {"ACE_MedicalLitter_adenosine"}} };
};
class Atropine: Morphine {
displayName = ECSTRING(medical,Inject_Atropine);
displayNameProgress = ECSTRING(medical,Injecting_Atropine);
items[] = {"ACE_atropine"};
litter[] = { {"All", "", {"ACE_MedicalLitter_atropine"}} };
};
class Epinephrine: Morphine {
displayName = ECSTRING(medical,Inject_Epinephrine);
displayNameProgress = ECSTRING(medical,Injecting_Epinephrine);
requiredMedic = QEGVAR(medical,medicSetting_basicEpi);
items[] = {"ACE_epinephrine"};
callbackSuccess = QFUNC(treatmentEpipen);
litter[] = { {"All", "", {"ACE_MedicalLitter_epinephrine"}} };
treatmentLocations[] = {QGVAR(useLocation_basicEpi)};
//treatmentLocations[] = {QGVAR(useLocation_basicEpi)};
};
// --- iv bags
@ -251,37 +260,6 @@ class GVAR(Actions) {
/*
class Advanced {
class Morphine: fieldDressing {
displayName = ECSTRING(medical,Inject_Morphine);
displayNameProgress = ECSTRING(medical,Injecting_Morphine);
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
category = "medication";
items[] = {"ACE_morphine"};
treatmentTime = 3;
callbackSuccess = QFUNC(treatmentMedication);
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = { {"All", "", {"ACE_MedicalLitter_morphine"}} };
sounds[] = {{QPATHTO_R(sounds\Inject.ogg),1,1,50}};
};
class Adenosine: Morphine {
displayName = ECSTRING(medical,Inject_Adenosine);
displayNameProgress = ECSTRING(medical,Injecting_Adenosine);
items[] = {"ACE_adenosine"};
litter[] = { {"All", "", {"ACE_MedicalLitter_adenosine"}} };
};
class Atropine: Morphine {
displayName = ECSTRING(medical,Inject_Atropine);
displayNameProgress = ECSTRING(medical,Injecting_Atropine);
items[] = {"ACE_atropine"};
litter[] = { {"All", "", {"ACE_MedicalLitter_atropine"}} };
};
class Epinephrine: Morphine {
displayName = ECSTRING(medical,Inject_Epinephrine);
displayNameProgress = ECSTRING(medical,Injecting_Epinephrine);
items[] = {"ACE_epinephrine"};
litter[] = { {"All", "", {"ACE_MedicalLitter_epinephrine"}} };
};
class SurgicalKit: fieldDressing {
displayName = ECSTRING(medical,Use_SurgicalKit);
displayNameProgress = ECSTRING(medical,Stitching);

View File

@ -1,4 +1,5 @@
// actions
PREP(actionCheckBloodPressure);
PREP(actionCheckBloodPressureLocal);
PREP(actionCheckPulse);
@ -8,6 +9,31 @@ PREP(actionDiagnose);
PREP(actionLoadUnit);
PREP(actionPlaceInBodyBag);
PREP(actionUnloadUnit);
// treaments
PREP(canTreat);
PREP(canTreatCached);
PREP(treatment);
PREP(treatment_success);
PREP(treatment_failure);
PREP(treatmentBandage);
PREP(treatmentBandageLocal);
PREP(treatmentTourniquet);
PREP(treatmentTourniquetLocal);
PREP(treatmentTourniquetRemove);
PREP(treatmentMedication);
PREP(treatmentMedicationLocal);
PREP(treatmentIV);
PREP(treatmentIVLocal);
PREP(treatmentCPR);
PREP(treatmentCPRLocal);
PREP(treatmentFullHeal);
PREP(treatmentFullHealLocal);
PREP(treatmentFullHealTreatmentTime);
PREP(treatmentSurgicalKit_onProgress);
// misc
PREP(addToLog);
PREP(addToTriageCard);
PREP(addUnloadPatientActions);
@ -22,33 +48,6 @@ PREP(isBeingDragged);
PREP(medicationEffectLoop);
PREP(onMedicationUsage);
// treaments
PREP(canTreat);
PREP(canTreatCached);
PREP(treatment);
PREP(treatment_success);
PREP(treatment_failure);
PREP(treatmentBandage);
PREP(treatmentBandageLocal);
PREP(treatmentTourniquet);
PREP(treatmentTourniquetLocal);
PREP(treatmentTourniquetRemove);
PREP(treatmentMorphine);
PREP(treatmentMorphineLocal);
PREP(treatmentEpipen);
//PREP(treatmentEpipenLocal);
PREP(treatmentMedication);
PREP(treatmentMedicationLocal);
PREP(treatmentIV);
PREP(treatmentIVLocal);
PREP(treatmentCPR);
PREP(treatmentCPRLocal);
PREP(treatmentFullHeal);
PREP(treatmentFullHealLocal);
PREP(treatmentFullHealTreatmentTime);
PREP(treatmentSurgicalKit_onProgress);
// items
PREP(checkItems);
PREP(hasItem);

View File

@ -10,8 +10,6 @@ if (isServer) then {
// treatment events
[QGVAR(treatmentBandageLocal), FUNC(treatmentBandageLocal)] call CBA_fnc_addEventHandler;
[QGVAR(treatmentTourniquetLocal), FUNC(treatmentTourniquetLocal)] call CBA_fnc_addEventHandler;
//[QGVAR(treatmentMorphineLocal), FUNC(treatmentMorphineLocal)] call CBA_fnc_addEventHandler;
//[QGVAR(treatmentEpipenLocal), FUNC(treatmentEpipenLocal)] call CBA_fnc_addEventHandler;
[QGVAR(treatmentMedicationLocal), FUNC(treatmentMedicationLocal)] call CBA_fnc_addEventHandler;
[QGVAR(treatmentIVLocal), FUNC(treatmentIVLocal)] call CBA_fnc_addEventHandler;
[QGVAR(treatmentCPRLocal), FUNC(treatmentCPRLocal)] call CBA_fnc_addEventHandler;

View File

@ -1,20 +0,0 @@
/*
* Author: KoffeinFlummi
* Callback when the epipen treatment is complete
*
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: Body part <STRING>
* 3: Treatment class name <STRING>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["_caller", "_target"];
[_target, false] call EFUNC(medical,setUnconscious);

View File

@ -17,6 +17,25 @@
params ["_target", "_className", "_partIndex"];
TRACE_3("params",_target,_className,_partIndex);
if !(EGVAR(medical,advancedMedication)) exitWith {
if (_className == "Morphine") exitWith {
#define MORPHINEHEAL 0.4
params ["_target"];
// reduce pain, pain sensitivity
private _morphine = ((_target getVariable [QEGVAR(medical,morphine), 0]) + MORPHINEHEAL) min 1;
_target setVariable [QEGVAR(medical,morphine), _morphine, true];
private _pain = ((_target getVariable [QEGVAR(medical,pain), 0]) - MORPHINEHEAL) max 0;
_target setVariable [QEGVAR(medical,pain), _pain, true];
};
if (_className == "Epinephrine") exitWith {
[_target, false] call EFUNC(medical,setUnconscious);
};
};
private _tourniquets = _target getVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0]];
if (_tourniquets select _partIndex > 0) exitWith {
@ -35,7 +54,7 @@ private _currentInSystem = _target getVariable [_varName, 0];
_target setVariable [_varName, _currentInSystem + 1];
// Find the proper attributes for the used medication
private _medicationConfig = (configFile >> "ace_medical_treatment" >> "Medication");
private _medicationConfig = configFile >> "ace_medical_treatment" >> "Medication";
private _painReduce = getNumber (_medicationConfig >> "painReduce");
private _hrIncreaseLow = getArray (_medicationConfig >> "hrIncreaseLow");
private _hrIncreaseNorm = getArray (_medicationConfig >> "hrIncreaseNormal");
@ -48,7 +67,7 @@ private _hrCallback = getText (_medicationConfig >> "hrCallback");
private _inCompatableMedication = [];
if (isClass (_medicationConfig >> _className)) then {
_medicationConfig = (_medicationConfig >> _className);
_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"); };
@ -91,6 +110,7 @@ if (_painReduce > 0) then {
// Reduce pain
private _painSuppress = _target getVariable [QEGVAR(medical,painSuppress), 0];
_target setVariable [QEGVAR(medical,painSuppress), (_painSuppress + _painReduce) max 0];
if (!GVAR(painIsOnlySuppressed)) then {
_pain = _target getVariable [QEGVAR(medical,pain), 0];
_target setVariable [QEGVAR(medical,pain), (_pain - _painReduce) max 0, true];
@ -101,6 +121,6 @@ private _resistance = _target getVariable [QEGVAR(medical,peripheralResistance),
_target setVariable [QEGVAR(medical,peripheralResistance), (_resistance + _viscosityChange) max 0];
// Call back to ensure that the medication is decreased over time
[_target, _classname, _varName, _maxDose, _timeInSystem, _inCompatableMedication, _viscosityChange, _painReduce] call FUNC(onMedicationUsage);
[_target, _className, _varName, _maxDose, _timeInSystem, _inCompatableMedication, _viscosityChange, _painReduce] call FUNC(onMedicationUsage);
true

View File

@ -1,22 +0,0 @@
/*
* Author: KoffeinFlummi
* Callback when the morphine treatment is complete
*
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: Body part <STRING>
* 3: Treatment class name <STRING>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
#define MORPHINEHEAL 0.4
params ["_caller", "_target"];
[QGVAR(treatmentMorphineLocal), [_target], _target] call CBA_fnc_targetEvent;

View File

@ -1,26 +0,0 @@
/*
* Author: KoffeinFlummi
* Local callback when the morphine treatment is complete
*
* Arguments:
* 0: The patient <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
#define MORPHINEHEAL 0.4
params ["_target"];
// reduce pain, pain sensitivity
private _morphine = ((_target getVariable [QEGVAR(medical,morphine), 0]) + MORPHINEHEAL) min 1;
_target setVariable [QEGVAR(medical,morphine), _morphine, true];
private _pain = ((_target getVariable [QEGVAR(medical,pain), 0]) - MORPHINEHEAL) max 0;
_target setVariable [QEGVAR(medical,pain), _pain, true];
// @todo overdose