kts.HOOK_WEAPON_DOWNSWING - function called when a knight swings a weapon
kts.HOOK_WEAPON_DOWNSWING = function() ... end
If kts.HOOK_WEAPON_DOWNSWING
is non-nil, then it is called as a Lua function (with no parameters) whenever a knight swings a weapon (e.g. sword, hammer, axe). Specifically, it is called at the point where the "downswing" animation frame is first displayed.
During the function call, the cxt table will be available; for example, cxt.pos
will give the position of the knight.
In the standard Knights data files, this hook is used to play the "swoosh" sound that is heard when knights swing their swords. The code for this is in sounds.lua.
Other modules could replace kts.HOOK_WEAPON_DOWNSWING
(or any of the other "hook" functions) with their own code if desired.