-
Notifications
You must be signed in to change notification settings - Fork 12
/
compat.lua
200 lines (182 loc) · 4.44 KB
/
compat.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
if minetest.get_modpath("default") then
local default_fences = {
"default:fence_wood",
"default:fence_acacia_wood",
"default:fence_aspen_wood",
"default:fence_junglewood",
"default:fence_pine_wood"
}
for _, n in ipairs(default_fences) do
minetest.override_item(n, {
check_for_pole = true
})
end
end
if minetest.get_modpath("cottages") then
local cbox = table.copy(minetest.registered_items["cottages:table"].node_box)
minetest.override_item("cottages:table", {
check_for_pole = true,
selection_box = cbox
})
end
if minetest.get_modpath("prefab_redo") then
minetest.override_item("prefab_redo:concrete_railing", {
check_for_pole = true,
selection_box = {
type = "connected",
connect_right = { -0.125, -0.5, -0.125, 0.5, 0.375, 0.125 },
connect_left = { -0.5, -0.5, -0.125, 0.125, 0.375, 0.125 },
connect_back = { -0.125, -0.5, -0.125, 0.125, 0.375, 0.5 },
connect_front = { -0.125, -0.5, -0.5, 0.125, 0.375, 0.125 },
disconnected = { -0.125, -0.5, -0.125, 0.125, 0.25, 0.125 },
fixed = {}
}
})
end
if minetest.get_modpath("streetspoles") then
local htj_north = {
[1] = true,
[3] = true,
[9] = true,
[11] = true,
[21] = true,
[23] = true
}
local htj_east = {
[0] = true,
[2] = true,
[16] = true,
[18] = true,
[20] = true,
[22] = true
}
local htj_south = {
[1] = true,
[3] = true,
[5] = true,
[7] = true,
[21] = true,
[23] = true
}
local htj_west = {
[0] = true,
[2] = true,
[12] = true,
[14] = true,
[20] = true,
[22] = true
}
local vtj_north = {
[8] = true,
[10] = true,
[13] = true,
[15] = true,
[17] = true,
[19] = true
}
local vtj_east = {
[4] = true,
[6] = true,
[8] = true,
[10] = true,
[17] = true,
[19] = true
}
local vtj_south = {
[4] = true,
[6] = true,
[13] = true,
[15] = true,
[17] = true,
[10] = true
}
local vtj_west = {
[4] = true,
[6] = true,
[8] = true,
[10] = true,
[13] = true,
[15] = true
}
minetest.override_item("streets:bigpole", {
check_for_pole = function(pos, node, def, ppos, pnode, pdef)
if pnode.param2 < 4
or (pnode.param2 > 19 and pnode.param2 < 24)
and (pos.x ~= ppos.x or pos.z ~= ppos.z) then
return true
end
end,
check_for_horiz_pole = function(pos, node, def, ppos, pnode, pdef)
if pnode.param2 > 3 and pnode.param2 < 12 then
if def.paramtype2 == "wallmounted" then
if node.param2 == 2 or node.param2 == 3 -- E/W
then return true
end
else
if node.param2 == 1 or node.param2 == 3 -- E/W
then return true
end
end
elseif pnode.param2 > 11 and pnode.param2 < 20 then
if def.paramtype2 == "wallmounted" then
if node.param2 == 4 or node.param2 == 5 then
return true
end
else
if node.param2 == 0 or node.param2 == 2 then
return true
end
end
end
end
})
minetest.override_item("streets:bigpole_tjunction", {
check_for_pole = function(pos, node, def, ppos, pnode, pdef)
if def.paramtype2 == "wallmounted" then
if (node.param2 == 4 and vtj_north[pnode.param2])
or (node.param2 == 2 and vtj_east[pnode.param2])
or (node.param2 == 5 and vtj_south[pnode.param2])
or (node.param2 == 3 and vtj_west[pnode.param2]) then
return true
end
else
if (node.param2 == 0 and vtj_north[pnode.param2])
or (node.param2 == 1 and vtj_east[pnode.param2])
or (node.param2 == 2 and vtj_south[pnode.param2])
or (node.param2 == 3 and vtj_west[pnode.param2]) then
return true
end
end
end,
check_for_horiz_pole = function(pos, node, def, ppos, pnode, pdef)
if def.paramtype2 == "wallmounted" then
if (node.param2 == 4 and htj_north[pnode.param2])
or (node.param2 == 2 and htj_east[pnode.param2])
or (node.param2 == 5 and htj_south[pnode.param2])
or (node.param2 == 3 and htj_west[pnode.param2]) then
return true
end
else
if (node.param2 == 0 and htj_north[pnode.param2])
or (node.param2 == 1 and htj_east[pnode.param2])
or (node.param2 == 2 and htj_south[pnode.param2])
or (node.param2 == 3 and htj_west[pnode.param2]) then
return true
end
end
end
})
end
if minetest.get_modpath("streetlamps") then
minetest.override_item("streets:streetlamp_basic_top_on", {
selection_box = {
type = "fixed",
fixed = {
{-0.3,-0.4,-0.3,0.3,0.5,0.3},
{-0.15,-0.4,-0.15,0.15,-1.55,0.15},
{-0.18,-1.55,-0.18,0.18,-2.5,0.18},
}
},
check_for_pole = true
})
end