-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathinit.lua
105 lines (86 loc) · 3.51 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
-- Home Decor mod by VanessaE
-- 2013-03-17
--
-- Mostly my own code, with bits and pieces lifted from Minetest's default
-- lua files and from ironzorg's flowers mod. Many thanks to GloopMaster
-- for helping me figure out the inventories used in the nightstands/dressers.
--
-- The code for ovens, nightstands, refrigerators are basically modified
-- copies of the code for chests and furnaces.
--
-- License: LGPL 2.0 or higher
--
local DEBUG = 0
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
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 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(minetest.get_modpath("homedecor").."/misc_nodes.lua") -- the catch-all for all misc nodes
dofile(minetest.get_modpath("homedecor").."/tables.lua")
dofile(minetest.get_modpath("homedecor").."/electronics.lua")
dofile(minetest.get_modpath("homedecor").."/shutters.lua")
dofile(minetest.get_modpath("homedecor").."/shingles.lua")
dofile(minetest.get_modpath("homedecor").."/slopes.lua")
dofile(minetest.get_modpath("homedecor").."/door_models.lua")
dofile(minetest.get_modpath("homedecor").."/doors_and_gates.lua")
dofile(minetest.get_modpath("homedecor").."/signs_lib.lua")
dofile(minetest.get_modpath("homedecor").."/fences.lua")
dofile(minetest.get_modpath("homedecor").."/lighting.lua")
dofile(minetest.get_modpath("homedecor").."/kitchen_cabinet.lua")
dofile(minetest.get_modpath("homedecor").."/refrigerator.lua")
dofile(minetest.get_modpath("homedecor").."/furnaces.lua")
dofile(minetest.get_modpath("homedecor").."/nightstands.lua")
dofile(minetest.get_modpath("homedecor").."/crafts.lua")
dofile(minetest.get_modpath("homedecor").."/furniture.lua")
dofile(minetest.get_modpath("homedecor").."/furniture_medieval.lua")
dofile(minetest.get_modpath("homedecor").."/furniture_bathroom.lua")
dofile(minetest.get_modpath("homedecor").."/furniture_recipes.lua")
dofile(minetest.get_modpath("homedecor").."/locked.lua")
print("[HomeDecor] "..S("Loaded!"))