kts.ThrowOrShoot

Name

kts.ThrowOrShoot – throw or shoot held item (e.g. axe or crossbow)

Synopsis

kts.ThrowOrShoot()

result = kts.Can_ThrowOrShoot()

Description

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.

Return Value

kts.ThrowOrShoot() returns nothing, and kts.Can_ThrowOrShoot() returns a boolean as described above.

Notes

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.

Examples

For examples see the definition of the axe or crossbow in items.lua.

See Also

The cxt table

kts.Control

kts.Throw