diff --git a/init.lua b/init.lua index f29fa39..d4c72c0 100644 --- a/init.lua +++ b/init.lua @@ -2,15 +2,12 @@ planetoids = { miny = tonumber(minetest.settings:get("planetoids.miny")) or 6000, maxy = tonumber(minetest.settings:get("planetoids.maxy")) or 10000, - debug = minetest.settings:get("planetoids.debug") or false, - min_chance = 1, - ores = {} + debug = minetest.settings:get("planetoids.debug") or false } local MP = minetest.get_modpath("planetoids") -dofile(MP.."/ores.lua") dofile(MP.."/mapgen_oreplanet.lua") dofile(MP.."/mapgen.lua") diff --git a/mapgen_oreplanet.lua b/mapgen_oreplanet.lua index 35a99a3..ea3a314 100644 --- a/mapgen_oreplanet.lua +++ b/mapgen_oreplanet.lua @@ -56,19 +56,6 @@ planetoids.mapgen_oreplanet = function(minp, maxp, vm, area) if planet_n > max_perlin then max_perlin = planet_n end if planet_n < min_perlin then min_perlin = planet_n end - - if planet_n > planetoids.min_chance then - - -- planet - data[index] = c_base - for _,ore in pairs(planetoids.ores) do - if planet_n > ore.chance then - data[index] = ore.id - count = count + 1 - break - end - end - end end i = i + 1 @@ -77,7 +64,9 @@ planetoids.mapgen_oreplanet = function(minp, maxp, vm, area) end --y end --z - vm:set_data(data) + minetest.generate_ores(vm, minp, maxp) + + vm:set_data(data) if planetoids.debug then print("[Planetoids] count: " .. count .. " min: " .. min_perlin .. " max: " .. max_perlin) diff --git a/ores.lua b/ores.lua deleted file mode 100644 index 9a71e4d..0000000 --- a/ores.lua +++ /dev/null @@ -1,46 +0,0 @@ - -local register_ore = function(def) - table.insert(planetoids.ores, def) - planetoids.min_chance = math.min(def.chance, planetoids.min_chance) -end - -register_ore({ - id = minetest.get_content_id("default:lava_source"), - chance = 1.16 -}) - -register_ore({ - id = minetest.get_content_id("default:stone_with_mese"), - chance = 1.1 -}) - -register_ore({ - id = minetest.get_content_id("default:stone_with_iron"), - chance = 1.0 -}) - -register_ore({ - id = minetest.get_content_id("default:stone_with_gold"), - chance = 0.99 -}) - -register_ore({ - id = minetest.get_content_id("default:stone_with_copper"), - chance = 0.98 -}) - -register_ore({ - id = minetest.get_content_id("default:ice"), - chance = 0.9 -}) - -register_ore({ - id = minetest.get_content_id("default:stone"), - chance = 0.85 -}) - - --- sort ores -table.sort(planetoids.ores, function(a,b) - return b.chance < a.chance -end)