Use HandleHeal instead

Return value of HandleHeal is ignored, but AISFinishHeal works
This commit is contained in:
johnb432 2024-07-15 19:28:56 +02:00
parent b7d1bc5bb6
commit df60c744c1
5 changed files with 20 additions and 45 deletions

View File

@ -1,5 +1,4 @@
PREP(applyAnimAfterRagdoll);
PREP(commandChanged);
PREP(damageBodyPart);
PREP(disableThirdParty);
PREP(getHitpointArmor);

View File

@ -1,6 +1,7 @@
#include "script_component.hpp"
[QGVAR(updateDamageEffects), LINKFUNC(updateDamageEffects)] call CBA_fnc_addEventHandler;
["unit", {
params ["_new"];
[_new] call FUNC(updateDamageEffects); // Run on new controlled unit to update QGVAR(aimFracture)
@ -23,9 +24,23 @@
QEGVAR(medical,HandleDamageEHID),
_unit addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]
];
_unit addEventHandler ["HandleHeal", {
params ["_injured", "_healer"];
// Replace the items so that the unit can't heal
_healer call EFUNC(common,replaceRegisteredItems);
AISFinishHeal [_injured, _healer, true];
// Set animation to what it was before starting the healing animation
[{"dnon_medic" in animationState (_this select 0)}, {
[_this select 0, _this select 1, 2] call EFUNC(common,doAnimation);
}, [_healer, _healer call EFUNC(common,getDefaultAnim)], 5] call CBA_fnc_waitUntilAndExecute;
}];
}, nil, [IGNORE_BASE_UAVPILOTS], true] call CBA_fnc_addClassEventHandler;
if !("ace_medical_treatment" call EFUNC(common,isModLoaded)) then {
if !(["ace_medical_treatment"] call EFUNC(common,isModLoaded)) then {
[TYPE_FIRST_AID_KIT, ""] call EFUNC(common,registerItemReplacement);
[TYPE_MEDIKIT, ""] call EFUNC(common,registerItemReplacement);
};
@ -95,13 +110,3 @@ if !("ace_medical_treatment" call EFUNC(common,isModLoaded)) then {
[_unit] call FUNC(unlockUnconsciousSeat);
};
}, true, []] call CBA_fnc_addClassEventHandler;
// Used for preventing vanilla heal by replacing items
addMissionEventHandler ["GroupCreated", {
params ["_group"];
_group addEventHandler ["CommandChanged", {_this call FUNC(commandChanged)}];
}];
{
_x addEventHandler ["CommandChanged", {_this call FUNC(commandChanged)}];
} forEach allGroups;

View File

@ -32,8 +32,6 @@ if (isNil QUOTE(FATAL_SUM_DAMAGE_WEIBULL_K) || isNil QUOTE(FATAL_SUM_DAMAGE_WEIB
FATAL_SUM_DAMAGE_WEIBULL_L = _x1 / _b1^(1/FATAL_SUM_DAMAGE_WEIBULL_K);
};
OVERRIDDEN_COMMANDS = ["HEAL", "HEAL SOLDIER", "PATCH SOLDIER", "FIRST AID", "HEAL SELF", "SUPPORT"] createHashMapFromArray [];
// Cache for armor values of equipped items (vests etc)
GVAR(armorCache) = createHashMap;
@ -87,9 +85,6 @@ addMissionEventHandler ["Loaded", {
};
}] call CBA_fnc_addEventhandler;
[] call FUNC(disableThirdParty);
// Future-proofing
EGVAR(medical,enabled) = true; // TODO: remove when medical enable setting is implemented
call FUNC(disableThirdParty);
ADDON = true;

View File

@ -1,24 +0,0 @@
#include "..\script_component.hpp"
/*
* Author: LinkIsGrim
* Intercepts group heal attempts and replaces items
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public: No
*/
params ["_group", "_newCommand"];
if (!local _group) exitWith {};
if !(_newCommand in OVERRIDDEN_COMMANDS) exitWith {};
{
_x call EFUNC(common,replaceRegisteredItems);
private _assignedTeam = assignedTeam _x;
[_x] joinSilent (leader _group);
_x assignTeam _assignedTeam;
} forEach ((units _group) select {(currentCommand _x) == _newCommand});

View File

@ -4,7 +4,7 @@
[LSTRING(Enabled_DisplayName), LSTRING(Enabled_Description)],
ELSTRING(medical,Category),
true,
true,
1,
{[QEGVAR(medical,enabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;
@ -15,7 +15,7 @@
[LSTRING(EnableVehicleCrashes_DisplayName), LSTRING(EnableVehicleCrashes_Description)],
ELSTRING(medical,Category),
true,
true
1
] call CBA_fnc_addSetting;
[
@ -24,5 +24,5 @@
[LSTRING(damagePassThroughEffect_displayName), LSTRING(damagePassThroughEffect_description)],
ELSTRING(medical,Category),
[0, 1, 1, 2, true],
true
1
] call CBA_fnc_addSetting;