on_throw callback: Add a modulo by the main list size to calculate next_index

This commit is contained in:
upsilon 2017-01-17 19:16:19 +01:00
parent 2331ccf9b4
commit 9179e12936

View File

@ -21,7 +21,7 @@ local function shoot_arrow(itemstack, player)
luaentity.player = player:get_player_name()
if luaentity.on_throw then
if luaentity.on_throw(pos, player, player:get_wield_index()+2, luaentity.data, luaentity) == false then
if luaentity.on_throw(pos, player, ((player:get_wield_index()+1) % inventory:get_size("main")) + 1, luaentity.data, luaentity) == false then
return false
end
end