diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index f95e77f003..77acd4ffc6 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -7,9 +7,9 @@ PREP(handleDamage_airway); PREP(handleDamage); PREP(handleDamage_advanced); PREP(handleDamage_basic); -PREP(handleDamage_medium); PREP(handleDamage_fractures); PREP(handleDamage_internalInjuries); +PREP(handleDamage_caching); PREP(init); PREP(selectionNameToNumber); PREP(handleDamage_wounds); diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index cb96a15529..bf2fd44e73 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -55,9 +55,17 @@ if (GVAR(level) >= 1) then { [_unit, _selectionName, _damage, _source, _projectile, _damageReturn] call FUNC(handleDamage_caching); // TODO check if this should would have killed the unit.. - if (_damageReturn > 0.95) then { - _damageReturn = 0.95; + if (_damageReturn > 0.9) then { + _damageReturn = 0.9; }; }; +if (_unit getVariable [QGVAR(preventDeath), false] && {_damageReturn >= 0.9} && {_selection in ["", "head", "body"]}) exitWith { + if (vehicle _unit != _unit and {damage _vehicle >= 1}) then { + // @todo + // [_unit] call FUNC(unload); + }; + 0.89 +}; + _damageReturn diff --git a/addons/medical/functions/fnc_handleDamage_basic.sqf b/addons/medical/functions/fnc_handleDamage_basic.sqf index da7a3dda40..f31c9f186d 100644 --- a/addons/medical/functions/fnc_handleDamage_basic.sqf +++ b/addons/medical/functions/fnc_handleDamage_basic.sqf @@ -43,6 +43,7 @@ if (diag_frameno > (_unit getVariable [QGVAR(frameNo), -3]) + 2) then { _unit setVariable [QGVAR(hitPoints), []]; _unit setVariable [QGVAR(damages), []]; _unit setVariable [QGVAR(structDamage), 0]; + _unit setVariable [QGVAR(preventDeath), false]; }; diff --git a/addons/medical/injury_defines.hpp b/addons/medical/injury_defines.hpp new file mode 100644 index 0000000000..4b4bc2b921 --- /dev/null +++ b/addons/medical/injury_defines.hpp @@ -0,0 +1,71 @@ +#define NO_INJURY -1 + +/* FLESH WOUNDS/BLEEDING INJURIES */ +#define SCRATCH 0 +#define MINOR_OPEN_WOUND 1 +#define MEDIUM_OPEN_WOUND 2 +#define LARGE_OPEN_WOUND 3 +#define SCHRAPNEL_WOUND 5 +#define GRAZE_WOUND 6 +#define MINOR_CUT 7 +#define MEDIUM_CUT 8 +#define LARGE_CUT 9 +#define MISSING_FLESH 10 +#define EXPLOSION_WOUND 11 +#define BRUISES 12 +#define ALL_WOUNDS [SCRATCH, MINOR_OPEN_WOUND, MEDIUM_OPEN_WOUND, LARGE_OPEN_WOUND, SCHRAPNEL_WOUND, GRAZE_WOUND, MINOR_CUT, MEDIUM_CUT, LARGE_CUT, MISSING_FLESH, EXPLOSION_WOUND, BRUISES] + +/* BURN INJURIES */ +#define MINOR_BURN 40 +#define MEDIUM_BURN 41 +#define HIGH_BURN 42 +#define ALL_BURNS [MINOR_BURN, MEDIUM_BURN, HIGH_BURN] + +/* INTERNAL BLEEDING */ +#define MINOR_INTERNAL_BLEEDING 50 +#define MEDIUM_INTERNAL_BLEEDING 51 +#define HEAVY_INTERNAL_BLEEDING 52 +#define ALL_INTERNAL_BLEEDING [MINOR_INTERNAL_BLEEDING, MEDIUM_INTERNAL_BLEEDING, HEAVY_INTERNAL_BLEEDING] + +/* BROKEN BONES */ +#define BROKEN_BONE_FEMUR 80 +#define BROKEN_BONE_TIBIA 81 +#define BROKEN_BONE_HUMERUS 82 +#define BROKEN_BONE_RADIAL 83 +#define BROKEN_BONE_SKULL 84 +#define BROKEN_RIB 85 +#define SHATTERED_NECK_BONE 86 +#define BROKEN_C_SPINE 87 +#define ALL_BROKEN_BONES [] + +/* AIRWAY INJURIES */ +#define TENSION_PNEUMOTHORA 200 +#define SIMPLE_PNEUMOTHORA 201 +#define HEMOTHORAX 202 +#define AIRWAY_OBSTRUCTION_PARTIAL 205 +#define AIRWAY_OBSTRUCTION_FULL 204 +#define ALL_AIRWAY_INJURES [] + +/* BLOOD_LOSS */ +#define SCRATCH_BLEEDING_RATE 0.001 +#define MINOR_OPEN_WOUND_BLEEDING_RATE 0.025 +#define MEDIUM_OPEN_WOUND_BLEEDING_RATE 0.05 +#define LARGE_OPEN_WOUND_BLEEDING_RATE 0.1 +#define SCHRAPNEL_WOUND_BLEEDING_RATE 0.07 +#define GRAZE_WOUND_BLEEDING_RATE 0.02 +#define MINOR_CUT_BLEEDING_RATE 0.01 +#define MEDIUM_CUT_BLEEDING_RATE 0.02 +#define LARGE_CUT_BLEEDING_RATE 0.04 +#define MISSING_FLESH_BLEEDING_RATE 0.15 +#define EXPLOSION_WOUND_BLEEDING_RATE 0.15 +#define BRUISES_WOUND_BLEEDING_RATE 0 +#define DEFAULT_BLEEDING_RATE MINOR_OPEN_WOUND_BLEEDING_RATE +#define ALL_POSSIBLE_BLEEDING_RATES [SCRATCH_BLEEDING_RATE, MINOR_OPEN_WOUND_BLEEDING_RATE, MEDIUM_OPEN_WOUND_BLEEDING_RATE, LARGE_OPEN_WOUND_BLEEDING_RATE, SCHRAPNEL_WOUND_BLEEDING_RATE, GRAZE_WOUND_BLEEDING_RATE, MINOR_CUT_BLEEDING_RATE, MEDIUM_CUT_BLEEDING_RATE, LARGE_CUT_BLEEDING_RATE, MISSING_FLESH_BLEEDING_RATE, EXPLOSION_WOUND_BLEEDING_RATE, BRUISES_WOUND_BLEEDING_RATE] + +// If you add new injures, they should be added to this as well +#define FIND_BLEEDING_RATE(TYPE) call {private '_foundInjuryType_FIND_BLEEDING_RATE';\ +_foundInjuryType_FIND_BLEEDING_RATE = ALL_WOUNDS find TYPE; \ +if (_foundType != -1) then { \ + ALL_POSSIBLE_BLEEDING_RATES select _foundType; \ +} else { 0; }; }; + diff --git a/addons/medical/script_component.hpp b/addons/medical/script_component.hpp index ad45e06a3e..910ccadf96 100644 --- a/addons/medical/script_component.hpp +++ b/addons/medical/script_component.hpp @@ -10,3 +10,6 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" + +// Includes the possible injury types for medium and advanced medical +#include "injury_defines.hpp"