add backgrounds to item slots in MCL

This commit is contained in:
FaceDeer 2022-08-26 23:49:19 -06:00
parent 9212a3df74
commit e0eab50290
2 changed files with 16 additions and 3 deletions

View File

@ -195,9 +195,18 @@ elseif minetest.get_modpath("mcl_explosions") then
end
df_dependencies.mods_required.mcl_formspec = true
df_dependencies.get_itemslot_bg = function(X,Y,W,H)
return ""
end
df_dependencies.get_itemslot_bg = function(X,Y,W,H) return "" end
df_dependencies.get_itemslot_bg_padded = function(X,Y,W,H) return "" end
if minetest.get_modpath("mcl_formspec") then
df_dependencies.get_itemslot_bg = mcl_formspec.get_itemslot_bg
df_dependencies.get_itemslot_bg_padded = function(x,y,w,h, padding)
local out = ""
for i = 0, w - 1, 1 do
for j = 0, h - 1, 1 do
out = out .."image["..x+i+(i*padding)..","..y+j+(j*padding)..";1,1;mcl_formspec_itemslot.png]"
end
end
return out
end
end

View File

@ -47,6 +47,8 @@ end
local prefix = "df_underworld_items:puzzle_chest"
local prefix_len = string.len("df_underworld_items:puzzle_chest")
local itemslot_bg = df_dependencies.get_itemslot_bg_padded
local show_formspec = function(pos, node, clicker, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
initialize(pos, meta)
@ -69,10 +71,12 @@ local show_formspec = function(pos, node, clicker, itemstack, pointed_thing)
.. "container[1,2.75]" .. formspec_bar(false, state_sum[3], key_sum[3]) .. "container_end[]"
.. "container[4,2.75]" .. formspec_bar(false, state_sum[4], key_sum[4]) .. "container_end[]"
.. "container_end[]"
.. itemslot_bg(0.6,6.7,8,4,0.25)
.. "list[current_player;main;0.6,6.7;8,4;]"
if solved then
local nodemeta = "nodemeta:"..pos.x..","..pos.y..","..pos.z
formspec = formspec
.. itemslot_bg(0.6,5.4,8,1,0.25)
.. "list["..nodemeta..";main;0.6,5.4;8,1;]"
.. "listring[]"
if meta:get_string("solved") ~= "true" then