forked from VoxeLibre/VoxeLibre
Compare commits
4 Commits
master
...
secret_ore
Author | SHA1 | Date |
---|---|---|
|
bafd0aa03f | |
|
69ad066e63 | |
|
89b025cae8 | |
|
e772bd12f0 |
|
@ -404,6 +404,22 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
|
|||
y_max = mcl_worlds.layer_to_y(15),
|
||||
})
|
||||
|
||||
--
|
||||
-- Netherite
|
||||
-- (default netherite spawning in mcl_secret_ores)
|
||||
if minetest.settings:get_bool("mcl_traditional_ancient_debris_ore",false) then
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "mcl_nether:ancient_debris",
|
||||
wherein = {"mcl_nether:netherrack","mcl_nether:soul_sand","mcl_blackstone:blackstone","mcl_blackstone:basalt"},
|
||||
clust_scarcity = 50000,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
y_min = mcl_vars.mg_nether_min,
|
||||
y_max = mcl_vars.mg_lava_nether_max,
|
||||
})
|
||||
end
|
||||
|
||||
--
|
||||
-- Redstone
|
||||
--
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
mcl_secret_ores = {}
|
||||
mcl_secret_ores.registered_ores = {}
|
||||
|
||||
local trad_ore = minetest.settings:get_bool("mcl_traditional_ancient_debris_ore",false)
|
||||
local noise_params = {
|
||||
offset = 0.27,
|
||||
scale = 1,
|
||||
spread = {x = 523, y = 123, z = 542 },
|
||||
seed = 252342,
|
||||
octaves = 1,
|
||||
persist = 0,
|
||||
flags = "absvalue",
|
||||
}
|
||||
|
||||
local adjacents = {
|
||||
{ x =-1, y = 0, z = 0},
|
||||
{ x = 1, y = 0, z = 0},
|
||||
{ x = 0, y =-1, z = 0},
|
||||
{ x = 0, y = 1, z = 0},
|
||||
{ x = 0, y = 0, z =-1},
|
||||
{ x = 0, y = 0, z = 1}
|
||||
}
|
||||
local seed = minetest.get_mapgen_setting("seed")
|
||||
|
||||
local function is_occluded(pos,dp)
|
||||
for k,v in pairs(adjacents) do
|
||||
local np=vector.add(pos,v)
|
||||
local n = minetest.get_node(np)
|
||||
if not vector.equals(np,dp) and n.name=="air" then return false end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function mcl_secret_ores.on_dig(pos, oldnode,def)
|
||||
if (def.y_min and pos.y < def.y_min) or ( def.y_max and pos.y > def.y_max ) then return end
|
||||
for k,v in pairs(adjacents) do
|
||||
local p=vector.add(pos,v)
|
||||
local n=minetest.get_node_or_nil(p)
|
||||
if n and table.indexof(def.wherein,n.name) and n.param2 == 0 and is_occluded(p,pos) and def.randomfunc(p,def) then
|
||||
if def.clust_num_ores then --enforce local limit
|
||||
local oo = minetest.find_nodes_in_area(vector.offset(p,-15,-15,-15),vector.offset(p,15,15,15),{def.ore})
|
||||
if oo and #oo > def.clust_num_ores then return end
|
||||
end
|
||||
minetest.set_node(p,{name=def.ore})
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_secret_ores.register_ore(def)
|
||||
if not def.randomfunc then
|
||||
def.randomfunc = function(p) return math.random(100) == 1 end
|
||||
end
|
||||
table.insert(mcl_secret_ores.registered_ores,def)
|
||||
end
|
||||
minetest.register_on_mods_loaded(function()
|
||||
for _,def in pairs(mcl_secret_ores.registered_ores) do
|
||||
for _,n in pairs(def.wherein) do
|
||||
local node = minetest.registered_nodes[n]
|
||||
local old_on_dig = node.on_dig
|
||||
minetest.override_item(n, {on_dig = function(pos,oldnode,digger)
|
||||
mcl_secret_ores.on_dig(pos, oldnode,def)
|
||||
return old_on_dig(pos,oldnode,digger)
|
||||
end,
|
||||
place_param2 = 1
|
||||
})
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if not trad_ore then
|
||||
mcl_secret_ores.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "mcl_nether:ancient_debris",
|
||||
wherein = {"mcl_nether:netherrack","mcl_nether:soul_sand","mcl_blackstone:blackstone","mcl_blackstone:basalt"},
|
||||
clust_num_ores = 8,
|
||||
y_min = mcl_vars.mg_nether_min,
|
||||
y_max = mcl_vars.mg_lava_nether_max,
|
||||
randomfunc = function(p,def)
|
||||
local noise = minetest.get_perlin(noise_params)
|
||||
local n = noise:get_3d(p)
|
||||
if n > 1 then return true end
|
||||
end
|
||||
})
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
name = mcl_secret_ores
|
||||
author = cora
|
||||
depends = mcl_init
|
|
@ -39,6 +39,9 @@ mcl_doTileDrops (Blocks have drops) bool true
|
|||
# If enabled, TNT explosions destroy blocks.
|
||||
mcl_tnt_griefing (TNT destroys blocks) bool true
|
||||
|
||||
# If enabled Ancient debris will spawn like other ores. Cheaters will be abel to see it. Off by default.
|
||||
mcl_traditional_ancient_debris_ore (spawn ancient debris as traditional [xrayable] ore) bool false
|
||||
|
||||
[Players]
|
||||
# If enabled, players respawn at the bed they last lay on instead of normal
|
||||
# spawn.
|
||||
|
|
Loading…
Reference in New Issue