Partially dehardcode on-hit mechanics
!4334 (merged) moves a part of C++ on-hit mechanics to Lua by adding a Lua hit event handler as an intermediate layer between hits and physical application of damage as a part of the new combat interface. This will let OpenMW-Lua-reliant mods and games catch attack events and e.g. adjust their results before they're applied or override the built-in handler altogether. The scope of the dehardcoding currently includes:
- Armor handling (rating, condition, hit sound, skill progression)
- Difficulty handling
- Blood VFX spawning (for which it necessarily exposes the actor's blood type)
- Miss sound playback
- Shield hit redistribution option (originally copied from Morrowind Code Patch, was not optional)
- Creature armor damage fix option (originally copied from MCP, was optional)
Parts of new interface such as the armor rating calculations are used by the GUI but are tentatively not used by autoequip and AI.
The built-in scripting currently does not handle these parts of on-hit mechanics which will presently remain on the C++ side:
- AI/crime reactions (friendly fire, assault, murder)
- mwscript OnPCHitMe script variable assignment
- Physical application of damage
- Grunts
- Stagger/knockdown
- Enabling player hit overlay
- Werewolf kills