merge basic and adv. bandage actions

This commit is contained in:
commy2 2016-10-13 09:47:52 +02:00
parent b1f0af7e1c
commit 5965326ca1
9 changed files with 294 additions and 430 deletions

View File

@ -47,9 +47,8 @@ private _openWounds = _unit getVariable QEGVAR(medical,openWounds);
private _bloodLossOnAffectedBodyParts = 0;
{
private _partIndex = ALL_BODY_PARTS find toLower _x;
private _bloodLossOnBodyPart = 0;
private _partIndex = ALL_BODY_PARTS find toLower _x;
{
_x params ["", "", "_bodyPartN", "_amountOf", "_percentageOpen"];

View File

@ -15,33 +15,21 @@
*/
#include "script_component.hpp"
private _configBasic = (configFile >> QEGVAR(medical_treatment,actions) >> "Basic");
private _configAdvanced = (configFile >> QEGVAR(medical_treatment,actions) >> "Advanced");
GVAR(actions) = [];
private _fnc_compileActionsLevel = {
params ["_config"];
private _actions = [];
{
if (isClass _x) then {
private _displayName = getText (_x >> "displayName");
private _category = getText (_x >> "category");
private _condition = format [QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), %2 select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical_treatment,canTreatCached)), configName _x, ALL_BODY_PARTS];
private _statement = format [QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), %2 select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical_treatment,treatment)), configName _x, ALL_BODY_PARTS];
_actions pushBack [_displayName, _category, compile _condition, compile _statement];
diag_log format["ACTION: %1", [_displayName, _category, compile _condition, compile _statement]];
};
nil
} count ("true" configClasses _config);
_actions;
};
GVAR(actionsBasic) = [_configBasic] call _fnc_compileActionsLevel;
GVAR(actionsAdvanced) = [_configAdvanced] call _fnc_compileActionsLevel;
{
if (isClass _x) then {
private _displayName = getText (_x >> "displayName");
private _category = getText (_x >> "category");
private _condition = format [QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), %2 select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical_treatment,canTreatCached)), configName _x, ALL_BODY_PARTS];
private _statement = format [QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), %2 select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical_treatment,treatment)), configName _x, ALL_BODY_PARTS];
GVAR(actions) pushBack [_displayName, _category, compile _condition, compile _statement];
};
nil
} count ("true" configClasses (configFile >> QEGVAR(medical_treatment,actions)));
//Manually add the drag actions, if dragging exists.
if (["ace_dragging"] call EFUNC(common,isModLoaded)) then {
if ("ace_dragging" call EFUNC(common,isModLoaded)) then {
private _condition = {
(ACE_player != GVAR(INTERACTION_TARGET)) && {[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,canDrag)}
};
@ -49,16 +37,14 @@ if (["ace_dragging"] call EFUNC(common,isModLoaded)) then {
GVAR(pendingReopen) = false; //No medical_treatmentSuccess event after drag, so don't want this true
[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,startDrag);
};
GVAR(actionsBasic) pushBack [localize ELSTRING(dragging,Drag), "drag", _condition, _statement];
GVAR(actionsAdvanced) pushBack [localize ELSTRING(dragging,Drag), "drag", _condition, _statement];
GVAR(actions) pushBack [localize ELSTRING(dragging,Drag), "drag", _condition, _statement];
private _condition = {
_condition = {
(ACE_player != GVAR(INTERACTION_TARGET)) && {[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,canCarry)}
};
private _statement = {
_statement = {
GVAR(pendingReopen) = false; //No medical_treatmentSuccess event after drag, so don't want this true
[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,startCarry);
};
GVAR(actionsBasic) pushBack [localize ELSTRING(dragging,Carry), "drag", _condition, _statement];
GVAR(actionsAdvanced) pushBack [localize ELSTRING(dragging,Carry), "drag", _condition, _statement];
GVAR(actions) pushBack [localize ELSTRING(dragging,Carry), "drag", _condition, _statement];
};

View File

@ -15,7 +15,7 @@
*/
#include "script_component.hpp"
private _actionsConfig = configFile >> QEGVAR(medical_treatment,actions) >> CUR_LEVEL;
private _actionsConfig = configFile >> QEGVAR(medical_treatment,actions);
private _actionPaths = ["ACE_Head", "ACE_Torso", "ACE_ArmLeft", "ACE_ArmRight", "ACE_LegLeft", "ACE_LegRight"];
private _actionPathTexts = [
localize ELSTRING(interaction,Head), localize ELSTRING(interaction,Torso),

View File

@ -21,12 +21,6 @@ params ["_player", "_target", "_name"];
if (!([ACE_player, _target, ["isNotInside"]] call EFUNC(common,canInteractWith))) exitWith {[]};
private _actions = if (EGVAR(medical,level) == 2) then {
GVAR(actionsAdvanced);
} else {
GVAR(actionsBasic);
};
private _collectedActions = [];
private _bodyPart = EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart);
{
@ -35,6 +29,6 @@ private _bodyPart = EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart);
_collectedActions pushBack _x;
};
nil
} count _actions;
} count GVAR(actions);
_collectedActions;

