123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- -- Renew mod for Minetest
- -- Copyright © 2018 Alex Yst <https://y.st./>
- -- This program is free software; you can redistribute it and/or
- -- modify it under the terms of the GNU Lesser General Public
- -- License as published by the Free Software Foundation; either
- -- version 2.1 of the License, or (at your option) any later version.
- -- This software is distributed in the hope that it will be useful,
- -- but WITHOUT ANY WARRANTY; without even the implied warranty of
- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- -- Lesser General Public License for more details.
- -- You should have received a copy of the GNU Lesser General Public
- -- License along with this program. If not, see
- -- <https://www.gnu.org./licenses/>.
- local function spawn_coal(y)
- if y >= 1025 and y <= 31000 then
- if math.random(8 * 8 * 8) <= 9 then
- return true
- end
- end
- if y >= -31000 and y <= 64 then
- if math.random(8 * 8 * 8) <= 8 then
- return true
- end
- end
- if y >= -31000 and y <= 0 then
- if math.random(24 * 24 * 24) <= 27 then
- return true
- end
- end
- end
- local function spawn_iron(y)
- if y >= 1025 and y <= 31000 then
- if math.random(9 * 9 * 9) <= 12 then
- return true
- end
- end
- if y >= -31000 and y <= 0 then
- if math.random(7 * 7 * 7) <= 5 then
- return true
- end
- end
- if y >= -31000 and y <= -64 then
- if math.random(24 * 24 * 24) <= 27 then
- return true
- end
- end
- end
- local function spawn_copper(y)
- if y >= 1025 and y <= 31000 then
- if math.random(9 * 9 * 9) <= 5 then
- return true
- end
- end
- if y >= -63 and y <= -16 then
- if math.random(12 * 12 * 12) <= 4 then
- return true
- end
- end
- if y >= -31000 and y <= -64 then
- if math.random(9 * 9 * 9) <= 5 then
- return true
- end
- end
- end
- local function spawn_tin(y)
- if y >= 1025 and y <= 31000 then
- if math.random(10 * 10 * 10) <= 5 then
- return true
- end
- end
- if y >= -127 and y <= -32 then
- if math.random(13 * 13 * 13) <= 4 then
- return true
- end
- end
- if y >= -31000 and y <= -128 then
- if math.random(10 * 10 * 10) <= 5 then
- return true
- end
- end
- end
- local function spawn_gold(y)
- if y >= 1025 and y <= 31000 then
- if math.random(13 * 13 * 13) <= 5 then
- return true
- end
- end
- if y >= -255 and y <= -64 then
- if math.random(15 * 15 * 15) <= 3 then
- return true
- end
- end
- if y >= -31000 and y <= -256 then
- if math.random(13 * 13 * 13) <= 5 then
- return true
- end
- end
- end
- local function spawn_mese(y)
- if y >= 1025 and y <= 31000 then
- if math.random(14 * 14 * 14) <= 5 then
- return true
- end
- end
- if y >= -255 and y <= -64 then
- if math.random(18 * 18 * 18) <= 3 then
- return true
- end
- end
- if y >= -31000 and y <= -256 then
- if math.random(14 * 14 * 14) <= 5 then
- return true
- end
- end
- end
- local function spawn_diamond(y)
- if y >= 1025 and y <= 31000 then
- if math.random(15 * 15 * 15) <= 4 then
- return true
- end
- end
- if y >= -255 and y <= -128 then
- if math.random(17 * 17 * 17) <= 4 then
- return true
- end
- end
- if y >= -3100 and y <= -256 then
- if math.random(15 * 15 * 15) <= 4 then
- return true
- end
- end
- end
- function default.cool_lava(pos, node)
- local wet = minetest.find_node_near(pos, 1, "group:water")
- if node.name == "default:lava_source" and not wet then
- minetest.set_node(pos, {name = "default:obsidian"})
- elseif wet or (pos.y < -112 and node.name ~= "default:lava_source") then
- if spawn_coal(pos.y) then
- minetest.set_node(pos, {name = "default:stone_with_coal"})
- elseif spawn_iron(pos.y) then
- minetest.set_node(pos, {name = "default:stone_with_iron"})
- elseif spawn_copper(pos.y) then
- minetest.set_node(pos, {name = "default:stone_with_copper"})
- elseif spawn_tin(pos.y) then
- minetest.set_node(pos, {name = "default:stone_with_tin"})
- elseif spawn_gold(pos.y) then
- minetest.set_node(pos, {name = "default:stone_with_gold"})
- elseif spawn_mese(pos.y) then
- minetest.set_node(pos, {name = "default:stone_with_mese"})
- elseif spawn_diamond(pos.y) then
- minetest.set_node(pos, {name = "default:stone_with_diamond"})
- else
- minetest.set_node(pos, {name = "default:stone"})
- end
- else
- minetest.set_node(pos, {name = "default:desert_stone"})
- end
- minetest.sound_play("default_cool_lava", {pos = pos, max_hear_distance = 16, gain = 0.25})
- end
- minetest.register_alias("renew:obsidian_shard", "default:obsidian")
|