read_ore_config.lua 592 B

1234567891011121314151617181920
  1. local S=minerdream.intllib
  2. local has_value = basic_functions.has_value
  3. local tier_cols={
  4. col_num={"name"},}
  5. local tier_definition = basic_functions.import_csv(minerdream.path.."/tiers.txt",tier_cols)
  6. local ore_configs=minetest.get_dir_list(minerdream.path..'/config')
  7. --print(dump(ore_configs))
  8. for i,oc in pairs(ore_configs) do
  9. ore=string.split(oc,'.')[1]
  10. local inconfig=basic_functions.read_file(minerdream.path..'/config/'..oc)
  11. local json_conf=minetest.parse_json(inconfig)
  12. if json_conf==nil then
  13. print("wrong config:"..i)
  14. else
  15. minerdream.register_ore(ore,json_conf)
  16. end
  17. end