1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2025-07-07 00:50:22 +02:00

Split ownership checking and 6d facedir into separate files. Changed

related functions to use homedecor: and lib_6d: namespaces, as
necessary, instead of simple "homedecor_" name prefixes.
This commit is contained in:
Vanessa Ezekowitz
2013-10-13 13:20:42 -04:00
parent 92d8a53f5b
commit e4c02a82d6
6 changed files with 122 additions and 104 deletions

View File

@ -13,6 +13,8 @@
homedecor = {}
homedecor.disable_signs = minetest.setting_getbool("homedecor.disable_signs")
homedecor.debug = 0
homedecor.modpath = minetest.get_modpath("homedecor")
@ -27,57 +29,21 @@ else
S = function ( s ) return s end
end
-- Global stuff
homedecor.disable_signs = minetest.setting_getbool("homedecor.disable_signs")
-- Various Functions
local dbg = function(s)
if homedecor.debug == 1 then
print('[HomeDecor] ' .. s)
end
end
function homedecor.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
if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then
homedecor.expect_infinite_stacks = false
else
homedecor.expect_infinite_stacks = true
end
dofile(homedecor.modpath.."/ownership.lua")
dofile(homedecor.modpath.."/lib_6d.lua")
dofile(homedecor.modpath.."/misc_nodes.lua") -- the catch-all for all misc nodes
dofile(homedecor.modpath.."/tables.lua")
dofile(homedecor.modpath.."/electronics.lua")