Search for player a little harder. Search interval now is 3 seconds.
parent
407d583de1
commit
6758c10a14
6
init.lua
6
init.lua
|
@ -240,12 +240,16 @@ minetest.register_node(":default:diamondblock", {
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"teleports:teleport"},
|
nodenames = {"teleports:teleport"},
|
||||||
interval = 10,
|
interval = 3,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
local objectsnear=minetest.get_objects_inside_radius({x=pos.x,y=pos.y+0.5,z=pos.z}, 0.52);
|
local objectsnear=minetest.get_objects_inside_radius({x=pos.x,y=pos.y+0.5,z=pos.z}, 0.52);
|
||||||
if #objectsnear>0 then
|
if #objectsnear>0 then
|
||||||
local player = objectsnear[1];
|
local player = objectsnear[1];
|
||||||
|
-- check only first two objekts then give up
|
||||||
|
if #objectsnear>1 and not player:is_player() then
|
||||||
|
player = objectsnear[2];
|
||||||
|
end
|
||||||
if player:is_player() and player:get_player_name()~=teleports.lastplayername then
|
if player:is_player() and player:get_player_name()~=teleports.lastplayername then
|
||||||
local positions = teleports:find_nearby(pos, 10)
|
local positions = teleports:find_nearby(pos, 10)
|
||||||
if #positions>0 then
|
if #positions>0 then
|
||||||
|
|
Loading…
Reference in New Issue