split chests off into a separate modpack component
@@ -7,4 +7,3 @@ enable_flashlight=true
 | 
			
		||||
enable_rubber_tree_generation=true
 | 
			
		||||
enable_marble_generation=true
 | 
			
		||||
enable_granite_generation=true
 | 
			
		||||
enable_obsidian_generation=true
 | 
			
		||||
 
 | 
			
		||||
@@ -9,14 +9,6 @@ dofile(modpath.."/config.lua")
 | 
			
		||||
--helper functions
 | 
			
		||||
dofile(modpath.."/helpers.lua")
 | 
			
		||||
 | 
			
		||||
-- chests
 | 
			
		||||
dofile(modpath.."/chest_commons.lua")
 | 
			
		||||
dofile(modpath.."/iron_chest.lua")
 | 
			
		||||
dofile(modpath.."/copper_chest.lua")
 | 
			
		||||
dofile(modpath.."/silver_chest.lua")
 | 
			
		||||
dofile(modpath.."/gold_chest.lua")
 | 
			
		||||
dofile(modpath.."/mithril_chest.lua")
 | 
			
		||||
 | 
			
		||||
--items 
 | 
			
		||||
dofile(modpath.."/items.lua")
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,145 +0,0 @@
 | 
			
		||||
minetest.register_craft({
 | 
			
		||||
	output = 'technic:mithril_chest 1',
 | 
			
		||||
	recipe = {
 | 
			
		||||
		{'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'},
 | 
			
		||||
		{'moreores:mithril_ingot','technic:gold_chest','moreores:mithril_ingot'},
 | 
			
		||||
		{'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'},
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_craft({
 | 
			
		||||
	output = 'technic:mithril_locked_chest 1',
 | 
			
		||||
	recipe = {
 | 
			
		||||
		{'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'},
 | 
			
		||||
		{'moreores:mithril_ingot','technic:gold_locked_chest','moreores:mithril_ingot'},
 | 
			
		||||
		{'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'},
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_craft({
 | 
			
		||||
	output = 'technic:mithril_locked_chest 1',
 | 
			
		||||
	recipe = {
 | 
			
		||||
		{'default:steel_ingot'},
 | 
			
		||||
		{'technic:mithril_chest'},
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_node("technic:mithril_chest", {
 | 
			
		||||
	description = "Mithril Chest",
 | 
			
		||||
	tiles = {"technic_mithril_chest_top.png", "technic_mithril_chest_top.png", "technic_mithril_chest_side.png",
 | 
			
		||||
		"technic_mithril_chest_side.png", "technic_mithril_chest_side.png", "technic_mithril_chest_front.png"},
 | 
			
		||||
	paramtype2 = "facedir",
 | 
			
		||||
	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
 | 
			
		||||
	legacy_facedir_simple = true,
 | 
			
		||||
	sounds = default.node_sound_wood_defaults(),
 | 
			
		||||
	on_construct = function(pos)
 | 
			
		||||
		local meta = minetest.env:get_meta(pos)
 | 
			
		||||
		meta:set_string("formspec",
 | 
			
		||||
				"invsize[13,9;]"..
 | 
			
		||||
				"list[current_name;main;0,0;13,4;]"..
 | 
			
		||||
				"list[current_player;main;0,5;8,4;]")
 | 
			
		||||
		meta:set_string("infotext", "Mithril Chest")
 | 
			
		||||
		local inv = meta:get_inventory()
 | 
			
		||||
		inv:set_size("main", 13*4)
 | 
			
		||||
	end,
 | 
			
		||||
	can_dig = function(pos,player)
 | 
			
		||||
		local meta = minetest.env: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", player:get_player_name()..
 | 
			
		||||
				" moves stuff in chest at "..minetest.pos_to_string(pos))
 | 
			
		||||
		return minetest.node_metadata_inventory_move_allow_all(
 | 
			
		||||
				pos, from_list, from_index, to_list, to_index, count, player)
 | 
			
		||||
	end,
 | 
			
		||||
    on_metadata_inventory_offer = function(pos, listname, index, stack, player)
 | 
			
		||||
		minetest.log("action", player:get_player_name()..
 | 
			
		||||
				" moves stuff to chest at "..minetest.pos_to_string(pos))
 | 
			
		||||
		return minetest.node_metadata_inventory_offer_allow_all(
 | 
			
		||||
				pos, listname, index, stack, player)
 | 
			
		||||
	end,
 | 
			
		||||
    on_metadata_inventory_take = function(pos, listname, index, stack, player)
 | 
			
		||||
		minetest.log("action", player:get_player_name()..
 | 
			
		||||
				" takes stuff from chest at "..minetest.pos_to_string(pos))
 | 
			
		||||
	end,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_node("technic:mithril_locked_chest", {
 | 
			
		||||
	description = "Mithril Locked Chest",
 | 
			
		||||
	tiles = {"technic_mithril_chest_top.png", "technic_mithril_chest_top.png", "technic_mithril_chest_side.png",
 | 
			
		||||
		"technic_mithril_chest_side.png", "technic_mithril_chest_side.png", "technic_mithril_chest_locked.png"},
 | 
			
		||||
	paramtype2 = "facedir",
 | 
			
		||||
	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
 | 
			
		||||
	legacy_facedir_simple = true,
 | 
			
		||||
	sounds = default.node_sound_wood_defaults(),
 | 
			
		||||
	after_place_node = function(pos, placer)
 | 
			
		||||
		local meta = minetest.env:get_meta(pos)
 | 
			
		||||
		meta:set_string("owner", placer:get_player_name() or "")
 | 
			
		||||
		meta:set_string("infotext", "Mithril Locked Chest (owned by "..
 | 
			
		||||
				meta:get_string("owner")..")")
 | 
			
		||||
	end,
 | 
			
		||||
on_construct = function(pos)
 | 
			
		||||
		local meta = minetest.env:get_meta(pos)
 | 
			
		||||
		meta:set_string("formspec",
 | 
			
		||||
				"invsize[13,9;]"..
 | 
			
		||||
				"list[current_name;main;0,0;13,4;]"..
 | 
			
		||||
				"list[current_player;main;0,5;8,4;]")
 | 
			
		||||
		meta:set_string("infotext", "Mithril Locked Chest")
 | 
			
		||||
		meta:set_string("owner", "")
 | 
			
		||||
		local inv = meta:get_inventory()
 | 
			
		||||
		inv:set_size("main", 13*4)
 | 
			
		||||
	end,
 | 
			
		||||
	can_dig = function(pos,player)
 | 
			
		||||
		local meta = minetest.env:get_meta(pos);
 | 
			
		||||
		local inv = meta:get_inventory()
 | 
			
		||||
		return inv:is_empty("main")
 | 
			
		||||
	end,
 | 
			
		||||
	allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
 | 
			
		||||
		local meta = minetest.env:get_meta(pos)
 | 
			
		||||
		if not has_locked_chest_privilege(meta, player) then
 | 
			
		||||
			minetest.log("action", player:get_player_name()..
 | 
			
		||||
					" tried to access a locked chest belonging to "..
 | 
			
		||||
					meta:get_string("owner").." at "..
 | 
			
		||||
					minetest.pos_to_string(pos))
 | 
			
		||||
			return 0
 | 
			
		||||
		end
 | 
			
		||||
		return count
 | 
			
		||||
	end,
 | 
			
		||||
    allow_metadata_inventory_put = function(pos, listname, index, stack, player)
 | 
			
		||||
		local meta = minetest.env:get_meta(pos)
 | 
			
		||||
		if not has_locked_chest_privilege(meta, player) then
 | 
			
		||||
			minetest.log("action", player:get_player_name()..
 | 
			
		||||
					" tried to access a locked chest belonging to "..
 | 
			
		||||
					meta:get_string("owner").." at "..
 | 
			
		||||
					minetest.pos_to_string(pos))
 | 
			
		||||
			return 0
 | 
			
		||||
		end
 | 
			
		||||
		return stack:get_count()
 | 
			
		||||
	end,
 | 
			
		||||
    allow_metadata_inventory_take = function(pos, listname, index, stack, player)
 | 
			
		||||
		local meta = minetest.env:get_meta(pos)
 | 
			
		||||
		if not has_locked_chest_privilege(meta, player) then
 | 
			
		||||
			minetest.log("action", player:get_player_name()..
 | 
			
		||||
					" tried to access a locked chest belonging to "..
 | 
			
		||||
					meta:get_string("owner").." at "..
 | 
			
		||||
					minetest.pos_to_string(pos))
 | 
			
		||||
			return 0
 | 
			
		||||
		end
 | 
			
		||||
		return stack:get_count()
 | 
			
		||||
	end,
 | 
			
		||||
	on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
 | 
			
		||||
		minetest.log("action", player:get_player_name()..
 | 
			
		||||
				" moves stuff in locked chest at "..minetest.pos_to_string(pos))
 | 
			
		||||
	end,
 | 
			
		||||
    on_metadata_inventory_put = function(pos, listname, index, stack, player)
 | 
			
		||||
		minetest.log("action", player:get_player_name()..
 | 
			
		||||
				" moves stuff to locked chest at "..minetest.pos_to_string(pos))
 | 
			
		||||
	end,
 | 
			
		||||
    on_metadata_inventory_take = function(pos, listname, index, stack, player)
 | 
			
		||||
		minetest.log("action", player:get_player_name()..
 | 
			
		||||
				" takes stuff from locked chest at "..minetest.pos_to_string(pos))
 | 
			
		||||
	end,
 | 
			
		||||
})
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 607 B  | 
| 
		 Before Width: | Height: | Size: 605 B  | 
| 
		 Before Width: | Height: | Size: 570 B  | 
| 
		 Before Width: | Height: | Size: 557 B  | 
| 
		 Before Width: | Height: | Size: 693 B  | 
| 
		 Before Width: | Height: | Size: 610 B  | 
| 
		 Before Width: | Height: | Size: 778 B  | 
| 
		 Before Width: | Height: | Size: 858 B  | 
| 
		 Before Width: | Height: | Size: 866 B  | 
| 
		 Before Width: | Height: | Size: 866 B  | 
| 
		 Before Width: | Height: | Size: 855 B  | 
| 
		 Before Width: | Height: | Size: 851 B  | 
| 
		 Before Width: | Height: | Size: 846 B  | 
| 
		 Before Width: | Height: | Size: 851 B  | 
| 
		 Before Width: | Height: | Size: 831 B  | 
| 
		 Before Width: | Height: | Size: 856 B  | 
| 
		 Before Width: | Height: | Size: 844 B  | 
| 
		 Before Width: | Height: | Size: 846 B  | 
| 
		 Before Width: | Height: | Size: 848 B  | 
| 
		 Before Width: | Height: | Size: 860 B  | 
| 
		 Before Width: | Height: | Size: 857 B  | 
| 
		 Before Width: | Height: | Size: 855 B  | 
| 
		 Before Width: | Height: | Size: 778 B  | 
| 
		 Before Width: | Height: | Size: 865 B  | 
| 
		 Before Width: | Height: | Size: 864 B  | 
| 
		 Before Width: | Height: | Size: 869 B  | 
| 
		 Before Width: | Height: | Size: 851 B  | 
| 
		 Before Width: | Height: | Size: 850 B  | 
| 
		 Before Width: | Height: | Size: 847 B  | 
| 
		 Before Width: | Height: | Size: 848 B  | 
| 
		 Before Width: | Height: | Size: 830 B  | 
| 
		 Before Width: | Height: | Size: 849 B  | 
| 
		 Before Width: | Height: | Size: 843 B  | 
| 
		 Before Width: | Height: | Size: 842 B  | 
| 
		 Before Width: | Height: | Size: 843 B  | 
| 
		 Before Width: | Height: | Size: 855 B  | 
| 
		 Before Width: | Height: | Size: 858 B  | 
| 
		 Before Width: | Height: | Size: 855 B  | 
| 
		 Before Width: | Height: | Size: 743 B  | 
| 
		 Before Width: | Height: | Size: 729 B  | 
| 
		 Before Width: | Height: | Size: 750 B  | 
| 
		 Before Width: | Height: | Size: 905 B  | 
| 
		 Before Width: | Height: | Size: 746 B  | 
| 
		 Before Width: | Height: | Size: 860 B  | 
| 
		 Before Width: | Height: | Size: 770 B  | 
| 
		 Before Width: | Height: | Size: 772 B  | 
| 
		 Before Width: | Height: | Size: 756 B  | 
| 
		 Before Width: | Height: | Size: 775 B  | 
| 
		 Before Width: | Height: | Size: 467 B  | 
| 
		 Before Width: | Height: | Size: 851 B  | 
| 
		 Before Width: | Height: | Size: 852 B  | 
| 
		 Before Width: | Height: | Size: 810 B  | 
| 
		 Before Width: | Height: | Size: 798 B  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.5 KiB  | 
| 
		 Before Width: | Height: | Size: 2.5 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.5 KiB  | 
| 
		 Before Width: | Height: | Size: 2.5 KiB  | 
| 
		 Before Width: | Height: | Size: 2.5 KiB  | 
| 
		 Before Width: | Height: | Size: 2.4 KiB  | 
| 
		 Before Width: | Height: | Size: 2.4 KiB  | 
| 
		 Before Width: | Height: | Size: 2.6 KiB  | 
| 
		 Before Width: | Height: | Size: 2.7 KiB  |