Page 1 of 1

Someone help please?

PostPosted: Wed Sep 18, 2013 02:36
by derpswa99
I get this bug' it's not an error where in the Iron and Copper Chests I can't take an object out of my inventory while viewing the chests' inventory

Here's the code, can anyone find the error:


--Stone Chest--

minetest.register_node("ictools:chest_stone", {
description = "Stone Chest",
tiles = {"ictools_chest_stone_top.png", "ictools_chest_stone_top.png", "ictools_chest_stone_side.png",
"ictools_chest_stone_side.png", "ictools_chest_stone_side.png", "ictools_chest_stone_front.png"},
paramtype2 = "facedir",
groups = {cracky=1,},
legacy_facedir_simple = true,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[8,10]"..
"list[current_name;main;0,0;8,5;]"..
"list[current_player;main;0,6;8,4;]")
meta:set_string("infotext", "Stone Chest")
local inv = meta:get_inventory()
inv:set_size("main", 8*5)
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", player:get_player_name()..
" moves stuff in 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 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 chest at "..minetest.pos_to_string(pos))
end,
})

minetest.register_craft({
output = 'ictools:chest_stone',
recipe = {
{'group:stone', 'group:stone', 'group:stone'},
{'group:stone', 'default:chest', 'group:stone'},
{'group:stone', 'group:stone', 'group:stone'},
}
})

--END--

--Coal Chest--

minetest.register_node("ictools:chest_coal", {
description = "Coal Chest",
tiles = {"ictools_chest_coal_top.png", "ictools_chest_coal_top.png", "ictools_chest_coal_side.png",
"ictools_chest_coal_side.png", "ictools_chest_coal_side.png", "ictools_chest_coal_front.png"},
paramtype2 = "facedir",
groups = {cracky=1,},
legacy_facedir_simple = true,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[8,11]"..
"list[current_name;main;0,0;8,6;]"..
"list[current_player;main;0,7;8,4;]")
meta:set_string("infotext", "Coal Chest")
local inv = meta:get_inventory()
inv:set_size("main", 8*6)
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", player:get_player_name()..
" moves stuff in 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 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 chest at "..minetest.pos_to_string(pos))
end,
})

minetest.register_craft({
output = 'ictools:chest_coal',
recipe = {
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
{'default:coal_lump', 'ictools:chest_stone', 'default:coal_lump'},
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
}
})

--END--

--Iron Chest--

minetest.register_node("ictools:chest_iron", {
description = "Iron Chest",
tiles = {"ictools_chest_iron_top.png", "ictools_chest_iron_top.png", "ictools_chest_iron_side.png",
"ictools_chest_iron_side.png", "ictools_chest_iron_side.png", "ictools_chest_iron_front.png"},
paramtype2 = "facedir",
groups = {cracky=2,},
legacy_facedir_simple = true,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[10,11]"..
"list[current_name;main;0,0;10,11;]"..
"list[current_player;main;1,7;8,4;]")
meta:set_string("infotext", "Iron Chest")
local inv = meta:get_inventory()
inv:set_size("main", 6*10)
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", player:get_player_name()..
" moves stuff in 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 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 chest at "..minetest.pos_to_string(pos))
end,
})

minetest.register_craft({
output = 'ictools:chest_iron',
recipe = {
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:steel_ingot', 'ictools:chest_coal', 'default:steel_ingot'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
}
})

--END--

--Copper Chest--

minetest.register_node("ictools:chest_copper", {
description = "Copper Chest",
tiles = {"ictools_chest_copper_top.png", "ictools_chest_copper_top.png", "ictools_chest_copper_side.png",
"ictools_chest_copper_side.png", "ictools_chest_copper_side.png", "ictools_chest_copper_front.png"},
paramtype2 = "facedir",
groups = {cracky=2,},
legacy_facedir_simple = true,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[12,11]"..
"list[current_name;main;0,0;12,11;]"..
"list[current_player;main;2,7;8,4;]")
meta:set_string("infotext", "Copper Chest")
local inv = meta:get_inventory()
inv:set_size("main", 6*12)
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", player:get_player_name()..
" moves stuff in 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 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 chest at "..minetest.pos_to_string(pos))
end,
})

minetest.register_craft({
output = 'ictools:chest_copper',
recipe = {
{'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'},
{'default:copper_ingot', 'ictools:chest_iron', 'default:copper_ingot'},
{'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'},
}
})

--END--

Thank you for your answers.

PostPosted: Wed Sep 18, 2013 14:43
by Rhys
Mmm... You have to put an item into your own inventory, before you do anything else. What I mean by this is if you want to give someone a present etc, then you put the item in your inventory, then give it to the person with Q if in hot bar, or throw it out of your inventory by pressing I, clicking the item, and click outside your inventory. Oh, and your inventory is always at the bottom.

PostPosted: Wed Sep 18, 2013 19:08
by derpswa99
Rhys wrote:Mmm... You have to put an item into your own inventory, before you do anything else. What I mean by this is if you want to give someone a present etc, then you put the item in your inventory, then give it to the person with Q if in hot bar, or throw it out of your inventory by pressing I, clicking the item, and click outside your inventory. Oh, and your inventory is always at the bottom.


No I can't do anything with my inventory while viewing the chest