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 8 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 @@ -25,6 +25,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 @@ -33,7 +38,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 @@ -91,3 +95,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;
2 changes: 2 additions & 0 deletions addons/medical_engine/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ 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;

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
24 changes: 24 additions & 0 deletions addons/medical_engine/functions/fnc_commandChanged.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#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;
johnb432 marked this conversation as resolved.
Show resolved Hide resolved
} forEach ((units _group) select {(currentCommand _x) == _newCommand});
11 changes: 11 additions & 0 deletions addons/medical_engine/initSettings.inc.sqf
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
[
QEGVAR(medical,enabled),
"CHECKBOX",
[LSTRING(Enabled_DisplayName), LSTRING(Enabled_Description)],
ELSTRING(medical,Category),
true,
true,
{[QEGVAR(medical,enabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;

[
QEGVAR(medical,enableVehicleCrashes),
"CHECKBOX",
Expand Down
3 changes: 3 additions & 0 deletions addons/medical_engine/script_macros_medical.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@
#define FRACTURE_DAMAGE_THRESHOLD EGVAR(medical,const_fractureDamageThreshold)
#define FRACTURE_DAMAGE_THRESHOLD_DEFAULT 0.50

// Overridden commands for group healing
#define OVERRIDDEN_COMMANDS EGVAR(medical,overriddenCommands)

// Minimum cardiac output
#define CARDIAC_OUTPUT_MIN EGVAR(medical,const_minCardiacOutput)
#define CARDIAC_OUTPUT_MIN_DEFAULT 0.05
Expand Down
6 changes: 6 additions & 0 deletions addons/medical_engine/stringtable.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="Medical_Engine">
<Key ID="STR_ACE_Medical_Engine_Enabled_DisplayName">
<English>Enable Medical System</English>
</Key>
<Key ID="STR_ACE_Medical_Engine_Enabled_Description">
<English>Controls whether ACE's Medical System is enabled. Disabling the medical system through this setting is experimental, and may not be compatible with other mods.\nUse the No Medical optional component instead if you have issues.</English>
</Key>
<Key ID="STR_ACE_Medical_Engine_EnableVehicleCrashes_DisplayName">
<English>Enable Vehicle Crash Damage</English>
<Russian>Вкл. урон при аварии в транспорте</Russian>
Expand Down
3 changes: 1 addition & 2 deletions addons/medical_treatment/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ 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 {};
TRACE_1("CBA_settingsInitialized EH",GVAR(convertItems)); // 0: Enabled 1: RemoveOnly
{
// turn [["stuff", 2], ...] into ["stuff", "stuff", ...]
private _replacements = [];
Expand Down
2 changes: 1 addition & 1 deletion addons/medical_treatment/initSettings.inc.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
Loading