Fix multiplayer support

This commit is contained in:
Hybrid Dog 2017-09-07 21:00:55 +02:00
parent 8c3a470690
commit f91c73d2e3

@ -55,8 +55,7 @@ if minetest.settings:get_bool("item_drop.enable_item_pickup") ~= false then
end end
end end
local function pickupfunc() local function pickupfunc(player)
for _,player in ipairs(minetest.get_connected_players()) do
local keys_pressed = not key_triggered local keys_pressed = not key_triggered
local control = player:get_player_control() local control = player:get_player_control()
@ -96,9 +95,7 @@ if minetest.settings:get_bool("item_drop.enable_item_pickup") ~= false then
return return
end end
end end
if inv:room_for_item("main", if inv:room_for_item("main", ItemStack(ent.itemstring)) then
ItemStack(ent.itemstring)
) then
local pos2 = object:getpos() local pos2 = object:getpos()
local distance = vector.distance(pos, pos2) local distance = vector.distance(pos, pos2)
if distance <= 1 then if distance <= 1 then
@ -127,10 +124,12 @@ if minetest.settings:get_bool("item_drop.enable_item_pickup") ~= false then
end end
end end
end end
end
local function pickup_step() local function pickup_step()
pickupfunc() local players = minetest.get_connected_players()
for i = 1,#players do
pickupfunc(players[i])
end
minetest.after(0.01, pickup_step) minetest.after(0.01, pickup_step)
end end
minetest.after(3.0, pickup_step) minetest.after(3.0, pickup_step)