mirror of
https://github.com/minetest-mods/throwing.git
synced 2024-11-10 12:30:32 +01:00
on_throw callback: Add a modulo by the main list size to calculate next_index
This commit is contained in:
parent
2331ccf9b4
commit
9179e12936
2
init.lua
2
init.lua
|
@ -21,7 +21,7 @@ local function shoot_arrow(itemstack, player)
|
||||||
luaentity.player = player:get_player_name()
|
luaentity.player = player:get_player_name()
|
||||||
|
|
||||||
if luaentity.on_throw then
|
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
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user