Pixel-perfect player image in inventory

This commit is contained in:
Wuzzy 2017-07-21 23:23:50 +02:00
parent 33a689ad94
commit e0212f8d36
3 changed files with 4 additions and 6 deletions

View file

@ -226,15 +226,14 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
-- Show armor and player image -- Show armor and player image
local show_armor = minetest.get_modpath("3d_armor") local show_armor = minetest.get_modpath("3d_armor")
-- TODO: Use player.png to allow for custom skins local img = "player.png"
local img = "crafting_player2d.png"
local player_preview = "image[3.9,1.4;1.2333,2.4666;"..img.."]" local player_preview = "image[3.9,1.4;1.2333,2.4666;"..img.."]"
if show_armor and armor.textures[playername] and armor.textures[playername].preview then if show_armor and armor.textures[playername] and armor.textures[playername].preview then
img = armor.textures[playername].preview img = armor.textures[playername].preview
local s1 = img:find("character_preview") local s1 = img:find("character_preview")
if s1 ~= nil then if s1 ~= nil then
s1 = img:sub(s1+21) s1 = img:sub(s1+21)
img = "crafting_player2d.png"..s1 img = "player.png"..s1
end end
player_preview = "image[3.9,1.4;1.2333,2.4666;"..img.."]" player_preview = "image[3.9,1.4;1.2333,2.4666;"..img.."]"
end end

View file

@ -49,15 +49,14 @@ local function set_inventory(player, armor_change_only)
local player_name = player:get_player_name() local player_name = player:get_player_name()
-- Show armor and player image -- Show armor and player image
-- TODO: Use player.png to allow for custom skins local img = "player.png"
local img = "crafting_player2d.png"
local player_preview = "image[0.6,0.2;2,4;"..img.."]" local player_preview = "image[0.6,0.2;2,4;"..img.."]"
if show_armor and armor.textures[player_name] and armor.textures[player_name].preview then if show_armor and armor.textures[player_name] and armor.textures[player_name].preview then
img = armor.textures[player_name].preview img = armor.textures[player_name].preview
local s1 = img:find("character_preview") local s1 = img:find("character_preview")
if s1 ~= nil then if s1 ~= nil then
s1 = img:sub(s1+21) s1 = img:sub(s1+21)
img = "crafting_player2d.png"..s1 img = "player.png"..s1
end end
player_preview = "image[1.1,0.2;2,4;"..img.."]" player_preview = "image[1.1,0.2;2,4;"..img.."]"
end end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 569 B