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