mirror of
https://github.com/minetest-mods/throwing.git
synced 2025-07-05 01:40:27 +02:00
Check for the presence of a throwing_entity field in item definition table
This commit is contained in:
6
init.lua
6
init.lua
@ -27,6 +27,12 @@ local function shoot_arrow(itemstack, player)
|
||||
local obj
|
||||
if throwing.is_arrow(arrow) then
|
||||
obj = minetest.add_entity(pos, arrow.."_entity")
|
||||
elseif minetest.registered_items[arrow].throwing_entity then
|
||||
if type(minetest.registered_items[arrow].throwing_entity) == "string" then
|
||||
obj = minetest.add_entity(pos, minetest.registered_items[arrow].throwing_entity)
|
||||
else -- Type is a function
|
||||
obj = minetest.registered_items[arrow].throwing_entity(pos, player)
|
||||
end
|
||||
else
|
||||
obj = minetest.add_entity(pos, "__builtin:item", arrow)
|
||||
end
|
||||
|
Reference in New Issue
Block a user