api.lua 1.0 KB

123456789101112131415161718192021222324252627282930
  1. local local_ore_register = function(modname,stonename,element,crack,itemname)
  2. if itemname == nil then
  3. itemname = modname..":"..stonename.."_with_"..element
  4. end
  5. print(itemname)
  6. print(modname:gsub(":","")..':'..element..'_lump')
  7. minetest.register_node(itemname, {
  8. -- description = S(element.." ore"),
  9. description = element.." ore",
  10. tiles = {"default_"..stonename:gsub("desert","desert_")..".png^minerdream_"..element.."_ore.png"},
  11. groups = {cracky = crack},
  12. drop = modname:gsub(":","")..':'..element..'_lump',
  13. sounds = default.node_sound_stone_defaults(),
  14. })
  15. end
  16. function minerdream.ore_register(tdef)
  17. if tdef.overrides == nil then
  18. local_ore_register(minetest.get_current_modname(),"stone",tdef.name,tdef.crack)
  19. if tdef.groups.in_desert ~= nil then
  20. local_ore_register(minetest.get_current_modname(),"desertstone",tdef.name,tdef.crack)
  21. end
  22. else
  23. local modname = ":"..string.split(tdef.overrides,":")[1]
  24. print(modname)
  25. local_ore_register(modname,"stone",tdef.name,tdef.crack,":"..tdef.overrides)
  26. end
  27. end