mirror of
https://github.com/minetest-mods/item_drop.git
synced 2025-01-03 11:37:36 +01:00
Ignore players which are outside the map
This commit is contained in:
parent
72f4225058
commit
f015cc1631
11
init.lua
11
init.lua
@ -252,6 +252,13 @@ if legacy_setting_getbool("item_drop.enable_item_pickup",
|
||||
return keys_pressed ~= key_invert
|
||||
end
|
||||
|
||||
local function is_inside_map(pos)
|
||||
local bound = 31000
|
||||
return -bound < pos.x and pos.x < bound
|
||||
and -bound < pos.y and pos.y < bound
|
||||
and -bound < pos.z and pos.z < bound
|
||||
end
|
||||
|
||||
-- called for each player to possibly collect an item, returns true if so
|
||||
local function pickupfunc(player)
|
||||
if not has_keys_pressed(player)
|
||||
@ -261,6 +268,10 @@ if legacy_setting_getbool("item_drop.enable_item_pickup",
|
||||
end
|
||||
|
||||
local pos = player:get_pos()
|
||||
if not is_inside_map(pos) then
|
||||
-- get_objects_inside_radius crashes for too far positions
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+0.5
|
||||
local inv = player:get_inventory()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user