2024-09-29 20:34:34 -06:00

154 lines
3.5 KiB
Lua

PyuTest.register_world = function (options)
local default_options = {}
local conf = {}
for k, v in pairs(options) do
conf[k] = v
end
for k, v in pairs(default_options) do
if conf[k] == nil then
conf[k] = v
end
end
if conf.y_max == nil or conf.y_min == nil then
error("Please supply 'y_max' and 'y_min' to the options table!")
end
if conf.name == nil then
error("Please supply 'name' in the options table!")
end
return {
name = conf.name,
y_max = conf.y_max,
y_min = conf.y_min,
register_biome = function (o)
local name = conf.name .. "-" .. o.name
local cfg = PyuTest.util.tablecopy(o)
cfg.node_stone = cfg.node_stone or conf.node_stone -- Defaults to nil
cfg.node_water = cfg.node_water or "air"
minetest.register_biome(PyuTest.util.tableconcat(cfg, {
name = name,
depth_top = 0,
depth_filler = 0,
y_max = conf.y_max,
y_min = conf.y_min,
node_river_water = cfg.node_water,
node_cave_liquid = cfg.node_water,
}))
return name
end,
register_ore = function (o)
minetest.register_ore(PyuTest.util.tableconcat(o, {
y_max = conf.y_max,
y_min = conf.y_min,
}))
end,
register_decoration = function (o)
minetest.register_decoration(PyuTest.util.tableconcat(o, {
y_max = conf.y_max,
y_min = conf.y_min
}))
end
}
end
IceWorld = PyuTest.register_world({
name = "ice_world",
y_max = -400,
y_min = -800
})
local icy_cavern = IceWorld.register_biome({
name = "icy_cave",
node_stone = "pyutest_core:ice_block",
heat_point = 14,
humidity_point = 0
})
IceWorld.register_ore({
ore_type = "blob",
ore = "pyutest_core:snow_block",
wherein = "pyutest_core:ice_block",
clust_scarcity = 3 * 3 * 3,
clust_num_ores = 35,
clust_size = 5,
biomes = {icy_cavern},
noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS
})
IceWorld.register_ore({
ore_type = "blob",
ore = "pyutest_core:crystal_lantern_block",
wherein = "pyutest_core:ice_block",
clust_scarcity = 5.5 * 5.5 * 5.5,
clust_num_ores = 6,
clust_size = 5,
biomes = {icy_cavern},
noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS
})
SlimeWorld = PyuTest.register_world({
name = "slime_world",
y_max = -1400,
y_min = -1800
})
local slimey_cavern = SlimeWorld.register_biome({
name = "slimey_cavern",
node_stone = "pyutest_core:slime_block",
heat_point = 45,
humidity_point = 0
})
SlimeWorld.register_ore({
ore_type = "blob",
ore = "pyutest_core:glowslime_block",
wherein = "pyutest_core:slime_block",
clust_scarcity = 4 * 4 * 4,
clust_num_ores = 6,
clust_size = 5,
biomes = {slimey_cavern},
noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS
})
LavaWorld = PyuTest.register_world({
name = "lava_world",
y_max = -2000,
y_min = -2400
})
local lava_cavern = LavaWorld.register_biome({
name = "lava_cavern",
node_stone = "pyutest_core:molten_rock_block",
heat_point = 100,
humidity_point = 0,
})
LavaWorld.register_ore({
ore_type = "blob",
ore = "pyutest_core:magma",
wherein = "pyutest_core:molten_rock_block",
clust_scarcity = 4.5 * 4.5 * 4.5,
clust_num_ores = 6,
clust_size = 5,
biomes = {lava_cavern},
noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS
})
LavaWorld.register_decoration({
deco_type = "simple",
sidelen = 16,
fill_ratio = 0.00063,
decoration = {"pyutest_core:lava_source"},
place_on = {"pyutest_core:molten_rock_block", "pyutest_core:magma"},
biomes = {lava_cavern},
flags = "all_ceilings"
})