Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medical - Use HandleHeal instead of making Vanilla FAKs and Medikits unusable #10401

Merged
merged 6 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions addons/medical_engine/CfgWeapons.hpp

This file was deleted.

28 changes: 28 additions & 0 deletions addons/medical_engine/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 && {!isNil {TYPE_FIRST_AID_KIT call EFUNC(common,getItemReplacements)} || {!isNil {TYPE_MEDIKIT call EFUNC(common,getItemReplacements)}}}) then {
// Replace the items (if possible) so that the unit can't heal
_healer call EFUNC(common,replaceRegisteredItems);
} else {
// If there are no replacements available, 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
Expand Down
1 change: 0 additions & 1 deletion addons/medical_engine/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ class CfgPatches {
#include "CfgFunctions.hpp"
#include "CfgMoves.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"

#endif
2 changes: 0 additions & 2 deletions addons/medical_treatment/CfgWeapons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down