mirror of
https://git.minetest.land/Mineclonia/Mineclonia.git
synced 2024-11-24 03:15:09 +00:00
3D Player preview in inventory
This commit is contained in:
parent
26037157f8
commit
b36db2044f
4 changed files with 47 additions and 27 deletions
|
@ -330,22 +330,27 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
|
||||||
inv_bg = "crafting_inventory_creative_survival.png"
|
inv_bg = "crafting_inventory_creative_survival.png"
|
||||||
|
|
||||||
-- Show armor and player image
|
-- Show armor and player image
|
||||||
local img, img_player
|
local player_preview
|
||||||
if mod_player then
|
if minetest.settings:get_bool("3d_player_preview", true) then
|
||||||
img_player = mcl_player.player_get_preview(player)
|
player_preview = mcl_player.get_player_formspec_model(player, 3.9, 1.4, 1.2333, 2.4666, "")
|
||||||
else
|
else
|
||||||
img_player = "player.png"
|
local img, img_player
|
||||||
end
|
if mod_player then
|
||||||
img = img_player
|
img_player = mcl_player.player_get_preview(player)
|
||||||
local player_preview = "image[3.9,1.4;1.2333,2.4666;"..img.."]"
|
else
|
||||||
if show_armor and armor.textures[playername] and armor.textures[playername].preview then
|
img_player = "player.png"
|
||||||
img = armor.textures[playername].preview
|
|
||||||
local s1 = img:find("character_preview")
|
|
||||||
if s1 ~= nil then
|
|
||||||
s1 = img:sub(s1+21)
|
|
||||||
img = img_player..s1
|
|
||||||
end
|
end
|
||||||
|
img = img_player
|
||||||
player_preview = "image[3.9,1.4;1.2333,2.4666;"..img.."]"
|
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
|
||||||
|
img = armor.textures[playername].preview
|
||||||
|
local s1 = img:find("character_preview")
|
||||||
|
if s1 ~= nil then
|
||||||
|
s1 = img:sub(s1+21)
|
||||||
|
img = img_player..s1
|
||||||
|
end
|
||||||
|
player_preview = "image[3.9,1.4;1.2333,2.4666;"..img.."]"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Background images for armor slots (hide if occupied)
|
-- Background images for armor slots (hide if occupied)
|
||||||
|
|
|
@ -64,22 +64,27 @@ 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
|
||||||
local img, img_player
|
local player_preview
|
||||||
if mod_player then
|
if minetest.settings:get_bool("3d_player_preview", true) then
|
||||||
img_player = mcl_player.player_get_preview(player)
|
player_preview = mcl_player.get_player_formspec_model(player, 1.0, 0.0, 2.25, 4.5, "")
|
||||||
else
|
else
|
||||||
img_player = "player.png"
|
local img, img_player
|
||||||
end
|
if mod_player then
|
||||||
img = img_player
|
img_player = mcl_player.player_get_preview(player)
|
||||||
local player_preview = "image[0.6,0.2;2,4;"..img.."]"
|
else
|
||||||
if show_armor and armor.textures[player_name] and armor.textures[player_name].preview then
|
img_player = "player.png"
|
||||||
img = armor.textures[player_name].preview
|
end
|
||||||
local s1 = img:find("character_preview")
|
img = img_player
|
||||||
if s1 ~= nil then
|
player_preview = "image[0.6,0.2;2,4;"..img.."]"
|
||||||
s1 = img:sub(s1+21)
|
if show_armor and armor.textures[player_name] and armor.textures[player_name].preview then
|
||||||
img = img_player..s1
|
img = armor.textures[player_name].preview
|
||||||
|
local s1 = img:find("character_preview")
|
||||||
|
if s1 ~= nil then
|
||||||
|
s1 = img:sub(s1+21)
|
||||||
|
img = img_player..s1
|
||||||
|
end
|
||||||
|
player_preview = "image[1.1,0.2;2,4;"..img.."]"
|
||||||
end
|
end
|
||||||
player_preview = "image[1.1,0.2;2,4;"..img.."]"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local armor_slots = {"helmet", "chestplate", "leggings", "boots"}
|
local armor_slots = {"helmet", "chestplate", "leggings", "boots"}
|
||||||
|
|
|
@ -93,6 +93,13 @@ function mcl_player.player_get_preview(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function mcl_player.get_player_formspec_model(player, x, y, w, h, fsname)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
local model = player_model[name]
|
||||||
|
local anim = models[model].animations[player_anim[name]]
|
||||||
|
return "model[" .. x .. "," .. y .. ";" .. w .. "," .. h .. ";" .. fsname .. ";" .. model .. ";" .. table.concat(player_textures[name], ",") .. ";0," .. 180 .. ";false;false;" .. anim.x .. "," .. anim.y .. "]"
|
||||||
|
end
|
||||||
|
|
||||||
function mcl_player.player_set_animation(player, anim_name, speed)
|
function mcl_player.player_set_animation(player, anim_name, speed)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if player_anim[name] == anim_name then
|
if player_anim[name] == anim_name then
|
||||||
|
|
|
@ -94,6 +94,9 @@ fire_animation_frames (Fire Animation Frames) int 8
|
||||||
# Whether to animate chests when open / close
|
# Whether to animate chests when open / close
|
||||||
animated_chests (Animated chests) bool true
|
animated_chests (Animated chests) bool true
|
||||||
|
|
||||||
|
# Whether to preview the player in inventory in 3D (requires Minetest 5.4)
|
||||||
|
3d_player_preview (3D Player preview) bool true
|
||||||
|
|
||||||
[Experimental]
|
[Experimental]
|
||||||
# Whether ice is translucent. If disabled, ice is fully opaque.
|
# Whether ice is translucent. If disabled, ice is fully opaque.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue