Skip to content

Conversation

@lambdatiger
Copy link

@lambdatiger lambdatiger commented Oct 8, 2024

When merged, this PR will

  • Removes code references to a modified version of _realDamage. _realDamage is the calculated damage caused by a bullet (_newDamage = _bulletDamage/_armor), a number unrelated to the value of the "new" armor.
    • Note that currently _modifiedRealDamage = _newDamage * _armor * _armor / _armor<Min/Max>
  • Replaces multiple occurrences of recalculating _realDamage in place of the variable

Without this PR, armor that is being adjusted down in value will create a large _modifiedRealDamage, making it appear as if armor that absorbed more damage.

Copy link
Owner

@johnb432 johnb432 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this PR, armor that is being adjusted down in value will create a large _modifiedRealDamage, making it appear as if armor that absorbed more damage.

Why is that a bad thing?

[_damageRightLeg select 0, PRIORITY_RIGHT_LEG, _damageRightLeg select 1, "RightLeg", _damageRightLeg param [2, _damageRightLeg select 0], _damageRightLeg param [3, _damageRightLeg select 1]],
[_damageStructural select 0, PRIORITY_STRUCTURAL, _damageStructural select 1, "#structural", _damageStructural param [2, _damageStructural select 0], _damageStructural param [3, _damageStructural select 1]]
// Real damage, Damage (with armor), Modified damage (with armor)
[_damageHead select 0, PRIORITY_HEAD, _damageHead select 1, "Head", _damageHead param [2, _damageHead select 1]],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you fail to get _modifiedRealDamage from a body part, you are going to get _newDamage instead?

The reason I added the param is in case other mods decide to set the array length at 2, they would be overwriting the changes done by this mod. Using _newDamage makes no sense when _realDamage is available - it's better to have no effect than a weird side effect.

case (_armorMin >= 1 && {_armor < _armorMin}): {
// This will decrease damage
_modifiedNewDamage = _newDamage * _armor / _armorMin;
_modifiedRealDamage = _realDamage * _armor / _armorMin;
Copy link
Owner

@johnb432 johnb432 Oct 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why I added this is because there are instances where shooting e.g. at the torso would trigger damage on limbs. The problem was (can't reproduce it in 2.18) that the adjusted damage of the torso was lower than the damage done to the limbs, so the wounds would appear on the limbs and not the torso.

As said, I can't reproduce it anymore, but I'm not comfortable removing it just yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants