Wind-up strength hit parameter (as opposed to attack strength)

Issue Description

In the Lua API, AttackInfo.strength is always 0 regardless of how far the character actually pulls back the weapon: https://openmw.readthedocs.io/en/latest/reference/lua-scripting/interface_combat.html##(AttackInfo)

There is no current, linear way to get the attack "wind up" percentage. It should be available regardless of if the attack dice roll succeeds or fails and should be.

The specific line in question as the root cause is: https://gitlab.com/OpenMW/openmw/-/blob/master/apps/openmw/mwmechanics/character.cpp#L1265

However, the vanilla functionality for playing the swoosh sound relies on this member property. I propose playSwishSound has its parameter list modified to accept the "attack strength" and not rely on the mAttackStrength property. This way, the Lua API can receive the correct attack strength, and the swish sound can stay true to the vanilla mechanics. Then, the setting of mAttackStrength to 0 for a missed melee attack can be removed entirely.

The use case for this is being able to properly override the melee hit mechanics in Lua - which currently cannot be done due to attack strength not sending for unsuccessful hits.

This should be a very small, simple MR; but I'm looking for any comments/discussions and opinions on this before blindly opening one.

Steps to Reproduce

CombatInterface.addOnHitHandler(function(attackData)
  print(attackData.strength)
  return attackData
end)

System Information

  • OpenMW Version: 0.52 (latest master at the time of this report)
  • Are you using mods? No
  • Are you using any shader mods? No
  • Does it happen in a clean vanilla install? N/A
Edited by Cole Green