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 - Add Enable Setting #9593

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 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
12 changes: 0 additions & 12 deletions addons/medical_engine/CfgActions.hpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@

class CfgActions {
class None;
class Heal: None {
show = 0;
};
class HealSoldier: None {
show = 0;
};
class HealSoldierSelf: None {
show = 0;
};
class FirstAid: None {
show = 0;
};
class UnloadUnconsciousUnits: None {
show = 0;
};
Expand Down
11 changes: 0 additions & 11 deletions addons/medical_engine/CfgWeapons.hpp

This file was deleted.

1 change: 1 addition & 0 deletions addons/medical_engine/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PREP(applyAnimAfterRagdoll);
PREP(commandChanged);
PREP(damageBodyPart);
PREP(disableThirdParty);
PREP(getHitpointArmor);
Expand Down
16 changes: 15 additions & 1 deletion addons/medical_engine/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand All @@ -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", {
Expand Down Expand Up @@ -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;
1 change: 0 additions & 1 deletion addons/medical_engine/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ class CfgPatches {
#include "CfgFunctions.hpp"
#include "CfgMoves.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"

#endif
27 changes: 27 additions & 0 deletions addons/medical_engine/functions/fnc_commandChanged.sqf
Original file line number Diff line number Diff line change
@@ -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)
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved
};
} forEach (units _group);
1 change: 0 additions & 1 deletion addons/medical_treatment/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
2 changes: 1 addition & 1 deletion addons/medical_treatment/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down