basic target selector system

This commit is contained in:
AFCMS 2021-06-24 12:03:56 +02:00
parent 5ddc3cf99a
commit 0129fdafef
1 changed files with 14 additions and 0 deletions

View File

@ -71,5 +71,19 @@ function mcl_commands.rename_command(new_name, original_name, bypass_setting)
end end
end end
--0: succesfull, table
--1: not connected player, nil
--2: invalid target selector, nil
function mcl_commands.get_target_selector(target_selector) function mcl_commands.get_target_selector(target_selector)
if minetest.player_exists(target_selector) then
local obj = minetest.get_player_by_name(target_selector)
if obj then
return 0, {obj}
else
return 1, nil
end
else
return 0, {}
end
end end