-
Notifications
You must be signed in to change notification settings - Fork 11
/
mineclone.lua
77 lines (66 loc) · 2.83 KB
/
mineclone.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
local S = minetest.get_translator(minetest.get_current_modname())
local water_probability = dynamic_liquid.config.water_probability
local river_water_probability = dynamic_liquid.config.river_water_probability
local lava_probability = dynamic_liquid.config.lava_probability
local water_level = dynamic_liquid.config.water_level
local springs = dynamic_liquid.config.springs
-- Since lava cooling behaviour can't be overridden in Mineclone, disabling dynamic liquid behaviour for lava
-- otherwise you get lava nodes wandering around on top of oceans covering the whole thing in stone.
--if dynamic_liquid.config.lava then
-- dynamic_liquid.liquid_abm("mcl_core:lava_source", "mcl_core:lava_flowing", lava_probability)
--end
if dynamic_liquid.config.water then
-- override water_source and water_flowing with liquid_renewable set to false
local override_def = {liquid_renewable = false}
minetest.override_item("mcl_core:water_source", override_def)
minetest.override_item("mcl_core:water_flowing", override_def)
dynamic_liquid.liquid_abm("mcl_core:water_source", "mcl_core:water_flowing", water_probability)
end
if dynamic_liquid.config.river_water then
dynamic_liquid.liquid_abm("mclx_core:river_water_source", "mclx_core:river_water_flowing", river_water_probability)
end
if dynamic_liquid.config.springs then
local clay_def = dynamic_liquid.duplicate_def("mcl_core:clay")
clay_def.description = S("Damp Clay")
minetest.register_node("dynamic_liquid:clay", clay_def)
local c_clay = minetest.get_content_id("mcl_core:clay")
local c_spring_clay = minetest.get_content_id("dynamic_liquid:clay")
local spring_placement = function(minp, maxp, data)
if minp.y >= water_level or maxp.y <= -15 then
return false
end
local placed_spring = false
for voxelpos, voxeldata in pairs(data) do
if voxeldata == c_clay then
data[voxelpos] = c_spring_clay
placed_spring = true
end
end
return placed_spring
end
-- mineclone 5
if minetest.get_modpath("mcl_mapgen") and mcl_mapgen.register_on_generated then
mcl_mapgen.register_on_generated(function(vm_context)
if spring_placement(vm_context.minp, vm_context.maxp, vm_context.data) then
vm_context.write = true
end
end, 999999999+1)
end
--mineclone 2
if minetest.get_modpath("mcl_mapgen_core") and mcl_mapgen_core.register_generator then
mcl_mapgen_core.register_generator("dynamic_liquid_damp_clay", function(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
return spring_placement(minp, maxp, data)
end, nil, 999999+1)
end
dynamic_liquid.spring({
nodenames = {"mcl_core:clay"},
water_source = "mcl_core:water_source",
water_flowing = "mcl_core:water_flowing",
y_max = water_level,
y_min = -15,
pressure = 15,
})
end
if dynamic_liquid.config.mapgen_prefill then
dynamic_liquid.mapgen_prefill({liquid="mcl_core:water_source", liquid_level=water_level})
end