mirror of
				https://github.com/FaceDeer/dfcaverns.git
				synced 2025-10-31 16:25:22 +01:00 
			
		
		
		
	add backgrounds to item slots in MCL
This commit is contained in:
		| @@ -195,9 +195,18 @@ elseif minetest.get_modpath("mcl_explosions") then | |||||||
| end | end | ||||||
|  |  | ||||||
| df_dependencies.mods_required.mcl_formspec = true | df_dependencies.mods_required.mcl_formspec = true | ||||||
| df_dependencies.get_itemslot_bg = function(X,Y,W,H) | df_dependencies.get_itemslot_bg = function(X,Y,W,H) return "" end | ||||||
| 	return "" | df_dependencies.get_itemslot_bg_padded = function(X,Y,W,H) return "" end | ||||||
| end |  | ||||||
| if minetest.get_modpath("mcl_formspec") then | if minetest.get_modpath("mcl_formspec") then | ||||||
| 	df_dependencies.get_itemslot_bg = mcl_formspec.get_itemslot_bg | 	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 | end | ||||||
| @@ -47,6 +47,8 @@ end | |||||||
| local prefix = "df_underworld_items:puzzle_chest" | local prefix = "df_underworld_items:puzzle_chest" | ||||||
| local prefix_len = string.len("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 show_formspec = function(pos, node, clicker, itemstack, pointed_thing) | ||||||
| 	local meta = minetest.get_meta(pos) | 	local meta = minetest.get_meta(pos) | ||||||
| 	initialize(pos, meta) | 	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[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[4,2.75]" .. formspec_bar(false, state_sum[4], key_sum[4]) .. "container_end[]" | ||||||
| 		.. "container_end[]" | 		.. "container_end[]" | ||||||
|  | 		.. itemslot_bg(0.6,6.7,8,4,0.25) | ||||||
| 		.. "list[current_player;main;0.6,6.7;8,4;]" | 		.. "list[current_player;main;0.6,6.7;8,4;]" | ||||||
| 	if solved then | 	if solved then | ||||||
| 		local nodemeta = "nodemeta:"..pos.x..","..pos.y..","..pos.z | 		local nodemeta = "nodemeta:"..pos.x..","..pos.y..","..pos.z | ||||||
| 		formspec = formspec | 		formspec = formspec | ||||||
|  | 			.. itemslot_bg(0.6,5.4,8,1,0.25) | ||||||
| 			.. "list["..nodemeta..";main;0.6,5.4;8,1;]" | 			.. "list["..nodemeta..";main;0.6,5.4;8,1;]" | ||||||
| 			.. "listring[]" | 			.. "listring[]" | ||||||
| 		if meta:get_string("solved") ~= "true" then | 		if meta:get_string("solved") ~= "true" then | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user