kts.HOOK_MISSILE_MISS – function called when a bolt or dagger misses its target
kts.HOOK_MISSILE_MISS = function() ... end
If kts.HOOK_MISSILE_MISS
is non-nil, then it is called as a Lua function (with no parameters) whenever a dagger or crossbow bolt "misses" its target – either because it ran out of range, or because it ran into an obstacle such as a wall.
During the function call, the cxt table will be available; for example, cxt.pos
will give the position of the missile.
In the standard Knights data files, this hook is used to play the sound effect that is heard when a dagger or bolt hits a wall (or otherwise misses its target and drops to the floor). The code for this is in sounds.lua.
Other modules could replace the kts.HOOK_MISSILE_MISS
function (or any of the other "hook" functions) with their own code if desired.