5 -- Mudstone Sed soft Ocean, beach, river, glaciers
6 minetest
.register_node( "rocks:mudstone", {
7 description
= S("Mudstone"),
8 tiles
= { "rocks_Mudstone.png" },
9 groups
= {cracky
=1, crumbly
=3},
10 is_ground_content
= true, sounds
= default
.node_sound_dirt_defaults(),
13 minetest
.register_node( "rocks:limestone", {
14 description
= S("Limestone"),
15 tiles
= { "rocks_Limestone.png" },
16 is_ground_content
= true, sounds
= default
.node_sound_stone_defaults(),
22 local highland_max
=200
28 -- Modify default grassland biome
29 local grassland
=minetest
.registered_biomes
["default:grassland"] or
30 { -- default biome, if no biome mod is installed
31 name
= "rocks:grassland",
39 local mountains
={ -- default mountain biome
40 name
= "rocks:mountain",
41 node_top
= "default:dirt_with_grass",
43 node_filler
= "default:dirt",
51 -- The biome layers are: dust, top, filler, stone
52 -- On beach: dust, shore_top, shore_filler, underwater
53 -- coastside: dust, top, filler, shore_filler, underwater, stone
54 if #minetest
.registered_biomes
> 1 then
55 minetest
.log("error","Biomes registered before [rocks] discarded, please depend the mod on 'rocks' to fix this.")
56 -- can't just re-register them here, cause clear_biomes also clears decorations
58 minetest
.clear_registered_biomes()
59 -- hook to inject our sedimentary stone to new biomes
60 local old_register_biome
=minetest
.register_biome
61 minetest
.register_biome
=function(def
)
62 --print("[rocks] register_biome .name="..def.name)
63 for n
,v
in pairs(def
) do
64 --if type(v)~="table" then print(" "..n.."="..v) end
66 local cor
=false -- was the biomeheight patched?
67 local tl
=3 -- tolerance in determining biome type based on y_min/max values
68 local btype
-- biome type (:string)
69 if (def
.y_max
>3000) and (def
.y_min
<=highland_min
) then
70 -- correct upper boundary of registered bimes
71 if (def
.y_min
<10) and (def
.y_min
>0) then def
.y_max
=lowland_max cor
=true end
72 if (def
.y_min
<30) and (def
.y_min
>10) then def
.y_max
=highland_max cor
=true end
73 minetest
.log("action","/rocks correcting upper bound on biome "..def
.name
.." to "..def
.y_max
)
75 -- actual detection code
76 if def
.node_stone
=="default:desert_stone" then btype
="desert"
77 elseif (def
.y_min
>beach_min
-tl
) and (def
.y_max
<beach_max
+tl
) then btype
="beach"
78 elseif (def
.y_min
>0) and (def
.y_max
<lowland_max
+tl
) then btype
="lowland"
79 elseif (def
.y_min
>highland_min
-tl
) and (def
.y_max
<highland_max
+tl
) then btype
="highland"
80 elseif (def
.y_min
<-3000) and (def
.y_max
<lowland_min
+tl
) then btype
="ocean"
81 else minetest
.log("error", "/rocks could not guess elevation type for biome "..def
.name
) end
82 rocksl
.print("register_biome .name="..def
.name
.." -> btype="..btype
)
83 -- patch the new biomes with our rocks
84 if btype
=="lowland" then
85 def
.node_filler
="rocks:mudstone"
87 elseif btype
=="highland" then
88 def
.node_filler
="rocks:limestone"
89 def
.node_stone
="rocks:limestone"
92 if (def
.node_stone
=="default:stone") or (not def
.node_stone
) then def
.node_stone
="mapgen_stone" end
93 -- deactivate the added and removed shore-thing of MGv7
94 -- to fix weirid sand layers underground
95 if btype
=="lowland" then -- fixme: does this affect beach/ocean too?
96 def
.node_shore_top
=def
.node_top
97 def
.node_shore_filler
=def
.node_filler
98 def
.node_underwater
=def
.node_filler
100 -- and call the saved method to actually do the registration
101 old_register_biome(def
)
103 --now register the default grassland
104 minetest
.register_biome(grassland
)
105 -- create a default mountain biome...
106 minetest
.register_biome(mountains
)
107 -- hook the clear callback (fix biomesdev)
108 local old_clear
=minetest
.clear_registered_biomes
109 minetest
.clear_registered_biomes
=function()
111 minetest
.log("action","/rocks re-registering default mountain biome!")
112 minetest
.register_biome(mountains
)
117 -- todo: mountains, alps, volcanos
121 local reg
=function(name
,param
)
122 minetest
.register_ore({
127 ore_type
= "scatter",
128 clust_scarcity
= 8^
3,
130 clust_num_ores
= 10^
3,
133 noise_threshhold
= param
.treshold
,
135 offset
=0, scale
=1, octaves
=1, persist
=0.3,
136 spread
={x
=param
.spread
, y
=param
.height
, z
=param
.spread
},
137 seed
=rocksl
.GetNextSeed(),
142 -- this does register a new sedimentary vein.
143 rocks
.register_sedimentary
=reg
145 -- follows the only thing remaining from old ver :)
147 -- Sedimentary rock hardness and distribution
148 -- Rock Hard Distribution
149 --Breccia Weak Localized continental, folded
150 -->Claystone Weak Localized continental, folded, oceanic
151 --Conglomerate Weak Localized continental, folded
152 -->Limestone Medium Localized continental, folded; primary oceanic, hills
153 -->Coal - Large beds, twice as common in swamps
154 --reg("rocks:limestone", { spread=64, height=32, treshold=0.35 })
155 --reg("rocks:breccia", { spread=64, height=32, treshold=0.6 })
156 --reg("rocks:conglomerate", { spread=64, height=32, treshold=0.6 })
157 reg("default:stone_with_coal", { spread
=64, height
=14, treshold
=0.58 })
158 reg("default:clay",{ spread
=48, height
=14, treshold
=0.55 })