compat.lua 4.4 KB

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