init.lua 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
  1. -- Minetest 0.4 mod: stairs
  2. -- See README.txt for licensing and other information.
  3. -- Global namespace for functions
  4. stairs = {}
  5. -- Register aliases for new pine node names
  6. minetest.register_alias("stairs:stair_pinewood", "stairs:stair_pine_wood")
  7. minetest.register_alias("stairs:slab_pinewood", "stairs:slab_pine_wood")
  8. -- Get setting for replace ABM
  9. local replace = minetest.settings:get_bool("enable_stairs_replace_abm")
  10. local function rotate_and_place(itemstack, placer, pointed_thing)
  11. local p0 = pointed_thing.under
  12. local p1 = pointed_thing.above
  13. local param2 = 0
  14. if placer then
  15. local placer_pos = placer:get_pos()
  16. if placer_pos then
  17. param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos))
  18. end
  19. local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
  20. local fpos = finepos.y % 1
  21. if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
  22. or (fpos < -0.5 and fpos > -0.999999999) then
  23. param2 = param2 + 20
  24. if param2 == 21 then
  25. param2 = 23
  26. elseif param2 == 23 then
  27. param2 = 21
  28. end
  29. end
  30. end
  31. return minetest.item_place(itemstack, placer, pointed_thing, param2)
  32. end
  33. -- Register stair
  34. -- Node will be called stairs:stair_<subname>
  35. function stairs.register_stair(subname, recipeitem, groups, images, description,
  36. sounds, worldaligntex)
  37. -- Set backface culling and world-aligned textures
  38. local stair_images = {}
  39. for i, image in ipairs(images) do
  40. if type(image) == "string" then
  41. stair_images[i] = {
  42. name = image,
  43. backface_culling = true,
  44. }
  45. if worldaligntex then
  46. stair_images[i].align_style = "world"
  47. end
  48. else
  49. stair_images[i] = table.copy(image)
  50. if stair_images[i].backface_culling == nil then
  51. stair_images[i].backface_culling = true
  52. end
  53. if worldaligntex and stair_images[i].align_style == nil then
  54. stair_images[i].align_style = "world"
  55. end
  56. end
  57. end
  58. local new_groups = table.copy(groups)
  59. new_groups.stair = 1
  60. minetest.register_node(":stairs:stair_" .. subname, {
  61. description = description,
  62. drawtype = "nodebox",
  63. tiles = stair_images,
  64. paramtype = "light",
  65. paramtype2 = "facedir",
  66. is_ground_content = false,
  67. groups = new_groups,
  68. sounds = sounds,
  69. node_box = {
  70. type = "fixed",
  71. fixed = {
  72. {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
  73. {-0.5, 0.0, 0.0, 0.5, 0.5, 0.5},
  74. },
  75. },
  76. on_place = function(itemstack, placer, pointed_thing)
  77. if pointed_thing.type ~= "node" then
  78. return itemstack
  79. end
  80. return rotate_and_place(itemstack, placer, pointed_thing)
  81. end,
  82. })
  83. -- for replace ABM
  84. if replace then
  85. minetest.register_node(":stairs:stair_" .. subname .. "upside_down", {
  86. replace_name = "stairs:stair_" .. subname,
  87. groups = {slabs_replace = 1},
  88. })
  89. end
  90. if recipeitem then
  91. -- Recipe matches appearence in inventory
  92. minetest.register_craft({
  93. output = 'stairs:stair_' .. subname .. ' 8',
  94. recipe = {
  95. {"", "", recipeitem},
  96. {"", recipeitem, recipeitem},
  97. {recipeitem, recipeitem, recipeitem},
  98. },
  99. })
  100. -- Use stairs to craft full blocks again (1:1)
  101. minetest.register_craft({
  102. output = recipeitem .. ' 3',
  103. recipe = {
  104. {'stairs:stair_' .. subname, 'stairs:stair_' .. subname},
  105. {'stairs:stair_' .. subname, 'stairs:stair_' .. subname},
  106. },
  107. })
  108. -- Fuel
  109. local baseburntime = minetest.get_craft_result({
  110. method = "fuel",
  111. width = 1,
  112. items = {recipeitem}
  113. }).time
  114. if baseburntime > 0 then
  115. minetest.register_craft({
  116. type = "fuel",
  117. recipe = 'stairs:stair_' .. subname,
  118. burntime = math.floor(baseburntime * 0.75),
  119. })
  120. end
  121. end
  122. end
  123. -- Register slab
  124. -- Node will be called stairs:slab_<subname>
  125. function stairs.register_slab(subname, recipeitem, groups, images, description,
  126. sounds, worldaligntex)
  127. -- Set world-aligned textures
  128. local slab_images = {}
  129. for i, image in ipairs(images) do
  130. if type(image) == "string" then
  131. slab_images[i] = {
  132. name = image,
  133. }
  134. if worldaligntex then
  135. slab_images[i].align_style = "world"
  136. end
  137. else
  138. slab_images[i] = table.copy(image)
  139. if worldaligntex and image.align_style == nil then
  140. slab_images[i].align_style = "world"
  141. end
  142. end
  143. end
  144. local new_groups = table.copy(groups)
  145. new_groups.slab = 1
  146. minetest.register_node(":stairs:slab_" .. subname, {
  147. description = description,
  148. drawtype = "nodebox",
  149. tiles = slab_images,
  150. paramtype = "light",
  151. paramtype2 = "facedir",
  152. is_ground_content = false,
  153. groups = new_groups,
  154. sounds = sounds,
  155. node_box = {
  156. type = "fixed",
  157. fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  158. },
  159. on_place = function(itemstack, placer, pointed_thing)
  160. local under = minetest.get_node(pointed_thing.under)
  161. local wield_item = itemstack:get_name()
  162. local player_name = placer and placer:get_player_name() or ""
  163. local creative_enabled = (creative and creative.is_enabled_for
  164. and creative.is_enabled_for(player_name))
  165. if under and under.name:find("^stairs:slab_") then
  166. -- place slab using under node orientation
  167. local dir = minetest.dir_to_facedir(vector.subtract(
  168. pointed_thing.above, pointed_thing.under), true)
  169. local p2 = under.param2
  170. -- Placing a slab on an upside down slab should make it right-side up.
  171. if p2 >= 20 and dir == 8 then
  172. p2 = p2 - 20
  173. -- same for the opposite case: slab below normal slab
  174. elseif p2 <= 3 and dir == 4 then
  175. p2 = p2 + 20
  176. end
  177. -- else attempt to place node with proper param2
  178. minetest.item_place_node(ItemStack(wield_item), placer, pointed_thing, p2)
  179. if not creative_enabled then
  180. itemstack:take_item()
  181. end
  182. return itemstack
  183. else
  184. return rotate_and_place(itemstack, placer, pointed_thing)
  185. end
  186. end,
  187. })
  188. -- for replace ABM
  189. if replace then
  190. minetest.register_node(":stairs:slab_" .. subname .. "upside_down", {
  191. replace_name = "stairs:slab_".. subname,
  192. groups = {slabs_replace = 1},
  193. })
  194. end
  195. if recipeitem then
  196. minetest.register_craft({
  197. output = 'stairs:slab_' .. subname .. ' 6',
  198. recipe = {
  199. {recipeitem, recipeitem, recipeitem},
  200. },
  201. })
  202. -- Use 2 slabs to craft a full block again (1:1)
  203. minetest.register_craft({
  204. output = recipeitem,
  205. recipe = {
  206. {'stairs:slab_' .. subname},
  207. {'stairs:slab_' .. subname},
  208. },
  209. })
  210. -- Fuel
  211. local baseburntime = minetest.get_craft_result({
  212. method = "fuel",
  213. width = 1,
  214. items = {recipeitem}
  215. }).time
  216. if baseburntime > 0 then
  217. minetest.register_craft({
  218. type = "fuel",
  219. recipe = 'stairs:slab_' .. subname,
  220. burntime = math.floor(baseburntime * 0.5),
  221. })
  222. end
  223. end
  224. end
  225. -- Optionally replace old "upside_down" nodes with new param2 versions.
  226. -- Disabled by default.
  227. if replace then
  228. minetest.register_abm({
  229. label = "Slab replace",
  230. nodenames = {"group:slabs_replace"},
  231. interval = 16,
  232. chance = 1,
  233. action = function(pos, node)
  234. node.name = minetest.registered_nodes[node.name].replace_name
  235. node.param2 = node.param2 + 20
  236. if node.param2 == 21 then
  237. node.param2 = 23
  238. elseif node.param2 == 23 then
  239. node.param2 = 21
  240. end
  241. minetest.set_node(pos, node)
  242. end,
  243. })
  244. end
  245. -- Register inner stair
  246. -- Node will be called stairs:stair_inner_<subname>
  247. function stairs.register_stair_inner(subname, recipeitem, groups, images,
  248. description, sounds, worldaligntex)
  249. -- Set backface culling and world-aligned textures
  250. local stair_images = {}
  251. for i, image in ipairs(images) do
  252. if type(image) == "string" then
  253. stair_images[i] = {
  254. name = image,
  255. backface_culling = true,
  256. }
  257. if worldaligntex then
  258. stair_images[i].align_style = "world"
  259. end
  260. else
  261. stair_images[i] = table.copy(image)
  262. if stair_images[i].backface_culling == nil then
  263. stair_images[i].backface_culling = true
  264. end
  265. if worldaligntex and stair_images[i].align_style == nil then
  266. stair_images[i].align_style = "world"
  267. end
  268. end
  269. end
  270. local new_groups = table.copy(groups)
  271. new_groups.stair = 1
  272. minetest.register_node(":stairs:stair_inner_" .. subname, {
  273. description = "Inner " .. description,
  274. drawtype = "nodebox",
  275. tiles = stair_images,
  276. paramtype = "light",
  277. paramtype2 = "facedir",
  278. is_ground_content = false,
  279. groups = new_groups,
  280. sounds = sounds,
  281. node_box = {
  282. type = "fixed",
  283. fixed = {
  284. {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
  285. {-0.5, 0.0, 0.0, 0.5, 0.5, 0.5},
  286. {-0.5, 0.0, -0.5, 0.0, 0.5, 0.0},
  287. },
  288. },
  289. on_place = function(itemstack, placer, pointed_thing)
  290. if pointed_thing.type ~= "node" then
  291. return itemstack
  292. end
  293. return rotate_and_place(itemstack, placer, pointed_thing)
  294. end,
  295. })
  296. if recipeitem then
  297. minetest.register_craft({
  298. output = 'stairs:stair_inner_' .. subname .. ' 7',
  299. recipe = {
  300. {"", recipeitem, ""},
  301. {recipeitem, "", recipeitem},
  302. {recipeitem, recipeitem, recipeitem},
  303. },
  304. })
  305. -- Fuel
  306. local baseburntime = minetest.get_craft_result({
  307. method = "fuel",
  308. width = 1,
  309. items = {recipeitem}
  310. }).time
  311. if baseburntime > 0 then
  312. minetest.register_craft({
  313. type = "fuel",
  314. recipe = 'stairs:stair_inner_' .. subname,
  315. burntime = math.floor(baseburntime * 0.875),
  316. })
  317. end
  318. end
  319. end
  320. -- Register outer stair
  321. -- Node will be called stairs:stair_outer_<subname>
  322. function stairs.register_stair_outer(subname, recipeitem, groups, images,
  323. description, sounds, worldaligntex)
  324. -- Set backface culling and world-aligned textures
  325. local stair_images = {}
  326. for i, image in ipairs(images) do
  327. if type(image) == "string" then
  328. stair_images[i] = {
  329. name = image,
  330. backface_culling = true,
  331. }
  332. if worldaligntex then
  333. stair_images[i].align_style = "world"
  334. end
  335. else
  336. stair_images[i] = table.copy(image)
  337. if stair_images[i].backface_culling == nil then
  338. stair_images[i].backface_culling = true
  339. end
  340. if worldaligntex and stair_images[i].align_style == nil then
  341. stair_images[i].align_style = "world"
  342. end
  343. end
  344. end
  345. local new_groups = table.copy(groups)
  346. new_groups.stair = 1
  347. minetest.register_node(":stairs:stair_outer_" .. subname, {
  348. description = "Outer " .. description,
  349. drawtype = "nodebox",
  350. tiles = stair_images,
  351. paramtype = "light",
  352. paramtype2 = "facedir",
  353. is_ground_content = false,
  354. groups = new_groups,
  355. sounds = sounds,
  356. node_box = {
  357. type = "fixed",
  358. fixed = {
  359. {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
  360. {-0.5, 0.0, 0.0, 0.0, 0.5, 0.5},
  361. },
  362. },
  363. on_place = function(itemstack, placer, pointed_thing)
  364. if pointed_thing.type ~= "node" then
  365. return itemstack
  366. end
  367. return rotate_and_place(itemstack, placer, pointed_thing)
  368. end,
  369. })
  370. if recipeitem then
  371. minetest.register_craft({
  372. output = 'stairs:stair_outer_' .. subname .. ' 6',
  373. recipe = {
  374. {"", recipeitem, ""},
  375. {recipeitem, recipeitem, recipeitem},
  376. },
  377. })
  378. -- Fuel
  379. local baseburntime = minetest.get_craft_result({
  380. method = "fuel",
  381. width = 1,
  382. items = {recipeitem}
  383. }).time
  384. if baseburntime > 0 then
  385. minetest.register_craft({
  386. type = "fuel",
  387. recipe = 'stairs:stair_outer_' .. subname,
  388. burntime = math.floor(baseburntime * 0.625),
  389. })
  390. end
  391. end
  392. end
  393. -- Stair/slab registration function.
  394. -- Nodes will be called stairs:{stair,slab}_<subname>
  395. function stairs.register_stair_and_slab(subname, recipeitem, groups, images,
  396. desc_stair, desc_slab, sounds, worldaligntex)
  397. stairs.register_stair(subname, recipeitem, groups, images, desc_stair,
  398. sounds, worldaligntex)
  399. stairs.register_stair_inner(subname, recipeitem, groups, images, desc_stair,
  400. sounds, worldaligntex)
  401. stairs.register_stair_outer(subname, recipeitem, groups, images, desc_stair,
  402. sounds, worldaligntex)
  403. stairs.register_slab(subname, recipeitem, groups, images, desc_slab,
  404. sounds, worldaligntex)
  405. end
  406. -- Register default stairs and slabs
  407. stairs.register_stair_and_slab(
  408. "wood",
  409. "default:wood",
  410. {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
  411. {"default_wood.png"},
  412. "Wooden Stair",
  413. "Wooden Slab",
  414. default.node_sound_wood_defaults(),
  415. false
  416. )
  417. stairs.register_stair_and_slab(
  418. "junglewood",
  419. "default:junglewood",
  420. {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
  421. {"default_junglewood.png"},
  422. "Jungle Wood Stair",
  423. "Jungle Wood Slab",
  424. default.node_sound_wood_defaults(),
  425. false
  426. )
  427. stairs.register_stair_and_slab(
  428. "pine_wood",
  429. "default:pine_wood",
  430. {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
  431. {"default_pine_wood.png"},
  432. "Pine Wood Stair",
  433. "Pine Wood Slab",
  434. default.node_sound_wood_defaults(),
  435. false
  436. )
  437. stairs.register_stair_and_slab(
  438. "acacia_wood",
  439. "default:acacia_wood",
  440. {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
  441. {"default_acacia_wood.png"},
  442. "Acacia Wood Stair",
  443. "Acacia Wood Slab",
  444. default.node_sound_wood_defaults(),
  445. false
  446. )
  447. stairs.register_stair_and_slab(
  448. "aspen_wood",
  449. "default:aspen_wood",
  450. {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
  451. {"default_aspen_wood.png"},
  452. "Aspen Wood Stair",
  453. "Aspen Wood Slab",
  454. default.node_sound_wood_defaults(),
  455. false
  456. )
  457. stairs.register_stair_and_slab(
  458. "stone",
  459. "default:stone",
  460. {cracky = 3},
  461. {"default_stone.png"},
  462. "Stone Stair",
  463. "Stone Slab",
  464. default.node_sound_stone_defaults(),
  465. true
  466. )
  467. stairs.register_stair_and_slab(
  468. "cobble",
  469. "default:cobble",
  470. {cracky = 3},
  471. {"default_cobble.png"},
  472. "Cobblestone Stair",
  473. "Cobblestone Slab",
  474. default.node_sound_stone_defaults(),
  475. true
  476. )
  477. stairs.register_stair_and_slab(
  478. "mossycobble",
  479. "default:mossycobble",
  480. {cracky = 3},
  481. {"default_mossycobble.png"},
  482. "Mossy Cobblestone Stair",
  483. "Mossy Cobblestone Slab",
  484. default.node_sound_stone_defaults(),
  485. true
  486. )
  487. stairs.register_stair_and_slab(
  488. "stonebrick",
  489. "default:stonebrick",
  490. {cracky = 2},
  491. {"default_stone_brick.png"},
  492. "Stone Brick Stair",
  493. "Stone Brick Slab",
  494. default.node_sound_stone_defaults(),
  495. false
  496. )
  497. stairs.register_stair_and_slab(
  498. "stone_block",
  499. "default:stone_block",
  500. {cracky = 2},
  501. {"default_stone_block.png"},
  502. "Stone Block Stair",
  503. "Stone Block Slab",
  504. default.node_sound_stone_defaults(),
  505. true
  506. )
  507. stairs.register_stair_and_slab(
  508. "desert_stone",
  509. "default:desert_stone",
  510. {cracky = 3},
  511. {"default_desert_stone.png"},
  512. "Desert Stone Stair",
  513. "Desert Stone Slab",
  514. default.node_sound_stone_defaults(),
  515. true
  516. )
  517. stairs.register_stair_and_slab(
  518. "desert_cobble",
  519. "default:desert_cobble",
  520. {cracky = 3},
  521. {"default_desert_cobble.png"},
  522. "Desert Cobblestone Stair",
  523. "Desert Cobblestone Slab",
  524. default.node_sound_stone_defaults(),
  525. true
  526. )
  527. stairs.register_stair_and_slab(
  528. "desert_stonebrick",
  529. "default:desert_stonebrick",
  530. {cracky = 2},
  531. {"default_desert_stone_brick.png"},
  532. "Desert Stone Brick Stair",
  533. "Desert Stone Brick Slab",
  534. default.node_sound_stone_defaults(),
  535. false
  536. )
  537. stairs.register_stair_and_slab(
  538. "desert_stone_block",
  539. "default:desert_stone_block",
  540. {cracky = 2},
  541. {"default_desert_stone_block.png"},
  542. "Desert Stone Block Stair",
  543. "Desert Stone Block Slab",
  544. default.node_sound_stone_defaults(),
  545. true
  546. )
  547. stairs.register_stair_and_slab(
  548. "sandstone",
  549. "default:sandstone",
  550. {crumbly = 1, cracky = 3},
  551. {"default_sandstone.png"},
  552. "Sandstone Stair",
  553. "Sandstone Slab",
  554. default.node_sound_stone_defaults(),
  555. true
  556. )
  557. stairs.register_stair_and_slab(
  558. "sandstonebrick",
  559. "default:sandstonebrick",
  560. {cracky = 2},
  561. {"default_sandstone_brick.png"},
  562. "Sandstone Brick Stair",
  563. "Sandstone Brick Slab",
  564. default.node_sound_stone_defaults(),
  565. false
  566. )
  567. stairs.register_stair_and_slab(
  568. "sandstone_block",
  569. "default:sandstone_block",
  570. {cracky = 2},
  571. {"default_sandstone_block.png"},
  572. "Sandstone Block Stair",
  573. "Sandstone Block Slab",
  574. default.node_sound_stone_defaults(),
  575. true
  576. )
  577. stairs.register_stair_and_slab(
  578. "desert_sandstone",
  579. "default:desert_sandstone",
  580. {crumbly = 1, cracky = 3},
  581. {"default_desert_sandstone.png"},
  582. "Desert Sandstone Stair",
  583. "Desert Sandstone Slab",
  584. default.node_sound_stone_defaults(),
  585. true
  586. )
  587. stairs.register_stair_and_slab(
  588. "desert_sandstone_brick",
  589. "default:desert_sandstone_brick",
  590. {cracky = 2},
  591. {"default_desert_sandstone_brick.png"},
  592. "Desert Sandstone Brick Stair",
  593. "Desert Sandstone Brick Slab",
  594. default.node_sound_stone_defaults(),
  595. false
  596. )
  597. stairs.register_stair_and_slab(
  598. "desert_sandstone_block",
  599. "default:desert_sandstone_block",
  600. {cracky = 2},
  601. {"default_desert_sandstone_block.png"},
  602. "Desert Sandstone Block Stair",
  603. "Desert Sandstone Block Slab",
  604. default.node_sound_stone_defaults(),
  605. true
  606. )
  607. stairs.register_stair_and_slab(
  608. "silver_sandstone",
  609. "default:silver_sandstone",
  610. {crumbly = 1, cracky = 3},
  611. {"default_silver_sandstone.png"},
  612. "Silver Sandstone Stair",
  613. "Silver Sandstone Slab",
  614. default.node_sound_stone_defaults(),
  615. true
  616. )
  617. stairs.register_stair_and_slab(
  618. "silver_sandstone_brick",
  619. "default:silver_sandstone_brick",
  620. {cracky = 2},
  621. {"default_silver_sandstone_brick.png"},
  622. "Silver Sandstone Brick Stair",
  623. "Silver Sandstone Brick Slab",
  624. default.node_sound_stone_defaults(),
  625. false
  626. )
  627. stairs.register_stair_and_slab(
  628. "silver_sandstone_block",
  629. "default:silver_sandstone_block",
  630. {cracky = 2},
  631. {"default_silver_sandstone_block.png"},
  632. "Silver Sandstone Block Stair",
  633. "Silver Sandstone Block Slab",
  634. default.node_sound_stone_defaults(),
  635. true
  636. )
  637. stairs.register_stair_and_slab(
  638. "obsidian",
  639. "default:obsidian",
  640. {cracky = 1, level = 2},
  641. {"default_obsidian.png"},
  642. "Obsidian Stair",
  643. "Obsidian Slab",
  644. default.node_sound_stone_defaults(),
  645. true
  646. )
  647. stairs.register_stair_and_slab(
  648. "obsidianbrick",
  649. "default:obsidianbrick",
  650. {cracky = 1, level = 2},
  651. {"default_obsidian_brick.png"},
  652. "Obsidian Brick Stair",
  653. "Obsidian Brick Slab",
  654. default.node_sound_stone_defaults(),
  655. false
  656. )
  657. stairs.register_stair_and_slab(
  658. "obsidian_block",
  659. "default:obsidian_block",
  660. {cracky = 1, level = 2},
  661. {"default_obsidian_block.png"},
  662. "Obsidian Block Stair",
  663. "Obsidian Block Slab",
  664. default.node_sound_stone_defaults(),
  665. true
  666. )
  667. stairs.register_stair_and_slab(
  668. "brick",
  669. "default:brick",
  670. {cracky = 3},
  671. {"default_brick.png"},
  672. "Brick Stair",
  673. "Brick Slab",
  674. default.node_sound_stone_defaults(),
  675. false
  676. )
  677. stairs.register_stair_and_slab(
  678. "steelblock",
  679. "default:steelblock",
  680. {cracky = 1, level = 2},
  681. {"default_steel_block.png"},
  682. "Steel Block Stair",
  683. "Steel Block Slab",
  684. default.node_sound_metal_defaults(),
  685. true
  686. )
  687. stairs.register_stair_and_slab(
  688. "tinblock",
  689. "default:tinblock",
  690. {cracky = 1, level = 2},
  691. {"default_tin_block.png"},
  692. "Tin Block Stair",
  693. "Tin Block Slab",
  694. default.node_sound_metal_defaults(),
  695. true
  696. )
  697. stairs.register_stair_and_slab(
  698. "copperblock",
  699. "default:copperblock",
  700. {cracky = 1, level = 2},
  701. {"default_copper_block.png"},
  702. "Copper Block Stair",
  703. "Copper Block Slab",
  704. default.node_sound_metal_defaults(),
  705. true
  706. )
  707. stairs.register_stair_and_slab(
  708. "bronzeblock",
  709. "default:bronzeblock",
  710. {cracky = 1, level = 2},
  711. {"default_bronze_block.png"},
  712. "Bronze Block Stair",
  713. "Bronze Block Slab",
  714. default.node_sound_metal_defaults(),
  715. true
  716. )
  717. stairs.register_stair_and_slab(
  718. "goldblock",
  719. "default:goldblock",
  720. {cracky = 1},
  721. {"default_gold_block.png"},
  722. "Gold Block Stair",
  723. "Gold Block Slab",
  724. default.node_sound_metal_defaults(),
  725. true
  726. )
  727. stairs.register_stair_and_slab(
  728. "ice",
  729. "default:ice",
  730. {cracky = 3, cools_lava = 1, slippery = 3},
  731. {"default_ice.png"},
  732. "Ice Stair",
  733. "Ice Slab",
  734. default.node_sound_glass_defaults(),
  735. true
  736. )
  737. stairs.register_stair_and_slab(
  738. "snowblock",
  739. "default:snowblock",
  740. {crumbly = 3, cools_lava = 1, snowy = 1},
  741. {"default_snow.png"},
  742. "Snow Block Stair",
  743. "Snow Block Slab",
  744. default.node_sound_snow_defaults(),
  745. true
  746. )
  747. -- Glass stair nodes need to be registered individually to utilize specialized textures.
  748. stairs.register_stair(
  749. "glass",
  750. "default:glass",
  751. {cracky = 3},
  752. {"stairs_glass_split.png", "default_glass.png",
  753. "stairs_glass_stairside.png^[transformFX", "stairs_glass_stairside.png",
  754. "default_glass.png", "stairs_glass_split.png"},
  755. "Glass Stair",
  756. default.node_sound_glass_defaults(),
  757. false
  758. )
  759. stairs.register_slab(
  760. "glass",
  761. "default:glass",
  762. {cracky = 3},
  763. {"default_glass.png", "default_glass.png", "stairs_glass_split.png"},
  764. "Glass Slab",
  765. default.node_sound_glass_defaults(),
  766. false
  767. )
  768. stairs.register_stair_inner(
  769. "glass",
  770. "default:glass",
  771. {cracky = 3},
  772. {"stairs_glass_stairside.png^[transformR270", "default_glass.png",
  773. "stairs_glass_stairside.png^[transformFX", "default_glass.png",
  774. "default_glass.png", "stairs_glass_stairside.png"},
  775. "Glass Stair",
  776. default.node_sound_glass_defaults(),
  777. false
  778. )
  779. stairs.register_stair_outer(
  780. "glass",
  781. "default:glass",
  782. {cracky = 3},
  783. {"stairs_glass_stairside.png^[transformR90", "default_glass.png",
  784. "stairs_glass_outer_stairside.png", "stairs_glass_stairside.png",
  785. "stairs_glass_stairside.png^[transformR90","stairs_glass_outer_stairside.png"},
  786. "Glass Stair",
  787. default.node_sound_glass_defaults(),
  788. false
  789. )
  790. stairs.register_stair(
  791. "obsidian_glass",
  792. "default:obsidian_glass",
  793. {cracky = 3},
  794. {"stairs_obsidian_glass_split.png", "default_obsidian_glass.png",
  795. "stairs_obsidian_glass_stairside.png^[transformFX", "stairs_obsidian_glass_stairside.png",
  796. "default_obsidian_glass.png", "stairs_obsidian_glass_split.png"},
  797. "Obsidian Glass Stair",
  798. default.node_sound_glass_defaults(),
  799. false
  800. )
  801. stairs.register_slab(
  802. "obsidian_glass",
  803. "default:obsidian_glass",
  804. {cracky = 3},
  805. {"default_obsidian_glass.png", "default_obsidian_glass.png", "stairs_obsidian_glass_split.png"},
  806. "Obsidian Glass Slab",
  807. default.node_sound_glass_defaults(),
  808. false
  809. )
  810. stairs.register_stair_inner(
  811. "obsidian_glass",
  812. "default:obsidian_glass",
  813. {cracky = 3},
  814. {"stairs_obsidian_glass_stairside.png^[transformR270", "default_obsidian_glass.png",
  815. "stairs_obsidian_glass_stairside.png^[transformFX", "default_obsidian_glass.png",
  816. "default_obsidian_glass.png", "stairs_obsidian_glass_stairside.png"},
  817. "Obsidian Glass Stair",
  818. default.node_sound_glass_defaults(),
  819. false
  820. )
  821. stairs.register_stair_outer(
  822. "obsidian_glass",
  823. "default:obsidian_glass",
  824. {cracky = 3},
  825. {"stairs_obsidian_glass_stairside.png^[transformR90", "default_obsidian_glass.png",
  826. "stairs_obsidian_glass_outer_stairside.png", "stairs_obsidian_glass_stairside.png",
  827. "stairs_obsidian_glass_stairside.png^[transformR90","stairs_obsidian_glass_outer_stairside.png"},
  828. "Obsidian Glass Stair",
  829. default.node_sound_glass_defaults(),
  830. false
  831. )