2
0

init.lua 27 KB

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