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(),
19 minetest
.register_node( "rocks:laterite", {
20 description
= S("Laterite clay"),
21 tiles
= { "rocks_laterite.png" },
22 is_ground_content
= true, sounds
= default
.node_sound_dirt_defaults(),
28 local highland_max
=200
34 -- Modify default grassland biome
35 local grassland
=minetest
.registered_biomes
["default:grassland"] or
36 { -- default biome, if no biome mod is installed
37 name
= "rocks:grassland",
46 local mountains
={ -- default mountain biome
47 name
= "rocks:mountain",
48 node_top
= "default:dirt_with_grass",
50 node_filler
= "default:dirt",
58 -- The biome layers are: dust, top, filler, stone
59 -- On beach: dust, shore_top, shore_filler, underwater
60 -- coastside: dust, top, filler, shore_filler, underwater, stone
61 if #minetest
.registered_biomes
> 1 then
62 minetest
.log("error","Biomes registered before [rocks] discarded, please depend the mod on 'rocks' to fix this.")
63 -- can't just re-register them here, cause clear_biomes also clears decorations
65 minetest
.clear_registered_biomes()
66 -- hook to inject our sedimentary stone to new biomes
67 local old_register_biome
=minetest
.register_biome
68 minetest
.register_biome
=function(def
)
69 --print("[rocks] register_biome .name="..def.name)
70 for n
,v
in pairs(def
) do
71 --if type(v)~="table" then print(" "..n.."="..v) end
73 local cor
=false -- was the biomeheight patched?
74 local tl
=3 -- tolerance in determining biome type based on y_min/max values
75 local btype
-- biome type (:string)
76 if (def
.y_max
>3000) and (def
.y_min
<=highland_min
) then
77 -- correct upper boundary of registered bimes
78 if (def
.y_min
<10) and (def
.y_min
>0) then def
.y_max
=lowland_max cor
=true end
79 if (def
.y_min
<30) and (def
.y_min
>10) then def
.y_max
=highland_max cor
=true end
80 minetest
.log("action","/rocks correcting upper bound on biome "..def
.name
.." to "..def
.y_max
)
82 -- actual detection code
83 if def
.node_stone
=="default:desert_stone" then btype
="desert"
84 elseif (def
.y_min
>beach_min
-tl
) and (def
.y_max
<beach_max
+tl
) then btype
="beach"
85 elseif (def
.y_min
>0) and (def
.y_max
<lowland_max
+tl
) then btype
="lowland"
86 elseif (def
.y_min
>highland_min
-tl
) and (def
.y_max
<highland_max
+tl
) then btype
="highland"
87 elseif (def
.y_min
<-3000) and (def
.y_max
<lowland_min
+tl
) then btype
="ocean"
88 else minetest
.log("error", "/rocks could not guess elevation type for biome "..def
.name
) end
89 rocksl
.print("register_biome .name="..def
.name
.." -> btype="..btype
)
90 -- patch the new biomes with our rocks
91 if btype
=="lowland" then
92 --def.node_filler="rocks:mudstone"
94 --def.node_stone="rocks:granite"
95 if (def
.humidity_point
>80) and (def
.heat_point
>80) then
96 --def.node_filler="rocks:laterite"
98 elseif btype
=="highland" then
99 def
.node_filler
="rocks:limestone"
100 def
.node_stone
="rocks:limestone"
102 elseif btype
=="beach" then
103 def
.node_stone
="rocks:granite"
105 if def
.heat_point
<50 then
106 def
.node_top
="default:gravel"
107 def
.node_filler
="default:gravel"
109 elseif def
.node_top
=="default:sand" then
110 if def
.depth_top
<2 then def
.depth_top
=3 end
111 def
.node_filler
="default:sandstone"
114 elseif btype
=="ocean" then
115 def
.node_stone
="rocks:basalt"
116 def
.node_top
="default:gravel"
117 def
.node_filler
="rocks:limestone"
119 do -- deactivate the added and removed shore-thing of MGv7
120 -- to fix weirid sand layers underground
121 def
.node_shore_top
=def
.node_top
122 def
.node_shore_filler
=def
.node_filler
123 def
.node_underwater
=def
.node_top
125 -- and call the saved method to actually do the registration
126 old_register_biome(def
)
128 --now register the default grassland
129 minetest
.register_biome(grassland
)
130 -- create a default mountain biome...
131 minetest
.register_biome(mountains
)
132 -- hook the clear callback (fix biomesdev)
133 local old_clear
=minetest
.clear_registered_biomes
134 minetest
.clear_registered_biomes
=function()
136 minetest
.log("action","/rocks re-registering default mountain biome!")
137 minetest
.register_biome(mountains
)
142 -- todo: mountains, alps, volcanos
146 local reg
=function(name
,param
)
147 minetest
.register_ore({
152 ore_type
= "scatter",
153 clust_scarcity
= 8^
3,
155 clust_num_ores
= 10^
3,
158 noise_threshhold
= param
.treshold
,
160 offset
=0, scale
=1, octaves
=1, persist
=0.3,
161 spread
={x
=param
.spread
, y
=param
.height
, z
=param
.spread
},
162 seed
=rocksl
.GetNextSeed(),
167 -- this does register a new sedimentary vein.
168 rocks
.register_sedimentary
=reg
170 -- follows the only thing remaining from old ver :)
172 -- Sedimentary rock hardness and distribution
173 -- Rock Hard Distribution
174 --Breccia Weak Localized continental, folded
175 -->Claystone Weak Localized continental, folded, oceanic
176 --Conglomerate Weak Localized continental, folded
177 -->Limestone Medium Localized continental, folded; primary oceanic, hills
178 -->Coal - Large beds, twice as common in swamps
179 --reg("rocks:limestone", { spread=64, height=32, treshold=0.35 })
180 --reg("rocks:breccia", { spread=64, height=32, treshold=0.6 })
181 --reg("rocks:conglomerate", { spread=64, height=32, treshold=0.6 })
182 --reg("default:stone_with_coal", { spread=64, height=14, treshold=0.58 })
183 --reg("default:clay",{ spread=48, height=14, treshold=0.55 })