mirror of
https://github.com/minetest-mods/MoreMesecons.git
synced 2025-06-30 15:30:28 +02:00
Change the code a bit
This commit is contained in:
@ -6,8 +6,7 @@ local kill_nearest_player = function(pos)
|
||||
local min_distance = MAX_DISTANCE
|
||||
for index, player in pairs(minetest.get_connected_players()) do
|
||||
local distance = vector.distance(pos, player:getpos())
|
||||
if distance < MAX_DISTANCE
|
||||
and distance < min_distance then
|
||||
if distance < min_distance then
|
||||
min_distance = distance
|
||||
nearest = player
|
||||
end
|
||||
@ -23,6 +22,11 @@ local kill_nearest_player = function(pos)
|
||||
-- maybe some mod placed it
|
||||
return
|
||||
end
|
||||
|
||||
if owner == nearest:get_player_name() then
|
||||
-- don't kill the owner !
|
||||
return
|
||||
end
|
||||
|
||||
-- And kill him
|
||||
nearest:set_hp(0)
|
||||
|
Reference in New Issue
Block a user