Skip to content

Commit

Permalink
address some of the lazy bits
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkIsGrim committed Nov 2, 2024
1 parent 9dba37f commit 219d91d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
4 changes: 2 additions & 2 deletions addons/medical_damage/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -848,15 +848,15 @@
<Russian>Использовать урон конечностям</Russian>
</Key>
<Key ID="STR_ACE_Medical_Damage_uselimbDamage_Description">
<English>Controls whether limb damage is taken into account for fatality and unconsciousness calculations.</English>
<English>Controls whether limb damage is taken into account for sum of trauma calculations.</English>
<Russian>Определяет, учитывается ли повреждение конечностей при расчете смертности и потери сознания.</Russian>
</Key>
<Key ID="STR_ACE_Medical_Damage_limbDamageThreshold_DisplayName">
<English>Limb Damage Threshold</English>
<Russian>Порог повреждения конечностей</Russian>
</Key>
<Key ID="STR_ACE_Medical_Damage_limbDamageThreshold_Description">
<English>Sets the amount of damage a limb can receive before going critical (leading to unconsciousness, or death if "Sum of Trauma" is enabled).\nDoes nothing if the "Use Limb Damage" setting is disabled.</English>
<English>Sets the amount of damage limbs can receive before going critical, leading to death. Must be over 0 for any effect.\nRequires the "Use Limb Damage" setting to be enabled and "Fatal Damage Source" to be set to "Sum of Trauma" or "Either".\nStacks multiplicatively with the overall unit Damage Threshold. Doesn't interact with fractures/limping at all.</English>
<Russian>Устанавливает величину урона, который может получить конечность, прежде чем он станет критическим (приводит к потере сознания или смерти, если включена "Сумма травм").\nНичего не делает, если настройка "Использовать урон конечностям" отключена.</Russian>
</Key>
</Package>
Expand Down
14 changes: 12 additions & 2 deletions addons/medical_gui/functions/fnc_updateBodyImage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,22 @@ private _bodyPartBloodLoss = [0, 0, 0, 0, 0, 0];
[_bloodLoss] call FUNC(bloodLossToRGBA);
} else {
private _damage = _bodyPartDamage select _forEachIndex;
// _damageThreshold here indicates how close unit is to guaranteed death via sum of trauma, so use the same multipliers used in medical_damage/functions/fnc_determineIfFatal.sqf
// TODO: make multipliers for head and torso a macro in medical_engine/script_macros_medical.hpp
switch (true) do { // torso damage threshold doesn't need scaling
case (_forEachIndex > 3): { // legs: index 4 & 5
_damageThreshold = LIMPING_DAMAGE_THRESHOLD * 4;
if (!EGVAR(medical,useLimbDamage) || EGVAR(medical,limbDamageThreshold) == 0) then { // Just indicate how close to the limping threshold we are
_damageThreshold = LIMPING_DAMAGE_THRESHOLD * 4;
} else {
_damageThreshold = _damageThreshold * EGVAR(medical,limbDamageThreshold);
};
};
case (_forEachIndex > 1): { // arms: index 2 & 3
_damageThreshold = FRACTURE_DAMAGE_THRESHOLD * 4;
if (!EGVAR(medical,useLimbDamage) || EGVAR(medical,limbDamageThreshold) == 0) then { // Just indicate how close to the fracture threshold we are
_damageThreshold = FRACTURE_DAMAGE_THRESHOLD * 4;
} else {
_damageThreshold = _damageThreshold * EGVAR(medical,limbDamageThreshold);
};
};
case (_forEachIndex == 0): { // head: index 0
_damageThreshold = _damageThreshold * 1.25;
Expand Down
13 changes: 11 additions & 2 deletions addons/medical_gui/functions/fnc_updateInjuryList.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,18 @@ if (GVAR(showDamageEntry)) then {
private _damageThreshold = GET_DAMAGE_THRESHOLD(_target);
switch (true) do {
case (_selectionN > 3): { // legs: index 4 & 5
_damageThreshold = LIMPING_DAMAGE_THRESHOLD * 4;
if (!EGVAR(medical,useLimbDamage) || EGVAR(medical,limbDamageThreshold) == 0) then { // Just indicate how close to the limping threshold we are
_damageThreshold = LIMPING_DAMAGE_THRESHOLD * 4;
} else {
_damageThreshold = _damageThreshold * EGVAR(medical,limbDamageThreshold);
};
};
case (_selectionN > 1): { // arms: index 2 & 3
_damageThreshold = FRACTURE_DAMAGE_THRESHOLD * 4;
if (!EGVAR(medical,useLimbDamage) || EGVAR(medical,limbDamageThreshold) == 0) then { // Just indicate how close to the fracture threshold we are
_damageThreshold = FRACTURE_DAMAGE_THRESHOLD * 4;
} else {
_damageThreshold = _damageThreshold * EGVAR(medical,limbDamageThreshold);
};
};
case (_selectionN == 0): { // head: index 0
_damageThreshold = _damageThreshold * 1.25;
Expand All @@ -180,6 +188,7 @@ if (GVAR(showDamageEntry)) then {
_damageThreshold = _damageThreshold * 1.5;
};
};
// _bodyPartDamage here should indicate how close unit is to guaranteed death via sum of trauma, so use the same multipliers used in medical_damage/functions/fnc_determineIfFatal.sqf
_bodyPartDamage = (_bodyPartDamage / _damageThreshold) min 1;
switch (true) do {
case (_bodyPartDamage isEqualTo 1): {
Expand Down

0 comments on commit 219d91d

Please sign in to comment.