Fixed item duplication bugs in tables and glowlights.

This commit is contained in:
Vanessa Ezekowitz 2013-04-17 02:47:49 -04:00
parent d0c62410f8
commit 44dd0bd82d
2 changed files with 33 additions and 30 deletions

View File

@ -10,6 +10,8 @@ else
S = function ( s ) return s end S = function ( s ) return s end
end end
local unified_inventory = minetest.get_modpath("unified_inventory")
-- Yellow -- Yellow
minetest.register_node('homedecor:glowlight_thick_yellow', { minetest.register_node('homedecor:glowlight_thick_yellow', {
@ -57,10 +59,11 @@ minetest.register_node('homedecor:glowlight_thick_yellow', {
else else
minetest.env:add_node(above, {name = 'homedecor:glowlight_thick_yellow'}) minetest.env:add_node(above, {name = 'homedecor:glowlight_thick_yellow'})
end end
if not minetest.setting_getbool("creative_mode") then print("get_stack_max() of homedecor:glowlight_thick_yellow = "..itemstack:get_stack_max())
if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end
@ -111,10 +114,10 @@ minetest.register_node('homedecor:glowlight_thick_yellow_wall', {
else else
minetest.env:add_node(above, {name = 'homedecor:glowlight_thick_yellow'}) minetest.env:add_node(above, {name = 'homedecor:glowlight_thick_yellow'})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end
@ -166,10 +169,10 @@ minetest.register_node('homedecor:glowlight_thin_yellow', {
else else
minetest.env:add_node(above, {name = 'homedecor:glowlight_thin_yellow'}) minetest.env:add_node(above, {name = 'homedecor:glowlight_thin_yellow'})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end
@ -220,10 +223,10 @@ minetest.register_node('homedecor:glowlight_thin_yellow_wall', {
else else
minetest.env:add_node(above, {name = 'homedecor:glowlight_thin_yellow'}) minetest.env:add_node(above, {name = 'homedecor:glowlight_thin_yellow'})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end
@ -275,10 +278,10 @@ minetest.register_node('homedecor:glowlight_small_cube_yellow', {
else else
minetest.env:add_node(above, {name = 'homedecor:glowlight_small_cube_yellow'}) minetest.env:add_node(above, {name = 'homedecor:glowlight_small_cube_yellow'})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end
@ -328,10 +331,10 @@ minetest.register_node('homedecor:glowlight_small_cube_yellow_ceiling', {
else else
minetest.env:add_node(above, {name = 'homedecor:glowlight_small_cube_white'}) minetest.env:add_node(above, {name = 'homedecor:glowlight_small_cube_white'})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end
@ -385,10 +388,10 @@ minetest.register_node('homedecor:glowlight_thick_white', {
else else
minetest.env:add_node(above, {name = 'homedecor:glowlight_thick_white'}) minetest.env:add_node(above, {name = 'homedecor:glowlight_thick_white'})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end
@ -439,10 +442,10 @@ minetest.register_node('homedecor:glowlight_thick_white_wall', {
else else
minetest.env:add_node(above, {name = 'homedecor:glowlight_thick_white'}) minetest.env:add_node(above, {name = 'homedecor:glowlight_thick_white'})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end
@ -494,10 +497,10 @@ minetest.register_node('homedecor:glowlight_thin_white', {
else else
minetest.env:add_node(above, {name = 'homedecor:glowlight_thin_white'}) minetest.env:add_node(above, {name = 'homedecor:glowlight_thin_white'})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end
@ -548,10 +551,10 @@ minetest.register_node('homedecor:glowlight_thin_white_wall', {
else else
minetest.env:add_node(above, {name = 'homedecor:glowlight_thin_white'}) minetest.env:add_node(above, {name = 'homedecor:glowlight_thin_white'})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end
@ -602,10 +605,10 @@ minetest.register_node('homedecor:glowlight_small_cube_white', {
else else
minetest.env:add_node(above, {name = 'homedecor:glowlight_small_cube_white'}) minetest.env:add_node(above, {name = 'homedecor:glowlight_small_cube_white'})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end
@ -655,10 +658,10 @@ minetest.register_node('homedecor:glowlight_small_cube_white_ceiling', {
else else
minetest.env:add_node(above, {name = 'homedecor:glowlight_small_cube_white'}) minetest.env:add_node(above, {name = 'homedecor:glowlight_small_cube_white'})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end

View File

@ -79,10 +79,10 @@ for i in ipairs(materials) do
else else
minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_small_square_b'}) minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_small_square_b'})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end
@ -207,10 +207,10 @@ for i in ipairs(materials) do
else else
minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_small_round_b'}) minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_small_round_b'})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end
@ -334,10 +334,10 @@ for i in ipairs(materials) do
else else
minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_large_b'}) minetest.env:add_node(above, {name = 'homedecor:'..m..'_table_large_b'})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") or unified_inventory then
itemstack:take_item() itemstack:take_item()
return itemstack
end end
return minetest.item_place_node(itemstack, placer, pointed_thing)
else else
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
end end