mirror of
https://github.com/minetest-mods/item_drop.git
synced 2024-12-22 22:02:26 +01:00
Fix multiplayer support
This commit is contained in:
parent
8c3a470690
commit
f91c73d2e3
13
init.lua
13
init.lua
@ -55,8 +55,7 @@ if minetest.settings:get_bool("item_drop.enable_item_pickup") ~= false then
|
||||
end
|
||||
end
|
||||
|
||||
local function pickupfunc()
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
local function pickupfunc(player)
|
||||
local keys_pressed = not key_triggered
|
||||
|
||||
local control = player:get_player_control()
|
||||
@ -96,9 +95,7 @@ if minetest.settings:get_bool("item_drop.enable_item_pickup") ~= false then
|
||||
return
|
||||
end
|
||||
end
|
||||
if inv:room_for_item("main",
|
||||
ItemStack(ent.itemstring)
|
||||
) then
|
||||
if inv:room_for_item("main", ItemStack(ent.itemstring)) then
|
||||
local pos2 = object:getpos()
|
||||
local distance = vector.distance(pos, pos2)
|
||||
if distance <= 1 then
|
||||
@ -127,10 +124,12 @@ if minetest.settings:get_bool("item_drop.enable_item_pickup") ~= false then
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
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)
|
||||
end
|
||||
minetest.after(3.0, pickup_step)
|
||||
|
Loading…
Reference in New Issue
Block a user