2
0

init.lua 27 KB

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