mirror of
				https://github.com/mt-mods/homedecor_modpack.git
				synced 2025-11-04 14:05:33 +01:00 
			
		
		
		
	added granite-, steel-, marble-topped cabinets
(no craft recipes yet)
This commit is contained in:
		@@ -2,54 +2,67 @@
 | 
			
		||||
 | 
			
		||||
local S = homedecor.gettext
 | 
			
		||||
 | 
			
		||||
minetest.register_node('homedecor:kitchen_cabinet', {
 | 
			
		||||
	description = S("Kitchen Cabinet"),
 | 
			
		||||
	tiles = { 'homedecor_kitchen_cabinet_top.png',
 | 
			
		||||
			'homedecor_kitchen_cabinet_bottom.png',
 | 
			
		||||
			'homedecor_kitchen_cabinet_sides.png',
 | 
			
		||||
			'homedecor_kitchen_cabinet_sides.png',
 | 
			
		||||
			'homedecor_kitchen_cabinet_sides.png',
 | 
			
		||||
			'homedecor_kitchen_cabinet_front.png'},
 | 
			
		||||
	sunlight_propagates = false,
 | 
			
		||||
	paramtype = "light",
 | 
			
		||||
	paramtype2 = "facedir",
 | 
			
		||||
	walkable = true,
 | 
			
		||||
	groups = { snappy = 3 },
 | 
			
		||||
	sounds = default.node_sound_wood_defaults(),
 | 
			
		||||
	on_construct = function(pos)
 | 
			
		||||
		local meta = minetest.get_meta(pos)
 | 
			
		||||
		meta:set_string("formspec",
 | 
			
		||||
				"size[8,8]"..
 | 
			
		||||
				"list[current_name;main;0,0;8,3;]"..
 | 
			
		||||
				"list[current_player;main;0,4;8,4;]")
 | 
			
		||||
		meta:set_string("infotext", S("Kitchen Cabinet"))
 | 
			
		||||
		local inv = meta:get_inventory()
 | 
			
		||||
		inv:set_size("main", 24)
 | 
			
		||||
	end,
 | 
			
		||||
	can_dig = function(pos,player)
 | 
			
		||||
		local meta = minetest.get_meta(pos);
 | 
			
		||||
		local inv = meta:get_inventory()
 | 
			
		||||
		return inv:is_empty("main")
 | 
			
		||||
	end,
 | 
			
		||||
	on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
 | 
			
		||||
		minetest.log("action", S("%s moves stuff in kitchen cabinet at %s"):format(
 | 
			
		||||
		    player:get_player_name(),
 | 
			
		||||
		    minetest.pos_to_string(pos)
 | 
			
		||||
		))
 | 
			
		||||
	end,
 | 
			
		||||
    on_metadata_inventory_put = function(pos, listname, index, stack, player)
 | 
			
		||||
		minetest.log("action", S("%s moves stuff to kitchen cabinet at %s"):format(
 | 
			
		||||
		    player:get_player_name(),
 | 
			
		||||
		    minetest.pos_to_string(pos)
 | 
			
		||||
		))
 | 
			
		||||
	end,
 | 
			
		||||
    on_metadata_inventory_take = function(pos, listname, index, stack, player)
 | 
			
		||||
		minetest.log("action", S("%s takes stuff from kitchen cabinet at %s"):format(
 | 
			
		||||
		    player:get_player_name(),
 | 
			
		||||
		    minetest.pos_to_string(pos)
 | 
			
		||||
		))
 | 
			
		||||
	end,
 | 
			
		||||
})
 | 
			
		||||
local counter_materials = { "", "granite", "marble", "steel" }
 | 
			
		||||
 | 
			
		||||
