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- Tweak Wound Blood Loss and generation #10528

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a38767b
initial commit
Cplhardcore Nov 5, 2024
4f03f3c
Update CfgVehicles.hpp
Cplhardcore Nov 5, 2024
2d0f1a9
Merge branch 'master' into Damage-Rework
Cplhardcore Nov 5, 2024
71daaa7
Missing curly bracket
Cplhardcore Nov 5, 2024
434f709
another one
Cplhardcore Nov 5, 2024
9243175
small fix
Cplhardcore Nov 5, 2024
c6effc9
Small fixes
Cplhardcore Nov 5, 2024
305654d
Update addons/medical_engine/functions/fnc_handleDamage.sqf
Cplhardcore Nov 5, 2024
822019f
Multiple fixes
Cplhardcore Nov 5, 2024
97c9fd4
Merge branch 'Damage-Rework' of https://github.com/Cplhardcore/ACE3 i…
Cplhardcore Nov 5, 2024
f4f3905
Fixing stringtables
Cplhardcore Nov 5, 2024
7c78535
Update addons/medical_gui/functions/fnc_updateBodyImage.sqf
Cplhardcore Nov 5, 2024
2aeda77
Update addons/medical_engine/functions/fnc_handleDamage.sqf
Cplhardcore Nov 5, 2024
0737077
Fixes
Cplhardcore Nov 5, 2024
799c794
Merge branch 'Damage-Rework' of https://github.com/Cplhardcore/ACE3 i…
Cplhardcore Nov 5, 2024
b6b1225
Adds switching to keypresses
Cplhardcore Nov 5, 2024
5b8e144
Adds a GET_BODYPART_DAMAGE macro, i think
Cplhardcore Nov 5, 2024
6fbea5a
small fix
Cplhardcore Nov 5, 2024
fd4c4cd
Fixing fractures
Cplhardcore Nov 5, 2024
9961493
GUI update
Cplhardcore Nov 6, 2024
1810f08
Hemtt suggestions
Cplhardcore Nov 8, 2024
7270e8d
Update fnc_updateBodyImage.sqf
Cplhardcore Nov 15, 2024
ac42769
Update script_component.hpp
Cplhardcore Nov 15, 2024
4b119bf
Update addons/medical_engine/functions/fnc_handleDamage.sqf
Cplhardcore Nov 16, 2024
263fbca
Merge branch 'Damage-Rework' of https://github.com/Cplhardcore/ACE3 i…
Cplhardcore Nov 16, 2024
ef08054
Update fnc_woundsHandlerBase.sqf
Cplhardcore Nov 16, 2024
3c906ce
GUI fixes
Cplhardcore Nov 17, 2024
09db653
Update fnc_woundsHandlerBase.sqf
Cplhardcore Nov 17, 2024
2b93099
Small fixed
Cplhardcore Nov 30, 2024
02e526b
Damage Handlers
Cplhardcore Nov 30, 2024
f7427fa
Small changes
Cplhardcore Dec 1, 2024
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
54 changes: 47 additions & 7 deletions addons/interaction/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,56 +172,96 @@ class CfgVehicles {

class ACE_Torso {
displayName = CSTRING(Torso);
selection = "spine1";
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_Chest {
displayName = CSTRING(Chest);
selection = "spine3";
distance = 1.50;
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_Head {
displayName = CSTRING(Head);
selection = "pilot";
distance = 1.50;
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_ArmLeft {
displayName = CSTRING(ArmLeft);
selection = "LWrist";
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_ArmUpperLeft {
displayName = CSTRING(ArmUpperLeft);
selection = "LeftForeArm";
distance = 1.50;
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_ArmRight {
displayName = CSTRING(ArmRight);
selection = "RWrist";
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_ArmUpperRight {
displayName = CSTRING(ArmUpperRight);
selection = "RightForeArm";
distance = 1.50;
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_LegLeft {
displayName = CSTRING(LegLeft);
selection = "LeftFoot";
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_LegUpperLeft {
displayName = CSTRING(LegUpperLeft);
selection = "LKnee";
distance = 1.50;
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_LegRight {
displayName = CSTRING(LegRight);
selection = "RightFoot";
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_LegUpperRight {
displayName = CSTRING(LegUpperRight);
selection = "RKnee";
distance = 1.50;
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
};
class ACE_Weapon {
displayName = CSTRING(Weapon);
position = QUOTE(call DFUNC(getWeaponPos));
distance = 1.50;
distance = 1.5;
condition = "";
statement = "";
exceptions[] = {"isNotSwimming"};
Expand Down
15 changes: 15 additions & 0 deletions addons/interaction/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
<Chinese>身體</Chinese>
<Turkish>Gövde</Turkish>
</Key>
<Key ID="STR_ACE_Interaction_Chest">
<English>Chest</English>
</Key>
<Key ID="STR_ACE_Interaction_Head">
<English>Head</English>
<French>Tête</French>
Expand Down Expand Up @@ -85,6 +88,9 @@
<Chinese>左手</Chinese>
<Turkish>Sol Kol</Turkish>
</Key>
<Key ID="STR_ACE_Interaction_ArmUpperLeft">
<English>Upper Left Arm</English>
</Key>
<Key ID="STR_ACE_Interaction_ArmRight">
<English>Right Arm</English>
<German>Rechter Arm</German>
Expand All @@ -102,6 +108,9 @@
<Chinese>右手</Chinese>
<Turkish>Sağ Kol</Turkish>
</Key>
<Key ID="STR_ACE_Interaction_ArmUpperRight">
<English>Upper Right Arm</English>
</Key>
<Key ID="STR_ACE_Interaction_LegLeft">
<English>Left Leg</English>
<German>Linkes Bein</German>
Expand All @@ -119,6 +128,9 @@
<Chinese>左腳</Chinese>
<Turkish>Sol Bacak</Turkish>
</Key>
<Key ID="STR_ACE_Interaction_LegUpperLeft">
<English>Upper Left Leg</English>
</Key>
<Key ID="STR_ACE_Interaction_LegRight">
<English>Right Leg</English>
<German>Rechtes Bein</German>
Expand All @@ -136,6 +148,9 @@
<Chinese>右腳</Chinese>
<Turkish>Sağ Bacak</Turkish>
</Key>
<Key ID="STR_ACE_Interaction_LegUpperRight">
<English>Upper Right Leg</English>
</Key>
<Key ID="STR_ACE_Interaction_Weapon">
<English>Weapon</English>
<French>Arme</French>
Expand Down
2 changes: 1 addition & 1 deletion addons/medical/dev/test_hitpointConfigs.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private _testPass = true;
private _typeOf = configName _x;
if (_typeOf == "") then { continue };
private _hitpoints = (configProperties [_x >> "HitPoints", "isClass _x", true]) apply {toLowerANSI configName _x};
private _expectedHitPoints = ["hitleftarm","hitrightarm","hitleftleg","hitrightleg","hithead","hitbody"];
private _expectedHitPoints = ["hitleftarm","hitrightarm","hitleftleg","hitrightleg","hitbody","hithead","hitneck","hitabdomen"];
private _missingHitPoints = _expectedHitPoints select {!(_x in _hitpoints)};
if (_missingHitPoints isNotEqualTo []) then {
WARNING_3("%1 missing ace hitpoints: %2 - class hitpoints: %3",_typeOf,_missingHitPoints,_hitpoints);
Expand Down
2 changes: 1 addition & 1 deletion addons/medical/dev/watchVariable.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ GVAR(dev_watchVariableRunning) = true;
_return pushBack format [" - [Pain: %1] [Suppress: %2]", _pain toFixed 3, _painSuppress toFixed 3];

// Damage:
private _damage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
private _damage = GET_BODYPART_DAMAGE(unit);
private _limping = ["", "[<t color ='#FFCC22'> Limping </t>]"] select (_unit getVariable [QEGVAR(medical,isLimping), false]);
_return pushBack format ["BodyPartDamage: [H: %1] [B: %2]", (_damage select 0) toFixed 2, (_damage select 1) toFixed 2];
_return pushBack format ["[LA:%1] [RA: %2] [LL:%3] [RL: %4]", (_damage select 2) toFixed 2, (_damage select 3) toFixed 2, (_damage select 4) toFixed 2, (_damage select 5) toFixed 2];
Expand Down
6 changes: 3 additions & 3 deletions addons/medical/functions/fnc_addDamageToUnit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ if (!_overrideInvuln && {!((isDamageAllowed _unit) && {_unit getVariable [QEGVAR
};

// Extension is case sensitive and expects this format (different from ALL_BODY_PARTS)
_bodyPart = ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"] select _bodyPartIndex;
_bodyPart = ["_Head", "_Neck", "_Chest", "_Body", "_LeftArm", "_LeftUpperArm", "_RightArm", "_RightUpperArm", "_LeftLeg", "_LeftUpperLeg", "_RightLeg", "_RightUpperLeg"] select _bodyPartIndex;

if (!isNull _instigator) then {
_unit setVariable [QEGVAR(medical,lastDamageSource), _instigator];
_unit setVariable [QEGVAR(medical,lastInstigator), _instigator];
};

#ifdef DEBUG_TESTRESULTS
private _startDmg = +(_unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]]);
private _startDmg = +(GET_BODYPART_DAMAGE(unit) ;);
private _startPain = GET_PAIN(_unit);
#endif

[QEGVAR(medical,woundReceived), [_unit, [[_damageToAdd, _bodyPart, _damageToAdd]], _instigator, _typeOfDamage]] call CBA_fnc_localEvent;

#ifdef DEBUG_TESTRESULTS
private _endDmg = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
private _endDmg = GET_BODYPART_DAMAGE(unit);
private _endPain = GET_PAIN(_unit);
private _typeOfDamageAdj = _typeOfDamage call EFUNC(medical_damage,getTypeOfDamage);
private _config = configFile >> "ACE_Medical_Injuries" >> "damageTypes" >> _typeOfDamageAdj;
Expand Down
2 changes: 1 addition & 1 deletion addons/medical/functions/fnc_deserializeState.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private _state = [_json] call CBA_fnc_parseJSON;
[QEGVAR(medical,ivBags), nil],
[QEGVAR(medical,triageLevel), 0],
[QEGVAR(medical,triageCard), []],
[QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]]
[QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0,0,0,0,0,0,0]]
// Offset needs to be converted
// [VAR_MEDICATIONS, []]
];
Expand Down
2 changes: 1 addition & 1 deletion addons/medical/functions/fnc_serializeState.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private _state = [] call CBA_fnc_createNamespace;
[QEGVAR(medical,ivBags), nil],
[QEGVAR(medical,triageLevel), 0],
[QEGVAR(medical,triageCard), []],
[QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]]
[QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0,0,0,0,0,0,0]]
// Time needs to be converted
// [VAR_MEDICATIONS, []]
];
Expand Down
15 changes: 12 additions & 3 deletions addons/medical_damage/ACE_Medical_Injuries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ACE_Medical_Injuries {
};
// Occur when an entire structure or part of it is forcibly pulled away, such as the loss of a permanent tooth or an ear lobe. Explosions, gunshots, and animal bites may cause avulsions.
class Avulsion {
bleeding = 0.1;
bleeding = 0.07;
pain = 1.0;
causeLimping = 1;
};
Expand All @@ -23,7 +23,7 @@ class ACE_Medical_Injuries {
};
// Occur when a heavy object falls onto a person, splitting the skin and shattering or tearing underlying structures.
class Crush {
bleeding = 0.05;
bleeding = 0.04;
pain = 0.8;
causeLimping = 1;
causeFracture = 1;
Expand All @@ -40,7 +40,7 @@ class ACE_Medical_Injuries {
};
// Also called velocity wounds, they are caused by an object entering the body at a high speed, typically a bullet or small peices of shrapnel.
class VelocityWound {
bleeding = 0.2;
bleeding = 0.15;
pain = 0.9;
causeLimping = 1;
causeFracture = 1;
Expand Down Expand Up @@ -133,9 +133,18 @@ class ACE_Medical_Injuries {
// explosives create more and smaller wounds than grenades
thresholds[] = {{20, 15}, {8, 7}, {2, 3}, {1.2, 2}, {0.4, 1}, {0,0}};
selectionSpecific = 0;
class woundHandlers: woundHandlers {
GVAR(woundsHandlerExplosion) = QFUNC(woundsHandlerExplosion);
};
class Avulsion {
weighting[] = {{1, 1}, {0.8, 0}};
};
class VelocityWound {
weighting[] = {{1, 1}, {0.8, 0}};
};
class PunctureWound {
weighting[] = {{1, 1}, {0.8, 0}};
};
class Cut {
weighting[] = {{1.5, 0}, {0.35, 1}, {0, 0}};
};
Expand Down
1 change: 1 addition & 0 deletions addons/medical_damage/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ PREP(parseWoundHandlersCfg);
PREP(woundReceived);
PREP(woundsHandlerBase);
PREP(woundsHandlerBurning);
PREP(woundsHandlerExplosion);
PREP(woundsHandlerVehiclecrash);
PREP(woundsHandlerVehiclehit);
4 changes: 2 additions & 2 deletions addons/medical_damage/functions/fnc_handleIncapacitation.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
params ["_unit"];

private _painLevel = GET_PAIN_PERCEIVED(_unit);
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
private _bodyPartDamage = GET_BODYPART_DAMAGE(unit);

_bodyPartDamage params ["_headDamage", "_bodyDamage"];
_bodyPartDamage params ["_headDamage", "_neckDamage", "_chestDamage","_bodyDamage"];

// Exclude non penetrating body damage
{
Expand Down
28 changes: 21 additions & 7 deletions addons/medical_damage/functions/fnc_woundsHandlerBase.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,28 @@ private _createdWounds = false;
private _updateDamageEffects = false;
private _painLevel = 0;
private _criticalDamage = false;
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
private _bodyPartDamage = GET_BODYPART_DAMAGE(unit);
private _bodyPartVisParams = [_unit, false, false, false, false]; // params array for EFUNC(medical_engine,updateBodyPartVisuals);

// process wounds separately for each body part hit
{ // forEach _allDamages
_x params ["_damage", "_bodyPart"];
_bodyPart = toLowerANSI _bodyPart;

if (_typeOfDamage != "explosive") then {
if (_bodyPart == "head") then {
private _isNeck = (random 1) < 0.1; // 10% chance for neck damage
_bodyPart = ["head", "neck"] select (_isNeck);
};
if (_bodyPart in ["leftarm", "rightarm", "leftleg", "rightleg"]) then {
private _isUpper = (random 1) < 0.5;
switch (_bodyPart) do {
case "leftarm": { _bodyPart = ["leftarm", "upperleftarm"] select (_isUpper); };
case "rightarm": { _bodyPart = ["rightarm", "upperrightarm"] select (_isUpper); };
case "leftleg": { _bodyPart = ["leftleg", "upperleftleg"] select (_isUpper); };
case "rightleg": { _bodyPart = ["rightleg", "upperrightleg"] select (_isUpper); };
};
};
};
// silently ignore structural damage
if (_bodyPart == "#structural") then {continue};

Expand Down Expand Up @@ -87,15 +101,15 @@ private _bodyPartVisParams = [_unit, false, false, false, false]; // params arra
private _woundClassIDToAdd = GVAR(woundClassNames) find _woundTypeToAdd;

// Add a bit of random variance to wounds
private _woundDamage = _dmgPerWound * _dmgMultiplier * random [0.9, 1, 1.1];
private _woundDamage = _dmgPerWound * _dmgMultiplier * random [0.7, 1, 1.5];

_bodyPartDamage set [_bodyPartNToAdd, (_bodyPartDamage select _bodyPartNToAdd) + _woundDamage];
_bodyPartVisParams set [[1,2,3,3,4,4] select _bodyPartNToAdd, true]; // Mark the body part index needs updating
_bodyPartVisParams set [[1,1,1,2,2,2,3,3,3,4,4,4] select _bodyPartNToAdd, true]; // Mark the body part index needs updating

// Anything above this value is guaranteed worst wound possible
private _worstDamage = 2;

#define LARGE_WOUND_THRESHOLD 0.5
#define LARGE_WOUND_THRESHOLD 0.9

// Config specifies bleeding and pain for worst possible wound
// Worse wound correlates to higher damage, damage is not capped at 1
Expand All @@ -116,7 +130,7 @@ private _bodyPartVisParams = [_unit, false, false, false, false]; // params arra
// Create a new injury. Format [0:classComplex, 1:amountOf, 2:bleedingRate, 3:woundDamage]
private _injury = [_classComplex, 1, _bleeding, _woundDamage];

if (_bodyPart isEqualTo "head" || {_bodyPart isEqualTo "body" && {_woundDamage > PENETRATION_THRESHOLD}}) then {
if (_bodyPart in ["head", "body", "neck", "chest"] && {_woundDamage > PENETRATION_THRESHOLD}) then {
_criticalDamage = true;
};
if ([_unit, _bodyPartNToAdd, _bodyPartDamage, _woundDamage] call FUNC(determineIfFatal)) then {
Expand All @@ -134,7 +148,7 @@ private _bodyPartVisParams = [_unit, false, false, false, false]; // params arra
case (
_causeFracture
&& {EGVAR(medical,fractures) > 0}
&& {_bodyPartNToAdd > 1}
&& {_bodyPartNToAdd > 3}
&& {_woundDamage > FRACTURE_DAMAGE_THRESHOLD}
&& {random 1 < (_fractureMultiplier * EGVAR(medical,fractureChance))}
): {
Expand Down
Loading
Loading