Use variable for max dist

master
Wuzzy 2020-09-08 19:08:37 +02:00
parent 9d9a85e0b3
commit fcd8c9ebfe
1 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,8 @@ teleports.teleports = {}
teleports.lastplayername =""
teleports.filename = minetest.get_worldpath() .. "/teleports.txt"
local TELEPORT_MAX_DIST = 260
function teleports:save()
local datastring = minetest.serialize(self.teleports)
if not datastring then
@ -31,7 +33,7 @@ function teleports:find_nearby(pos, count)
local nearby = {}
for i = #teleports.teleports, 1, -1 do
local EachTeleport = teleports.teleports[i]
if not vector.equals(EachTeleport.pos, pos) and vector.distance(EachTeleport.pos, pos) < 260 then
if not vector.equals(EachTeleport.pos, pos) and vector.distance(EachTeleport.pos, pos) < TELEPORT_MAX_DIST then
table.insert(nearby, EachTeleport)
if #nearby>count then
break