kts.HOOK_SHOOT

Name

kts.HOOK_SHOOT – function called when a crossbow bolt is shot

Synopsis

kts.HOOK_SHOOT = function() ... end

Description

If kts.HOOK_SHOOT is non-nil, then it is called as a Lua function (with no parameters) whenever a knight shoots a crossbow bolt.

During the function call, the cxt table will be available; for example, cxt.pos will give the position of the knight.

Examples

In the standard Knights data files, this hook is used to play the sound effect for the crossbow. The code for this is in sounds.lua.

Other modules could replace the kts.HOOK_SHOOT function (or any of the other "hook" functions) with their own code if desired.

See Also

kts.HOOK_MISSILE_MISS