slopes.lua 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  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 box_regular = {
  8. type = "fixed",
  9. fixed = {
  10. {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  11. }
  12. }
  13. local box_slope = {
  14. type = "fixed",
  15. fixed = {
  16. {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  17. {-0.5, -0.25, -0.25, 0.5, 0, 0.5},
  18. {-0.5, 0, 0, 0.5, 0.25, 0.5},
  19. {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5}
  20. }
  21. }
  22. local box_slope_half = {
  23. type = "fixed",
  24. fixed = {
  25. {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
  26. {-0.5, -0.375, -0.25, 0.5, -0.25, 0.5},
  27. {-0.5, -0.25, 0, 0.5, -0.125, 0.5},
  28. {-0.5, -0.125, 0.25, 0.5, 0, 0.5},
  29. }
  30. }
  31. local box_slope_half_raised = {
  32. type = "fixed",
  33. fixed = {
  34. {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
  35. {-0.5, 0.125, -0.25, 0.5, 0.25, 0.5},
  36. {-0.5, 0.25, 0, 0.5, 0.375, 0.5},
  37. {-0.5, 0.375, 0.25, 0.5, 0.5, 0.5},
  38. }
  39. }
  40. local box_slope_lh = {
  41. type = "fixed",
  42. fixed = {
  43. {-0.5, -0.5, -0.5, 0, -0.25, 0.5},
  44. {-0.5, -0.25, -0.25, 0, 0, 0.5},
  45. {-0.5, 0, 0, 0, 0.25, 0.5},
  46. {-0.5, 0.25, 0.25, 0, 0.5, 0.5}
  47. }
  48. }
  49. local box_slope_half_lh = {
  50. type = "fixed",
  51. fixed = {
  52. {-0.5, -0.5, -0.5, 0, -0.375, 0.5},
  53. {-0.5, -0.375, -0.25, 0, -0.25, 0.5},
  54. {-0.5, -0.25, 0, 0, -0.125, 0.5},
  55. {-0.5, -0.125, 0.25, 0, 0, 0.5},
  56. }
  57. }
  58. local box_slope_half_raised_lh = {
  59. type = "fixed",
  60. fixed = {
  61. {-0.5, -0.5, -0.5, 0, 0.125, 0.5},
  62. {-0.5, 0.125, -0.25, 0, 0.25, 0.5},
  63. {-0.5, 0.25, 0, 0, 0.375, 0.5},
  64. {-0.5, 0.375, 0.25, 0, 0.5, 0.5},
  65. }
  66. }
  67. local box_slope_rh = {
  68. type = "fixed",
  69. fixed = {
  70. {0, -0.5, -0.5, 0.5, -0.25, 0.5},
  71. {0, -0.25, -0.25, 0.5, 0, 0.5},
  72. {0, 0, 0, 0.5, 0.25, 0.5},
  73. {0, 0.25, 0.25, 0.5, 0.5, 0.5}
  74. }
  75. }
  76. local box_slope_half_rh = {
  77. type = "fixed",
  78. fixed = {
  79. {0, -0.5, -0.5, 0.5, -0.375, 0.5},
  80. {0, -0.375, -0.25, 0.5, -0.25, 0.5},
  81. {0, -0.25, 0, 0.5, -0.125, 0.5},
  82. {0, -0.125, 0.25, 0.5, 0, 0.5},
  83. }
  84. }
  85. local box_slope_half_raised_rh = {
  86. type = "fixed",
  87. fixed = {
  88. {0, -0.5, -0.5, 0.5, 0.125, 0.5},
  89. {0, 0.125, -0.25, 0.5, 0.25, 0.5},
  90. {0, 0.25, 0, 0.5, 0.375, 0.5},
  91. {0, 0.375, 0.25, 0.5, 0.5, 0.5},
  92. }
  93. }
  94. --==============================================================
  95. local box_slope_inner = {
  96. type = "fixed",
  97. fixed = {
  98. {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  99. {-0.5, -0.5, -0.25, 0.5, 0, 0.5},
  100. {-0.5, -0.5, -0.5, 0.25, 0, 0.5},
  101. {-0.5, 0, -0.5, 0, 0.25, 0.5},
  102. {-0.5, 0, 0, 0.5, 0.25, 0.5},
  103. {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5},
  104. {-0.5, 0.25, -0.5, -0.25, 0.5, 0.5},
  105. }
  106. }
  107. local box_slope_inner_half = {
  108. type = "fixed",
  109. fixed = {
  110. {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
  111. {-0.5, -0.375, -0.25, 0.5, -0.25, 0.5},
  112. {-0.5, -0.375, -0.5, 0.25, -0.25, 0.5},
  113. {-0.5, -0.25, -0.5, 0, -0.125, 0.5},
  114. {-0.5, -0.25, 0, 0.5, -0.125, 0.5},
  115. {-0.5, -0.125, 0.25, 0.5, 0, 0.5},
  116. {-0.5, -0.125, -0.5, -0.25, 0, 0.5},
  117. }
  118. }
  119. local box_slope_inner_half_raised = {
  120. type = "fixed",
  121. fixed = {
  122. {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
  123. {-0.5, 0.125, -0.25, 0.5, 0.25, 0.5},
  124. {-0.5, 0.125, -0.5, 0.25, 0.25, 0.5},
  125. {-0.5, 0.25, -0.5, 0, 0.375, 0.5},
  126. {-0.5, 0.25, 0, 0.5, 0.375, 0.5},
  127. {-0.5, 0.375, 0.25, 0.5, 0.5, 0.5},
  128. {-0.5, 0.375, -0.5, -0.25, 0.5, 0.5},
  129. }
  130. }
  131. --==============================================================
  132. local box_slope_outer = {
  133. type = "fixed",
  134. fixed = {
  135. {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  136. {-0.5, -0.25, -0.25, 0.25, 0, 0.5},
  137. {-0.5, 0, 0, 0, 0.25, 0.5},
  138. {-0.5, 0.25, 0.25, -0.25, 0.5, 0.5}
  139. }
  140. }
  141. local box_slope_outer_half = {
  142. type = "fixed",
  143. fixed = {
  144. {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
  145. {-0.5, -0.375, -0.25, 0.25, -0.25, 0.5},
  146. {-0.5, -0.25, 0, 0, -0.125, 0.5},
  147. {-0.5, -0.125, 0.25, -0.25, 0, 0.5}
  148. }
  149. }
  150. local box_slope_outer_half_raised = {
  151. type = "fixed",
  152. fixed = {
  153. {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
  154. {-0.5, 0.125, -0.25, 0.25, 0.25, 0.5},
  155. {-0.5, 0.25, 0, 0, 0.375, 0.5},
  156. {-0.5, 0.375, 0.25, -0.25, 0.5, 0.5}
  157. }
  158. }
  159. local xslope_quarter = {
  160. type = "fixed",
  161. fixed = {
  162. {-0.5, -0.5, 0.5, 0, 0, 0},
  163. {-0.25, -0.25, 0, -0.5, -0.5, -0.5},
  164. }
  165. }
  166. local xslope_quarter2 = {
  167. type = "fixed",
  168. fixed = {
  169. {0.0, -0.5, 0.5, 0.5, 0, 0},
  170. {0.5, -0.25, 0, 0.25, -0.5, -0.5},
  171. }
  172. }
  173. local xslope_three_quarter = {
  174. type = "fixed",
  175. fixed = {
  176. {-0.5, -0.5, 0.5, 0.5, 0.5, 0},
  177. {0.25, 0.25, 0, -0.5, -0.5, -0.5},
  178. }
  179. }
  180. local xslope_three_quarter_half = {
  181. type = "fixed",
  182. fixed = {
  183. {-0.5, -0.5, 0.5, 0.5, 0.5, 0},
  184. }
  185. }
  186. local xslope_cut = {
  187. type = "fixed",
  188. fixed = {
  189. {-0.5, -0.5, 0.5, 0.5, 0.5, 0},
  190. }
  191. }
  192. local xslope_slope = {
  193. type = "fixed",
  194. fixed = {
  195. {-0.5, -0.5, 0.5, 0.5, 0, 0},
  196. }
  197. }
  198. local xslope_peak = {
  199. type = "fixed",
  200. fixed = {
  201. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  202. {-0.5, 0, -0.25, 0.5, 0.5, 0.25},
  203. }
  204. }
  205. local xslope_peak_half = {
  206. type = "fixed",
  207. fixed = {
  208. {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  209. {-0.5, -0.25, -0.25, 0.5, 0, 0.25},
  210. }
  211. }
  212. local xslope_slope_lh = {
  213. type = "fixed",
  214. fixed = {
  215. {-0.5, -0.5, 0.5, 0, 0, 0},
  216. }
  217. }
  218. local xslope_slope_rh = {
  219. type = "fixed",
  220. fixed = {
  221. {0, -0.5, 0.5, 0.5, 0, 0},
  222. }
  223. }
  224. local xslope_peak_lh = {
  225. type = "fixed",
  226. fixed = {
  227. {-0.5, -0.5, -0.5, 0, 0, 0.5},
  228. {-0.5, 0, -0.25, 0, 0.5, 0.25},
  229. }
  230. }
  231. local xslope_peak_half_lh = {
  232. type = "fixed",
  233. fixed = {
  234. {-0.5, -0.5, -0.5, 0, -0.25, 0.5},
  235. {-0.5, -0.25, -0.25, 0, 0, 0.25},
  236. }
  237. }
  238. local astair_1 = {
  239. type = "fixed",
  240. fixed = {
  241. -- Big angle.
  242. {-0.5, -0.5, 0.5, 0.5, 0, 0.25},
  243. {-0.5, -0.5, 0.25, 0.25, 0, 0},
  244. {-0.5, -0.5, 0, 0, 0, -0.25},
  245. {-0.5, -0.5, -0.25, -0.25, 0, -0.5},
  246. -- Corner angle.
  247. {-0.5, 0, 0.5, 0, 0.5, 0.25},
  248. {-0.5, 0, 0.25, -0.25, 0.5, 0},
  249. }
  250. }
  251. local astair_2 = {
  252. type = "fixed",
  253. fixed = {
  254. -- Box.
  255. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  256. -- Angle.
  257. {-0.5, 0, 0.5, 0.5, 0.5, 0.25},
  258. {-0.5, 0, 0.25, 0.25, 0.5, 0},
  259. {-0.5, 0, 0, 0, 0.5, -0.25},
  260. {-0.5, 0, -0.25, -0.25, 0.5, -0.5},
  261. }
  262. }
  263. local astair_3 = {
  264. type = "fixed",
  265. fixed = {
  266. -- Box.
  267. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  268. -- Corner angle.
  269. {-0.5, 0, 0.5, 0, 0.5, 0.25},
  270. {-0.5, 0, 0.25, -0.25, 0.5, 0},
  271. }
  272. }
  273. local astair_4 = {
  274. type = "fixed",
  275. fixed = {
  276. -- Box.
  277. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  278. -- Corner angle.
  279. {-0.5, 0, 0.5, 0, 0.5, 0.25},
  280. {-0.5, 0, 0.25, -0.25, 0.5, 0},
  281. }
  282. }
  283. -- Node will be called <modname>:slope_<subname>
  284. local slopes_defs = {
  285. [""] = {
  286. mesh = "moreblocks_slope.obj",
  287. collision_box = box_slope,
  288. selection_box = box_slope,
  289. light=1/2,
  290. },
  291. ["_half"] = {
  292. mesh = "moreblocks_slope_half.obj",
  293. collision_box = box_slope_half,
  294. selection_box = box_slope_half,
  295. light=1/4,
  296. },
  297. ["_half_raised"] = {
  298. mesh = "moreblocks_slope_half_raised.obj",
  299. collision_box = box_slope_half_raised,
  300. selection_box = box_slope_half_raised,
  301. light=3/4,
  302. },
  303. --==============================================================
  304. ["_inner"] = {
  305. mesh = "moreblocks_slope_inner.obj",
  306. collision_box = box_slope_inner,
  307. selection_box = box_slope_inner,
  308. light=3/4,
  309. },
  310. ["_inner_half"] = {
  311. mesh = "moreblocks_slope_inner_half.obj",
  312. collision_box = box_slope_inner_half,
  313. selection_box = box_slope_inner_half,
  314. light=2/5,
  315. },
  316. ["_inner_half_raised"] = {
  317. mesh = "moreblocks_slope_inner_half_raised.obj",
  318. collision_box = box_slope_inner_half_raised,
  319. selection_box = box_slope_inner_half_raised,
  320. light=4/5,
  321. },
  322. --==============================================================
  323. ["_inner_cut"] = {
  324. mesh = "moreblocks_slope_inner_cut.obj",
  325. collision_box = box_slope_inner,
  326. selection_box = box_slope_inner,
  327. light=4/5,
  328. },
  329. ["_inner_cut2"] = {
  330. mesh = "moreblocks_slope_inner_cut2.obj",
  331. collision_box = box_regular,
  332. selection_box = box_regular,
  333. light=4/5,
  334. },
  335. ["_inner_cut3"] = {
  336. mesh = "moreblocks_slope_inner_cut3.obj",
  337. collision_box = box_regular,
  338. selection_box = box_regular,
  339. light=4/5,
  340. },
  341. ["_inner_cut4"] = {
  342. mesh = "moreblocks_slope_inner_cut4.obj",
  343. collision_box = box_slope_inner,
  344. selection_box = box_slope_inner,
  345. light=4/5,
  346. },
  347. ["_inner_cut5"] = {
  348. mesh = "moreblocks_slope_inner_cut5.obj",
  349. collision_box = box_slope_inner,
  350. selection_box = box_slope_inner,
  351. light=4/5,
  352. },
  353. ["_inner_cut6"] = {
  354. mesh = "moreblocks_slope_inner_cut6.obj",
  355. collision_box = box_slope_inner,
  356. selection_box = box_slope_inner,
  357. light=4/5,
  358. },
  359. ["_inner_cut7"] = {
  360. mesh = "moreblocks_slope_inner_cut7.obj",
  361. collision_box = box_regular,
  362. selection_box = box_regular,
  363. light=4/5,
  364. },
  365. ["_inner_cut_half"] = {
  366. mesh = "moreblocks_slope_inner_cut_half.obj",
  367. collision_box = box_slope_inner_half,
  368. selection_box = box_slope_inner_half,
  369. light=2/5,
  370. },
  371. ["_inner_cut_half_raised"] = {
  372. mesh = "moreblocks_slope_inner_cut_half_raised.obj",
  373. collision_box = box_slope_inner_half_raised,
  374. selection_box = box_slope_inner_half_raised,
  375. light=4/5,
  376. },
  377. --==============================================================
  378. ["_outer"] = {
  379. mesh = "moreblocks_slope_outer.obj",
  380. collision_box = box_slope_outer,
  381. selection_box = box_slope_outer,
  382. light=2/5,
  383. },
  384. ["_outer_half"] = {
  385. mesh = "moreblocks_slope_outer_half.obj",
  386. collision_box = box_slope_outer_half,
  387. selection_box = box_slope_outer_half,
  388. light=1/5,
  389. },
  390. ["_outer_half_raised"] = {
  391. mesh = "moreblocks_slope_outer_half_raised.obj",
  392. collision_box = box_slope_outer_half_raised,
  393. selection_box = box_slope_outer_half_raised,
  394. light=4/5,
  395. },
  396. --==============================================================
  397. ["_outer_cut"] = {
  398. mesh = "moreblocks_slope_outer_cut.obj",
  399. collision_box = box_slope_outer,
  400. selection_box = box_slope_outer,
  401. light=1/4,
  402. },
  403. ["_outer_cut_half"] = {
  404. mesh = "moreblocks_slope_outer_cut_half.obj",
  405. collision_box = box_slope_outer_half,
  406. selection_box = box_slope_outer_half,
  407. light=1/8,
  408. },
  409. ["_outer_cut_half_raised"] = {
  410. mesh = "moreblocks_slope_outer_cut_half_raised.obj",
  411. collision_box = box_slope_outer_half_raised,
  412. selection_box = box_slope_outer_half_raised,
  413. light=3/8,
  414. },
  415. ["_cut"] = {
  416. mesh = "moreblocks_slope_cut.obj",
  417. collision_box = box_slope_outer,
  418. selection_box = box_slope_outer,
  419. light=1/2,
  420. },
  421. -- Additional custom slopes.
  422. ["_xslope_quarter"] = {
  423. mesh = "xslopes_quarter.obj",
  424. collision_box = xslope_quarter,
  425. selection_box = xslope_quarter,
  426. light=1/5,
  427. },
  428. ["_xslope_quarter2"] = {
  429. mesh = "xslopes_quarter2.obj",
  430. collision_box = xslope_quarter2,
  431. selection_box = xslope_quarter2,
  432. light=1/5,
  433. },
  434. ["_xslope_three_quarter"] = {
  435. mesh = "xslopes_three_quarter.obj",
  436. collision_box = xslope_three_quarter,
  437. selection_box = xslope_three_quarter,
  438. light=3/5,
  439. },
  440. ["_xslope_three_quarter_half"] = {
  441. mesh = "xslopes_three_quarter_half.obj",
  442. collision_box = xslope_three_quarter_half,
  443. selection_box = xslope_three_quarter_half,
  444. light=2/5,
  445. },
  446. ["_xslope_cut"] = {
  447. mesh = "xslopes_cut.obj",
  448. collision_box = xslope_cut,
  449. selection_box = xslope_cut,
  450. light=1/2,
  451. },
  452. ["_xslope_slope"] = {
  453. mesh = "xslopes_slope.obj",
  454. collision_box = xslope_slope,
  455. selection_box = xslope_slope,
  456. light=1/4,
  457. },
  458. ["_xslope_peak"] = {
  459. mesh = "xslopes_peak.obj",
  460. collision_box = xslope_peak,
  461. selection_box = xslope_peak,
  462. light=2/4,
  463. },
  464. ["_xslope_peak_half"] = {
  465. mesh = "xslopes_peak_half.obj",
  466. collision_box = xslope_peak_half,
  467. selection_box = xslope_peak_half,
  468. light=1/4,
  469. },
  470. ["_lh"] = {
  471. mesh = "moreblocks_slope_lh.obj",
  472. collision_box = box_slope_lh,
  473. selection_box = box_slope_lh,
  474. light=1/4,
  475. },
  476. ["_half_lh"] = {
  477. mesh = "moreblocks_slope_half_lh.obj",
  478. collision_box = box_slope_half_lh,
  479. selection_box = box_slope_half_lh,
  480. light=1/8,
  481. },
  482. ["_half_raised_lh"] = {
  483. mesh = "moreblocks_slope_half_raised_lh.obj",
  484. collision_box = box_slope_half_raised_lh,
  485. selection_box = box_slope_half_raised_lh,
  486. light=3/8,
  487. },
  488. ["_xslope_slope_lh"] = {
  489. mesh = "xslopes_slope_lh.obj",
  490. collision_box = xslope_slope_lh,
  491. selection_box = xslope_slope_lh,
  492. light=1/8,
  493. },
  494. ["_xslope_peak_lh"] = {
  495. mesh = "xslopes_peak_lh.obj",
  496. collision_box = xslope_peak_lh,
  497. selection_box = xslope_peak_lh,
  498. light=2/8,
  499. },
  500. ["_xslope_peak_half_lh"] = {
  501. mesh = "xslopes_peak_half_lh.obj",
  502. collision_box = xslope_peak_half_lh,
  503. selection_box = xslope_peak_half_lh,
  504. light=1/8,
  505. },
  506. ["_rh"] = {
  507. mesh = "moreblocks_slope_rh.obj",
  508. collision_box = box_slope_rh,
  509. selection_box = box_slope_rh,
  510. light=1/4,
  511. },
  512. ["_half_rh"] = {
  513. mesh = "moreblocks_slope_half_rh.obj",
  514. collision_box = box_slope_half_rh,
  515. selection_box = box_slope_half_rh,
  516. light=1/8,
  517. },
  518. ["_half_raised_rh"] = {
  519. mesh = "moreblocks_slope_half_raised_rh.obj",
  520. collision_box = box_slope_half_raised_rh,
  521. selection_box = box_slope_half_raised_rh,
  522. light=3/8,
  523. },
  524. ["_xslope_slope_rh"] = {
  525. mesh = "xslopes_slope_rh.obj",
  526. collision_box = xslope_slope_rh,
  527. selection_box = xslope_slope_rh,
  528. light=1/8,
  529. },
  530. ["_astair_1"] = {
  531. mesh = "astair_1.obj",
  532. collision_box = astair_1,
  533. selection_box = astair_1,
  534. light=1/3,
  535. },
  536. ["_astair_2"] = {
  537. mesh = "astair_2.obj",
  538. collision_box = astair_2,
  539. selection_box = astair_2,
  540. light=1/3,
  541. },
  542. ["_astair_3"] = {
  543. mesh = "astair_3.obj",
  544. collision_box = astair_3,
  545. selection_box = astair_3,
  546. light=1/3,
  547. },
  548. ["_astair_4"] = {
  549. mesh = "astair_4.obj",
  550. collision_box = astair_4,
  551. selection_box = astair_4,
  552. light=1/3,
  553. },
  554. ["_astair_5"] = {
  555. mesh = "moreblocks_slope_inner_cut8.obj",
  556. collision_box = box_regular,
  557. selection_box = box_regular,
  558. light=4/5,
  559. },
  560. }
  561. function stairs.register_slopes(subname, recipeitem, groups, images, description, sounds)
  562. local stair_images = {}
  563. for i, image in ipairs(images) do
  564. if type(image) == "string" then
  565. stair_images[i] = {
  566. name = image,
  567. backface_culling = true,
  568. }
  569. elseif image.backface_culling == nil then -- override using any other value
  570. stair_images[i] = table.copy(image)
  571. stair_images[i].backface_culling = true
  572. end
  573. end
  574. local defs = table.copy(slopes_defs)
  575. -- Do not modify function argument.
  576. local groups = table.copy(groups)
  577. groups.stairs_slope = 1
  578. groups.not_in_craft_guide = 1
  579. groups.stairs_node = 1
  580. local ndef = minetest.registered_items[recipeitem]
  581. assert(ndef)
  582. for alternate, def in pairs(defs) do
  583. --if not alternate:find("_xslope_") or minetest.settings:get("port") == "30001" then
  584. def.drawtype = "mesh"
  585. def.paramtype = "light"
  586. def.paramtype2 = "facedir"
  587. def.on_place = function(...) return stairs.rotate_and_place(...) end
  588. def.groups = groups
  589. def.sounds = sounds
  590. def.description = description
  591. def.tiles = stair_images
  592. def.light_source = math.ceil(ndef.light_source*(def.light or 0))
  593. def.light = nil
  594. stairs.setup_nodedef_callbacks(subname, def)
  595. minetest.register_node(":stairs:slope_" ..subname..alternate, def)
  596. --end
  597. end
  598. if recipeitem then
  599. circular_saw.known_nodes[recipeitem] = {"stairs", subname}
  600. end
  601. end