Zefram
2014-05-16 68b7bcc28e39bdf0926072b834eeeeec0ee6c721
technic_worldgen/nodes.lua
@@ -76,6 +76,29 @@
   sounds = default.node_sound_stone_defaults()
})
minetest.register_alias("technic:wrought_iron_block", "default:steelblock")
minetest.override_item("default:steelblock", {
   description = S("Wrought Iron Block"),
   tiles = { "technic_wrought_iron_block.png" },
})
minetest.register_node(":technic:cast_iron_block", {
   description = S("Cast Iron Block"),
   tiles = { "technic_cast_iron_block.png" },
   is_ground_content = true,
   groups = {cracky=1, level=2},
   sounds = default.node_sound_stone_defaults()
})
minetest.register_node(":technic:carbon_steel_block", {
   description = S("Carbon Steel Block"),
   tiles = { "technic_carbon_steel_block.png" },
   is_ground_content = true,
   groups = {cracky=1, level=2},
   sounds = default.node_sound_stone_defaults()
})
minetest.register_node(":technic:stainless_steel_block", {
   description = S("Stainless Steel Block"),
   tiles = { "technic_stainless_steel_block.png" },
@@ -101,4 +124,40 @@
})
minetest.register_alias("technic:diamond_block", "default:diamondblock")
minetest.register_alias("technic:diamond", "default:diamond")
minetest.register_alias("technic:mineral_diamond", "default:stone_with_diamond")
local function for_each_registered_node(action)
   local already_reg = {}
   for k, _ in pairs(minetest.registered_nodes) do
      table.insert(already_reg, k)
   end
   local really_register_node = minetest.register_node
   minetest.register_node = function(name, def)
      really_register_node(name, def)
      action(string.gsub(name, "^:", ""))
   end
   for _, name in ipairs(already_reg) do
      action(name)
   end
end
for_each_registered_node(function(node_name)
   local node_def = minetest.registered_nodes[node_name]
   if node_name ~= "default:steelblock" and string.find(node_name, "steelblock") and string.find(node_def.description, "Steel") then
      minetest.override_item(node_name, { description = string.gsub(node_def.description, "Steel", S("Wrought Iron")) })
   end
   if node_def.tiles or node_def.tile_images then
      local tn = node_def.tiles and "tiles" or "tile_images"
      local tl = {}
      local ca = false
      for i, t in ipairs(node_def[tn]) do
         if type(t) == "string" and t == "default_steel_block.png" then
            ca = true
            t = "technic_wrought_iron_block.png"
         end
         table.insert(tl, t)
      end
      if ca then minetest.override_item(node_name, { [tn] = tl }) end
   end
end)