From 0063598f220e2135c7bfda4545be1734b311bf39 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Fri, 8 Nov 2013 04:49:32 -0500 Subject: [PATCH] fix nil refs caused by a renamed function --- doors_and_gates.lua | 4 ++-- init.lua | 11 ----------- ownership.lua | 13 +++++++++++++ signs_lib.lua | 14 +++++++------- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/doors_and_gates.lua b/doors_and_gates.lua index 4b36b6ed..c32c4489 100644 --- a/doors_and_gates.lua +++ b/doors_and_gates.lua @@ -444,8 +444,8 @@ function homedecor.place_door(itemstack, placer, pointed_thing, name, forceright local node_bottom = minetest.get_node(pos1) local node_top = minetest.get_node(pos2) - if not homedecor:node_is_owned(pos1, placer) - and not homedecor:node_is_owned(pos2, placer) then + if not homedecor.node_is_owned(pos1, placer) + and not homedecor.node_is_owned(pos2, placer) then if not get_nodedef_field(node_bottom.name, "buildable_to") or not get_nodedef_field(node_top.name, "buildable_to") then diff --git a/init.lua b/init.lua index d88412fd..56a04241 100644 --- a/init.lua +++ b/init.lua @@ -59,17 +59,6 @@ function homedecor.table_copy(t) return nt end --- protection wrapper for 6d stuff - -function homedecor.protect_and_rotate(itemstack, placer, pointed_thing) - if not homedecor.node_is_owned(pointed_thing.under, placer) - and not homedecor.node_is_owned(pointed_thing.above, placer) then - local keys=placer:get_player_control() - minetest.rotate_and_place(itemstack, placer, pointed_thing, - homedecor.expect_infinite_stacks, {invert_wall = keys.sneak}) - end - return itemstack -end -- load various other components diff --git a/ownership.lua b/ownership.lua index 06bc726a..f7987d27 100644 --- a/ownership.lua +++ b/ownership.lua @@ -33,3 +33,16 @@ function homedecor.node_is_owned(pos, placer) return false end end + +-- protection wrapper for 6d stuff + +function homedecor.protect_and_rotate(itemstack, placer, pointed_thing) + if not homedecor.node_is_owned(pointed_thing.under, placer) + and not homedecor.node_is_owned(pointed_thing.above, placer) then + local keys=placer:get_player_control() + minetest.rotate_and_place(itemstack, placer, pointed_thing, + homedecor.expect_infinite_stacks, {invert_wall = keys.sneak}) + end + return itemstack +end + diff --git a/signs_lib.lua b/signs_lib.lua index 47afb55a..62ed6efd 100644 --- a/signs_lib.lua +++ b/signs_lib.lua @@ -386,13 +386,13 @@ if not homedecor.disable_signs then local name name = minetest.get_node(pointed_thing.under).name if fences_with_sign[name] then - if homedecor:node_is_owned(pointed_thing.under, placer) then + if homedecor.node_is_owned(pointed_thing.under, placer) then return itemstack end else name = minetest.get_node(pointed_thing.above).name local def = minetest.registered_nodes[name] - if homedecor:node_is_owned(pointed_thing.above, placer) + if homedecor.node_is_owned(pointed_thing.above, placer) or (not def.buildable_to) then return itemstack end @@ -469,7 +469,7 @@ if not homedecor.disable_signs then minetest.pos_to_string(pos) )) end - if homedecor:node_is_owned(pos, sender) then return end + if homedecor.node_is_owned(pos, sender) then return end homedecor.update_sign(pos, fields) end, on_punch = function(pos, node, puncher) @@ -506,7 +506,7 @@ minetest.register_node(":signs:sign_yard", { minetest.pos_to_string(pos) )) end - if homedecor:node_is_owned(pos, sender) then return end + if homedecor.node_is_owned(pos, sender) then return end homedecor.update_sign(pos, fields) end, on_punch = function(pos, node, puncher) @@ -597,7 +597,7 @@ function homedecor.register_fence_with_sign(fencename, fencewithsignname) local fdir = minetest.dir_to_facedir(placer:get_look_dir()) if def_under and def_under.on_rightclick then return def_under.on_rightclick(pointed_thing.under, node_under, placer, itemstack) or itemstack - elseif (not homedecor:node_is_owned(pointed_thing.under, placer)) + elseif (not homedecor.node_is_owned(pointed_thing.under, placer)) and def_under.buildable_to then minetest.add_node(pointed_thing.under, {name = fencename, param2 = fdir}) if not homedecor.expect_infinite_stacks then @@ -605,7 +605,7 @@ function homedecor.register_fence_with_sign(fencename, fencewithsignname) end placer:set_wielded_item(itemstack) return itemstack - elseif (not homedecor:node_is_owned(pointed_thing.above, placer)) + elseif (not homedecor.node_is_owned(pointed_thing.above, placer)) and def_above.buildable_to then minetest.add_node(pointed_thing.above, {name = fencename, param2 = fdir}) if not homedecor.expect_infinite_stacks then @@ -629,7 +629,7 @@ function homedecor.register_fence_with_sign(fencename, fencewithsignname) minetest.pos_to_string(pos) )) end - if homedecor:node_is_owned(pos, sender) then return end + if homedecor.node_is_owned(pos, sender) then return end homedecor.update_sign(pos, fields) end def_sign.on_punch = function(pos, node, puncher, ...)