View File

@ -1,246 +1,257 @@
class GVAR(Actions) {
class Basic {
class BasicBandage {
displayName = ECSTRING(medical,Bandage);
displayNameProgress = ECSTRING(medical,Bandaging);
category = "bandage";
treatmentLocations[] = {"All"};
allowedSelections[] = {"All"};
allowSelfTreatment = 1;
requiredMedic = 0;
treatmentTime = 5;
treatmentTimeSelfCoef = 1;
items[] = {{"ACE_fieldDressing", "ACE_packingBandage", "ACE_elasticBandage", "ACE_quikclot"}};
condition = QEGVAR(medical,basicBandages);
patientStateCondition = 0;
itemConsumed = 1;
callbackSuccess = QFUNC(treatmentBandage);
callbackFailure = "";
callbackProgress = "";
// --- bandages
class BasicBandage {
displayName = ECSTRING(medical,Bandage);
displayNameProgress = ECSTRING(medical,Bandaging);
category = "bandage";
treatmentLocations[] = {"All"};
allowedSelections[] = {"All"};
allowSelfTreatment = 1;
requiredMedic = 0;
treatmentTime = 5;
treatmentTimeSelfCoef = 1;
items[] = {{"ACE_fieldDressing", "ACE_packingBandage", "ACE_elasticBandage", "ACE_quikclot"}};
condition = QEGVAR(medical,basicBandages);
patientStateCondition = 0;
itemConsumed = 1;
callbackSuccess = QFUNC(treatmentBandage);
callbackFailure = "";
callbackProgress = "";
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationPatientUnconsciousExcludeOn[] = {"ainjppnemstpsnonwrfldnon"};
animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medicOther";
animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther";
animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic";
animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
litter[] = {
{"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}},
{"All", "_bloodLossOnSelection <= 0", {"ACE_MedicalLitter_clean"}}
};
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationPatientUnconsciousExcludeOn[] = {"ainjppnemstpsnonwrfldnon"};
animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medicOther";
animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther";
animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic";
animationCallerSelfProne = "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"}}
};
class FieldDressing: BasicBandage {
displayName = ECSTRING(medical,Actions_FieldDressing);
items[] = {"ACE_fieldDressing"};
condition = QUOTE(!EGVAR(medical,basicBandages));
litter[] = {
{"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}},
{"All", "_bloodLossOnSelection <= 0", {"ACE_MedicalLitter_clean"}}
};
};
class FieldDressing: BasicBandage {
displayName = ECSTRING(medical,Actions_FieldDressing);
items[] = {"ACE_fieldDressing"};
condition = QUOTE(!EGVAR(medical,basicBandages));
litter[] = {
{"All", "_bloodLossOnBodyPart > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}},
{"All", "_bloodLossOnBodyPart <= 0", {"ACE_MedicalLitter_clean"}}
};
class PackingBandage: BasicBandage {
displayName = ECSTRING(medical,Actions_PackingBandage);
items[] = {"ACE_packingBandage"};
condition = QUOTE(!EGVAR(medical,basicBandages));
litter[] = {
{"All", "", {"ACE_MedicalLitter_packingBandage"}},
{"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}},
{"All", "_bloodLossOnSelection <= 0", {"ACE_MedicalLitter_clean"}}
};
};
class PackingBandage: BasicBandage {
displayName = ECSTRING(medical,Actions_PackingBandage);
items[] = {"ACE_packingBandage"};
condition = QUOTE(!EGVAR(medical,basicBandages));
litter[] = {
{"All", "", {"ACE_MedicalLitter_packingBandage"}},
{"All", "_bloodLossOnBodyPart > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}},
{"All", "_bloodLossOnBodyPart <= 0", {"ACE_MedicalLitter_clean"}}
};
class ElasticBandage: BasicBandage {
displayName = ECSTRING(medical,Actions_ElasticBandage);
items[] = {"ACE_elasticBandage"};
condition = QUOTE(!EGVAR(medical,basicBandages));
litter[] = {
{"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}},
{"All", "_bloodLossOnSelection <= 0", {"ACE_MedicalLitter_clean"}}
};
};
class ElasticBandage: BasicBandage {
displayName = ECSTRING(medical,Actions_ElasticBandage);
items[] = {"ACE_elasticBandage"};
condition = QUOTE(!EGVAR(medical,basicBandages));
litter[] = {
{"All", "_bloodLossOnBodyPart > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}},
{"All", "_bloodLossOnBodyPart <= 0", {"ACE_MedicalLitter_clean"}}
};
class QuikClot: BasicBandage {
displayName = ECSTRING(medical,Actions_QuikClot);
items[] = {"ACE_quikclot"};
condition = QUOTE(!EGVAR(medical,basicBandages));
litter[] = {
{"All", "", {"ACE_MedicalLitter_QuickClot"}},
{"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}},
{"All", "_bloodLossOnSelection <= 0", {"ACE_MedicalLitter_clean"}}
};
};
class Morphine: BasicBandage {
displayName = ECSTRING(medical,Inject_Morphine);
displayNameProgress = ECSTRING(medical,Injecting_Morphine);
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
allowSelfTreatment = 1;
category = "medication";
treatmentTime = 8;
items[] = {"ACE_morphine"};
condition = "";
callbackSuccess = QFUNC(treatmentMorphine);
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = { {"All", "", {"ACE_MedicalLitter_morphine"}} };
sounds[] = {{QPATHTO_R(sounds\Inject.ogg),1,1,50}};
};
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)};
};
class BloodIV: BasicBandage {
displayName = ECSTRING(medical,Actions_Blood4_1000);
displayNameProgress = ECSTRING(medical,Transfusing_Blood);
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
allowSelfTreatment = 0;
category = "advanced";
requiredMedic = 1;
treatmentTime = 12;
items[] = {"ACE_bloodIV"};
condition = "";
callbackSuccess = QFUNC(treatmentIV);
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = {};
};
class BloodIV_500: BloodIV {
displayName = ECSTRING(medical,Actions_Blood4_500);
items[] = {"ACE_bloodIV_500"};
};
class BloodIV_250: BloodIV {
displayName = ECSTRING(medical,Actions_Blood4_250);
items[] = {"ACE_bloodIV_250"};
};
class BodyBag: BasicBandage {
displayName = ECSTRING(medical,PlaceInBodyBag);
displayNameProgress = ECSTRING(medical,PlacingInBodyBag);
category = "advanced";
treatmentLocations[] = {"All"};
requiredMedic = 0;
treatmentTime = 15;
items[] = {"ACE_BodyBag"};
condition = "!alive _target";
callbackSuccess = QFUNC(actionPlaceInBodyBag);
callbackFailure = "";
callbackProgress = "";
animationPatient = "";
animationPatientUnconscious = "";
itemConsumed = 1;
litter[] = {};
};
class Diagnose: BasicBandage {
displayName = ECSTRING(medical,Actions_Diagnose);
displayNameProgress = ECSTRING(medical,Actions_Diagnosing);
category = "examine";
treatmentLocations[] = {"All"};
allowedSelections[] = {"Head", "Body"};
requiredMedic = 0;
treatmentTime = 1;
items[] = {};
condition = "";
callbackSuccess = QFUNC(actionDiagnose);
callbackFailure = "";
callbackProgress = "";
animationPatient = "";
animationCaller = ""; // TODO
itemConsumed = 0;
litter[] = {};
};
class CPR: BasicBandage {
displayName = ECSTRING(medical,Actions_CPR);
displayNameProgress = ECSTRING(medical,Actions_PerformingCPR);
category = "advanced";
treatmentLocations[] = {"All"};
allowedSelections[] = {"Body"};
allowSelfTreatment = 0;
requiredMedic = 0;
treatmentTime = 15;
items[] = {};
condition = QUOTE(!(_target call EFUNC(common,isAwake)) && EGVAR(medical,enableRevive) > 0);
callbackSuccess = QFUNC(treatmentCPR);
callbackFailure = "";
callbackProgress = QUOTE((_this select 0 select 1) call EFUNC(common,isAwake));
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medic";
animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
animationCallerSelf = "";
animationCallerSelfProne = "";
itemConsumed = 0;
litter[] = {};
};
class QuikClot: BasicBandage {
displayName = ECSTRING(medical,Actions_QuikClot);
items[] = {"ACE_quikclot"};
condition = QUOTE(!EGVAR(medical,basicBandages));
litter[] = {
{"All", "", {"ACE_MedicalLitter_QuickClot"}},
{"All", "_bloodLossOnBodyPart > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}},
{"All", "_bloodLossOnBodyPart <= 0", {"ACE_MedicalLitter_clean"}}
};
};
// --- tourniquet
class Tourniquet: BasicBandage {
displayName = ECSTRING(medical,Apply_Tourniquet);
displayNameProgress = ECSTRING(medical,Applying_Tourniquet);
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
items[] = {"ACE_tourniquet"};
treatmentTime = 4;
callbackSuccess = QFUNC(treatmentTourniquet);
condition = QUOTE(!([ARR_2(_target,_selectionName)] call EFUNC(medical,hasTourniquetAppliedTo)));
litter[] = {};
};
class RemoveTourniquet: Tourniquet {
displayName = ECSTRING(medical,Actions_RemoveTourniquet);
displayNameProgress = ECSTRING(medical,RemovingTourniquet);
items[] = {};
treatmentTime = 2.5;
callbackSuccess = QFUNC(actionRemoveTourniquet);
condition = QUOTE([ARR_2(_target,_selectionName)] call EFUNC(medical,hasTourniquetAppliedTo));
};
// --- syringes
class Morphine: BasicBandage {
displayName = ECSTRING(medical,Inject_Morphine);
displayNameProgress = ECSTRING(medical,Injecting_Morphine);
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
allowSelfTreatment = 1;
category = "medication";
treatmentTime = 8;
items[] = {"ACE_morphine"};
condition = "";
callbackSuccess = QFUNC(treatmentMorphine);
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = { {"All", "", {"ACE_MedicalLitter_morphine"}} };
sounds[] = {{QPATHTO_R(sounds\Inject.ogg),1,1,50}};
};
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)};
};
// --- iv bags
class BloodIV: BasicBandage {
displayName = ECSTRING(medical,Actions_Blood4_1000);
displayNameProgress = ECSTRING(medical,Transfusing_Blood);
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
allowSelfTreatment = 0;
category = "advanced";
requiredMedic = 1;
treatmentTime = 12;
items[] = {"ACE_bloodIV"};
condition = "";
callbackSuccess = QFUNC(treatmentIV);
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = {};
};
class BloodIV_500: BloodIV {
displayName = ECSTRING(medical,Actions_Blood4_500);
items[] = {"ACE_bloodIV_500"};
};
class BloodIV_250: BloodIV {
displayName = ECSTRING(medical,Actions_Blood4_250);
items[] = {"ACE_bloodIV_250"};
};
class PlasmaIV: BloodIV {
displayName = ECSTRING(medical,Actions_Plasma4_1000);
displayNameProgress = ECSTRING(medical,Transfusing_Plasma);
items[] = {"ACE_plasmaIV"};
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
};
class PlasmaIV_500: PlasmaIV {
displayName = ECSTRING(medical,Actions_Plasma4_500);
items[] = {"ACE_plasmaIV_500"};
};
class PlasmaIV_250: PlasmaIV {
displayName = ECSTRING(medical,Actions_Plasma4_250);
items[] = {"ACE_plasmaIV_250"};
};
class SalineIV: BloodIV {
displayName = ECSTRING(medical,Actions_Saline4_1000);
displayNameProgress = ECSTRING(medical,Transfusing_Saline);
items[] = {"ACE_salineIV"};
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
};
class SalineIV_500: SalineIV {
displayName = ECSTRING(medical,Actions_Saline4_500);
items[] = {"ACE_salineIV_500"};
};
class SalineIV_250: SalineIV {
displayName = ECSTRING(medical,Actions_Saline4_250);
items[] = {"ACE_salineIV_250"};
};
// --- diagnose
class Diagnose: BasicBandage {
displayName = ECSTRING(medical,Actions_Diagnose);
displayNameProgress = ECSTRING(medical,Actions_Diagnosing);
category = "examine";
treatmentLocations[] = {"All"};
allowedSelections[] = {"Head", "Body"};
requiredMedic = 0;
treatmentTime = 1;
items[] = {};
condition = "";
callbackSuccess = QFUNC(actionDiagnose);
callbackFailure = "";
callbackProgress = "";
animationPatient = "";
animationCaller = ""; // TODO
itemConsumed = 0;
litter[] = {};
};
class CheckPulse: Diagnose {
displayName = ECSTRING(medical,Actions_CheckPulse);
displayNameProgress = ECSTRING(medical,Check_Pulse_Content);
allowedSelections[] = {"All"};
treatmentTime = 2;
callbackSuccess = QFUNC(actionCheckPulse);
animationCallerProne = "";
animationCallerSelfProne = "";
};
class CheckBloodPressure: CheckPulse {
displayName = ECSTRING(medical,Actions_CheckBloodPressure);
displayNameProgress = ECSTRING(medical,Check_Bloodpressure_Content);
callbackSuccess = QFUNC(actionCheckBloodPressure);
};
class CheckResponse: CheckPulse {
displayName = ECSTRING(medical,Check_Response);
displayNameProgress = ECSTRING(medical,Check_Response_Content);
allowSelfTreatment = 0;
callbackSuccess = QFUNC(actionCheckResponse);
};
// --- misc
class BodyBag: BasicBandage {
displayName = ECSTRING(medical,PlaceInBodyBag);
displayNameProgress = ECSTRING(medical,PlacingInBodyBag);
category = "advanced";
treatmentLocations[] = {"All"};
allowSelfTreatment = 0;
requiredMedic = 0;
treatmentTime = 15;
items[] = {"ACE_BodyBag"};
condition = "!alive _target";
callbackSuccess = QFUNC(actionPlaceInBodyBag);
callbackFailure = "";
callbackProgress = "";
animationPatient = "";
animationPatientUnconscious = "";
itemConsumed = 1;
litter[] = {};
};
class CPR: BasicBandage {
displayName = ECSTRING(medical,Actions_CPR);
displayNameProgress = ECSTRING(medical,Actions_PerformingCPR);
category = "advanced";
treatmentLocations[] = {"All"};
allowedSelections[] = {"Body"};
allowSelfTreatment = 0;
requiredMedic = 0;
treatmentTime = 15;
items[] = {};
condition = QUOTE(!(_target call EFUNC(common,isAwake)) && EGVAR(medical,enableRevive) > 0);
callbackSuccess = QFUNC(treatmentCPR);
callbackFailure = "";
callbackProgress = QUOTE((_this select 0 select 1) call EFUNC(common,isAwake));
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medic";
animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
animationCallerSelf = "";
animationCallerSelfProne = "";
itemConsumed = 0;
litter[] = {};
};
/*
class Advanced {
class FieldDressing {
displayName = ECSTRING(medical,Actions_FieldDressing);
displayNameProgress = ECSTRING(medical,Bandaging);
category = "bandage";
// Which locations can this treatment action be used? Available: Field, MedicalFacility, MedicalVehicle, All.
treatmentLocations[] = {"All"};
allowedSelections[] = {"All"};
allowSelfTreatment = 1;
// What is the level of medical skill required for this treatment action? 0 = all soldiers, 1 = medic, 2 = doctor
requiredMedic = 0;
// The time it takes for a treatment action to complete. Time is in seconds.
treatmentTime = 8;
// Item required for the action. Leave empty for no item required.
items[] = {"ACE_fieldDressing"};
condition = "";
patientStateCondition = 0;
// Callbacks
callbackSuccess = QFUNC(treatmentBandage);
callbackFailure = "";
callbackProgress = "";
itemConsumed = 1;
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationPatientUnconsciousExcludeOn[] = {"ainjppnemstpsnonwrfldnon"};
animationCaller = "AinvPknlMstpSlayWrflDnon_medicOther";
animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther";
animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic";
animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
litter[] = {
{"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}},
{"All", "_bloodLossOnSelection <= 0", {"ACE_MedicalLitter_clean"}}
};
};
class PackingBandage: fieldDressing {
displayName = ECSTRING(medical,Actions_PackingBandage);
items[] = {"ACE_packingBandage"};
litter[] = {
{"All", "", {"ACE_MedicalLitter_packingBandage"}},
{"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}},
{"All", "_bloodLossOnSelection <= 0", {"ACE_MedicalLitter_clean"}}
};
};
class ElasticBandage: fieldDressing {
displayName = ECSTRING(medical,Actions_ElasticBandage);
items[] = {"ACE_elasticBandage"};
};
class QuikClot: fieldDressing {
displayName = ECSTRING(medical,Actions_QuikClot);
items[] = {"ACE_quikclot"};
litter[] = {
{"All", "", {"ACE_MedicalLitter_QuickClot"}},
{"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}},
{"All", "_bloodLossOnSelection <= 0", {"ACE_MedicalLitter_clean"}}
};
};
class Tourniquet: fieldDressing {
displayName = ECSTRING(medical,Apply_Tourniquet);
displayNameProgress = ECSTRING(medical,Applying_Tourniquet);
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
items[] = {"ACE_tourniquet"};
treatmentTime = 4;
callbackSuccess = QFUNC(treatmentTourniquet);
condition = QUOTE(!([ARR_2(_target,_selectionName)] call EFUNC(medical,hasTourniquetAppliedTo)));
litter[] = {};
};
class Morphine: fieldDressing {
displayName = ECSTRING(medical,Inject_Morphine);
displayNameProgress = ECSTRING(medical,Injecting_Morphine);
@ -271,55 +282,7 @@ class GVAR(Actions) {
items[] = {"ACE_epinephrine"};
litter[] = { {"All", "", {"ACE_MedicalLitter_epinephrine"}} };
};
class BloodIV: fieldDressing {
displayName = ECSTRING(medical,Actions_Blood4_1000);
displayNameProgress = ECSTRING(medical,Transfusing_Blood);
allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"};
allowSelfTreatment = 0;
category = "advanced";
items[] = {"ACE_bloodIV"};
requiredMedic = 1;
treatmentTime = 12;
callbackSuccess = QFUNC(treatmentIV);
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
litter[] = {};
};
class BloodIV_500: BloodIV {
displayName = ECSTRING(medical,Actions_Blood4_500);
items[] = {"ACE_bloodIV_500"};
};
class BloodIV_250: BloodIV {
displayName = ECSTRING(medical,Actions_Blood4_250);
items[] = {"ACE_bloodIV_250"};
};
class PlasmaIV: BloodIV {
displayName = ECSTRING(medical,Actions_Plasma4_1000);
displayNameProgress = ECSTRING(medical,Transfusing_Plasma);
items[] = {"ACE_plasmaIV"};
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
};
class PlasmaIV_500: PlasmaIV {
displayName = ECSTRING(medical,Actions_Plasma4_500);
items[] = {"ACE_plasmaIV_500"};
};
class PlasmaIV_250: PlasmaIV {
displayName = ECSTRING(medical,Actions_Plasma4_250);
items[] = {"ACE_plasmaIV_250"};
};
class SalineIV: BloodIV {
displayName = ECSTRING(medical,Actions_Saline4_1000);
displayNameProgress = ECSTRING(medical,Transfusing_Saline);
items[] = {"ACE_salineIV"};
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
};
class SalineIV_500: SalineIV {
displayName = ECSTRING(medical,Actions_Saline4_500);
items[] = {"ACE_salineIV_500"};
};
class SalineIV_250: SalineIV {
displayName = ECSTRING(medical,Actions_Saline4_250);
items[] = {"ACE_salineIV_250"};
};
class SurgicalKit: fieldDressing {
displayName = ECSTRING(medical,Use_SurgicalKit);
displayNameProgress = ECSTRING(medical,Stitching);
@ -355,89 +318,11 @@ class GVAR(Actions) {
animationCallerSelf = "";
animationCallerSelfProne = "";
litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"}},
{"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}},
{"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}},
{"All", "_bloodLossOnSelection <= 0", {"ACE_MedicalLitter_clean"}}
{"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"}}
};
};
class CheckPulse: fieldDressing {
displayName = ECSTRING(medical,Actions_CheckPulse);
displayNameProgress = ECSTRING(medical,Check_Pulse_Content);
category = "examine";
treatmentLocations[] = {"All"};
requiredMedic = 0;
treatmentTime = 2;
items[] = {};
callbackSuccess = QFUNC(actionCheckPulse);
callbackFailure = "";
callbackProgress = "";
animationPatient = "";
animationCaller = ""; // TODO
animationCallerProne = "";
animationCallerSelfProne = "";
itemConsumed = 0;
litter[] = {};
};
class CheckBloodPressure: CheckPulse {
displayName = ECSTRING(medical,Actions_CheckBloodPressure);
callbackSuccess = QFUNC(actionCheckBloodPressure);
displayNameProgress = ECSTRING(medical,Check_Bloodpressure_Content);
};
class CheckResponse: CheckPulse {
displayName = ECSTRING(medical,Check_Response);
callbackSuccess = QFUNC(actionCheckResponse);
displayNameProgress = ECSTRING(medical,Check_Response_Content);
allowSelfTreatment = 0;
};
class RemoveTourniquet: Tourniquet {
displayName = ECSTRING(medical,Actions_RemoveTourniquet);
items[] = {};
treatmentTime = 2.5;
callbackSuccess = QFUNC(actionRemoveTourniquet);
condition = QUOTE([ARR_2(_target,_selectionName)] call EFUNC(medical,hasTourniquetAppliedTo));
displayNameProgress = ECSTRING(medical,RemovingTourniquet);
litter[] = {};
};
class CPR: fieldDressing {
displayName = ECSTRING(medical,Actions_CPR);
displayNameProgress = ECSTRING(medical,Actions_PerformingCPR);
category = "advanced";
treatmentLocations[] = {"All"};
allowedSelections[] = {"Body"};
allowSelfTreatment = 0;
requiredMedic = 0;
treatmentTime = 15;
items[] = {};
condition = QUOTE(!(_target call EFUNC(common,isAwake)));
callbackSuccess = QFUNC(treatmentCPR);
callbackFailure = "";
callbackProgress = QUOTE((_this select 0 select 1) call EFUNC(common,isAwake));
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medic";
animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
animationCallerSelf = "";
animationCallerSelfProne = "";
itemConsumed = 0;
litter[] = {};
};
class BodyBag: fieldDressing {
displayName = ECSTRING(medical,PlaceInBodyBag);
displayNameProgress = ECSTRING(medical,PlacingInBodyBag);
category = "advanced";
treatmentLocations[] = {"All"};
allowSelfTreatment = 0;
requiredMedic = 0;
treatmentTime = 15;
items[] = {"ACE_BodyBag"};
condition = "!alive _target";
callbackSuccess = QFUNC(actionPlaceInBodyBag);
callbackFailure = "";
callbackProgress = "";
animationPatient = "";
animationPatientUnconscious = "";
itemConsumed = 1;
litter[] = {};
};
};
*/
};

View File

@ -5,8 +5,8 @@
* Arguments:
* 0: The caller <OBJECT>
* 1: The target <OBJECT>
* 2: Selection name <STRING>
* 3: ACE_Medical_Treatment Classname <STRING>
* 2: Body part <STRING>
* 3: Treatment class name <STRING>
*
* ReturnValue:
* Can Treat <BOOL>
@ -18,11 +18,11 @@
*/
#include "script_component.hpp"
params ["_caller", "_target", "_selectionName", "_className"];
params ["_caller", "_target", "_bodyPart", "_className"];
if !(_target isKindOf "CAManBase") exitWith {false};
private _config = configFile >> QGVAR(Actions) >> CUR_LEVEL >> _className;
private _config = configFile >> QGVAR(Actions) >> _className;
if !(isClass _config) exitwith {false};
@ -46,7 +46,7 @@ if !([_caller, _medicRequired] call EFUNC(medical,isMedic)) exitWith {false};
// check selection
private _allowedSelections = getArray (_config >> "allowedSelections") apply {toLower _x};
if !("all" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitWith {false};
if !("all" in _allowedSelections || {(_bodyPart in _allowedSelections)}) exitWith {false};
// check item
private _items = getArray (_config >> "items");

View File

@ -5,8 +5,8 @@
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: SelectionName <STRING>
* 3: Treatment classname <STRING>
* 2: Body part <STRING>
* 3: Treatment class name <STRING>
*
* Return Value:
* Succesful treatment started <BOOL>
@ -15,18 +15,16 @@
*/
#include "script_component.hpp"
params ["_caller", "_target", "_selectionName", "_className"];
params ["_caller", "_target", "_bodyPart", "_className"];
// if the cursorMenu is open, the loading bar will fail. If we execute the function one frame later, it will work fine
if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened), false]) exitWith {
[DFUNC(treatment), _this] call CBA_fnc_execNextFrame;
};
TRACE_1("banana",_this);
if !([_caller, _target, _selectionName, _className] call FUNC(canTreat)) exitWith {false};
TRACE_1("can treat",_this);
if !([_caller, _target, _bodyPart, _className] call FUNC(canTreat)) exitWith {false};
private _config = configFile >> QGVAR(Actions) >> CUR_LEVEL >> _className;
private _config = configFile >> QGVAR(Actions) >> _className;
// handle items
private _items = getArray (_config >> "items");
@ -180,7 +178,7 @@ if (isArray (_config >> "sounds")) then {
// start treatment
[
_treatmentTime,
[_caller, _target, _selectionName, _className, _items, _usersOfItems],
[_caller, _target, _bodyPart, _className, _items, _usersOfItems],
DFUNC(treatment_success),
DFUNC(treatment_failure),
getText (_config >> "displayNameProgress"),

View File

@ -5,8 +5,8 @@
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: SelectionName <STRING>
* 3: Treatment classname <STRING>
* 2: Body part <STRING>
* 3: Treatment class name <STRING>
* 4: Items available <ARRAY<STRING>>
*
* Return Value:
@ -17,7 +17,7 @@
#include "script_component.hpp"
params ["_args"];
_args params ["_caller", "_target", "_selectionName", "_className", "_items", "_usersOfItems"];
_args params ["_caller", "_target", "_bodyPart", "_className", "_items", "_usersOfItems"];
// switch to end anim immediately
private _endInAnim = _caller getVariable QGVAR(endInAnim);
@ -39,7 +39,7 @@ if (!isNil "_endInAnim") then {
} forEach _usersOfItems;
// Record specific callback
private _config = configFile >> QGVAR(Actions) >> CUR_LEVEL >> _className;
private _config = configFile >> QGVAR(Actions) >> _className;
private _callback = getText (_config >> "callbackFailure");

View File

@ -6,7 +6,7 @@
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: Body part <STRING>
* 3: Treatment classname <STRING>
* 3: Treatment class name <STRING>
* 4: Items available <ARRAY<STRING>>
*
* Return Value:
@ -34,7 +34,7 @@ if (!isNil "_endInAnim") then {
[QEGVAR(common,setAnimSpeedCoef), [_caller, 1]] call CBA_fnc_globalEvent;
// Record specific callback
private _config = configFile >> QGVAR(Actions) >> CUR_LEVEL >> _className;
private _config = configFile >> QGVAR(Actions) >> _className;
private _callback = getText (_config >> "callbackSuccess");
@ -49,25 +49,27 @@ if !(_callback isEqualType {}) then {
};
//Get current blood loose on limb (for "bloody" litter)
private _bloodLossOnSelection = 0;
private _partNumber = (ALL_BODY_PARTS find toLower _bodyPart) max 0;
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 ["", "", "_selectionX", "_amountOf", "_percentageOpen"];
if (_selectionX == _partNumber) then {
_bloodLossOnSelection = _bloodLossOnSelection + (_amountOf * _percentageOpen);
_x params ["", "", "_bodyPartN", "_amountOf", "_percentageOpen"];
if (_bodyPartN isEqualTo _partIndex) then {
_bloodLossOnBodyPart = _bloodLossOnBodyPart + (_amountOf * _percentageOpen);
};
} forEach _openWounds;
TRACE_1("advanced",_bloodLossOnSelection);
TRACE_1("advanced",_bloodLossOnBodyPart);
_args call _callback;
_args pushBack _bloodLossOnSelection;
_args pushBack _bloodLossOnBodyPart;
_args call FUNC(litterCreate);
//If we're not already tracking vitals, start:
if (!(_target getVariable [QGVAR(addedToUnitLoop),false])) then {
if !(_target getVariable [QGVAR(addedToUnitLoop),false]) then {
[_target] call FUNC(addVitalLoop);
};