mg76

registrations.lua

Dec 25th, 2017
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.07 KB | None | 0 0
  1. --[[
  2. More Blocks: registrations
  3.  
  4. Copyright (c) 2011-2017 Hugo Locurcio and contributors.
  5. Licensed under the zlib license. See LICENSE.md for more information.
  6. --]]
  7.  
  8. local default_nodes = { -- Default stairs/slabs/panels/microblocks:
  9.     "stone",
  10.     "stone_block",
  11.     "cobble",
  12.     "mossycobble",
  13.     "brick",
  14.     "sandstone",
  15.     "steelblock",
  16.     "goldblock",
  17.     "copperblock",
  18.     "bronzeblock",
  19.     "diamondblock",
  20.     "desert_stone",
  21.     "desert_stone_block",
  22.     "desert_cobble",
  23.     "meselamp",
  24.     "glass",
  25.     "tree",
  26.     "wood",
  27.     "jungletree",
  28.     "junglewood",
  29.     "pine_tree",
  30.     "pine_wood",
  31.     "acacia_tree",
  32.     "acacia_wood",
  33.     "aspen_tree",
  34.     "aspen_wood",
  35.     "obsidian",
  36.     "obsidian_block",
  37.     "obsidianbrick",
  38.     "obsidian_glass",
  39.     "stonebrick",
  40.     "desert_stonebrick",
  41.     "sandstonebrick",
  42.     "sandstone_block",
  43.     "coral_skeleton",
  44.     "farming:straw"
  45. --        "steampunk:wood",
  46. --        "steampunk:junglewood",
  47. --        "steampunk:cobble",
  48. --        "steampunk:steelblock",
  49. --        "steampunk:copperblock",
  50. --        "steampunk:mese",
  51. --        "steampunk:stonebrick",
  52. --        "steampunk:brick",
  53. --        "steampunk:brick_grey",
  54. --        "steampunk:glass",
  55. --        "steampunk:glass_black",
  56. --        "steampunk:glass_blue",
  57. --        "steampunk:glass_red",
  58. --        "steampunk:glass_green",
  59. --        "steampunk:glass_magenta",
  60. --        "steampunk:glass_purple"
  61. }
  62.  
  63. for _, name in pairs(default_nodes) do
  64.     local nodename = "default:"..name
  65.     local a,b = string.find(name, ":")
  66.     if b then
  67.         nodename = name
  68.         name = string.sub(name, b+1)
  69.     end
  70.     local ndef = minetest.registered_nodes[nodename]
  71.     if ndef then
  72.         local drop
  73.         if type(ndef.drop) == "string" then
  74.             drop = ndef.drop:sub((b or 8)+1)
  75.         end
  76.  
  77.         local tiles = ndef.tiles
  78.         if #ndef.tiles > 1 and ndef.drawtype:find("glass") then
  79.             tiles = { ndef.tiles[1] }
  80.         end
  81.  
  82.         stairsplus:register_all("moreblocks", name, nodename, {
  83.             description = ndef.description,
  84.             drop = drop,
  85.             groups = ndef.groups,
  86.             sounds = ndef.sounds,
  87.             tiles = tiles,
  88.             sunlight_propagates = true,
  89.             light_source = ndef.light_source
  90.         })
  91.     end
  92. end
  93.  
  94.  
  95.  
  96. -- wool registrations
  97.  
  98. if minetest.get_modpath("wool") then
  99.  
  100.         local colorlist = {
  101.                 {"white",      "White Wool"},
  102.                 {"grey",       "Grey Wool"},
  103.                 {"black",      "Black Wool"},
  104.                 {"red",        "Red Wool"},
  105.                 {"yellow",     "Yellow Wool"},
  106.                 {"green",      "Green Wool"},
  107.                 {"cyan",       "Cyan Wool"},
  108.                 {"blue",       "Blue Wool"},
  109.                 {"magenta",    "Magenta Wool"},
  110.                 {"orange",     "Orange Wool"},
  111.                 {"violet",     "Violet Wool"},
  112.                 {"brown",      "Brown Wool"},
  113.                 {"pink",       "Pink Wool"},
  114.                 {"dark_grey",  "Dark Grey Wool"},
  115.                 {"dark_green", "Dark Green Wool"},
  116.         }
  117.  
  118.         for i in ipairs(colorlist) do
  119.                 local color = colorlist[i][1]
  120.                 local colordesc = colorlist[i][2]
  121.  
  122.                 stairsplus:register_all("wool", color, "wool:"..color, {
  123.                         description = colordesc,
  124.                         tiles = {"wool_"..color..".png"},
  125.                         groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,
  126.                                         flammable=3,wool=1,not_in_creative_inventory=1},
  127.                         sounds = default.node_sound_defaults(),
  128.                         sunlight_propagates = true,
  129.                 })
  130.         end
  131. end
  132.  
  133.  
  134.  
  135.  
  136. local cave_nodes = { -- Default stairs/slabs/panels/microblocks:
  137.         "caverealms:glow_crystal",
  138.         "caverealms:glow_emerald",
  139.         "caverealms:glow_mese",
  140.         "caverealms:glow_ore",
  141.         "caverealms:glow_emerald_ore",
  142.         "caverealms:glow_ruby",
  143.         "caverealms:glow_amethyst",
  144.         "caverealms:glow_ruby_ore",
  145.         "caverealms:salt_crystal",
  146.         "caverealms:stone_with_salt",
  147.         "caverealms:glow_obsidian"
  148.        
  149. }
  150.  
  151.    
  152.     for _, name in pairs(cave_nodes) do
  153.     local nodename = "caverealms:"..name
  154.     local a,b = string.find(name, ":")
  155.     if b then
  156.         nodename = name
  157.         name = string.sub(name, b+1)
  158.     end
  159.     local ndef = minetest.registered_nodes[nodename]
  160.     if ndef then
  161.         local drop
  162.         if type(ndef.drop) == "string" then
  163.             drop = ndef.drop:sub((b or 8)+1)
  164.         end
  165.  
  166.         local tiles = ndef.tiles
  167.         if #ndef.tiles > 1 and ndef.drawtype:find("glass") then
  168.             tiles = { ndef.tiles[1] }
  169.         end
  170.  
  171.         stairsplus:register_all("caverealms", name, nodename, {
  172.             description = ndef.description,
  173.             drop = drop,
  174.             groups = ndef.groups,
  175.             sounds = ndef.sounds,
  176.             tiles = tiles,
  177.             sunlight_propagates = true,
  178.             light_source = ndef.light_source
  179.         })
  180.     end
  181. end
  182.  
  183. local riventest_nodes = { -- Default stairs/slabs/panels/microblocks:
  184.  
  185.         "riventest:rt1",
  186.         "riventest:rt2",
  187.         "riventest:rt5",
  188.         "riventest:rt3",
  189.         "riventest:rt4",
  190.         "riventest:rt7",
  191.         "riventest:rt8",
  192.         "riventest:rt10",
  193.         "riventest:rt11",
  194.         "riventest:rt12",
  195.         "riventest:wood",
  196.         "riventet:woodblue",
  197.         "riventest:stone1",
  198.         "riventest:stone2",
  199.         "riventest:stoneblue",
  200.         "riventest:metal",
  201.         "riventest:bulkhead",
  202.         "riventest:goldstone1",
  203.         "riventest:goldstone2"
  204.  
  205. }
  206.        
  207.    
  208.         for _, name in pairs(riventest_nodes) do
  209.     local nodename = "riventest:"..name
  210.     local a,b = string.find(name, ":")
  211.     if b then
  212.         nodename = name
  213.         name = string.sub(name, b+1)
  214.     end
  215.     local ndef = minetest.registered_nodes[nodename]
  216.     if ndef then
  217.         local drop
  218.         if type(ndef.drop) == "string" then
  219.             drop = ndef.drop:sub((b or 8)+1)
  220.         end
  221.  
  222.         local tiles = ndef.tiles
  223.         if #ndef.tiles > 1 and ndef.drawtype:find("glass") then
  224.             tiles = { ndef.tiles[1] }
  225.         end
  226.  
  227.         stairsplus:register_all("riventest", name, nodename, {
  228.             description = ndef.description,
  229.             drop = drop,
  230.             groups = ndef.groups,
  231.             sounds = ndef.sounds,
  232.             tiles = tiles,
  233.             sunlight_propagates = true,
  234.             light_source = ndef.light_source
  235.         })
  236.     end
  237. end
Advertisement
Add Comment
Please, Sign In to add comment