From 751f0f953880f258f3c255b00797843b5c83514d Mon Sep 17 00:00:00 2001 From: Alexander Weber Date: Tue, 13 Feb 2018 22:40:07 +0100 Subject: [PATCH] added /skinsdb show --- chatcommands.lua | 15 +++++++++++++-- 1 file 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] | list | list private | list public", + params = "[set] | show [] | 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