mirror of
https://github.com/minetest-mods/throwing.git
synced 2025-07-05 09:50:24 +02:00
Many things:
* Use global variable throwing.modname instead of local modname * Use minetest.place_node instead of minetest.set_node for torch arrow and build arrow * Add an error return value to the on_hit function
This commit is contained in:
@ -54,6 +54,8 @@ On_hit: callback function: on_hit(pos, last_pos, node, object, hitter) where:
|
||||
whether the arrow hitted a node or an object (you should always check for that).
|
||||
An object can be a player or a luaentity.
|
||||
* Hitter: the ObjectRef of the player who throwed the arrow.
|
||||
* When it fails, it should return:
|
||||
false[, reason]
|
||||
]]
|
||||
|
||||
-- Examples:
|
||||
@ -74,6 +76,10 @@ function(pos, last_pos, node, object, hitter)
|
||||
if not node then
|
||||
return
|
||||
end
|
||||
minetest.set_node(last_pos, {name="default:obsidian_glass"})
|
||||
|
||||
if minetest.is_protected(last_pos) then
|
||||
return false, "Area is protected"
|
||||
end
|
||||
return minetest.place_node(last_pos, {name="default:obsidian_glass"})
|
||||
end)
|
||||
```
|
||||
|
Reference in New Issue
Block a user