]> git.lizzy.rs Git - signs_lib.git/blob - compat.lua
2f87b47d829ceec3a36241de6bd34a43e271bf5a
[signs_lib.git] / compat.lua
1
2 local default_fences = {
3         "default:fence_wood",
4         "default:fence_acacia_wood",
5         "default:fence_aspen_wood",
6         "default:fence_junglewood",
7         "default:fence_pine_wood"
8 }
9
10 for _, n in ipairs(default_fences) do
11         minetest.override_item(n, {
12                 check_for_pole = true
13         })
14 end
15
16 if minetest.get_modpath("cottages") then
17         local cbox = table.copy(minetest.registered_items["cottages:table"].node_box)
18         minetest.override_item("cottages:table", {
19                 check_for_pole = true,
20                 selection_box = cbox
21         })
22 end
23
24 if minetest.get_modpath("prefab_redo") then
25         minetest.override_item("prefab_redo:concrete_railing", {
26                 check_for_pole = true,
27                 selection_box = {
28                         type = "connected",
29                         connect_right = { -0.125, -0.5, -0.125, 0.5,   0.375, 0.125 },
30                         connect_left  = { -0.5,   -0.5, -0.125, 0.125, 0.375, 0.125 },
31                         connect_back  = { -0.125, -0.5, -0.125, 0.125, 0.375, 0.5   },
32                         connect_front = { -0.125, -0.5, -0.5,   0.125, 0.375, 0.125 },
33                         fixed = {}
34                 }
35         })
36 end
37
38 if minetest.get_modpath("streetspoles") then
39
40         local htj_north = {
41                 [1] = true,
42                 [3] = true,
43                 [9] = true,
44                 [11] = true,
45                 [21] = true,
46                 [23] = true
47         }
48
49         local htj_east = {
50                 [0] = true,
51                 [2] = true,
52                 [16] = true,
53                 [18] = true,
54                 [20] = true,
55                 [22] = true
56         }
57
58         local htj_south = {
59                 [1] = true,
60                 [3] = true,
61                 [5] = true,
62                 [7] = true,
63                 [21] = true,
64                 [23] = true
65         }
66
67         local htj_west = {
68                 [0] = true,
69                 [2] = true,
70                 [12] = true,
71                 [14] = true,
72                 [20] = true,
73                 [22] = true
74         }
75
76         local vtj_north = {
77                 [8] = true,
78                 [10] = true,
79                 [13] = true,
80                 [15] = true,
81                 [17] = true,
82                 [19] = true
83         }
84
85         local vtj_east = {
86                 [4] = true,
87                 [6] = true,
88                 [8] = true,
89                 [10] = true,
90                 [17] = true,
91                 [19] = true
92         }
93
94         local vtj_south = {
95                 [4] = true,
96                 [6] = true,
97                 [13] = true,
98                 [15] = true,
99                 [17] = true,
100                 [10] = true
101         }
102
103         local vtj_west = {
104                 [4] = true,
105                 [6] = true,
106                 [8] = true,
107                 [10] = true,
108                 [13] = true,
109                 [15] = true
110         }
111
112         minetest.override_item("streets:bigpole", {
113                 check_for_pole = function(pos, node, def, ppos, pnode, pdef)
114                         if pnode.param2 < 4
115                           or (pnode.param2 > 19 and pnode.param2 < 24)
116                           and (pos.x ~= ppos.x or pos.z ~= ppos.z) then
117                                 return true
118                         end
119                 end,
120
121                 check_for_horiz_pole = function(pos, node, def, ppos, pnode, pdef)
122                         if pnode.param2 > 3 and pnode.param2 < 12 then
123                                 if def.paramtype2 == "wallmounted" then
124                                         if node.param2 == 2 or node.param2 == 3 -- E/W
125                                                 then return true
126                                         end
127                                 else
128                                         if node.param2 == 1 or node.param2 == 3 -- E/W
129                                                 then return true
130                                         end
131                                 end
132                         elseif pnode.param2 > 11 and pnode.param2 < 20 then
133                                 if def.paramtype2 == "wallmounted" then
134                                         if node.param2 == 4 or node.param2 == 5 then
135                                                 return true
136                                         end
137                                 else
138                                         if node.param2 == 0 or node.param2 == 2 then
139                                                 return true
140                                         end
141                                 end
142                         end
143                 end
144         })
145
146         minetest.override_item("streets:bigpole_tjunction", {
147                 check_for_pole = function(pos, node, def, ppos, pnode, pdef)
148                         if def.paramtype2 == "wallmounted" then
149                                 if   (node.param2 == 4 and vtj_north[pnode.param2])
150                                   or (node.param2 == 2 and vtj_east[pnode.param2])
151                                   or (node.param2 == 5 and vtj_south[pnode.param2])
152                                   or (node.param2 == 3 and vtj_west[pnode.param2]) then
153                                         return true
154                                 end
155                         else
156                                 if   (node.param2 == 0 and vtj_north[pnode.param2])
157                                   or (node.param2 == 1 and vtj_east[pnode.param2])
158                                   or (node.param2 == 2 and vtj_south[pnode.param2])
159                                   or (node.param2 == 3 and vtj_west[pnode.param2]) then
160                                         return true
161                                 end
162                         end
163                 end,
164
165                 check_for_horiz_pole = function(pos, node, def, ppos, pnode, pdef)
166                         if def.paramtype2 == "wallmounted" then
167                                 if   (node.param2 == 4 and htj_north[pnode.param2])
168                                   or (node.param2 == 2 and htj_east[pnode.param2])
169                                   or (node.param2 == 5 and htj_south[pnode.param2])
170                                   or (node.param2 == 3 and htj_west[pnode.param2]) then
171                                         return true
172                                 end
173                         else
174                                 if   (node.param2 == 0 and htj_north[pnode.param2])
175                                   or (node.param2 == 1 and htj_east[pnode.param2])
176                                   or (node.param2 == 2 and htj_south[pnode.param2])
177                                   or (node.param2 == 3 and htj_west[pnode.param2]) then
178                                         return true
179                                 end
180                         end
181                 end
182         })
183
184 end
185
186 if minetest.get_modpath("streetlamps") then
187         minetest.override_item("streets:streetlamp_basic_top_on", {
188                 selection_box = {
189                         type = "fixed",
190                         fixed = {
191                                 {-0.3,-0.4,-0.3,0.3,0.5,0.3},
192                                 {-0.15,-0.4,-0.15,0.15,-1.55,0.15},
193                                 {-0.18,-1.55,-0.18,0.18,-2.5,0.18},
194                         }
195                 },
196                 check_for_pole = true
197         })
198 end