groundwork (replace items on heal order)

This commit is contained in:
LinkIsGrim 2023-10-26 20:10:36 -04:00
parent eee86a4bac
commit 62556d303b
7 changed files with 44 additions and 15 deletions

View File

@ -1,11 +0,0 @@
class CfgWeapons {
// Remove items from Virtual Arsenal.
class ItemCore;
class FirstAidKit: ItemCore {
type = 0;
};
class Medikit: ItemCore {
type = 0;
};
};

View File

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

View File

@ -30,6 +30,11 @@
};
}, nil, [IGNORE_BASE_UAVPILOTS], true] call CBA_fnc_addClassEventHandler;
if !("ace_medical_treatment" call EFUNC(common,isModLoaded)) then {
[TYPE_FIRST_AID_KIT, ""] call EFUNC(common,registerItemReplacement);
[TYPE_MEDIKIT, ""] call EFUNC(common,registerItemReplacement);
};
#ifdef DEBUG_MODE_FULL
[QEGVAR(medical,woundReceived), {
params ["_unit", "_damages", "_shooter", "_ammo"];
@ -38,7 +43,6 @@
}] call CBA_fnc_addEventHandler;
#endif
// this handles moving units into vehicles via load functions or zeus
// needed, because the vanilla INCAPACITATED state does not handle vehicles
["CAManBase", "GetInMan", {
@ -96,3 +100,13 @@
[_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

@ -27,6 +27,5 @@ class CfgPatches {
#include "CfgFunctions.hpp"
#include "CfgMoves.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
#endif

View File

@ -0,0 +1,27 @@
#include "..\script_component.hpp"
/*
* Author: LinkIsGrim
* Intercepts group heal attempts and replaces items
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_medical_engine_fnc_commandChanged
*
* Public: No
*/
params ["_group", "_newCommand"];
if (!local _group) exitWith {};
if !(_newCommand in ["HEAL", "HEAL SOLDIER", "PATCH SOLDIER", "FIRST AID", "HEAL SELF", "SUPPORT"]) exitWith {};
{
_x call EFUNC(common,replaceRegisteredItems);
if (!unitReady _x) then {
[_x] joinSilent (leader _group)
};
} forEach (units _group);

View File

@ -36,7 +36,6 @@ if (isServer) then {
// replace medical items with their ACE equivalents
["CBA_settingsInitialized", {
TRACE_1("CBA_settingsInitialized EH",GVAR(convertItems)); // 0: Enabled 1: RemoveOnly 2:Disabled
if (GVAR(convertItems) == 2) exitWith {};
{
// turn [["stuff", 2], ...] into ["stuff", "stuff", ...]
private _replacements = [];

View File

@ -85,7 +85,7 @@
"LIST",
[LSTRING(ConvertItems_DisplayName), LSTRING(ConvertItems_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)],
[[0, 1, 2], [ELSTRING(common,Enabled), LSTRING(ConvertItems_RemoveOnly), ELSTRING(common,Disabled)], 0],
[[0, 1], [ELSTRING(common,Enabled), LSTRING(ConvertItems_RemoveOnly)], 0],
true
] call CBA_fnc_addSetting;