mirror of
https://github.com/minetest-mods/item_drop.git
synced 2024-12-23 06:12:30 +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
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user