for _, mat in ipairs(counter_materials) do
 | 
			
		||||
 | 
			
		||||
	local desc = S("Kitchen Cabinet")
 | 
			
		||||
	local material = ""
 | 
			
		||||
 | 
			
		||||
	if mat ~= "" then
 | 
			
		||||
		desc = S("Kitchen Cabinet ("..mat.." top)")
 | 
			
		||||
		material = "_"..mat
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	minetest.register_node('homedecor:kitchen_cabinet'..material, {
 | 
			
		||||
		description = desc,
 | 
			
		||||
		tiles = { 'homedecor_kitchen_cabinet_top'..material..'.png',
 | 
			
		||||
				'homedecor_kitchen_cabinet_bottom.png',
 | 
			
		||||
				'homedecor_kitchen_cabinet_sides.png',
 | 
			
		||||
				'homedecor_kitchen_cabinet_sides.png',
 | 
			
		||||
				'homedecor_kitchen_cabinet_sides.png',
 | 
			
		||||
				'homedecor_kitchen_cabinet_front.png'},
 | 
			
		||||
		sunlight_propagates = false,
 | 
			
		||||
		paramtype = "light",
 | 
			
		||||
		paramtype2 = "facedir",
 | 
			
		||||
		walkable = true,
 | 
			
		||||
		groups = { snappy = 3 },
 | 
			
		||||
		sounds = default.node_sound_wood_defaults(),
 | 
			
		||||
		on_construct = function(pos)
 | 
			
		||||
			local meta = minetest.get_meta(pos)
 | 
			
		||||
			meta:set_string("formspec",
 | 
			
		||||
					"size[8,8]"..
 | 
			
		||||
					"list[current_name;main;0,0;8,3;]"..
 | 
			
		||||
					"list[current_player;main;0,4;8,4;]")
 | 
			
		||||
			meta:set_string("infotext", S("Kitchen Cabinet"))
 | 
			
		||||
			local inv = meta:get_inventory()
 | 
			
		||||
			inv:set_size("main", 24)
 | 
			
		||||
		end,
 | 
			
		||||
		can_dig = function(pos,player)
 | 
			
		||||
			local meta = minetest.get_meta(pos);
 | 
			
		||||
			local inv = meta:get_inventory()
 | 
			
		||||
			return inv:is_empty("main")
 | 
			
		||||
		end,
 | 
			
		||||
		on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
 | 
			
		||||
			minetest.log("action", S("%s moves stuff in kitchen cabinet at %s"):format(
 | 
			
		||||
				player:get_player_name(),
 | 
			
		||||
				minetest.pos_to_string(pos)
 | 
			
		||||
			))
 | 
			
		||||
		end,
 | 
			
		||||
		on_metadata_inventory_put = function(pos, listname, index, stack, player)
 | 
			
		||||
			minetest.log("action", S("%s moves stuff to kitchen cabinet at %s"):format(
 | 
			
		||||
				player:get_player_name(),
 | 
			
		||||
				minetest.pos_to_string(pos)
 | 
			
		||||
			))
 | 
			
		||||
		end,
 | 
			
		||||
		on_metadata_inventory_take = function(pos, listname, index, stack, player)
 | 
			
		||||
			minetest.log("action", S("%s takes stuff from kitchen cabinet at %s"):format(
 | 
			
		||||
				player:get_player_name(),
 | 
			
		||||
				minetest.pos_to_string(pos)
 | 
			
		||||
			))
 | 
			
		||||
		end,
 | 
			
		||||
	})
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
minetest.register_node('homedecor:kitchen_cabinet_half', {	
 | 
			
		||||
	drawtype="nodebox",
 | 
			
		||||
 
 | 
			
		||||
@@ -121,6 +121,12 @@ local items = {
 | 
			
		||||
      "Fridge (stainless steel)" },
 | 
			
		||||
    { "kitchen_cabinet",
 | 
			
		||||
      "Cabinet" },
 | 
			
		||||
    { "kitchen_cabinet_steel",
 | 
			
		||||
      "Cabinet (stainless steel top)" },
 | 
			
		||||
    { "kitchen_cabinet_granite",
 | 
			
		||||
      "Cabinet (granite top)" },
 | 
			
		||||
    { "kitchen_cabinet_marble",
 | 
			
		||||
      "Cabinet (marble top)" },
 | 
			
		||||
    { "kitchen_cabinet_half",
 | 
			
		||||
      "Cabinet" },
 | 
			
		||||
    { "kitchen_cabinet_with_sink",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								homedecor/textures/homedecor_kitchen_cabinet_top_granite.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								homedecor/textures/homedecor_kitchen_cabinet_top_granite.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 853 B  | 
							
								
								
									
										
											BIN
										
									
								
								homedecor/textures/homedecor_kitchen_cabinet_top_marble.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								homedecor/textures/homedecor_kitchen_cabinet_top_marble.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 819 B  | 
							
								
								
									
										
											BIN
										
									
								
								homedecor/textures/homedecor_kitchen_cabinet_top_steel.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								homedecor/textures/homedecor_kitchen_cabinet_top_steel.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 102 B  | 
		Reference in New Issue
	
	Block a user