1
0
Fork 0

Players must be closer to grab arrows

This commit is contained in:
Wuzzy 2018-05-09 18:19:42 +02:00
parent 7ca61b7185
commit 294be0f302
1 changed files with 4 additions and 7 deletions

View File

@ -119,11 +119,11 @@ ARROW_ENTITY.on_step = function(self, dtime)
end end
self._stuckrechecktimer = 0 self._stuckrechecktimer = 0
end end
local objects = minetest.get_objects_inside_radius(pos, 2) -- Pickup arrow if player is nearby (not in Creative Mode)
local objects = minetest.get_objects_inside_radius(pos, 1)
for _,obj in ipairs(objects) do for _,obj in ipairs(objects) do
if obj:is_player() then if obj:is_player() then
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
-- Pickup arrow if player is nearby
if obj:get_inventory():room_for_item("main", "mcl_bows:arrow") then if obj:get_inventory():room_for_item("main", "mcl_bows:arrow") then
obj:get_inventory():add_item("main", "mcl_bows:arrow") obj:get_inventory():add_item("main", "mcl_bows:arrow")
minetest.sound_play("item_drop_pickup", { minetest.sound_play("item_drop_pickup", {
@ -131,13 +131,10 @@ ARROW_ENTITY.on_step = function(self, dtime)
max_hear_distance = 16, max_hear_distance = 16,
gain = 1.0, gain = 1.0,
}) })
self.object:remove()
return
end end
else
self.object:remove()
return
end end
self.object:remove()
return
end end
end end