init.lua 28 KB

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