mirror of
https://github.com/minetest-mods/MoreMesecons.git
synced 2025-07-02 08:20:25 +02:00
Various code fixes detected by luacheck
* Luablock: Fix the missing position argument when executing the lua code fails * Wireless: Fix the missing id argument * Localize several variables * Some other small changes, e.g. dead code removal
This commit is contained in:
committed by
Pierre-Adrien Langrognet
parent
28292dc2a5
commit
c41d0371c0
@ -24,12 +24,12 @@ local function teleport_nearest(pos)
|
||||
|
||||
-- Search for the nearest player
|
||||
local nearest = nil
|
||||
local min_distance = MAX_PLAYER_DISTANCE
|
||||
local min_distance_player = MAX_PLAYER_DISTANCE
|
||||
local players = minetest.get_connected_players()
|
||||
for _, player in pairs(players) do
|
||||
local distance = vector.distance(pos, player:getpos())
|
||||
if distance <= min_distance then
|
||||
min_distance = distance
|
||||
if distance <= min_distance_player then
|
||||
min_distance_player = distance
|
||||
nearest = player
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user