kts.ThrowOrShoot – throw or shoot held item (e.g. axe or crossbow)
kts.ThrowOrShoot()
result = kts.Can_ThrowOrShoot()
Calling kts.ThrowOrShoot()
will cause the current actor (cxt.actor
) to either throw (as in an axe) or shoot (as in a crossbow) the item currently held in their hands, if this is possible.
Calling kts.Can_ThrowOrShoot()
returns true if throwing or shooting is currently possible (i.e. the actor is carrying a suitable item and all other conditions are met), or false otherwise.
kts.ThrowOrShoot()
returns nothing, and kts.Can_ThrowOrShoot()
returns a boolean as described above.
Throwing or shooting will not be possible if the actor is currently approaching a tile (like a door or chest tile).
kts.ThrowOrShoot
and kts.Can_ThrowOrShoot
are usually used as the action
and possible
functions of a Control, respectively. In particular this Control will usually be attached to the item type that is to be thrown or shot.
For examples see the definition of the axe or crossbow in items.lua.