diff --git a/addons/medical/sounds/Inject.ogg b/addons/medical/sounds/Inject.ogg deleted file mode 100644 index 8418078e0f..0000000000 Binary files a/addons/medical/sounds/Inject.ogg and /dev/null differ diff --git a/addons/medical_engine/CfgMoves.hpp b/addons/medical_engine/CfgMoves.hpp new file mode 100644 index 0000000000..7c9f891c71 --- /dev/null +++ b/addons/medical_engine/CfgMoves.hpp @@ -0,0 +1,11 @@ + +class CfgMovesBasic; +class CfgMovesMaleSdr: CfgMovesBasic { + class States { + // fixes hand being stuck at rifle which is on the back + class AmovPknlMstpSrasWrflDnon_AinvPknlMstpSlayWrflDnon; + class AinvPknlMstpSlayWnonDnon_medicOther: AmovPknlMstpSrasWrflDnon_AinvPknlMstpSlayWrflDnon { + weaponIK = 0; + }; + }; +}; diff --git a/addons/medical_engine/config.cpp b/addons/medical_engine/config.cpp index ce65d837e9..ff8c4aa996 100644 --- a/addons/medical_engine/config.cpp +++ b/addons/medical_engine/config.cpp @@ -17,6 +17,7 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgActions.hpp" +#include "CfgMoves.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" #include "CfgInGameUI.hpp" diff --git a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp index a8e73da609..a42eb42a10 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp @@ -1,5 +1,5 @@ -class ACE_Medical_Treatment_Actions { +class GVAR(Actions) { class Basic { class Bandage { displayName = ECSTRING(medical,Bandage); @@ -22,7 +22,7 @@ class ACE_Medical_Treatment_Actions { animationPatient = ""; animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback"; animationPatientUnconsciousExcludeOn[] = {"ainjppnemstpsnonwrfldnon"}; - animationCaller = "AinvPknlMstpSlayWrflDnon_medicOther"; + animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medicOther"; animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther"; animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic"; animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; @@ -37,11 +37,12 @@ class ACE_Medical_Treatment_Actions { allowedSelections[] = {"hand_l", "hand_r", "leg_l", "leg_r"}; allowSelfTreatment = 1; category = "medication"; - treatmentTime = 2; + treatmentTime = 8; items[] = {"ACE_morphine"}; callbackSuccess = QUOTE(DFUNC(treatmentBasic_morphine)); animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; litter[] = { {"All", "", {"ACE_MedicalLitter_morphine"}} }; + sounds[] = {{QPATHTO_R(sounds\Inject.ogg),1,1,50}}; }; class Epinephrine: Bandage { displayName = ECSTRING(medical,Inject_Epinephrine); @@ -50,12 +51,13 @@ class ACE_Medical_Treatment_Actions { allowSelfTreatment = 1; category = "medication"; requiredMedic = QEGVAR(medical,medicSetting_basicEpi); - treatmentTime = 3; + treatmentTime = 8; items[] = {"ACE_epinephrine"}; callbackSuccess = QUOTE(DFUNC(treatmentBasic_epipen)); animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; litter[] = { {"All", "", {"ACE_MedicalLitter_epinephrine"}} }; treatmentLocations[] = {QGVAR(useLocation_basicEpi)}; + sounds[] = {{QPATHTO_R(sounds\Inject.ogg),1,1,50}}; }; class BloodIV: Bandage { displayName = ECSTRING(medical,Transfuse_Blood); @@ -64,7 +66,7 @@ class ACE_Medical_Treatment_Actions { allowSelfTreatment = 0; category = "advanced"; requiredMedic = 1; - treatmentTime = 20; + treatmentTime = 12; items[] = {"ACE_bloodIV"}; // callbackSuccess = QUOTE(DFUNC(treatmentBasic_bloodbag)); callbackSuccess = QUOTE(DFUNC(treatmentIV)); @@ -85,9 +87,9 @@ class ACE_Medical_Treatment_Actions { category = "advanced"; treatmentLocations[] = {"All"}; requiredMedic = 0; - treatmentTime = 4; + treatmentTime = 15; items[] = {"ACE_bodyBag"}; - condition = "!alive (_this select 1);"; + condition = "!alive _target"; callbackSuccess = QUOTE(DFUNC(actionPlaceInBodyBag)); callbackFailure = ""; callbackProgress = ""; @@ -123,13 +125,13 @@ class ACE_Medical_Treatment_Actions { requiredMedic = 0; treatmentTime = 15; items[] = {}; - condition = QUOTE(!([(_this select 1)] call ace_common_fnc_isAwake) && EGVAR(medical,enableRevive)>0); + condition = QUOTE(!(_target call EFUNC(common,isAwake)) && EGVAR(medical,enableRevive) > 0); callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_CPR)); callbackFailure = ""; - callbackProgress = "!([((_this select 0) select 1)] call ace_common_fnc_isAwake)"; + callbackProgress = QUOTE((_this select 0 select 1) call EFUNC(common,isAwake)); animationPatient = ""; animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback"; - animationCaller = "AinvPknlMstpSlayWnonDnon_medic"; + animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medic"; animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; animationCallerSelf = ""; animationCallerSelfProne = ""; @@ -201,7 +203,7 @@ class ACE_Medical_Treatment_Actions { items[] = {"ACE_tourniquet"}; treatmentTime = 4; callbackSuccess = QUOTE(DFUNC(treatmentTourniquet)); - condition = QUOTE(!([ARR_2(_this select 1, _this select 2)] call EFUNC(medical,hasTourniquetAppliedTo))); + condition = QUOTE(!([ARR_2(_target,_selectionName)] call EFUNC(medical,hasTourniquetAppliedTo))); litter[] = {}; }; class Morphine: fieldDressing { @@ -214,6 +216,7 @@ class ACE_Medical_Treatment_Actions { callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_medication)); 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); @@ -241,7 +244,7 @@ class ACE_Medical_Treatment_Actions { category = "advanced"; items[] = {"ACE_bloodIV"}; requiredMedic = 1; - treatmentTime = 7; + treatmentTime = 12; callbackSuccess = QUOTE(DFUNC(treatmentIV)); animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; litter[] = {}; @@ -291,7 +294,7 @@ class ACE_Medical_Treatment_Actions { allowSelfTreatment = 0; requiredMedic = QEGVAR(medical,medicSetting_SurgicalKit); patientStateCondition = QEGVAR(medical,useCondition_SurgicalKit); - treatmentTime = "(count ((_this select 1) getVariable ['ACE_Medical_bandagedWounds', []]) * 5)"; + treatmentTime = QUOTE(count (_target getVariable [ARR_2('EGVAR(medical,bandagedWounds)',[])]) * 5); callbackSuccess = ""; callbackProgress = QUOTE(DFUNC(treatmentAdvanced_surgicalKit_onProgress)); itemConsumed = QEGVAR(medical,consumeItem_SurgicalKit); @@ -307,12 +310,12 @@ class ACE_Medical_Treatment_Actions { allowSelfTreatment = 0; requiredMedic = QEGVAR(medical,medicSetting_PAK); patientStateCondition = QEGVAR(medical,useCondition_PAK); - treatmentTime = QUOTE((_this select 1) call FUNC(treatmentAdvanced_fullHealTreatmentTime)); + treatmentTime = QUOTE(_target call FUNC(treatmentAdvanced_fullHealTreatmentTime)); callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_fullHeal)); itemConsumed = QEGVAR(medical,consumeItem_PAK); animationPatient = ""; animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback"; - animationCaller = "AinvPknlMstpSlayWnonDnon_medicOther"; + animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medicOther"; animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther"; animationCallerSelf = ""; animationCallerSelfProne = ""; @@ -356,7 +359,7 @@ class ACE_Medical_Treatment_Actions { items[] = {}; treatmentTime = 2.5; callbackSuccess = QUOTE(DFUNC(actionRemoveTourniquet)); - condition = QUOTE([ARR_2(_this select 1, _this select 2)] call EFUNC(medical,hasTourniquetAppliedTo)); + condition = QUOTE([ARR_2(_target,_selectionName)] call EFUNC(medical,hasTourniquetAppliedTo)); displayNameProgress = ECSTRING(medical,RemovingTourniquet); litter[] = {}; }; @@ -370,13 +373,13 @@ class ACE_Medical_Treatment_Actions { requiredMedic = 0; treatmentTime = 15; items[] = {}; - condition = "!([(_this select 1)] call ace_common_fnc_isAwake)"; + condition = QUOTE(!(_target call EFUNC(common,isAwake))); callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_CPR)); callbackFailure = ""; - callbackProgress = "!([((_this select 0) select 1)] call ace_common_fnc_isAwake)"; + callbackProgress = QUOTE((_this select 0 select 1) call EFUNC(common,isAwake)); animationPatient = ""; animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback"; - animationCaller = "AinvPknlMstpSlayWnonDnon_medic"; + animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medic"; animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; animationCallerSelf = ""; animationCallerSelfProne = ""; @@ -392,7 +395,7 @@ class ACE_Medical_Treatment_Actions { requiredMedic = 0; treatmentTime = 15; items[] = {"ACE_bodyBag"}; - condition = "!alive (_this select 1);"; + condition = "!alive _target"; callbackSuccess = QUOTE(DFUNC(actionPlaceInBodyBag)); callbackFailure = ""; callbackProgress = ""; diff --git a/addons/medical_treatment/XEH_preInit.sqf b/addons/medical_treatment/XEH_preInit.sqf index a7feade1c3..44bccbee3e 100644 --- a/addons/medical_treatment/XEH_preInit.sqf +++ b/addons/medical_treatment/XEH_preInit.sqf @@ -4,4 +4,30 @@ ADDON = false; #include "XEH_PREP.hpp" +// config to determine animation acceleration coefficient +// adjusting these is trail and error +// if the animation is cut of ingame, increase these values +// if the unit idles too much, decrease them +GVAR(animDurations) = [] call CBA_fnc_createNamespace; + +{ + GVAR(animDurations) setVariable _x; +} forEach [ + ["AinvPknlMstpSlayWnonDnon_medic", 7.5], + ["AinvPpneMstpSlayWnonDnon_medic", 7], + ["AinvPknlMstpSlayWrflDnon_medic", 7], + ["AinvPpneMstpSlayWrflDnon_medic", 9.5], + ["AinvPknlMstpSlayWlnrDnon_medic", 9], + ["AinvPknlMstpSlayWpstDnon_medic", 9.5], + ["AinvPpneMstpSlayWpstDnon_medic", 10], + ["AinvPknlMstpSlayWnonDnon_medicOther", 8.5], + ["AinvPpneMstpSlayWnonDnon_medicOther", 8.5], + ["AinvPknlMstpSlayWrflDnon_medicOther", 7], + ["AinvPpneMstpSlayWrflDnon_medicOther", 9], + ["AinvPknlMstpSlayWlnrDnon_medicOther", 9], + ["AinvPknlMstpSlayWpstDnon_medicOther", 10], + ["AinvPpneMstpSlayWpstDnon_medicOther", 8.5], + ["AinvPknlMstpSnonWnonDnon_medic1", 10] +]; + ADDON = true; diff --git a/addons/medical_treatment/functions/fnc_canTreat.sqf b/addons/medical_treatment/functions/fnc_canTreat.sqf index 4625a554c0..c4421bf385 100644 --- a/addons/medical_treatment/functions/fnc_canTreat.sqf +++ b/addons/medical_treatment/functions/fnc_canTreat.sqf @@ -16,85 +16,102 @@ * * Public: Yes */ - #include "script_component.hpp" params ["_caller", "_target", "_selectionName", "_className"]; -if !(_target isKindOf "CAManBase") exitWith { false }; +if !(_target isKindOf "CAManBase") exitWith {false}; -private _config = (configFile >> "ACE_Medical_Treatment_Actions" >> (["Basic", "Advanced"] select (EGVAR(medical,level)>=2)) >> _className); +private _config = configFile >> QGVAR(Actions) >> CUR_LEVEL >> _className; if !(isClass _config) exitwith {false}; -// Allow self treatment check -if (_caller == _target && {getNumber (_config >> "allowSelfTreatment") == 0}) exitwith {false}; +// allow self treatment check +private _isSelf = _caller isEqualTo _target; -private _medicRequired = if (isNumber (_config >> "requiredMedic")) then { - getNumber (_config >> "requiredMedic"); +if (_isSelf && {getNumber (_config >> "allowSelfTreatment") == 0}) exitwith {false}; + +private _medicRequired = 0; + +if (isNumber (_config >> "requiredMedic")) then { + _medicRequired = getNumber (_config >> "requiredMedic"); } else { - // Check for required class - if (isText (_config >> "requiredMedic")) exitwith { - missionNamespace getVariable [getText (_config >> "requiredMedic"), 0]; + if (isText (_config >> "requiredMedic")) then { + _medicRequired = missionNamespace getVariable [getText (_config >> "requiredMedic"), 0]; }; - 0; }; -if !([_caller, _medicRequired] call EFUNC(medical,isMedic)) exitwith { false }; - -private _items = getArray (_config >> "items"); -if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith { false }; +if !([_caller, _medicRequired] call EFUNC(medical,isMedic)) exitWith {false}; +// check selection private _allowedSelections = getArray (_config >> "allowedSelections"); -if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith { false }; -private _return = true; -if (getText (_config >> "condition") != "") then { - private _condition = getText (_config >> "condition"); - if (isnil _condition) then { +if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitWith {false}; + +// check item +private _items = getArray (_config >> "items"); + +if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitWith {false}; + +private _condition = true; + +if (isText (_config >> "condition")) then { + _condition = getText (_config >> "condition"); + + if (_condition isEqualTo "") exitWith { + _condition = true; + }; + + if (isNil _condition) then { _condition = compile _condition; } else { _condition = missionNamespace getVariable _condition; }; - if (_condition isEqualType false) then { - _return = _condition; - } else { - _return = [_caller, _target, _selectionName, _className] call _condition; + + if !(_condition isEqualType false) then { + _condition = call _condition; }; }; -if (!_return) exitwith { - false; -}; -private _patientStateCondition = if (isText(_config >> "patientStateCondition")) then { - missionNamespace getVariable [getText(_config >> "patientStateCondition"), 0] +if !(_condition) exitWith {false}; + +private _patientStateCondition = 0; + +if (isNumber (_config >> "patientStateCondition")) then { + _patientStateCondition = getNumber (_config >> "patientStateCondition"); } else { - getNumber(_config >> "patientStateCondition") + if (isText (_config >> "patientStateCondition")) then { + _patientStateCondition = missionNamespace getVariable [getText (_config >> "patientStateCondition"), 0]; + }; }; -if (_patientStateCondition == 1 && {!([_target] call EFUNC(medical,isInStableCondition))}) exitwith {false}; +if (_patientStateCondition == 1 && {!([_target] call EFUNC(medical,isInStableCondition))}) exitWith {false}; + +// check allowed locations private _locations = getArray (_config >> "treatmentLocations"); -if ("All" in _locations) exitwith { true }; -private _medFacility = {([_caller] call EFUNC(medical,isInMedicalFacility)) || ([_target] call EFUNC(medical,isInMedicalFacility))}; -private _medVeh = {([_caller] call EFUNC(medical,isInMedicalVehicle)) || ([_target] call EFUNC(medical,isInMedicalVehicle))}; +if ("All" in _locations) then { + _locations = true; +} else { + private _medFacility = {([_caller] call EFUNC(medical,isInMedicalFacility)) || ([_target] call EFUNC(medical,isInMedicalFacility))}; + private _medVeh = {([_caller] call EFUNC(medical,isInMedicalVehicle)) || ([_target] call EFUNC(medical,isInMedicalVehicle))}; -{ - if (_x == "field") exitwith {_return = true;}; - if (_x == "MedicalFacility" && _medFacility) exitwith {_return = true;}; - if (_x == "MedicalVehicle" && _medVeh) exitwith {_return = true;}; - if !(isnil _x) exitwith { - private _val = missionNamespace getVariable _x; - if (_val isEqualType 0) then { - _return = switch (_val) do { - case 0: {true}; //AdvancedMedicalSettings_anywhere - case 1: {call _medVeh}; //AdvancedMedicalSettings_vehicle - case 2: {call _medFacility}; //AdvancedMedicalSettings_facility - case 3: {(call _medFacility) || {call _medVeh}}; //AdvancedMedicalSettings_vehicleAndFacility - default {false}; //Disabled + { + if (_x == "field") exitWith { _locations = true; }; + if (_x == "MedicalFacility" && _medFacility) exitWith { _locations = true; }; + if (_x == "MedicalVehicle" && _medVeh) exitWith { _locations = true; }; + if !(isNil _x) exitWith { + _locations = missionNamespace getVariable _x; + + if !(_locations isEqualType false) then { + if (_locations isEqualTo 0) exitWith { _locations = true; }; //AdvancedMedicalSettings_anywhere + if (_locations isEqualTo 1) exitWith { _locations = call _medVeh; }; //AdvancedMedicalSettings_vehicle + if (_locations isEqualTo 2) exitWith { _locations = call _medFacility; }; //AdvancedMedicalSettings_facility + if (_locations isEqualTo 3) exitWith { _locations = call _medFacility || {call _medVeh}; }; //AdvancedMedicalSettings_vehicleAndFacility + _locations = false; //Disabled }; }; - }; -} foreach _locations; + } forEach _locations; +}; -_return; +_locations diff --git a/addons/medical_treatment/functions/fnc_hasItem.sqf b/addons/medical_treatment/functions/fnc_hasItem.sqf index f1e96e7637..b57de5dcfa 100644 --- a/addons/medical_treatment/functions/fnc_hasItem.sqf +++ b/addons/medical_treatment/functions/fnc_hasItem.sqf @@ -8,11 +8,10 @@ * 2: Item * * ReturnValue: - * + * Has the items * * Public: Yes */ - #include "script_component.hpp" params ["_medic", "_patient", "_item"]; @@ -20,6 +19,7 @@ params ["_medic", "_patient", "_item"]; if (isNil QEGVAR(medical,setting_allowSharedEquipment)) then { EGVAR(medical,setting_allowSharedEquipment) = true; }; + if (EGVAR(medical,setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitWith { true }; @@ -29,13 +29,13 @@ if ([_medic, _item] call EFUNC(common,hasItem)) exitWith { }; private _return = false; -if ((vehicle _medic != _medic) && {[vehicle _medic] call EFUNC(medical,isMedicalVehicle)}) then { - private _crew = crew vehicle _medic; + +if (vehicle _medic != _medic && {vehicle _medic call EFUNC(medical,isMedicalVehicle)}) then { { - if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitWith { + if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {[_x, _item] call EFUNC(common,hasItem)}) exitWith { _return = true; }; - } forEach _crew; + } forEach crew vehicle _medic; }; _return diff --git a/addons/medical_treatment/functions/fnc_hasItems.sqf b/addons/medical_treatment/functions/fnc_hasItems.sqf index d3e79c0a54..51fbd2a568 100644 --- a/addons/medical_treatment/functions/fnc_hasItems.sqf +++ b/addons/medical_treatment/functions/fnc_hasItems.sqf @@ -12,20 +12,22 @@ * * Public: Yes */ - #include "script_component.hpp" params ["_medic", "_patient", "_items"]; private _return = true; + { - // - if (_x isEqualType [] && {({[_medic, _patient, _x] call FUNC(hasItem)}count _x == 0)}) exitwith { + // handle a one of type use item + if (_x isEqualType [] && {{[_medic, _patient, _x] call FUNC(hasItem)} count _x == 0}) exitWith { _return = false; }; - if (_x isEqualType "" && {!([_medic, _patient, _x] call FUNC(hasItem))}) exitwith { + + // handle required item + if (_x isEqualType "" && {!([_medic, _patient, _x] call FUNC(hasItem))}) exitWith { _return = false; }; -}foreach _items; +} forEach _items; _return diff --git a/addons/medical_treatment/functions/fnc_litterCreate.sqf b/addons/medical_treatment/functions/fnc_litterCreate.sqf index 3104f4b2a4..120f9f85b2 100644 --- a/addons/medical_treatment/functions/fnc_litterCreate.sqf +++ b/addons/medical_treatment/functions/fnc_litterCreate.sqf @@ -32,7 +32,7 @@ if !(EGVAR(medical,allowLitterCreation)) exitWith {}; // Don't create litter if medic or patient are inside a vehicle if (vehicle _caller != _caller || {vehicle _target != _target}) exitWith {}; -private _config = configFile >> "ACE_Medical_Treatment_Actions" >> ["Basic", "Advanced"] select (EGVAR(medical,level) >= 2) >> _className; +private _config = configFile >> "ACE_Medical_Treatment_Actions" >> CUR_LEVEL >> _className; if !(isClass _config) exitWith {TRACE_1("No action config",_className);}; if !(isArray (_config >> "litter")) exitWith {TRACE_1("No litter config",_className);}; diff --git a/addons/medical_treatment/functions/fnc_treatment.sqf b/addons/medical_treatment/functions/fnc_treatment.sqf index aa56413467..53c88bd6af 100644 --- a/addons/medical_treatment/functions/fnc_treatment.sqf +++ b/addons/medical_treatment/functions/fnc_treatment.sqf @@ -13,136 +13,63 @@ * * Public: Yes */ - #include "script_component.hpp" params ["_caller", "_target", "_selectionName", "_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 { +// 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; }; -if !(_target isKindOf "CAManBase") exitWith {false}; +if !([_caller, _target, _selectionName, _className] call FUNC(canTreat)) exitWith {false}; -private _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Basic" >> _className); -if (EGVAR(medical,level) >= 2) then { - _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Advanced" >> _className); -}; +private _config = configFile >> QGVAR(Actions) >> CUR_LEVEL >> _className; -if !(isClass _config) exitwith {false}; - -// Allow self treatment check -if (_caller == _target && {getNumber (_config >> "allowSelfTreatment") == 0}) exitwith {false}; - -private _medicRequired = if (isNumber (_config >> "requiredMedic")) then { - getNumber (_config >> "requiredMedic"); -} else { - // Check for required class - if (isText (_config >> "requiredMedic")) exitwith { - missionNamespace getVariable [(getText (_config >> "requiredMedic")), 0]; - }; - 0; -}; - -if !([_caller, _medicRequired] call EFUNC(medical,isMedic)) exitwith {false}; - -private _allowedSelections = getArray (_config >> "allowedSelections"); -if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith {false}; - -// Check item +// handle items private _items = getArray (_config >> "items"); -if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith {false}; -private _return = true; -if (isText (_config >> "Condition")) then { - private _condition = getText(_config >> "condition"); - if (_condition != "") then { - if (isnil _condition) then { - _condition = compile _condition; - } else { - _condition = missionNamespace getVariable _condition; - }; - if (_condition isEqualType false) then { - _return = _condition; - } else { - _return = [_caller, _target, _selectionName, _className] call _condition; - }; +private _consumeItems = 0; + +if (isNumber (_config >> "itemConsumed")) then { + _consumeItems = getNumber (_config >> "itemConsumed"); +} else { + if (isText (_config >> "itemConsumed")) then { + _consumeItems = missionNamespace getVariable [getText (_config >> "itemConsumed"), 0]; }; }; -if (!_return) exitwith {false}; - -private _patientStateCondition = if (isText(_config >> "patientStateCondition")) then { - missionNamespace getVariable [getText(_config >> "patientStateCondition"), 0] -} else { - getNumber(_config >> "patientStateCondition") -}; -if (_patientStateCondition == 1 && {!([_target] call EFUNC(medical,isInStableCondition))}) exitwith {false}; - -// Check allowed locations -private _locations = getArray (_config >> "treatmentLocations"); - -if ("All" in _locations) then { - _return = true; -} else { - private _medFacility = {([_caller] call EFUNC(medical,isInMedicalFacility)) || ([_target] call EFUNC(medical,isInMedicalFacility))}; - private _medVeh = {([_caller] call EFUNC(medical,isInMedicalVehicle)) || ([_target] call EFUNC(medical,isInMedicalVehicle))}; - - { - if (_x == "field") exitwith {_return = true;}; - if (_x == "MedicalFacility" && _medFacility) exitwith {_return = true;}; - if (_x == "MedicalVehicle" && _medVeh) exitwith {_return = true;}; - if !(isnil _x) exitwith { - private _val = missionNamespace getVariable _x; - if (_val isEqualType 0) then { - _return = switch (_val) do { - case 0: {true}; //AdvancedMedicalSettings_anywhere - case 1: {call _medVeh}; //AdvancedMedicalSettings_vehicle - case 2: {call _medFacility}; //AdvancedMedicalSettings_facility - case 3: {(call _medFacility) || {call _medVeh}}; //AdvancedMedicalSettings_vehicleAndFacility - default {false}; //Disabled - }; - }; - }; - } foreach _locations; -}; - -if !(_return) exitwith {false}; private _usersOfItems = []; -private _consumeItems = if (isNumber (_config >> "itemConsumed")) then { - getNumber (_config >> "itemConsumed"); -} else { - // Check for required class - if (isText (_config >> "itemConsumed")) exitwith { - missionNamespace getVariable [(getText (_config >> "itemConsumed")), 0]; - }; - 0; -}; + if (_consumeItems > 0) then { _usersOfItems = ([_caller, _target, _items] call FUNC(useItems)) select 1; }; -// Parse the config for the progress callback +// parse the config for the progress callback private _callbackProgress = getText (_config >> "callbackProgress"); -if (_callbackProgress == "") then { + +if (_callbackProgress isEqualTo "") then { _callbackProgress = "true"; }; + if (isNil _callbackProgress) then { _callbackProgress = compile _callbackProgress; } else { _callbackProgress = missionNamespace getVariable _callbackProgress; }; -// Patient Animation +// play patient animation private _patientAnim = getText (_config >> "animationPatient"); + if (_target getVariable ["ACE_isUnconscious", false] && EGVAR(medical,allowUnconsciousAnimationOnTreatment)) then { if !(animationState _target in (getArray (_config >> "animationPatientUnconsciousExcludeOn"))) then { _patientAnim = getText (_config >> "animationPatientUnconscious"); }; }; -if (_caller != _target && {vehicle _target == _target} && {_patientAnim != ""}) then { +private _isSelf = _caller isEqualTo _target; + +if (!_isSelf && {vehicle _target == _target} && {_patientAnim != ""}) then { if (_target getVariable ["ACE_isUnconscious", false]) then { [_target, _patientAnim, 2, true] call EFUNC(common,doAnimation); } else { @@ -150,71 +77,105 @@ if (_caller != _target && {vehicle _target == _target} && {_patientAnim != ""}) }; }; -// Player Animation -private _callerAnim = [getText (_config >> "animationCaller"), getText (_config >> "animationCallerProne")] select (stance _caller == "PRONE"); -if (_caller == _target) then { - _callerAnim = [getText (_config >> "animationCallerSelf"), getText (_config >> "animationCallerSelfProne")] select (stance _caller == "PRONE"); -}; +// play animation +private "_callerAnim"; -_caller setVariable [QGVAR(selectedWeaponOnTreatment), (weaponState _caller)]; - -// Cannot use secondairy weapon for animation -if (currentWeapon _caller == secondaryWeapon _caller) then { - _caller selectWeapon (primaryWeapon _caller); -}; - -private _wpn = switch (true) do { - case ((currentWeapon _caller) == ""): {"non"}; - case ((currentWeapon _caller) == (primaryWeapon _caller)): {"rfl"}; - case ((currentWeapon _caller) == (handgunWeapon _caller)): {"pst"}; - default {"non"}; -}; -private _callerAnim = [_callerAnim, "[wpn]", _wpn] call CBA_fnc_replace; -if (vehicle _caller == _caller && {_callerAnim != ""}) then { - if (primaryWeapon _caller == "") then { - _caller addWeapon "ACE_FakePrimaryWeapon"; - }; - if (currentWeapon _caller == "") then { - _caller selectWeapon (primaryWeapon _caller); // unit always has a primary weapon here - }; - - if (isWeaponDeployed _caller) then { - TRACE_1("Weapon Deployed, breaking out first",(stance _caller)); - [_caller, "", 0] call EFUNC(common,doAnimation); - }; - - if ((stance _caller) == "STAND") then { - switch (_wpn) do {//If standing, end in a crouched animation based on their current weapon - case ("rfl"): {_caller setVariable [QGVAR(treatmentPrevAnimCaller), "AmovPknlMstpSrasWrflDnon"];}; - case ("pst"): {_caller setVariable [QGVAR(treatmentPrevAnimCaller), "AmovPknlMstpSrasWpstDnon"];}; - case ("non"): {_caller setVariable [QGVAR(treatmentPrevAnimCaller), "AmovPknlMstpSnonWnonDnon"];}; - }; - } else { - _caller setVariable [QGVAR(treatmentPrevAnimCaller), animationState _caller]; - }; - [_caller, _callerAnim] call EFUNC(common,doAnimation); -}; - -//Get treatment time -private _treatmentTime = if (isNumber (_config >> "treatmentTime")) then { - getNumber (_config >> "treatmentTime"); +if (_isSelf) then { + _callerAnim = getText (_config >> ["animationCallerSelf", "animationCallerSelfProne"] select (stance _caller == "PRONE")); } else { - if (isText (_config >> "treatmentTime")) exitwith { - private _treatmentTimeConfig = getText(_config >> "treatmentTime"); - if (isnil _treatmentTimeConfig) then { - _treatmentTimeConfig = compile _treatmentTimeConfig; - } else { - _treatmentTimeConfig = missionNamespace getVariable _treatmentTimeConfig; - }; - if (_treatmentTimeConfig isEqualType 0) exitwith { - _treatmentTimeConfig; - }; - [_caller, _target, _selectionName, _className] call _treatmentTimeConfig; - }; - 0; + _callerAnim = getText (_config >> ["animationCaller", "animationCallerProne"] select (stance _caller == "PRONE")); }; -// Start treatment +_caller setVariable [QGVAR(selectedWeaponOnTreatment), weaponState _caller]; + +private _wpn = ["non", "rfl", "lnr", "pst"] param [["", primaryWeapon _caller, secondaryWeapon _caller, handgunWeapon _caller] find currentWeapon _caller, "non"]; + +_callerAnim = [_callerAnim, "[wpn]", _wpn] call CBA_fnc_replace; + +// this one is missing +if (_callerAnim == "AinvPknlMstpSlayWlnrDnon_medic") then { + _callerAnim = "AinvPknlMstpSlayWlnrDnon_medicOther"; +}; + +private _animDuration = GVAR(animDurations) getVariable _callerAnim; + +// these animations have transitions that take a bit longer... +if (weaponLowered _caller) then { + _animDuration = _animDuration + 0.5; + + // fix problems with lowered weapon transitions by raising the weapon first + _caller action ["WeaponInHand", _caller]; +}; + +if (binocular _caller != "" && {binocular _caller == currentWeapon _caller}) then { + _animDuration = _animDuration + 1.0; +}; + +if (vehicle _caller == _caller && {_callerAnim != ""}) then { + private _endInAnim = "AmovP[pos]MstpS[stn]W[wpn]Dnon"; + + private _pos = ["knl", "pne"] select (stance _caller == "PRONE"); + private _stn = "non"; + + if (_wpn != "non") then { + _stn = ["ras", "low"] select (weaponLowered _caller); + }; + + _endInAnim = [_endInAnim, "[pos]", _pos] call CBA_fnc_replace; + _endInAnim = [_endInAnim, "[stn]", _stn] call CBA_fnc_replace; + _endInAnim = [_endInAnim, "[wpn]", _wpn] call CBA_fnc_replace; + TRACE_1("",_endInAnim); + + [_caller, _callerAnim] call EFUNC(common,doAnimation); + [_caller, _endInAnim] call EFUNC(common,doAnimation); + _caller setVariable [QGVAR(endInAnim), _endInAnim]; +}; + +// get treatment time +private _treatmentTime = 0; + +// reads number from config. supports variables and code expressions +if (isNumber (_config >> "treatmentTime")) then { + _treatmentTime = getNumber (_config >> "treatmentTime"); +} else { + if (isText (_config >> "treatmentTime")) then { + _treatmentTime = getText (_config >> "treatmentTime"); + + if (isNil _treatmentTime) then { + _treatmentTime = compile _treatmentTime; + } else { + _treatmentTime = missionNamespace getVariable _treatmentTime; + }; + + if !(_treatmentTime isEqualType 0) then { + _treatmentTime = call _treatmentTime; + }; + }; +}; +TRACE_1("",_treatmentTime); + +// speed up animation depending on treatment time +if (!isNil "_animDuration") then { + _caller setAnimSpeedCoef (_animDuration / _treatmentTime); + TRACE_2("",_animDuration,_treatmentTime); +}; + +// play sound +if (isArray (_config >> "sounds")) then { + selectRandom getArray (_config >> "sounds") params ["_file", ["_volume", 1], ["_pitch", 1], ["_distance", 0]]; + TRACE_4("playSound3D",_file,_volume,_pitch,_distance); + playSound3D [ + _file, + objNull, + false, + getPosASL _caller, + _volume, + _pitch, + _distance + ]; +}; + +// start treatment [ _treatmentTime, [_caller, _target, _selectionName, _className, _items, _usersOfItems], @@ -225,22 +186,18 @@ private _treatmentTime = if (isNumber (_config >> "treatmentTime")) then { ["isnotinside"] ] call EFUNC(common,progressBar); -// Display Icon +// display icon private _iconDisplayed = getText (_config >> "actionIconPath"); + if (_iconDisplayed != "") then { - [QGVAR(treatmentActionIcon), true, _iconDisplayed, [1,1,1,1], getNumber(_config >> "actionIconDisplayTime")] call EFUNC(common,displayIcon); + [QGVAR(treatmentActionIcon), true, _iconDisplayed, [1,1,1,1], getNumber (_config >> "actionIconDisplayTime")] call EFUNC(common,displayIcon); }; // handle display of text/hints -private _displayText = ""; -if (_target != _caller) then { - _displayText = getText(_config >> "displayTextOther"); -} else { - _displayText = getText(_config >> "displayTextSelf"); -}; +private _displayText = getText (_config >> ["displayTextOther", "displayTextSelf"] select _isSelf); if (_displayText != "") then { - [QEGVAR(common,displayTextStructured), [[_displayText, [_caller] call EFUNC(common,getName), [_target] call EFUNC(common,getName)], 1.5, _caller], [_caller]] call CBA_fnc_targetEvent; + [QEGVAR(common,displayTextStructured), [[_displayText, _caller call EFUNC(common,getName), _target call EFUNC(common,getName)], 1.5, _caller], _caller] call CBA_fnc_targetEvent; }; -true; +true diff --git a/addons/medical_treatment/functions/fnc_treatment_failure.sqf b/addons/medical_treatment/functions/fnc_treatment_failure.sqf index be1ae7c860..af24c1cf9e 100644 --- a/addons/medical_treatment/functions/fnc_treatment_failure.sqf +++ b/addons/medical_treatment/functions/fnc_treatment_failure.sqf @@ -14,60 +14,43 @@ * * Public: No */ - #include "script_component.hpp" params ["_args"]; _args params ["_caller", "_target", "_selectionName", "_className", "_items", "_usersOfItems"]; -if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { - _caller removeWeapon "ACE_FakePrimaryWeapon"; -}; -if (vehicle _caller == _caller) then { - private _lastAnim = _caller getVariable [QGVAR(treatmentPrevAnimCaller), ""]; - //Don't play another medic animation (when player is rapidily treating) - TRACE_2("Reseting to old animation", animationState player, _lastAnim); - switch (toLower _lastAnim) do { - case "ainvpknlmstpslaywrfldnon_medic": {_lastAnim = "AmovPknlMstpSrasWrflDnon"}; - case "ainvppnemstpslaywrfldnon_medic": {_lastAnim = "AmovPpneMstpSrasWrflDnon"}; - case "ainvpknlmstpslaywnondnon_medic": {_lastAnim = "AmovPknlMstpSnonWnonDnon"}; - case "ainvppnemstpslaywpstdnon_medic": {_lastAnim = "AinvPpneMstpSlayWpstDnon"}; - case "ainvpknlmstpslaywpstdnon_medic": {_lastAnim = "AmovPknlMstpSrasWpstDnon"}; - }; +// switch to end anim immediately +private _endInAnim = _caller getVariable QGVAR(endInAnim); - [_caller, _lastAnim, 2] call EFUNC(common,doAnimation); -}; -_caller setVariable [QGVAR(treatmentPrevAnimCaller), nil]; - -private _weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnTreatment), []]); -if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") && {_previousWeapon in (weapons _caller)}}) then { - for "_index" from 0 to 99 do { - _caller action ["SwitchWeapon", _caller, _caller, _index]; - //Just check weapon, muzzle and mode (ignore ammo in case they were reloading) - if (((weaponState _caller) select [0,3]) isEqualTo (_weaponSelect select [0,3])) exitWith {TRACE_1("Restoring", (weaponState _caller));}; - if ((weaponState _caller) isEqualTo ["","","","",0]) exitWith {ERROR("weaponState not found");}; +if (!isNil "_endInAnim") then { + if (animationState _caller != _endInAnim) then { + [_caller, _endInAnim, 2] call EFUNC(common,doAnimation); }; -} else { - _caller action ["SwitchWeapon", _caller, _caller, 99]; + _caller setVariable [QGVAR(endInAnim), nil]; + TRACE_1("abort",_endInAnim); }; +// reset sped up animations +_caller setAnimSpeedCoef 1; + { _x params ["_unit", "_item"]; _unit addItem _item; } forEach _usersOfItems; // Record specific callback -private _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Basic" >> _className); -if (EGVAR(medical,level) >= 2) then { - _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Advanced" >> _className); -}; +private _config = configFile >> QGVAR(Actions) >> CUR_LEVEL >> _className; private _callback = getText (_config >> "callbackFailure"); -_callback = if (isNil _callback) then { - compile _callback + +if (isNil _callback) then { + _callback = compile _callback; } else { - missionNamespace getVariable _callback + _callback = missionNamespace getVariable _callback; +}; + +if !(_callback isEqualType {}) then { + _callback = {TRACE_1("callback was NOT code",_callback)}; }; -if (!(_callback isEqualType {})) then {_callback = {TRACE_1("callback was NOT code",_callback)};}; _args call _callback; diff --git a/addons/medical_treatment/functions/fnc_treatment_success.sqf b/addons/medical_treatment/functions/fnc_treatment_success.sqf index 47ab77433c..31d9a2f34e 100644 --- a/addons/medical_treatment/functions/fnc_treatment_success.sqf +++ b/addons/medical_treatment/functions/fnc_treatment_success.sqf @@ -14,56 +14,39 @@ * * Public: No */ - #include "script_component.hpp" params ["_args"]; _args params ["_caller", "_target", "_selectionName", "_className", "_items", "_usersOfItems"]; -if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { - _caller removeWeapon "ACE_FakePrimaryWeapon"; -}; -if (vehicle _caller == _caller) then { - private _lastAnim = _caller getVariable [QGVAR(treatmentPrevAnimCaller), ""]; - //Don't play another medic animation (when player is rapidily treating) - TRACE_2("Reseting to old animation", animationState player, _lastAnim); - switch (toLower _lastAnim) do { - case "ainvpknlmstpslaywrfldnon_medic": {_lastAnim = "AmovPknlMstpSrasWrflDnon"}; - case "ainvppnemstpslaywrfldnon_medic": {_lastAnim = "AmovPpneMstpSrasWrflDnon"}; - case "ainvpknlmstpslaywnondnon_medic": {_lastAnim = "AmovPknlMstpSnonWnonDnon"}; - case "ainvppnemstpslaywpstdnon_medic": {_lastAnim = "AinvPpneMstpSlayWpstDnon"}; - case "ainvpknlmstpslaywpstdnon_medic": {_lastAnim = "AmovPknlMstpSrasWpstDnon"}; - }; +// switch to end anim immediately +private _endInAnim = _caller getVariable QGVAR(endInAnim); - [_caller, _lastAnim, 2] call EFUNC(common,doAnimation); -}; -_caller setVariable [QGVAR(treatmentPrevAnimCaller), nil]; - -private _weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnTreatment), []]); -if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") && {_previousWeapon in (weapons _caller)}}) then { - for "_index" from 0 to 99 do { - _caller action ["SwitchWeapon", _caller, _caller, _index]; - //Just check weapon, muzzle and mode (ignore ammo in case they were reloading) - if (((weaponState _caller) select [0,3]) isEqualTo (_weaponSelect select [0,3])) exitWith {TRACE_1("Restoring", (weaponState _caller));}; - if ((weaponState _caller) isEqualTo ["","","","",0]) exitWith {ERROR("weaponState not found");}; +if (!isNil "_endInAnim") then { + if (animationState _caller != _endInAnim) then { + [_caller, _endInAnim, 2] call EFUNC(common,doAnimation); }; -} else { - _caller action ["SwitchWeapon", _caller, _caller, 99]; + _caller setVariable [QGVAR(endInAnim), nil]; + TRACE_1("abort",_endInAnim); }; +// reset sped up animations +_caller setAnimSpeedCoef 1; + // Record specific callback -private _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Basic" >> _className); -if (EGVAR(medical,level) >= 2) then { - _config = (configFile >> "ACE_Medical_Treatment_Actions" >> "Advanced" >> _className); -}; +private _config = configFile >> QGVAR(Actions) >> CUR_LEVEL >> _className; private _callback = getText (_config >> "callbackSuccess"); + if (isNil _callback) then { _callback = compile _callback; } else { _callback = missionNamespace getVariable _callback; }; -if (!(_callback isEqualType {})) then {_callback = {TRACE_1("callback was NOT code",_callback)};}; + +if !(_callback isEqualType {}) then { + _callback = {TRACE_1("callback was NOT code",_callback)}; +}; //Get current blood loose on limb (for "bloody" litter) private _bloodLossOnSelection = 0; diff --git a/addons/medical_treatment/functions/fnc_useItem.sqf b/addons/medical_treatment/functions/fnc_useItem.sqf index a96db8dc2f..39f16621d2 100644 --- a/addons/medical_treatment/functions/fnc_useItem.sqf +++ b/addons/medical_treatment/functions/fnc_useItem.sqf @@ -13,46 +13,33 @@ * * Public: Yes */ - #include "script_component.hpp" params ["_medic", "_patient", "_item"]; if (isNil QEGVAR(medical,setting_allowSharedEquipment)) then { - EGVAR(medical,setting_allowSharedEquipment)= true; + EGVAR(medical,setting_allowSharedEquipment) = true; }; if (EGVAR(medical,setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitWith { - if (local _patient) then { - ["ace_useItem", [_patient, _item]] call CBA_fnc_localEvent; - } else { - ["ace_useItem", [_patient, _item], _patient] call CBA_fnc_targetEvent; - }; - [true, _patient]; + ["ace_useItem", [_patient, _item], _patient] call CBA_fnc_targetEvent; + [true, _patient] }; if ([_medic, _item] call EFUNC(common,hasItem)) exitWith { - if (local _medic) then { - ["ace_useItem", [_medic, _item]] call CBA_fnc_localEvent; - } else { - ["ace_useItem", [_medic, _item], _medic] call CBA_fnc_targetEvent; - }; - [true, _medic]; + ["ace_useItem", [_medic, _item], _medic] call CBA_fnc_targetEvent; + [true, _medic] }; private _return = [false, objNull]; -if ([vehicle _medic] call EFUNC(medical,isMedicalVehicle) && {vehicle _medic != _medic}) then { - private _crew = crew vehicle _medic; + +if (vehicle _medic != _medic && {vehicle _medic call EFUNC(medical,isMedicalVehicle)}) then { { - if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitWith { + if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {[_x, _item] call EFUNC(common,hasItem)}) exitWith { + ["ace_useItem", [_x, _item], _x] call CBA_fnc_targetEvent; _return = [true, _x]; - if (local _x) then { - ["ace_useItem", [_x, _item]] call CBA_fnc_localEvent; - } else { - ["ace_useItem", [_x, _item], _x] call CBA_fnc_targetEvent; - }; }; - } forEach _crew; + } forEach crew vehicle _medic; }; _return diff --git a/addons/medical_treatment/functions/fnc_useItems.sqf b/addons/medical_treatment/functions/fnc_useItems.sqf index aac7b0623a..e1372b247d 100644 --- a/addons/medical_treatment/functions/fnc_useItems.sqf +++ b/addons/medical_treatment/functions/fnc_useItems.sqf @@ -8,29 +8,36 @@ * 2: Items > * * ReturnValue: - * None + * 0: success + * 1: Unit * * Public: Yes */ - #include "script_component.hpp" params ["_medic", "_patient", "_items"]; private _itemsUsedBy = []; + { // handle a one of type use item if (_x isEqualType []) then { { private _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); - if (_itemUsedInfo select 0) exitWith { _itemsUsedBy pushBack [(_itemUsedInfo select 1), _x]}; + + if (_itemUsedInfo select 0) exitWith { + _itemsUsedBy pushBack [_itemUsedInfo select 1, _x]; + }; } forEach _x; }; // handle required item if (_x isEqualType "") then { private _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); - if (_itemUsedInfo select 0) exitWith { _itemsUsedBy pushBack [(_itemUsedInfo select 1), _x]}; + + if (_itemUsedInfo select 0) exitWith { + _itemsUsedBy pushBack [_itemUsedInfo select 1, _x]; + }; }; } forEach _items; diff --git a/addons/medical_treatment/script_component.hpp b/addons/medical_treatment/script_component.hpp index 10d353b8b6..cfc16518f8 100644 --- a/addons/medical_treatment/script_component.hpp +++ b/addons/medical_treatment/script_component.hpp @@ -3,7 +3,7 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL -// #define DISABLE_COMPILE_CACHE +#define DISABLE_COMPILE_CACHE // #define CBA_DEBUG_SYNCHRONOUS // #define ENABLE_PERFORMANCE_COUNTERS @@ -16,3 +16,5 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" + +#define CUR_LEVEL (["Basic", "Advanced"] select (EGVAR(medical,level) >= 2))