"background[-0.19,-0.25;9.41,9.49;gui_hb_bg.png]"..
"list[nodemeta:" .. spos .. ";main;0,0.3;9,4;]" ..
"list[current_player;main;0,4.5;9,1;]" ..
- "list[current_player;main;0,6.08;9,3;8]" ..
+ "list[current_player;main;0,6.08;9,3;9]" ..
"listring[nodemeta:" .. spos .. ";main]" ..
"listring[current_player;main]" --..
--default.get_hotbar_bg(0,4.85)
end
local node = minetest.get_node(pos)
- minetest.after(0.2, minetest.swap_node, pos, { name = "utility:" .. swap,
- param2 = node.param2 })
- minetest.sound_play(sound, {gain = 0.3, pos = pos,
- max_hear_distance = 10}, true)
+ minetest.after(0.2, function(pos,swap,node)
+ if minetest.get_node(pos).name == "utility:chest_open" then
+ minetest.swap_node(pos,{name = "utility:"..swap,param2=node.param2})
+ minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10},true)
+ end
+ redstone.collect_info(pos)
+ end,pos,swap,node)
end
chest.open_chests = {}
minetest.show_formspec(clicker:get_player_name(),"utility:chest", chest.get_chest_formspec(pos))
chest.open_chests[clicker:get_player_name()] = { pos = pos,
sound = def.sound_close, swap = name }
+
end
def.on_blast = function() end
def.on_key_use = function(pos, player)
end
def.on_rightclick = function(pos, node, clicker)
- minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos,
- max_hear_distance = 10}, true)
- minetest.swap_node(pos, {
- name = "utility:" .. name .. "_open",
- param2 = node.param2 })
- minetest.show_formspec(clicker:get_player_name(),"utility:chest", chest.get_chest_formspec(pos))
- chest.open_chests[clicker:get_player_name()] = { pos = pos,
- sound = def.sound_close, swap = name }
+ if minetest.get_node(pos).name ~= "utility:chest" and minetest.get_node(pos).name ~= "utility:chest_open" then
+ return
+ end
+ minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos, max_hear_distance = 10}, true)
+ minetest.swap_node(pos, {name = "utility:" .. name .. "_open", param2 = node.param2 })
+
+ minetest.show_formspec(clicker:get_player_name(),"utility:chest", chest.get_chest_formspec(pos))
+ chest.open_chests[clicker:get_player_name()] = { pos = pos,sound = def.sound_close, swap = name }
+ redstone.collect_info(pos)
end
def.on_blast = function(pos)
local drops = {}
return drops
end
end
-
- def.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))
- end
- def.on_metadata_inventory_put = function(pos, listname, index, stack, player)
- minetest.log("action", player:get_player_name() ..
- " moves " .. stack:get_name() ..
- " to chest at " .. minetest.pos_to_string(pos))
- end
- def.on_metadata_inventory_take = function(pos, listname, index, stack, player)
- minetest.log("action", player:get_player_name() ..
- " takes " .. stack:get_name() ..
- " from chest at " .. minetest.pos_to_string(pos))
- end
def.on_destruct = function(pos)
destroy_chest(pos)
minetest.register_craft({
output = "utility:chest",
recipe = {
- {"group:wood", "group:wood", "group:wood"},
- {"group:wood", "", "group:wood"},
- {"group:wood", "group:wood", "group:wood"},
+ {"main:wood", "main:wood", "main:wood"},
+ {"main:wood", "", "main:wood"},
+ {"main:wood", "main:wood", "main:wood"},
}
})
recipe = "utility:chest",
burntime = 5,
})
+
+
+local groups = minetest.registered_nodes["utility:chest_open"].groups
+groups["redstone_torch"]=1
+groups["redstone_power"]=9
+minetest.override_item("utility:chest_open", {
+ groups = groups
+})