-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.lua
42 lines (31 loc) · 923 Bytes
/
example.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
-- forces the map into singlenode mode, don't do this if this is just a "realm".
luamap.set_singlenode()
-- creates a terrain noise
luamap.register_noise("terrain",{
type = "2d",
np_vals = {
offset = 0,
scale = 1,
spread = {x=384, y=256, z=384},
seed = 5900033,
octaves = 5,
persist = 0.63,
lacunarity = 2.0,
flags = ""
},
})
local c_stone = minetest.get_content_id("default:stone")
local c_water = minetest.get_content_id("default:water_source")
local water_level = 0
local old_logic = luamap.logic
function luamap.logic(noise_vals,x,y,z,seed,original_content)
-- get any terrain defined in another mod
local content = old_logic(noise_vals,x,y,z,seed,original_content)
if y < water_level then
content = c_water
end
if y < noise_vals.terrain * 50 then
content = c_stone
end
return content
end