Fix error in command blocks (#30)

Possibly caused by force-loaded blocks.
This commit is contained in:
luk3yx 2023-04-08 03:20:43 +12:00 committed by GitHub
parent 13645134a6
commit 464699e78b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -52,11 +52,11 @@ local function receive_fields(pos, _, fields, player)
end end
local function resolve_commands(commands, pos) local function resolve_commands(commands, pos)
local nearest = nil local nearest = ""
local min_distance = math.huge local min_distance = math.huge
local players = minetest.get_connected_players() local players = minetest.get_connected_players()
for _, player in pairs(players) do for _, player in pairs(players) do
local distance = vector.distance(pos, player:getpos()) local distance = vector.distance(pos, player:get_pos())
if distance < min_distance then if distance < min_distance then
min_distance = distance min_distance = distance
nearest = player:get_player_name() nearest = player:get_player_name()