I tried to make a sniper zoom out when it's held. I can do this by checking if the player's inventory has the sniper and setting a variable whenever the player switches to it, or some other gun.
It works almost perfectly, except that the scroll wheel breaks it. Players can switch to the sniper with number keys, and switch to some other gun with scroll wheel. The zoom will stay the same.
It would be nice if we could have:
- Mouse event trigger actions like we have for the keyboard keys
- or maybe just a way to set a variable to the right mouse button and scroll wheel states.