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