remove old ownership code in favor of the ownership code in Minetest

This commit is contained in:
Vanessa Ezekowitz 2014-01-30 16:17:02 -05:00
parent 861788a6a9
commit abe2abe5cf
2 changed files with 1 additions and 59 deletions

View File

@ -13,21 +13,6 @@ end
ilights.modpath = minetest.get_modpath("ilights")
-- protection wrapper for 6d stuff
function ilights.protect_and_rotate(itemstack, placer, pointed_thing)
if not ilights.node_is_owned(pointed_thing.under, placer)
and not ilights.node_is_owned(pointed_thing.above, placer) then
minetest.rotate_and_place(itemstack, placer, pointed_thing,
ilights.expect_infinite_stacks)
end
return itemstack
end
-- other components
dofile(ilights.modpath.."/ownership.lua")
-- The important stuff!
ilights.types = {
@ -83,7 +68,7 @@ for _, row in ipairs(ilights.types) do
type = "fixed",
fixed = { -6/16, -8/16, -6/16, 6/16, 7/32, 6/16 }
},
on_place = ilights.protect_and_rotate
on_place = minetest.rotate_node
})
if name then

View File

@ -1,43 +0,0 @@
-- simple function to check for ownership of a node before placing it.
local S
if ilights.intllib_modpath then
dofile(ilights.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
function ilights.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