mirror of
https://github.com/minetest-mods/skinsdb.git
synced 2025-01-24 06:40:20 +01:00
added /skinsdb show
This commit is contained in:
parent
5498faa88a
commit
751f0f9538
@ -1,5 +1,5 @@
|
|||||||
minetest.register_chatcommand("skinsdb", {
|
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",
|
description = "Set, show or list player's skin",
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
@ -12,7 +12,7 @@ minetest.register_chatcommand("skinsdb", {
|
|||||||
for word in param:gmatch("([^ ]+)") do
|
for word in param:gmatch("([^ ]+)") do
|
||||||
if not command then
|
if not command then
|
||||||
-- first word
|
-- first word
|
||||||
if word == 'set' or word == 'list' then
|
if word == 'set' or word == 'list' or word == 'show' then
|
||||||
command = word
|
command = word
|
||||||
elseif skins.get(word) then
|
elseif skins.get(word) then
|
||||||
command = 'set'
|
command = 'set'
|
||||||
@ -58,6 +58,17 @@ minetest.register_chatcommand("skinsdb", {
|
|||||||
end
|
end
|
||||||
minetest.chat_send_player(name, info)
|
minetest.chat_send_player(name, info)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user