give the inventory formspec a background and make the armor tab have a 3d model

master
MisterE 2022-08-13 13:42:44 -04:00
parent ef08020c9a
commit aafae6b744
19 changed files with 19 additions and 3 deletions

View File

@ -34,7 +34,8 @@ armor = {
elements = {"head", "torso", "legs", "feet"},
physics = {"jump", "speed", "gravity"},
attributes = {"heal", "fire", "water"},
formspec = "image[2.5,0;2,4;armor_preview]"..
formspec = "model[2.5,0;2,4;armor_preview]" ..
-- "image[2.5,0;2,4;armor_preview]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
@ -525,7 +526,20 @@ armor.get_armor_formspec = function(self, name, listring)
formspec = formspec.."listring[current_player;main]"..
"listring[detached:"..name.."_armor;armor]"
end
formspec = formspec:gsub("armor_preview", armor.textures[name].preview)
-- formspec = formspec:gsub("armor_preview", armor.textures[name].preview)
local player = minetest.get_player_by_name(name)
local anim = player:get_local_animation()
local player_model = table.concat({
"player_model_"..name,
player:get_properties().mesh,
table.concat(player:get_properties().textures,","),
table.concat({0,-150},","),
"false",
"true",
table.concat({anim.x,anim.y},","),
"30"
},";")
formspec = formspec:gsub("armor_preview",player_model)
formspec = formspec:gsub("armor_level", armor.def[name].level)
for _, attr in pairs(self.attributes) do
formspec = formspec:gsub("armor_attr_"..attr, armor.def[name][attr])

View File

@ -35,7 +35,6 @@ function sfinv.get_nav_fs(player, context, nav, current_idx)
return ""
end
end
local theme_inv = [[
image[0,5.2;1,1;gui_hb_bg.png]
image[1,5.2;1,1;gui_hb_bg.png]
@ -52,6 +51,7 @@ local theme_inv = [[
function sfinv.make_formspec(player, context, content, show_inv, size)
local tmp = {
size or "size[8,9.1]",
"background9[-2,-2;12,13.1;sfinv_bg.png;false;64,96]",
sfinv.get_nav_fs(player, context, context.nav_titles, context.nav_idx),
show_inv and theme_inv or "",
content

View File

@ -7,8 +7,10 @@ local S = minetest.get_translator("sfinv")
sfinv.register_page("sfinv:crafting", {
title = S("Crafting"),
icon = "crafting_icon.png",
get = function(self, player, context)
return sfinv.make_formspec(player, context, [[
style_type[list;size=1,spacing=.5]
list[current_player;craft;1.75,0.5;3,3;]
list[current_player;craftpreview;5.75,1.5;1,1;]
image[4.75,1.5;1,1;sfinv_crafting_arrow.png]

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 469 B

After

Width:  |  Height:  |  Size: 469 B