From 0129fdafef99f621b641216d0793c492fa863321 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Thu, 24 Jun 2021 12:03:56 +0200 Subject: [PATCH] basic target selector system --- mods/CORE/mcl_commands/api.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mods/CORE/mcl_commands/api.lua b/mods/CORE/mcl_commands/api.lua index 2e3dc2667..1caf39207 100644 --- a/mods/CORE/mcl_commands/api.lua +++ b/mods/CORE/mcl_commands/api.lua @@ -71,5 +71,19 @@ function mcl_commands.rename_command(new_name, original_name, bypass_setting) end end + +--0: succesfull, table +--1: not connected player, nil +--2: invalid target selector, nil 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 \ No newline at end of file