1
0
mirror of git://repo.or.cz/rocks.git synced 2024-11-16 07:20:40 +01:00

Add part of geologica rocks.

This commit is contained in:
Tomáš Brada 2015-01-10 15:46:45 +01:00
parent af659b9602
commit d547a233e9
3 changed files with 92 additions and 227 deletions

87
geologica.lua Normal file
View File

@ -0,0 +1,87 @@
local CcHard=3
local CcStrong=3
local CcMed=3
local CcSoft=3
--
-- Main rocks (top to bottom)
--
-- Granite In/Felsic hard Very common, below sed on land
minetest.register_node( "rocks:granite", {
description = S("Granite"),
tiles = { "rocks_stoneGranite.png" },
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
groups = {cracky=CcStrong, stone=1},
})
rocks.register_layer( "granite",{ gain=20, height=-40, limit=2, seed=1 }, "rocks:granite")
-- Diorite In/Inter vhard Below granite
minetest.register_node( "rocks:diorite", {
description = S("Diorite"),
tiles = { "rocks_stoneDiorite.png" },
groups = {cracky=CcHard, stone=1},
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
})
rocks.register_layer( "diorite",{ gain=20, height=-90, limit=2, seed=2 }, "rocks:diorite")
-- Basalt Ex/Mafic hard same as diorite, byt limit=0.5
minetest.register_node( "rocks:basalt", {
description = S("Basalt"),
tiles = { "rocks_stoneBasalt.png" },
groups = {cracky=CcStrong, stone=1},
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
})
rocks.register_layer( "basalt",{ gain=20, height=-85, limit=-0.7, seed=2 }, "rocks:basalt")
-- Gabbro In/Mafic vhard Below basalt/diorite (mtns, ocean)
minetest.register_node( "rocks:gabbro", {
description = S("Gabbro"),
tiles = { "rocks_stoneGabbro.png" },
groups = {cracky=CcHard, stone=1},
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
})
rocks.register_layer( "gabbro",{ gain=20, height=-130, limit=2, seed=3 }, "rocks:gabbro")
-- Peridotite In/UMafic vhard Rarely under gabbro
minetest.register_node( "rocks:peridotite", {
description = S("Peridotite"),
tiles = { "rocks_stonePeridotite.png" },
groups = {cracky=CcStrong, stone=1},
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
})
rocks.register_layer( "peridotite",{ gain=20, height=-200, limit=2, seed=4 }, "rocks:peridotite")
-- Komatiite Ex/UMafic - Too deep
-- no texture
--
-- top rocks
--
-- Mudstone Sed soft Ocean, beach, river, glaciers
minetest.register_node( "rocks:mudstone", {
description = S("Mudstone"),
tiles = { "rocks_stoneMudstone.png" },
groups = {cracky=CcSoft, stone=1},
is_ground_content = true, sounds = default.node_sound_stone_defaults(),
})
rocks.register_layer( "mudstone",{ gain=20, height=-5, limit=2, seed=4 }, "rocks:mudstone")
-- Slate MM/barro med Under mud/clay/siltstone
-- Schist MM/barro med Under slate, sometimes igneous
-- Gneiss MM/barro hard Under schist, sometimes igneous
-- Hornfels MM/contact vhard b/w granite and lime/dolo
-- Skarn MM/contact med b/w granite and lime/dolo, hornfels
-- Marble MM/contact hard b/w granite and lime/dolo
-- Quartzite MM/contact vhard sandstone
-- peak rocks
-- Rhyolite Ex/Felsic hard Mountains, top
-- Andesite Ex/Inter hard Mountains, below rhyolite
-- Limestone Sed med Hills
-- nonvein vein
-- Claystone Sed soft in mudstone
-- Breccia Mixture soft in mudstone
-- Conglomerate Sed soft in mudstone

227
init.lua
View File

