Automatically fill the "item" field of the arrow luaentity if not existing

This commit is contained in:
upsilon 2017-06-21 10:51:20 +02:00
parent d7fae754f9
commit df73f47285
No known key found for this signature in database
GPG Key ID: A80DAE1F266E1C3C
1 changed files with 3 additions and 0 deletions

View File

@ -47,6 +47,9 @@ local function shoot_arrow(itemstack, player, throw_itself)
local luaentity = obj:get_luaentity()
luaentity.player = player:get_player_name()
if not luaentity.item then
luaentity.item = arrow
end
if luaentity.on_throw then
if luaentity.on_throw(pos, player, ((player:get_wield_index()+1) % inventory:get_size("main")) + 1, luaentity.data, luaentity) == false then