diff --git a/addons/medical_engine/CfgWeapons.hpp b/addons/medical_engine/CfgWeapons.hpp deleted file mode 100644 index b4e3572620..0000000000 --- a/addons/medical_engine/CfgWeapons.hpp +++ /dev/null @@ -1,11 +0,0 @@ - -class CfgWeapons { - // Remove items from Virtual Arsenal. - class ItemCore; - class FirstAidKit: ItemCore { - type = 0; - }; - class Medikit: ItemCore { - type = 0; - }; -}; diff --git a/addons/medical_engine/XEH_postInit.sqf b/addons/medical_engine/XEH_postInit.sqf index ed66091498..cffa1127a1 100644 --- a/addons/medical_engine/XEH_postInit.sqf +++ b/addons/medical_engine/XEH_postInit.sqf @@ -23,6 +23,34 @@ QEGVAR(medical,HandleDamageEHID), _unit addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}] ]; + + // Fires where healer is local + _unit addEventHandler ["HandleHeal", { + params ["_injured", "_healer", "_isMedic", "_atVehicle"]; + + AISFinishHeal [_injured, _healer, _isMedic]; + + // AI stay in healing loop if they have healing items available (they try to heal once every second) + if (isNull _atVehicle && {(missionNamespace getVariable [QEGVAR(medical_treatment,convertItems), 2]) != 2}) then { + // Replace the items (if enabled) so that the unit can't heal + _healer call EFUNC(common,replaceRegisteredItems); + } else { + // If medical_treatment isn't loaded, interrupt healing command by forcing the unit to leave and rejoin the group + if (_healer call EFUNC(common,isPlayer)) exitWith {}; + + // This resets their command/action + private _assignedTeam = assignedTeam _healer; + private _groupInfo = [group _healer, groupId _healer]; + [_healer] joinSilent grpNull; // If unit doesn't leave group first, it will take the lowest Id when joinAsSilent is run, regardless of parameters + _healer joinAsSilent _groupInfo; + + if (_assignedTeam != "") then { + _healer assignTeam _assignedTeam; + }; + }; + + true + }]; }, nil, [IGNORE_BASE_UAVPILOTS], true] call CBA_fnc_addClassEventHandler; #ifdef DEBUG_MODE_FULL diff --git a/addons/medical_engine/config.cpp b/addons/medical_engine/config.cpp index 2d7926aa41..21e779c730 100644 --- a/addons/medical_engine/config.cpp +++ b/addons/medical_engine/config.cpp @@ -28,6 +28,5 @@ class CfgPatches { #include "CfgFunctions.hpp" #include "CfgMoves.hpp" #include "CfgVehicles.hpp" -#include "CfgWeapons.hpp" #endif diff --git a/addons/medical_treatment/CfgWeapons.hpp b/addons/medical_treatment/CfgWeapons.hpp index 7b31e10bee..ea08d75fe5 100644 --- a/addons/medical_treatment/CfgWeapons.hpp +++ b/addons/medical_treatment/CfgWeapons.hpp @@ -7,14 +7,12 @@ class CfgWeapons { class MedikitItem; class FirstAidKit: ItemCore { - type = 0; ACE_isMedicalItem = 1; class ItemInfo: InventoryFirstAidKitItem_Base_F { mass = 4; }; }; class Medikit: ItemCore { - type = 0; ACE_isMedicalItem = 1; class ItemInfo: MedikitItem { mass = 60;