* [Native American Village](https://github.com/Steamed-Punk/Native-American-Village), by Steamed-Punk, adds, among many other various items, a tomahawk that can be thrown.
function throwing.register_arrow(name, definition table)
--[[
Name: Arrow name. If it doesn't contain ":", the "throwing:" prefix will be added.
Definition: definition table, containing:
* tiles (essential): tiles of the arrow.
* target (optional, defaulting to throwing.target_both): what the arrow is able to hit (throwing.target_node, throwing.target_object, throwing.target_both).
* allow_protected (optional, defaulting to false): whether the arrow can be throw in a protected area
* on_hit_sound (optional): sound played when the arrow hits a node or an object.
* on_hit(self, pos, last_pos, node, object, hitter, data) (optional but very useful): callback function:
- pos: the position of the hit node or object.
- last_pos: the last air node where the arrow was
- node and object: hit node or object. Either node or object is nil, depending
whether the arrow hit a node or an object.
- hitter: an ObjectRef to the thrower player.
- data: a data table associated to the entity where you can store what you want
- self: the arrow entity table (it allows you to hack a lot!)
- pos: the position from where the arrow is throw (which a bit higher than the hitter position)
- thrower: an ObjectRef to the thrower player
- next_index: the index next to the arrow in the "main" inventory
- data: a data table associated to the entity where you can store what you want
- self: the arrow entity table
- If the arrow shouldn't be thrown, it should return false.
* on_throw_sound (optional, there is a default sound, specify "" for no sound): sound to be played when the arrow is throw
* on_hit_fails(self, pos, thrower, data) (optional): callback function called if the hit failed (e.g. because on_hit returned false or because the area was protected)
If the item to throw is an arrow registered using `throwing.register_arrow`, the entity used will be the entity automatically registered by this function.
Otherwise, if its definition contains a `throwing_entity` field, this field will be used as the entity name if it is a string, otherwise it will be called as a `function(pos, player)` that has to spawn the object and return the corresponding ObjectRef.
If the item is neither an arrow nor has a `throwing_entity` field, the corresponding `__builtin:item` will be used.