Player_skins: Update inv menu when using cmd

This commit is contained in:
Wuzzy 2019-09-04 00:41:22 +02:00
parent 499f3bd7aa
commit 10070e8d1f
1 changed files with 10 additions and 0 deletions

View File

@ -210,6 +210,16 @@ minetest.register_chatcommand(
func = function(name, param)
if is_valid_skin(param) then
player_skins.set_skin(name, param)
local form = player_skins.get_formspec(name)
local player = minetest.get_player_by_name(name)
if player then
--[[ This updates inventory menu to make sure the
checkmark is updated. However, it will force-change
the inventory menu page to skins, even when sth else
was selected. This is a minor annoyance, but not a big problem.
TODO: Only do this when we're on the skins page. ]]
player:set_inventory_formspec(form)
end
return true, S("Skin set to “@1”.", param)
elseif param == "" then
return true, S("Current player skin: @1", player_skins.skins[name])