diff options
author | Alexander Weber <web.alexander@web.de> | 2018-02-13 22:40:07 +0100 |
---|---|---|
committer | sofar <sofar+github@foo-projects.org> | 2018-02-19 11:18:18 -0800 |
commit | 751f0f953880f258f3c255b00797843b5c83514d (patch) | |
tree | 680f4e761ac7230fce8b241cdb361c95a06fa956 | |
parent | 5498faa88aff6893ee68fa4d6da83f0d5d3a24da (diff) |
added /skinsdb show
-rw-r--r-- | chatcommands.lua | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/chatcommands.lua b/chatcommands.lua index f8df4ff..c135847 100644 --- a/chatcommands.lua +++ b/chatcommands.lua @@ -1,5 +1,5 @@ minetest.register_chatcommand("skinsdb", { - params = "[set] <skinname> | list | list private | list public", + params = "[set] <skin key> | show [<skin key>] | list | list private | list public", description = "Set, show or list player's skin", func = function(name, param) local player = minetest.get_player_by_name(name) @@ -12,7 +12,7 @@ minetest.register_chatcommand("skinsdb", { for word in param:gmatch("([^ ]+)") do if not command then -- first word - if word == 'set' or word == 'list' then + if word == 'set' or word == 'list' or word == 'show' then command = word elseif skins.get(word) then command = 'set' @@ -58,6 +58,17 @@ minetest.register_chatcommand("skinsdb", { end minetest.chat_send_player(name, info) end + elseif command == "show" then + if parameter then + skin = skins.get(parameter) + else + skin = skins.get_player_skin(player) + end + if not skin then + return false, "unknown skin" + end + local formspec = "size[8,3]"..skins.get_skin_info_formspec(skin) + minetest.show_formspec(name, 'skinsdb_show_skin', formspec) end |