mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-12 12:43:15 +01:00
basic target selector system
This commit is contained in:
parent
5ddc3cf99a
commit
0129fdafef
@ -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
|
Loading…
Reference in New Issue
Block a user