dont return arrow when in creative

This commit is contained in:
Juraj Vajda 2022-10-10 09:25:40 -04:00
parent 3ec49c30c6
commit 40da885055

View File

@ -45,7 +45,7 @@ local function reset_charged_bow(player, includeWielded)
local arrow = item_meta:get_string('arrow')
-- return arrow
if arrow ~= '' then
if arrow ~= '' and not x_bows.is_creative(player:get_player_name()) then
if inv:room_for_item('main', {name=arrow}) then
inv:add_item('main', arrow)
else
@ -105,11 +105,10 @@ function x_bows.register_bow(name, def)
local arrow = item_meta:get_string('arrow')
-- return arrow
if arrow ~= '' then
if arrow ~= '' and not x_bows.is_creative(dropper:get_player_name()) then
minetest.item_drop(ItemStack({name=arrow, count=1}), dropper, {x=pos.x + 0.5, y=pos.y + 0.5, z=pos.z + 0.5})
end
itemstack:set_name(def.name)
-- returns leftover itemstack
return minetest.item_drop(itemstack, dropper, pos)