forked from minetest-mods/item_drop
fix server crash when player exits during loop
This commit is contained in:
parent
2624ea4e73
commit
076ebbe0f4
4
init.lua
4
init.lua
|
@ -6,7 +6,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do
|
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do
|
||||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||||
if inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
||||||
inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
|
inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
|
||||||
if object:get_luaentity().itemstring ~= "" then
|
if object:get_luaentity().itemstring ~= "" then
|
||||||
minetest.sound_play("item_drop_pickup", {
|
minetest.sound_play("item_drop_pickup", {
|
||||||
|
@ -22,7 +22,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 2)) do
|
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 2)) do
|
||||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||||
if object:get_luaentity().collect then
|
if object:get_luaentity().collect then
|
||||||
if inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
||||||
local pos1 = pos
|
local pos1 = pos
|
||||||
pos1.y = pos1.y+0.2
|
pos1.y = pos1.y+0.2
|
||||||
local pos2 = object:getpos()
|
local pos2 = object:getpos()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user