diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index bb52693e91..9f0484f671 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -77,21 +77,9 @@ class ACE_Medical_Actions { callbackProgress = ""; animationPatient = ""; animationPatientUnconscious = ""; - itemConsumed = 0; + itemConsumed = 1; litter[] = {}; }; - /*class PersonalAidKit: Bandage { - displayName = ""; - displayNameProgress = ""; - items[] = {"ACE_personalAidKit"}; - treatmentLocations[] = {"All"}; - requiredMedic = 1; - treatmentTime = 15; - callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_fullHeal)); - itemConsumed = 0; - animationCaller = "AinvPknlMstpSlayW[wpn]Dnon_medic"; - litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"}}, {"All", "", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}, {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}} }; - };*/ }; class Advanced { @@ -204,7 +192,7 @@ class ACE_Medical_Actions { displayName = ""; displayNameProgress = ""; items[] = {"ACE_surgicalKit"}; - treatmentLocations[] = {"MedicalFacility", "MedicalVehicle"}; + treatmentLocations[] = {QGVAR(useLocation_SurgicalKit)}; requiredMedic = QGVAR(medicSetting_SurgicalKit); treatmentTime = 10; callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_surgicalKit)); @@ -216,7 +204,7 @@ class ACE_Medical_Actions { displayName = ""; displayNameProgress = ""; items[] = {"ACE_personalAidKit"}; - treatmentLocations[] = {"All"}; + treatmentLocations[] = {QGVAR(useLocation_PAK)}; requiredMedic = QGVAR(medicSetting_PAK); treatmentTime = 10; callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_fullHeal)); @@ -288,7 +276,7 @@ class ACE_Medical_Actions { callbackProgress = ""; animationPatient = ""; animationPatientUnconscious = ""; - itemConsumed = 0; + itemConsumed = 1; litter[] = {}; }; }; diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index 915beafd6c..0af12c0a37 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -99,6 +99,16 @@ class ACE_Settings { value = 0; values[] = {"No", "Yes"}; }; + class GVAR(useLocation_PAK) { + typeName = "SCALAR"; + value = 3; + values[] = {"Anywhere", "Medical vehicles", "Medical facility", "vehicle & facility", "Disabled"}; + }; + class GVAR(useLocation_SurgicalKit) { + typeName = "SCALAR"; + value = 2; + values[] = {"Anywhere", "Medical vehicles", "Medical facility", "vehicle & facility", "Disabled"}; + }; class GVAR(keepLocalSettingsSynced) { typeName = "BOOL"; value = 1; diff --git a/addons/medical/CfgEventHandlers.hpp b/addons/medical/CfgEventHandlers.hpp index 6330819daa..bf96b6a239 100644 --- a/addons/medical/CfgEventHandlers.hpp +++ b/addons/medical/CfgEventHandlers.hpp @@ -17,6 +17,11 @@ class Extended_Init_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_init)); }; }; + class ACE_bodyBagObject { + class ADDON { + init = QUOTE(_this call DEFUNC(dragging,initObject)); + }; + }; }; class Extended_Respawn_EventHandlers { diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index a1110019ae..c2336529b3 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -204,7 +204,7 @@ class CfgVehicles { defaultValue = 1800; }; class medicSetting_PAK { - displayName = "Allow PAK"; + displayName = "Allow PAK (Adv)"; description = "Who can use the PAK for full heal?"; typeName = "NUMBER"; class values { @@ -214,7 +214,7 @@ class CfgVehicles { }; }; class consumeItem_PAK { - displayName = "Remove PAK on use"; + displayName = "Remove PAK on use (Adv)"; description = "Should PAK be removed on usage?"; typeName = "NUMBER"; class values { @@ -222,14 +222,30 @@ class CfgVehicles { class remove { name = "Yes"; value = 1; default = 1; }; }; }; + class useLocation_PAK { + displayName = "Locations PAK (Adv)"; + description = "Where can the personal aid kit be used?"; + typeName = "NUMBER"; + class values { + class anywhere { name = "Anywhere"; value = 0; }; + class vehicle { name = "Medical Vehicles"; value = 1; }; + class facility { name = "Medical facility"; value = 2; }; + class vehicleAndFacility { name = "Vehicles & facility"; value = 3; default = 1; }; + class disabled { name = "Disabled"; value = 4;}; + }; + }; class medicSetting_SurgicalKit: medicSetting_PAK { - displayName = "Allow Surgical kit"; + displayName = "Allow Surgical kit (Adv)"; description = "Who can use the surgical kit?"; }; class consumeItem_SurgicalKit: consumeItem_PAK { - displayName = "Remove Surgical kit"; + displayName = "Remove Surgical kit (Adv)"; description = "Should Surgical kit be removed on usage?"; }; + class useLocation_SurgicalKit: useLocation_PAK { + displayName = "Locations Surgical kit (Adv)"; + description = "Where can the Surgical kit be used?"; + }; }; class ModuleDescription { @@ -597,12 +613,26 @@ class CfgVehicles { }; }; class MapBoard_altis_F; - class ACE_bodyBag: MapBoard_altis_F { + class ACE_bodyBagObject: MapBoard_altis_F { + XEH_ENABLED; scope = 1; side = -1; model = QUOTE(PATHTOF(data\bodybag.p3d)); icon = ""; displayName = $STR_ACE_MEDICAL_BODYBAG_DISPLAY; + EGVAR(dragging,canDrag) = 1; + EGVAR(dragging,dragPosition[]) = {0,1.2,0}; + EGVAR(dragging,dragDirection) = 0; + class ACE_Actions { + class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; + distance = 5; + condition = QUOTE(true); + statement = ""; + icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; + selection = ""; + }; + }; }; // Medical litter classes diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 77fed65110..27f2ce07b9 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -13,6 +13,28 @@ GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"]; ["medical_woundUpdateRequest", FUNC(onWoundUpdateRequest)] call ace_common_fnc_addEventHandler; ["interactMenuClosed", {[objNull, false] call FUNC(displayPatientInformation); }] call ace_common_fnc_addEventHandler; +["medical_onUnconscious", { + if (local (_this select 0)) then { + _unit = _this select 0; + if (_this select 1) then { + _unit setVariable ["tf_globalVolume", 0.4]; + _unit setVariable ["tf_voiceVolume", 0, true]; + _unit setVariable ["tf_unable_to_use_radio", true, true]; + + _unit setVariable ["acre_sys_core_isDisabled", true, true]; + _unit setVariable ["acre_sys_core_globalVolume", 0.4]; + } else { + _unit setVariable ["tf_globalVolume", 1]; + _unit setVariable ["tf_voiceVolume", 1, true]; + _unit setVariable ["tf_unable_to_use_radio", true, true]; + + _unit setVariable ["acre_sys_core_isDisabled", true, true]; + _unit setVariable ["acre_sys_core_globalVolume", 1]; + }; + }; +}] call ace_common_fnc_addEventHandler; + + // Initialize all effects _fnc_createEffect = { private ["_type", "_layer", "_default"]; diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index fc9d68fc68..56056de0c6 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -54,6 +54,7 @@ PREP(init); PREP(isBeingCarried); PREP(isBeingDragged); PREP(isInMedicalFacility); +PREP(isInMedicalVehicle); PREP(isMedic); PREP(isMedicalVehicle); PREP(itemCheck); diff --git a/addons/medical/config.cpp b/addons/medical/config.cpp index 28e07fe4d4..a5f00bbeed 100644 --- a/addons/medical/config.cpp +++ b/addons/medical/config.cpp @@ -2,7 +2,7 @@ class CfgPatches { class ADDON { - units[] = {"ACE_medicalSupplyCrate", "ACE_fieldDressingItem", "ACE_packingBandageItem", "ACE_elasticBandageItem", "ACE_tourniquetItem", "ACE_morphineItem", "ACE_atropineItem", "ACE_epinephrineItem", "ACE_plasmaIVItem", "ACE_bloodIVItem", "ACE_salineIVItem", "ACE_quikclotItem", "ACE_personalAidKitItem", "ACE_surgicalKitItem", "ACE_bodyBagItem"}; + units[] = {"ACE_medicalSupplyCrate", "ACE_fieldDressingItem", "ACE_packingBandageItem", "ACE_elasticBandageItem", "ACE_tourniquetItem", "ACE_morphineItem", "ACE_atropineItem", "ACE_epinephrineItem", "ACE_plasmaIVItem", "ACE_bloodIVItem", "ACE_salineIVItem", "ACE_quikclotItem", "ACE_personalAidKitItem", "ACE_surgicalKitItem", "ACE_bodyBagItem", "ACE_bodyBagObject"}; weapons[] = {"ACE_fieldDressing", "ACE_packingBandage", "ACE_elasticBandage", "ACE_tourniquet", "ACE_morphine", "ACE_atropine", "ACE_epinephrine", "ACE_plasmaIV", "ACE_plasmaIV_500", "ACE_plasmaIV_250", "ACE_bloodIV", "ACE_bloodIV_500", "ACE_bloodIV_250", "ACE_salineIV", "ACE_salineIV_500", "ACE_salineIV_250", "ACE_quikclot", "ACE_personalAidKit", "ACE_surgicalKit", "ACE_bodyBag"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {ace_common, ace_interaction, ace_modules}; diff --git a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf index d657dbe152..872b9a628a 100644 --- a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf +++ b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf @@ -18,22 +18,14 @@ private ["_target","_caller", "_nameOfUnit", "_onPosition", "_bodyBagCreated"]; _caller = _this select 0; _target = _this select 1; -if !([_caller, "ACE_itemBodyBag"] call EFUNC(common,hasItem)) exitwith {}; - -[_caller, "ACE_itemBodyBag"] call EFUNC(common,useItem); - _nameOfUnit = [_target] call EFUNC(common,getName); if (alive _target) then { - // force kill the unit. [_target, true] call FUNC(setDead); }; _onPosition = getPos _target; deleteVehicle _target; -_bodyBagCreated = createVehicle ["ACE_bodyBag", _onPosition, [], 0, "NONE"]; +_bodyBagCreated = createVehicle ["ACE_bodyBagObject", _onPosition, [], 0, "NONE"]; // reset the position to ensure it is on the correct one. -_bodyBagCreated setPos _onPosition; - -// TODO Does this need to be something with QUOTE(DEFUNC)? -[[_bodyBagCreated], QUOTE(DEFUNC(common,revealObject)), true] call call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +_bodyBagCreated setPos [_onPosition select 0, _onPosition select 1, (_onPosition select 2) + 0.2]; _bodyBagCreated; diff --git a/addons/medical/functions/fnc_canTreat.sqf b/addons/medical/functions/fnc_canTreat.sqf index 4cb9adf8e1..5f52759f54 100644 --- a/addons/medical/functions/fnc_canTreat.sqf +++ b/addons/medical/functions/fnc_canTreat.sqf @@ -64,10 +64,26 @@ if (!_return) exitwith {false}; if ("All" in _locations) exitwith {true}; +private [ "_medFacility", "_medVeh"]; +_medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))}; +_medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isInMedicalVehicle))}; + { if (_x == "field") exitwith {_return = true;}; - if (_x == "MedicalFacility" && {[_caller, _target] call FUNC(inMedicalFacility)}) exitwith {_return = true;}; - if (_x == "MedicalVehicle" && {[_caller, _target] call FUNC(inMedicalVehicle)}) exitwith {_return = true;}; + if (_x == "MedicalFacility" && _medFacility) exitwith {_return = true;}; + if (_x == "MedicalVehicle" && _medVeh) exitwith {_return = true;}; + if !(isnil _x) exitwith { + private "_val"; + _val = missionNamespace getvariable _x; + if (typeName _val == "SCALAR") then { + _return = switch (_val) do { + case 0: {true}; + case 1: _medVeh; + case 2: _medFacility; + case 3: {call _medFacility || call _medVeh}; + }; + }; + }; }foreach _locations; _return; diff --git a/addons/medical/functions/fnc_isInMedicalVehicle.sqf b/addons/medical/functions/fnc_isInMedicalVehicle.sqf index e610a5cf3f..cffc24410d 100644 --- a/addons/medical/functions/fnc_isInMedicalVehicle.sqf +++ b/addons/medical/functions/fnc_isInMedicalVehicle.sqf @@ -11,6 +11,8 @@ * Public: Yes */ +#include "script_component.hpp" + private ["_unit", "_vehicle"]; _unit = _this select 0; @@ -19,5 +21,4 @@ _vehicle = vehicle _unit; if (_unit == _vehicle) exitWith {false}; if (_unit in [driver _vehicle, gunner _vehicle, commander _vehicle]) exitWith {false}; -// @todo: variable names standard? _vehicle getVariable [QGVAR(isMedic), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "attendant") == 1] diff --git a/addons/medical/functions/fnc_isMedicalVehicle.sqf b/addons/medical/functions/fnc_isMedicalVehicle.sqf index bf13c51a6a..7be406e556 100644 --- a/addons/medical/functions/fnc_isMedicalVehicle.sqf +++ b/addons/medical/functions/fnc_isMedicalVehicle.sqf @@ -12,8 +12,7 @@ */ #include "script_component.hpp" -private ["_veh"]; -_veh = _this select 0; +private ["_vehicle"]; +_vehicle = _this select 0; -if !(_veh getvariable [QGVAR(isMedicalVehicle), true]) exitwith {false}; // exit in case the false is set. -((getNumber(configFile >> "CfgVehicles" >> typeOf _veh >> QGVAR(isMedicalVehicle)) == 1) || (_veh getvariable [QGVAR(isMedicalVehicle), false])); +_vehicle getVariable [QGVAR(isMedic), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "attendant") == 1] diff --git a/addons/medical/functions/fnc_moduleTreatmentConfiguration.sqf b/addons/medical/functions/fnc_moduleTreatmentConfiguration.sqf index 6ae3f7eeb8..5d88fa0f0a 100644 --- a/addons/medical/functions/fnc_moduleTreatmentConfiguration.sqf +++ b/addons/medical/functions/fnc_moduleTreatmentConfiguration.sqf @@ -32,3 +32,5 @@ if !(_activated) exitWith {}; [_logic, QGVAR(medicSetting_SurgicalKit), "medicSetting_SurgicalKit"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(consumeItem_PAK), "consumeItem_PAK"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(consumeItem_SurgicalKit), "consumeItem_SurgicalKit"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(useLocation_PAK), "useLocation_PAK"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(useLocation_SurgicalKit), "useLocation_SurgicalKit"] call EFUNC(common,readSettingFromModule); diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index 9e68d2c3e3..dcd3f98f05 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -37,7 +37,6 @@ if (!local _unit) exitwith { _unit setvariable ["ACE_isUnconscious", true, true]; _unit setUnconscious true; -// @todo: mute player? if (_unit == ACE_player) then { if (visibleMap) then {openMap false}; closeDialog 0; diff --git a/addons/medical/functions/fnc_treatment.sqf b/addons/medical/functions/fnc_treatment.sqf index d3b849b3cd..e010279be1 100644 --- a/addons/medical/functions/fnc_treatment.sqf +++ b/addons/medical/functions/fnc_treatment.sqf @@ -77,10 +77,26 @@ if (!_return) exitwith {false}; if ("All" in _locations) then { _return = true; } else { + private [ "_medFacility", "_medVeh"]; + _medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))}; + _medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isInMedicalVehicle))}; + { if (_x == "field") exitwith {_return = true;}; - if (_x == "MedicalFacility" && {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))}) exitwith {_return = true;}; - if (_x == "MedicalVehicle" && {([vehicle _caller] call FUNC(isMedicalVehicle)) || ([vehicle _target] call FUNC(isMedicalVehicle))}) exitwith {_return = true;}; + if (_x == "MedicalFacility" && _medFacility) exitwith {_return = true;}; + if (_x == "MedicalVehicle" && _medVeh) exitwith {_return = true;}; + if !(isnil _x) exitwith { + private "_val"; + _val = missionNamespace getvariable _x; + if (typeName _val == "SCALAR") then { + _return = switch (_val) do { + case 0: {true}; + case 1: _medVeh; + case 2: _medFacility; + case 3: {call _medFacility || call _medVeh}; + }; + }; + }; }foreach _locations; };