@ -1,6 +1,5 @@
-- Load translation library if intllib is installed -- Load translation library if intllib is installed
local S
if (minetest.get_modpath("intllib")) then if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua") dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
@ -15,235 +14,13 @@ dofile(modpath.."/register.lua")
rocks.noiseparams_layers = { rocks.noiseparams_layers = {
offset = 0, offset = 0,
scale = 1, scale = 1,
spread = {x=300, y=300, z=300}, spread = {x=30, y=30, z=30},
octaves = 3, octaves = 3,
persist = 0.63 persist = 0.63
} }
--
-- test layer
--
rocks.register_layer("test1",{ gain=40, height=70, limit=2, seed=1 }, "air") --"rocks:black_granite")
-- uhlie ako vrstva je kokotina.
rocks.register_layer("test3",{ gain=40, height=65, limit=2, seed=3 },"air") --"rocks:pink_granite")
rocks.register_layer("test4",{ gain=40, height=90, limit=2, seed=4 },"air") --"rocks:white_granite")
--
-- test vein
--
rocks.register_vein("testvein1",{
spread = {x=15, y=15, z=15}, -- tall, narrow
-- larger values -> larger and less frequent vein
treshold=0.8, -- betveen -2 and +2, mapgen will use this or per-ore treshold if it is larger
-- 2 never generate
-- 1 extremly rare
-- 0 50% chance
-- less than 0 = SPAM
seed = 9, -- random seed
hmin=5, -- set to nil to generate everywhere
hmax=100,
layers={ "test3" }, -- only occur in layers
})
rocks.register_ore( "testvein1", "default:glass" , {treshold=0, chance=1 } )
-- treshold=0 chance=1 ... generate everywhere
rocks.register_ore( "testvein1", "default:wood" , {treshold=0, chance=0.2} )
-- chance<1 ... vein contains chance*100% of the material, evenly randomly distributed
rocks.register_ore( "testvein1", "default:tree", {treshold=0.87, chance=1 } )
-- treshold>0 ... generate in the center, larger value -> narrower
-- 20% wood, lava in center, dirt the rest
-- ore with smallest chance and highest treshold is selected
dofile(modpath.."/mapgen.lua") dofile(modpath.."/mapgen.lua")
dofile(modpath.."/geologica.lua")
--
--Bedrock
--
minetest.register_node( "rocks:pink_granite", {
description = "Pink Granite",
tiles = { "rocks_pgr.png" },
is_ground_content = true,
groups = {cracky=3, stone=1},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_ore({
ore_type = "sheet",
ore = "rocks:pink_granite",
wherein = "do_not_generate",
clust_scarcity = 1,
clust_num_ores = 1,
clust_size = 60,
height_min = -31000,
height_max = -46,
noise_threshhold = 0.2,
noise_params = {offset=0, scale=80, spread={x=4350, y=4350, z=4350}, seed=31, octaves=11, persist=0.0000000001}
})
minetest.register_node( "rocks:black_granite", {
description = "Black Granite",
tiles = { "rocks_blkgr.png" },
is_ground_content = true,
groups = {cracky=3, stone=1},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_ore({
ore_type = "sheet",
ore = "rocks:black_granite",
wherein = "do_not_generate",
clust_scarcity = 1,
clust_num_ores = 1,
clust_size = 60,
height_min = -31000,
height_max = -46,
noise_threshhold = 0.2,
noise_params = {offset=0, scale=80, spread={x=4350, y=4350, z=4350}, seed=32, octaves=11, persist=0.0000000001}
})
minetest.register_node( "rocks:white_granite", {
description = "White Granite",
tiles = { "rocks_wgr.png" },
is_ground_content = true,
groups = {cracky=3, stone=1},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_ore({
ore_type = "sheet",
ore = "rocks:white_granite",
wherein = "do_not_generate",
clust_scarcity = 1,
clust_num_ores = 1,
clust_size = 60,
height_min = -31000,
height_max = -46,
noise_threshhold = 0.2,
noise_params = {offset=0, scale=80, spread={x=4350, y=4350, z=4350}, seed=33, octaves=11, persist=0.0000000001}
})
minetest.register_node( "rocks:brown_granite", {
description = "Brown Granite",
tiles = { "rocks_brgr.png" },
is_ground_content = true,
groups = {cracky=3, stone=1},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_ore({
ore_type = "sheet",
ore = "rocks:brown_granite",
wherein = "do_not_generate",
clust_scarcity = 1,
clust_num_ores = 1,
clust_size = 60,
height_min = -31000,
height_max = -46,
noise_threshhold = 0.2,
noise_params = {offset=0, scale=80, spread={x=4350, y=4350, z=4350}, seed=34, octaves=11, persist=0.0000000001}
})
minetest.register_node( "rocks:red_sandstone", {
description = "Red Sandstone",
tiles = { "rocks_rss.png" },
is_ground_content = true,
groups = {cracky=3, stone=1},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_ore({
ore_type = "sheet",
ore = "rocks:red_sandstone",
wherein = "do_not_generate",
clust_scarcity = 1,
clust_num_ores = 1,
clust_size = 60,
height_min = -31000,
height_max = -46,
noise_threshhold = 0.2,
noise_params = {offset=0, scale=80, spread={x=4350, y=4350, z=4350}, seed=35, octaves=11, persist=0.0000000001}
})
minetest.register_node( "rocks:yellow_sandstone", {
description = "Yellow Sandstone",
tiles = { "rocks_yss.png" },
is_ground_content = true,
groups = {cracky=3, stone=1},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_ore({
ore_type = "sheet",
ore = "rocks:yellow_sandstone",
wherein = "do_not_generate",
clust_scarcity = 1,
clust_num_ores = 1,
clust_size = 60,
height_min = -31000,
height_max = -46,
noise_threshhold = 0.2,
noise_params = {offset=0, scale=80, spread={x=4350, y=4350, z=4350}, seed=36, octaves=11, persist=0.0000000001}
})
minetest.register_node( "rocks:white_marble", {
description = "White Marble",
tiles = { "rocks_wm.png" },
is_ground_content = true,
groups = {cracky=3, stone=1},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_ore({
ore_type = "sheet",
ore = "rocks:white_marble",
wherein = "do_not_generate",
clust_scarcity = 1,
clust_num_ores = 1,
clust_size = 60,
height_min = -31000,
height_max = -46,
noise_threshhold = 0.2,
noise_params = {offset=0, scale=80, spread={x=4350, y=4350, z=4350}, seed=37, octaves=11, persist=0.0000000001}
})
minetest.register_node( "rocks:black_basalt", {
description = "Black Basalt",
tiles = { "rocks_bb.png" },
is_ground_content = true,
groups = {cracky=3, stone=1},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_ore({
ore_type = "sheet",
ore = "rocks:black_basalt",
wherein = "do_not_generate",
clust_scarcity = 1,
clust_num_ores = 1,
clust_size = 60,
height_min = -31000,
height_max = -46,
noise_threshhold = 0.2,
noise_params = {offset=0, scale=80, spread={x=4350, y=4350, z=4350}, seed=38, octaves=11, persist=0.0000000001}
})
minetest.register_ore({
ore_type = "sheet",
ore = "default:clay",
wherein = "do_not_generate",
clust_scarcity = 1,
clust_num_ores = 1,
clust_size = 6,
height_min = -31000,
height_max = 15,
noise_threshhold = 0.5,
noise_params = {offset=0, scale=15, spread={x=25, y=20, z=30}, seed=15, octaves=3, persist=0.10}
})
print("[rocks] loaded.") print("[rocks] loaded.")

View File

@ -27,7 +27,7 @@ local function mkheightmap(layers,x,z,minp,maxp)
local hm={} local hm={}
for ln,ld in pairs(layers) do for ln,ld in pairs(layers) do
local noise=ld.nmap[z-minp.z+1][x-minp.x+1] local noise=ld.nmap[z-minp.z+1][x-minp.x+1]
if math.abs(noise)<ld.limit then if noise<ld.limit then
ld.nh = (noise*ld.gain)+ld.height ld.nh = (noise*ld.gain)+ld.height
-- if (ld.nh<maxy)and(ld.nh>miny) -- if (ld.nh<maxy)and(ld.nh>miny)
table.insert(hm,ld) table.insert(hm,ld)
@ -39,7 +39,7 @@ end
local stonectx=nil local stonectx=nil
minetest.register_on_generated(function(minp, maxp, seed) minetest.register_on_generated(function(minp, maxp, seed)
if not stone_ctx then stone_ctx= minetest.get_content_id("air") end if not stone_ctx then stone_ctx= minetest.get_content_id("default:stone") end
-- noise values range (-1;+1) (1 octave) -- noise values range (-1;+1) (1 octave)
-- 3 octaves it is like 1.7 max -- 3 octaves it is like 1.7 max
-- 4 octaves with 0.8 presist = 2.125 max !! -- 4 octaves with 0.8 presist = 2.125 max !!
@ -112,6 +112,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
rock.ctx=minetest.get_content_id(rock.node) rock.ctx=minetest.get_content_id(rock.node)
end end
nodes[p_pos] = rock.ctx nodes[p_pos] = rock.ctx
-- if minp.x>0 then nodes[p_pos]=0 end
end end
perlin_index =perlin_index+1 perlin_index =perlin_index+1