slopes.lua 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  1. --[[
  2. More Blocks: slope definitions
  3. Copyright (c) 2011-2015 Calinou and contributors.
  4. Licensed under the zlib license. See LICENSE.md for more information.
  5. --]]
  6. local S = function(str) return str end
  7. local function pixel_box(x1, y1, z1, x2, y2, z2)
  8. return {
  9. x1 / 16 - 0.5,
  10. y1 / 16 - 0.5,
  11. z1 / 16 - 0.5,
  12. x2 / 16 - 0.5,
  13. y2 / 16 - 0.5,
  14. z2 / 16 - 0.5,
  15. }
  16. end
  17. local box_regular = {
  18. type = "fixed",
  19. fixed = {
  20. {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  21. }
  22. }
  23. local box_slope = {
  24. type = "fixed",
  25. fixed = {
  26. {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  27. {-0.5, -0.25, -0.25, 0.5, 0, 0.5},
  28. {-0.5, 0, 0, 0.5, 0.25, 0.5},
  29. {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5}
  30. }
  31. }
  32. local box_slope_half = {
  33. type = "fixed",
  34. fixed = {
  35. {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
  36. {-0.5, -0.375, -0.25, 0.5, -0.25, 0.5},
  37. {-0.5, -0.25, 0, 0.5, -0.125, 0.5},
  38. {-0.5, -0.125, 0.25, 0.5, 0, 0.5},
  39. }
  40. }
  41. local box_slope_half_raised = {
  42. type = "fixed",
  43. fixed = {
  44. {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
  45. {-0.5, 0.125, -0.25, 0.5, 0.25, 0.5},
  46. {-0.5, 0.25, 0, 0.5, 0.375, 0.5},
  47. {-0.5, 0.375, 0.25, 0.5, 0.5, 0.5},
  48. }
  49. }
  50. local box_slope_lh = {
  51. type = "fixed",
  52. fixed = {
  53. {-0.5, -0.5, -0.5, 0, -0.25, 0.5},
  54. {-0.5, -0.25, -0.25, 0, 0, 0.5},
  55. {-0.5, 0, 0, 0, 0.25, 0.5},
  56. {-0.5, 0.25, 0.25, 0, 0.5, 0.5}
  57. }
  58. }
  59. local box_slope_half_lh = {
  60. type = "fixed",
  61. fixed = {
  62. {-0.5, -0.5, -0.5, 0, -0.375, 0.5},
  63. {-0.5, -0.375, -0.25, 0, -0.25, 0.5},
  64. {-0.5, -0.25, 0, 0, -0.125, 0.5},
  65. {-0.5, -0.125, 0.25, 0, 0, 0.5},
  66. }
  67. }
  68. local box_slope_half_raised_lh = {
  69. type = "fixed",
  70. fixed = {
  71. {-0.5, -0.5, -0.5, 0, 0.125, 0.5},
  72. {-0.5, 0.125, -0.25, 0, 0.25, 0.5},
  73. {-0.5, 0.25, 0, 0, 0.375, 0.5},
  74. {-0.5, 0.375, 0.25, 0, 0.5, 0.5},
  75. }
  76. }
  77. local box_slope_rh = {
  78. type = "fixed",
  79. fixed = {
  80. {0, -0.5, -0.5, 0.5, -0.25, 0.5},
  81. {0, -0.25, -0.25, 0.5, 0, 0.5},
  82. {0, 0, 0, 0.5, 0.25, 0.5},
  83. {0, 0.25, 0.25, 0.5, 0.5, 0.5}
  84. }
  85. }
  86. local box_slope_half_rh = {
  87. type = "fixed",
  88. fixed = {
  89. {0, -0.5, -0.5, 0.5, -0.375, 0.5},
  90. {0, -0.375, -0.25, 0.5, -0.25, 0.5},
  91. {0, -0.25, 0, 0.5, -0.125, 0.5},
  92. {0, -0.125, 0.25, 0.5, 0, 0.5},
  93. }
  94. }
  95. local box_slope_half_raised_rh = {
  96. type = "fixed",
  97. fixed = {
  98. {0, -0.5, -0.5, 0.5, 0.125, 0.5},
  99. {0, 0.125, -0.25, 0.5, 0.25, 0.5},
  100. {0, 0.25, 0, 0.5, 0.375, 0.5},
  101. {0, 0.375, 0.25, 0.5, 0.5, 0.5},
  102. }
  103. }
  104. --==============================================================
  105. local box_slope_inner = {
  106. type = "fixed",
  107. fixed = {
  108. {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  109. {-0.5, -0.5, -0.25, 0.5, 0, 0.5},
  110. {-0.5, -0.5, -0.5, 0.25, 0, 0.5},
  111. {-0.5, 0, -0.5, 0, 0.25, 0.5},
  112. {-0.5, 0, 0, 0.5, 0.25, 0.5},
  113. {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5},
  114. {-0.5, 0.25, -0.5, -0.25, 0.5, 0.5},
  115. }
  116. }
  117. local box_slope_inner_cut4 = {
  118. type = "fixed",
  119. fixed = {
  120. pixel_box(0, 0, 8, 16, 8, 16),
  121. pixel_box(0, 0, 8, 8, 8, 0),
  122. pixel_box(0, 8, 0, 4, 16, 16),
  123. pixel_box(4, 8, 12, 16, 16, 16),
  124. }
  125. }
  126. local box_slope_01 = {
  127. type = "fixed",
  128. fixed = {
  129. pixel_box(0, 0, 8, 4, 8, 0),
  130. pixel_box(8, 0, 16, 16, 8, 12),
  131. pixel_box(0, 0, 16, 8, 8, 8),
  132. pixel_box(0, 8, 16, 4, 16, 12),
  133. }
  134. }
  135. local box_slope_inner_half = {
  136. type = "fixed",
  137. fixed = {
  138. {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
  139. {-0.5, -0.375, -0.25, 0.5, -0.25, 0.5},
  140. {-0.5, -0.375, -0.5, 0.25, -0.25, 0.5},
  141. {-0.5, -0.25, -0.5, 0, -0.125, 0.5},
  142. {-0.5, -0.25, 0, 0.5, -0.125, 0.5},
  143. {-0.5, -0.125, 0.25, 0.5, 0, 0.5},
  144. {-0.5, -0.125, -0.5, -0.25, 0, 0.5},
  145. }
  146. }
  147. local box_slope_inner_half_raised = {
  148. type = "fixed",
  149. fixed = {
  150. {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
  151. {-0.5, 0.125, -0.25, 0.5, 0.25, 0.5},
  152. {-0.5, 0.125, -0.5, 0.25, 0.25, 0.5},
  153. {-0.5, 0.25, -0.5, 0, 0.375, 0.5},
  154. {-0.5, 0.25, 0, 0.5, 0.375, 0.5},
  155. {-0.5, 0.375, 0.25, 0.5, 0.5, 0.5},
  156. {-0.5, 0.375, -0.5, -0.25, 0.5, 0.5},
  157. }
  158. }
  159. --==============================================================
  160. local box_slope_outer = {
  161. type = "fixed",
  162. fixed = {
  163. {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  164. {-0.5, -0.25, -0.25, 0.25, 0, 0.5},
  165. {-0.5, 0, 0, 0, 0.25, 0.5},
  166. {-0.5, 0.25, 0.25, -0.25, 0.5, 0.5}
  167. }
  168. }
  169. local box_slope_outer_half = {
  170. type = "fixed",
  171. fixed = {
  172. {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
  173. {-0.5, -0.375, -0.25, 0.25, -0.25, 0.5},
  174. {-0.5, -0.25, 0, 0, -0.125, 0.5},
  175. {-0.5, -0.125, 0.25, -0.25, 0, 0.5}
  176. }
  177. }
  178. local box_slope_outer_half_raised = {
  179. type = "fixed",
  180. fixed = {
  181. {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
  182. {-0.5, 0.125, -0.25, 0.25, 0.25, 0.5},
  183. {-0.5, 0.25, 0, 0, 0.375, 0.5},
  184. {-0.5, 0.375, 0.25, -0.25, 0.5, 0.5}
  185. }
  186. }
  187. local xslope_quarter = {
  188. type = "fixed",
  189. fixed = {
  190. {-0.5, -0.5, 0.5, 0, 0, 0},
  191. {-0.25, -0.25, 0, -0.5, -0.5, -0.5},
  192. }
  193. }
  194. local xslope_quarter2 = {
  195. type = "fixed",
  196. fixed = {
  197. {0.0, -0.5, 0.5, 0.5, 0, 0},
  198. {0.5, -0.25, 0, 0.25, -0.5, -0.5},
  199. }
  200. }
  201. local xslope_three_quarter = {
  202. type = "fixed",
  203. fixed = {
  204. {-0.5, -0.5, 0.5, 0.5, 0.5, 0},
  205. {0.25, 0.25, 0, -0.5, -0.5, -0.5},
  206. }
  207. }
  208. local xslope_three_quarter_half = {
  209. type = "fixed",
  210. fixed = {
  211. {-0.5, -0.5, 0.5, 0.5, 0.5, 0},
  212. }
  213. }
  214. local xslope_cut = {
  215. type = "fixed",
  216. fixed = {
  217. {-0.5, -0.5, 0.5, 0.5, 0.5, 0},
  218. }
  219. }
  220. local xslope_slope = {
  221. type = "fixed",
  222. fixed = {
  223. {-0.5, -0.5, 0.5, 0.5, 0, 0},
  224. }
  225. }
  226. local xslope_peak = {
  227. type = "fixed",
  228. fixed = {
  229. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  230. {-0.5, 0, -0.25, 0.5, 0.5, 0.25},
  231. }
  232. }
  233. local xslope_peak_half = {
  234. type = "fixed",
  235. fixed = {
  236. {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  237. {-0.5, -0.25, -0.25, 0.5, 0, 0.25},
  238. }
  239. }
  240. local xslope_slope_lh = {
  241. type = "fixed",
  242. fixed = {
  243. {-0.5, -0.5, 0.5, 0, 0, 0},
  244. }
  245. }
  246. local xslope_slope_rh = {
  247. type = "fixed",
  248. fixed = {
  249. {0, -0.5, 0.5, 0.5, 0, 0},
  250. }
  251. }
  252. local xslope_peak_lh = {
  253. type = "fixed",
  254. fixed = {
  255. {-0.5, -0.5, -0.5, 0, 0, 0.5},
  256. {-0.5, 0, -0.25, 0, 0.5, 0.25},
  257. }
  258. }
  259. local xslope_peak_half_lh = {
  260. type = "fixed",
  261. fixed = {
  262. {-0.5, -0.5, -0.5, 0, -0.25, 0.5},
  263. {-0.5, -0.25, -0.25, 0, 0, 0.25},
  264. }
  265. }
  266. local astair_1 = {
  267. type = "fixed",
  268. fixed = {
  269. -- Big angle.
  270. {-0.5, -0.5, 0.5, 0.5, 0, 0.25},
  271. {-0.5, -0.5, 0.25, 0.25, 0, 0},
  272. {-0.5, -0.5, 0, 0, 0, -0.25},
  273. {-0.5, -0.5, -0.25, -0.25, 0, -0.5},
  274. -- Corner angle.
  275. {-0.5, 0, 0.5, 0, 0.5, 0.25},
  276. {-0.5, 0, 0.25, -0.25, 0.5, 0},
  277. }
  278. }
  279. local astair_2 = {
  280. type = "fixed",
  281. fixed = {
  282. -- Box.
  283. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  284. -- Angle.
  285. {-0.5, 0, 0.5, 0.5, 0.5, 0.25},
  286. {-0.5, 0, 0.25, 0.25, 0.5, 0},
  287. {-0.5, 0, 0, 0, 0.5, -0.25},
  288. {-0.5, 0, -0.25, -0.25, 0.5, -0.5},
  289. }
  290. }
  291. local astair_3 = {
  292. type = "fixed",
  293. fixed = {
  294. -- Box.
  295. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  296. -- Corner angle.
  297. {-0.5, 0, 0.5, 0, 0.5, 0.25},
  298. {-0.5, 0, 0.25, -0.25, 0.5, 0},
  299. }
  300. }
  301. local astair_4 = {
  302. type = "fixed",
  303. fixed = {
  304. -- Box.
  305. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  306. -- Corner angle.
  307. {-0.5, 0, 0.5, 0, 0.5, 0.25},
  308. {-0.5, 0, 0.25, -0.25, 0.5, 0},
  309. }
  310. }
  311. -- Node will be called <modname>:slope_<subname>
  312. local slopes_defs = {
  313. [""] = {
  314. description = "45 Slope Full",
  315. mesh = "moreblocks_slope.obj",
  316. collision_box = box_slope,
  317. selection_box = box_slope,
  318. light=1/2,
  319. },
  320. ["_half"] = {
  321. description = "22 Slope Full",
  322. mesh = "moreblocks_slope_half.obj",
  323. collision_box = box_slope_half,
  324. selection_box = box_slope_half,
  325. light=1/4,
  326. },
  327. ["_half_raised"] = {
  328. description = "22 Slope Raised Full",
  329. mesh = "moreblocks_slope_half_raised.obj",
  330. collision_box = box_slope_half_raised,
  331. selection_box = box_slope_half_raised,
  332. light=3/4,
  333. },
  334. --==============================================================
  335. ["_inner"] = {
  336. description = "45 Inner Corner Slope #1",
  337. mesh = "moreblocks_slope_inner.obj",
  338. collision_box = box_slope_inner,
  339. selection_box = box_slope_inner,
  340. light=3/4,
  341. },
  342. ["_inner_half"] = {
  343. description = "22 Inner Corner Slope",
  344. mesh = "moreblocks_slope_inner_half.obj",
  345. collision_box = box_slope_inner_half,
  346. selection_box = box_slope_inner_half,
  347. light=2/5,
  348. },
  349. ["_inner_half_raised"] = {
  350. description = "22 Inner Corner Raised Slope",
  351. mesh = "moreblocks_slope_inner_half_raised.obj",
  352. collision_box = box_slope_inner_half_raised,
  353. selection_box = box_slope_inner_half_raised,
  354. light=4/5,
  355. },
  356. --==============================================================
  357. ["_inner_cut"] = {
  358. description = "Beveled Corner Slope #4",
  359. mesh = "moreblocks_slope_inner_cut.obj",
  360. collision_box = box_slope_inner,
  361. selection_box = box_slope_inner,
  362. light=4/5,
  363. },
  364. ["_inner_cut2"] = {
  365. description = "Beveled Corner Slope #5",
  366. mesh = "moreblocks_slope_inner_cut2.obj",
  367. collision_box = box_regular,
  368. selection_box = box_regular,
  369. light=4/5,
  370. },
  371. ["_inner_cut3"] = {
  372. description = "Beveled Corner Slope #1",
  373. mesh = "moreblocks_slope_inner_cut3.obj",
  374. collision_box = box_regular,
  375. selection_box = box_regular,
  376. light=4/5,
  377. },
  378. ["_inner_cut4"] = {
  379. description = "Inner Corner Beveled Slope",
  380. mesh = "moreblocks_slope_inner_cut4.obj",
  381. collision_box = box_slope_inner_cut4,
  382. selection_box = box_slope_inner_cut4,
  383. light=4/5,
  384. },
  385. ["_inner_cut5"] = {
  386. description = "Inner Corner Slope #1",
  387. mesh = "moreblocks_slope_inner_cut5.obj",
  388. collision_box = box_slope_inner_cut4,
  389. selection_box = box_slope_inner_cut4,
  390. light=4/5,
  391. },
  392. ["_inner_cut6"] = {
  393. description = "Inner Corner Slope #2",
  394. mesh = "moreblocks_slope_inner_cut6.obj",
  395. collision_box = box_slope_inner,
  396. selection_box = box_slope_inner,
  397. light=4/5,
  398. },
  399. ["_inner_cut7"] = {
  400. description = "Inner Corner Slope #3",
  401. mesh = "moreblocks_slope_inner_cut7.obj",
  402. collision_box = box_regular,
  403. selection_box = box_regular,
  404. light=4/5,
  405. },
  406. ["_inner_cut_half"] = {
  407. description = "Beveled Corner Slope #3",
  408. mesh = "moreblocks_slope_inner_cut_half.obj",
  409. collision_box = box_slope_inner_half,
  410. selection_box = box_slope_inner_half,
  411. light=2/5,
  412. },
  413. ["_inner_cut_half_raised"] = {
  414. description = "Beveled Corner Slope #2",
  415. mesh = "moreblocks_slope_inner_cut_half_raised.obj",
  416. collision_box = box_slope_inner_half_raised,
  417. selection_box = box_slope_inner_half_raised,
  418. light=4/5,
  419. },
  420. --==============================================================
  421. ["_outer"] = {
  422. description = "45 Outer Corner Slope",
  423. mesh = "moreblocks_slope_outer.obj",
  424. collision_box = box_slope_outer,
  425. selection_box = box_slope_outer,
  426. light=2/5,
  427. },
  428. ["_outer_half"] = {
  429. description = "22 Outer Corner Slope",
  430. mesh = "moreblocks_slope_outer_half.obj",
  431. collision_box = box_slope_outer_half,
  432. selection_box = box_slope_outer_half,
  433. light=1/5,
  434. },
  435. ["_outer_half_raised"] = {
  436. description = "22 Outer Corner Raised Slope",
  437. mesh = "moreblocks_slope_outer_half_raised.obj",
  438. collision_box = box_slope_outer_half_raised,
  439. selection_box = box_slope_outer_half_raised,
  440. light=4/5,
  441. },
  442. --==============================================================
  443. ["_outer_cut"] = {
  444. description = "Beveled Corner Slope #7",
  445. mesh = "moreblocks_slope_outer_cut.obj",
  446. collision_box = box_slope_01,
  447. selection_box = box_slope_01,
  448. light=1/4,
  449. },
  450. ["_outer_cut_half"] = {
  451. description = "Beveled Corner Slope #8",
  452. mesh = "moreblocks_slope_outer_cut_half.obj",
  453. collision_box = box_slope_outer_half,
  454. selection_box = box_slope_outer_half,
  455. light=1/8,
  456. },
  457. ["_outer_cut_half_raised"] = {
  458. description = "Beveled Corner Slope #9",
  459. mesh = "moreblocks_slope_outer_cut_half_raised.obj",
  460. collision_box = box_slope_outer_half_raised,
  461. selection_box = box_slope_outer_half_raised,
  462. light=3/8,
  463. },
  464. ["_cut"] = {
  465. description = "Beveled Corner Slope #6",
  466. mesh = "moreblocks_slope_cut.obj",
  467. collision_box = box_slope_outer,
  468. selection_box = box_slope_outer,
  469. light=1/2,
  470. },
  471. -- Additional custom slopes.
  472. ["_xslope_quarter"] = {
  473. description = "Microspike Left",
  474. mesh = "xslopes_quarter.obj",
  475. collision_box = xslope_quarter,
  476. selection_box = xslope_quarter,
  477. light=1/5,
  478. },
  479. ["_xslope_quarter2"] = {
  480. description = "Microspike Right",
  481. mesh = "xslopes_quarter2.obj",
  482. collision_box = xslope_quarter2,
  483. selection_box = xslope_quarter2,
  484. light=1/5,
  485. },
  486. ["_xslope_three_quarter"] = {
  487. description = "Corner Trapezoid Full",
  488. mesh = "xslopes_three_quarter.obj",
  489. collision_box = xslope_three_quarter,
  490. selection_box = xslope_three_quarter,
  491. light=3/5,
  492. },
  493. ["_xslope_three_quarter_half"] = {
  494. description = "Corner Trapezoid Half",
  495. mesh = "xslopes_three_quarter_half.obj",
  496. collision_box = xslope_three_quarter_half,
  497. selection_box = xslope_three_quarter_half,
  498. light=2/5,
  499. },
  500. ["_xslope_cut"] = {
  501. description = "Edge Trapezoid Half",
  502. mesh = "xslopes_cut.obj",
  503. collision_box = xslope_cut,
  504. selection_box = xslope_cut,
  505. light=1/2,
  506. },
  507. ["_xslope_slope"] = {
  508. description = "45 Doubled Microblock",
  509. mesh = "xslopes_slope.obj",
  510. collision_box = xslope_slope,
  511. selection_box = xslope_slope,
  512. light=1/4,
  513. },
  514. ["_xslope_peak"] = {
  515. description = "Tall Peak Full-Width",
  516. mesh = "xslopes_peak.obj",
  517. collision_box = xslope_peak,
  518. selection_box = xslope_peak,
  519. light=2/4,
  520. },
  521. ["_xslope_peak_half"] = {
  522. description = "Short Peak Full-Width",
  523. mesh = "xslopes_peak_half.obj",
  524. collision_box = xslope_peak_half,
  525. selection_box = xslope_peak_half,
  526. light=1/4,
  527. },
  528. ["_lh"] = {
  529. description = "45 Slope Left",
  530. mesh = "moreblocks_slope_lh.obj",
  531. collision_box = box_slope_lh,
  532. selection_box = box_slope_lh,
  533. light=1/4,
  534. },
  535. ["_half_lh"] = {
  536. description = "22 Slope Left",
  537. mesh = "moreblocks_slope_half_lh.obj",
  538. collision_box = box_slope_half_lh,
  539. selection_box = box_slope_half_lh,
  540. light=1/8,
  541. },
  542. ["_half_raised_lh"] = {
  543. description = "22 Slope Raised Left",
  544. mesh = "moreblocks_slope_half_raised_lh.obj",
  545. collision_box = box_slope_half_raised_lh,
  546. selection_box = box_slope_half_raised_lh,
  547. light=3/8,
  548. },
  549. ["_xslope_slope_lh"] = {
  550. description = "45 Microblock Slope Left",
  551. mesh = "xslopes_slope_lh.obj",
  552. collision_box = xslope_slope_lh,
  553. selection_box = xslope_slope_lh,
  554. light=1/8,
  555. },
  556. ["_xslope_peak_lh"] = {
  557. description = "Tall Peak Half-Width",
  558. mesh = "xslopes_peak_lh.obj",
  559. collision_box = xslope_peak_lh,
  560. selection_box = xslope_peak_lh,
  561. light=2/8,
  562. },
  563. ["_xslope_peak_half_lh"] = {
  564. description = "Short Peak Half-Width",
  565. mesh = "xslopes_peak_half_lh.obj",
  566. collision_box = xslope_peak_half_lh,
  567. selection_box = xslope_peak_half_lh,
  568. light=1/8,
  569. },
  570. ["_rh"] = {
  571. description = "45 Slope Right",
  572. mesh = "moreblocks_slope_rh.obj",
  573. collision_box = box_slope_rh,
  574. selection_box = box_slope_rh,
  575. light=1/4,
  576. },
  577. ["_half_rh"] = {
  578. description = "22 Slope Right",
  579. mesh = "moreblocks_slope_half_rh.obj",
  580. collision_box = box_slope_half_rh,
  581. selection_box = box_slope_half_rh,
  582. light=1/8,
  583. },
  584. ["_half_raised_rh"] = {
  585. description = "22 Slope Raised Right",
  586. mesh = "moreblocks_slope_half_raised_rh.obj",
  587. collision_box = box_slope_half_raised_rh,
  588. selection_box = box_slope_half_raised_rh,
  589. light=3/8,
  590. },
  591. ["_xslope_slope_rh"] = {
  592. description = "45 Microblock Slope Right",
  593. mesh = "xslopes_slope_rh.obj",
  594. collision_box = xslope_slope_rh,
  595. selection_box = xslope_slope_rh,
  596. light=1/8,
  597. },
  598. ["_astair_1"] = {
  599. description = "Beveled Corner-Stair #1",
  600. mesh = "astair_1.obj",
  601. collision_box = astair_1,
  602. selection_box = astair_1,
  603. light=1/3,
  604. },
  605. ["_astair_2"] = {
  606. description = "Beveled Corner-Stair #2",
  607. mesh = "astair_2.obj",
  608. collision_box = astair_2,
  609. selection_box = astair_2,
  610. light=1/3,
  611. },
  612. ["_astair_3"] = {
  613. description = "Beveled Corner-Stair #3",
  614. mesh = "astair_3.obj",
  615. collision_box = astair_3,
  616. selection_box = astair_3,
  617. light=1/3,
  618. },
  619. ["_astair_4"] = {
  620. description = "Beveled Corner-Stair #4",
  621. mesh = "astair_4.obj",
  622. collision_box = astair_4,
  623. selection_box = astair_4,
  624. light=1/3,
  625. },
  626. ["_astair_5"] = {
  627. description = "Beveled Corner-Stair #5",
  628. mesh = "moreblocks_slope_inner_cut8.obj",
  629. collision_box = box_regular,
  630. selection_box = box_regular,
  631. light=4/5,
  632. },
  633. }
  634. function stairs.register_slopes(subname, recipeitem, groups, images, description, sounds)
  635. local stair_images = {}
  636. for i, image in ipairs(images) do
  637. if type(image) == "string" then
  638. stair_images[i] = {
  639. name = image,
  640. backface_culling = true,
  641. }
  642. elseif image.backface_culling == nil then -- override using any other value
  643. stair_images[i] = table.copy(image)
  644. stair_images[i].backface_culling = true
  645. end
  646. end
  647. local defs = table.copy(slopes_defs)
  648. -- Do not modify function argument.
  649. local groups = table.copy(groups)
  650. groups.stairs_slope = 1
  651. groups.not_in_craft_guide = 1
  652. groups.stairs_node = 1
  653. local ndef = minetest.registered_items[recipeitem]
  654. assert(ndef)
  655. for alternate, def in pairs(defs) do
  656. --if not alternate:find("_xslope_") or minetest.settings:get("port") == "30001" then
  657. def.drawtype = "mesh"
  658. def.paramtype = "light"
  659. def.paramtype2 = "facedir"
  660. def.on_place = function(...) return stairs.rotate_and_place(...) end
  661. def.groups = groups
  662. def.sounds = sounds
  663. def.description = description .. " " .. (def.description or "Slope")
  664. def.tiles = stair_images
  665. def.light_source = math.ceil(ndef.light_source*(def.light or 0))
  666. def.light = nil
  667. def._stairs_parent_material = recipeitem
  668. stairs.setup_nodedef_callbacks(subname, def)
  669. minetest.register_node(":stairs:slope_" ..subname..alternate, def)
  670. --end
  671. end
  672. if recipeitem then
  673. circular_saw.register_node(recipeitem, subname)
  674. end
  675. end
  676. local newslope_box01 = {
  677. type = "fixed",
  678. fixed = {
  679. pixel_box(0, 0, 16, 16, 8, 8),
  680. pixel_box(0, 0, 8, 8, 8, 0),
  681. },
  682. }
  683. local newslope_box02 = {
  684. type = "fixed",
  685. fixed = {
  686. pixel_box(0, 0, 16, 8, 8, 8),
  687. },
  688. }
  689. -- Note: names must NOT conflict with 'slopes_defs'!
  690. -- This table shall only contain shapes suitable for use with default, basic materials:
  691. -- stone, stone brick, desert stone and brick, sandstone and brick, and MAYBE a few others.
  692. -- Strive hard to keep the node count down, and DO NOT register these shapes for every
  693. -- possible material just because you *think* you can get away with it! This game is
  694. -- already very close to the maximum allowed number of content IDs.
  695. local new_slopes_defs = {
  696. ["_01"] = {
  697. description = "45 Inner Corner Slope #2",
  698. mesh = "musttest_newslopes_01.obj",
  699. collision_box = newslope_box01,
  700. selection_box = newslope_box01,
  701. light=1/4,
  702. },
  703. ["_02"] = {
  704. description = "Half Microspike",
  705. mesh = "musttest_newslopes_02.obj",
  706. collision_box = newslope_box02,
  707. selection_box = newslope_box02,
  708. light=1/8,
  709. },
  710. }
  711. function stairs.register_new_slopes(subname, recipeitem, groups, images, description, sounds, datatable)
  712. local stair_images = {}
  713. for i, image in ipairs(images) do
  714. if type(image) == "string" then
  715. stair_images[i] = {
  716. name = image,
  717. backface_culling = true,
  718. }
  719. elseif image.backface_culling == nil then -- override using any other value
  720. stair_images[i] = table.copy(image)
  721. stair_images[i].backface_culling = true
  722. end
  723. end
  724. local defs = table.copy(new_slopes_defs)
  725. if datatable.blacklist then
  726. for k, v in pairs(datatable.blacklist) do
  727. defs[k] = nil
  728. end
  729. end
  730. if datatable.whitelist then
  731. local newdefs = {}
  732. for k, v in pairs(defs) do
  733. if datatable.whitelist[k] then
  734. newdefs[k] = v
  735. end
  736. end
  737. defs = newdefs
  738. end
  739. -- Do not modify function argument.
  740. local groups = table.copy(groups)
  741. groups.stairs_slope = 1
  742. groups.not_in_craft_guide = 1
  743. groups.stairs_node = 1
  744. local ndef = minetest.registered_items[recipeitem]
  745. assert(ndef)
  746. for alternate, def in pairs(defs) do
  747. --if not alternate:find("_xslope_") or minetest.settings:get("port") == "30001" then
  748. def.drawtype = "mesh"
  749. def.paramtype = "light"
  750. def.paramtype2 = "facedir"
  751. def.on_place = function(...) return stairs.rotate_and_place(...) end
  752. def.groups = groups
  753. def.sounds = sounds
  754. def.description = description .. " " .. (def.description or "Slope")
  755. def.tiles = stair_images
  756. def.light_source = math.ceil(ndef.light_source*(def.light or 0))
  757. def.light = nil
  758. def._stairs_parent_material = recipeitem
  759. stairs.setup_nodedef_callbacks(subname, def)
  760. minetest.register_node(":newslopes:" ..subname..alternate, def)
  761. --end
  762. end
  763. if recipeitem then
  764. circular_saw.register_node(recipeitem, subname)
  765. end
  766. end