controls.use = 4 sometimes semi-freezes the game
Issue Description
Setting controls.use to 4 (Thrust attack) on an actor in Lua SOMETIMES results in an engine error due to this line of code since in one of the execution paths a bit op results in 4 being transformed to 5, which starts spamming this error:
[11:32:44.436 E] Error in frame: Invalid attack type value: 5
From a user side of things - visually this looks like game is frozen, BUT all menus work, as well as (i think) VFX. So its more akin to game time scale being set to 0.
Steps to Reproduce
I don't have a very good reproduction setup unfortunately as I havent had time to make one, neither I really know how to make one since the issue is somewhat random on a user side, but im sure that for someone who's familiar with that part of code it will be obvious when the issue will be triggered.
I received a report of it from people using Mercy potentially in combination with some other mods that affect controls.use, it is still unclear if Mercy on its own causes this issue (I know im being very vague, sorry). Issue happened while user was fighting a large group of ordinators, my guess will be that one need to fight a good group of spearmen (to maximise amount of thrusting attacks) to have a chance of encountering this. Once again it does not happen on EVERY thrust attack, otherwise would've been spotted much earlier. Alternatively, instead of seeking a big group of thrusters you can change this line in Mercy to
state.attack = 4
To make every enemy use thrust attacks (state.attack is later fed directly into controls.use
System Information
- OpenMW Version: Latest 0.51
PS
This bug is essentially a side effect of my old MR !4187 (merged) where I simply didnt understand the intention of that line and skipped over it. Line of code in question was working fine when only 2 values possible were 0 and 1, but with extended range of values everything gets messed up.