summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2014-01-30 16:09:23 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2014-01-30 16:09:23 -0500
commit050b19e4635618b924998037046372d67f8dc9a8 (patch)
tree814271089f7546fbf46c9e7aecfcd3263aa3ce38
parentb0a559ed0bc6d2b9bf423f3561a4551248aeb0f4 (diff)
Get rid of old ownership code, use Minetest's own code instead
-rw-r--r--node_defs.lua20
-rw-r--r--ownership.lua35
2 files changed, 2 insertions, 53 deletions
diff --git a/node_defs.lua b/node_defs.lua
index f2ef221..3c685c3 100644
--- a/node_defs.lua
+++ b/node_defs.lua
@@ -82,15 +82,7 @@ for i in ipairs(moretrees.treelist) do
is_ground_content = true,
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
- on_place = function(itemstack, placer, pointed_thing)
- local keys=placer:get_player_control()
- local pos = pointed_thing.under
- if not moretrees:node_is_owned(pos, placer) then
- minetest.rotate_and_place(itemstack, placer, pointed_thing,
- moretrees.expect_infinite_stacks, { invert_wall = keys.sneak })
- end
- return itemstack
- end
+ on_place = minetest.rotate_node,
})
minetest.register_node("moretrees:"..treename.."_planks", {
@@ -451,15 +443,7 @@ minetest.register_node("moretrees:rubber_tree_trunk_empty", {
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
paramtype2 = "facedir",
- on_place = function(itemstack, placer, pointed_thing)
- local keys=placer:get_player_control()
- local pos = pointed_thing.under
- if not moretrees:node_is_owned(pos, placer) then
- minetest.rotate_and_place(itemstack, placer, pointed_thing,
- moretrees.expect_infinite_stacks, { invert_wall = keys.sneak })
- end
- return itemstack
- end,
+ on_place = minetest.rotate_node,
after_place_node = function(pos, placer, itemstack)
local meta = minetest.get_meta(pos)
meta:set_int("placed", 1)
diff --git a/ownership.lua b/ownership.lua
deleted file mode 100644
index e075888..0000000
--- a/ownership.lua
+++ /dev/null
@@ -1,35 +0,0 @@
-
-local S = moretrees.gettext
-
-function moretrees:node_is_owned(pos, placer)
- local ownername = false
- if type(IsPlayerNodeOwner) == "function" then -- node_ownership mod
- if HasOwner(pos, placer) then -- returns true if the node is owned
- if not IsPlayerNodeOwner(pos, placer:get_player_name()) then
- if type(getLastOwner) == "function" then -- ...is an old version
- ownername = getLastOwner(pos)
- elseif type(GetNodeOwnerName) == "function" then -- ...is a recent version
- ownername = GetNodeOwnerName(pos)
- else
- ownername = S("someone")
- end
- end
- end
-
- elseif type(isprotect)=="function" then -- glomie's protection mod
- if not isprotect(5, pos, placer) then
- ownername = S("someone")
- end
- elseif type(protector)=="table" and type(protector.can_dig)=="function" then -- Zeg9's protection mod
- if not protector.can_dig(5, pos, placer) then
- ownername = S("someone")
- end
- end
-
- if ownername ~= false then
- minetest.chat_send_player( placer:get_player_name(), S("Sorry, %s owns that spot."):format(ownername) )
- return true
- else
- return false
- end
-end