Clean up code style.

master
vlapsley 2016-12-08 16:40:30 +11:00
parent 20b6954776
commit 26b3bb3483
16 changed files with 777 additions and 785 deletions

View File

@ -1,4 +1,4 @@
-- mods/australia/biome_australian_alps.lua
-- mods/australia_modpack/australia/biome_australian_alps.lua
-- localize math routines for performance
local math_random = math.random
@ -6,16 +6,11 @@ local math_random = math.random
-- australian alps
minetest.register_biome({
name = "australian_alps",
--node_dust = "default:snow",
node_top = "default:snowblock",
depth_top = 2,
node_filler = "default:dirt_with_snow",
depth_filler = 1,
node_stone = "default:stone",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 150,
y_max = 31000,
heat_point = 10,
@ -23,25 +18,24 @@ minetest.register_biome({
})
--
-- Ores
--
--[[
Ores
--]]
-- Blob ore first to avoid other ores inside blobs
-- Bluestone (Basalt)
minetest.register_ore({
ore_type = "blob",
ore = "australia:bluestone",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 8,
biomes = {"australian_alps"},
y_min = 150,
y_max = 222,
noise_threshold = 0.0,
noise_params = {
ore_type = "blob",
ore = "australia:bluestone",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 8,
biomes = {"australian_alps"},
y_min = 150,
y_max = 222,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
@ -52,11 +46,11 @@ minetest.register_ore({
})
--[[
Decorations
--]]
--
-- Decorations
--
-- Grass
local function register_grass_decoration(offset, scale, length)
minetest.register_decoration({
deco_type = "simple",
@ -77,7 +71,6 @@ local function register_grass_decoration(offset, scale, length)
})
end
-- Grasses
register_grass_decoration(0.015, 0.045, 2)
register_grass_decoration(0.03, 0.03, 1)
@ -94,9 +87,9 @@ minetest.register_decoration({
})
--
-- Trees
--
--[[
Trees
--]]
-- Snow Gum
aus.register_plant({
@ -112,7 +105,7 @@ aus.register_plant({
return pos.y >= 150 and pos.y <= 180 and table.contains({"australian_alps"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(2,4)
local height = math_random(2, 4)
local radius = 2
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,

View File

@ -1,4 +1,4 @@
-- mods/australia/biome_tasmania.lua
-- mods/australia_modpack/australia/biome_tasmania.lua
-- localize math routines for performance
local math_random = math.random
@ -6,16 +6,11 @@ local math_random = math.random
-- tasmania
minetest.register_biome({
name = "tasmania",
--node_dust = "",
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 3,
node_stone = "default:stone",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = 4,
y_max = 31000,
heat_point = 15,
@ -23,19 +18,18 @@ minetest.register_biome({
})
--
-- Ores
--
--[[
Ores
--]]
-- Blob ore first to avoid other ores inside blobs
--[[
Decorations
--]]
--
-- Decorations
--
-- Grass
local function register_grass_decoration(offset, scale, length)
minetest.register_decoration({
deco_type = "simple",
@ -56,7 +50,6 @@ local function register_grass_decoration(offset, scale, length)
})
end
-- Grasses
register_grass_decoration(-0.03, 0.09, 5)
register_grass_decoration(-0.015, 0.075, 4)
register_grass_decoration(0, 0.06, 3)
@ -75,6 +68,7 @@ local function register_rivergrass(length)
end,
})
end
register_rivergrass(5)
register_rivergrass(4)
@ -90,6 +84,7 @@ minetest.register_decoration({
decoration = "default:snow",
})
-- Small stone rocks
local function register_small_stone_rocks(number)
minetest.register_decoration({
deco_type = "simple",
@ -104,7 +99,6 @@ local function register_small_stone_rocks(number)
})
end
-- Small stone rocks
register_small_stone_rocks(6)
register_small_stone_rocks(5)
register_small_stone_rocks(4)
@ -113,9 +107,9 @@ register_small_stone_rocks(2)
register_small_stone_rocks(1)
--
-- Trees
--
--[[
Trees
--]]
-- Black Wattle
aus.register_plant({
@ -131,8 +125,8 @@ aus.register_plant({
return pos.y >= 5 and pos.y <= 50 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(9,15)
local radius = math_random(5,6)
local height = math_random(9, 15)
local radius = math_random(5, 6)
aus.make_black_wattle(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
@ -151,7 +145,7 @@ aus.register_plant({
return pos.y >= 51 and pos.y <= 125 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(6,8)
local height = math_random(6, 8)
local radius = 3
aus.make_black_wattle(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
@ -171,8 +165,8 @@ aus.register_plant({
return t.valleys > 0 and t.valleys < 0.3 and pos.y >= 5 and pos.y <= 40 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(12,22)
local radius = math_random(5,7)
local height = math_random(12, 22)
local radius = math_random(5, 7)
local limbs = true
aus.make_tall_gum(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -192,8 +186,8 @@ aus.register_plant({
return t.v4 > 0.5 and pos.y >= 5 and pos.y <= 40 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(12,22)
local radius = math_random(5,7)
local height = math_random(12, 22)
local radius = math_random(5, 7)
local limbs = true
aus.make_tall_gum(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -213,8 +207,8 @@ aus.register_plant({
return t.valleys > 0.3 and t.v4 > 0.4 and t.v4 < 0.6 and pos.y >= 40 and pos.y <= 80 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(8,10)
local radius = math_random(3,4)
local height = math_random(8, 10)
local radius = math_random(3, 4)
aus.make_conifer(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
@ -233,8 +227,8 @@ aus.register_plant({
return pos.y >= 5 and pos.y <= 39 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(8,10)
local radius = math_random(3,4)
local height = math_random(8, 10)
local radius = math_random(3, 4)
aus.make_conifer(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
@ -253,8 +247,8 @@ aus.register_plant({
return pos.y >= 81 and pos.y <= 120 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(8,10)
local radius = math_random(3,4)
local height = math_random(8, 10)
local radius = math_random(3, 4)
aus.make_conifer(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
@ -273,8 +267,8 @@ aus.register_plant({
return t.v2 > 0 and t.v2 < 0.05 and pos.y >= 5 and pos.y <= 15 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(8,13)
local radius = math_random(5,6)
local height = math_random(8, 13)
local radius = math_random(5, 6)
local limbs = true
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -294,8 +288,8 @@ aus.register_plant({
return t.v4 > 0.6 and pos.y >= 5 and pos.y <= 90 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(8,13)
local radius = math_random(5,6)
local height = math_random(8, 13)
local radius = math_random(5, 6)
local limbs = true
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -315,8 +309,8 @@ aus.register_plant({
return t.v2 > 0 and t.v2 < 0.05 and pos.y >= 5 and pos.y <= 80 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(8,13)
local radius = math_random(6,8)
local height = math_random(8, 13)
local radius = math_random(6, 8)
aus.make_conifer(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
@ -335,8 +329,8 @@ aus.register_plant({
return t.valleys > 0 and t.valleys < 0.3 and pos.y >= 5 and pos.y <= 80 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(8,13)
local radius = math_random(6,8)
local height = math_random(8, 13)
local radius = math_random(6, 8)
aus.make_conifer(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
@ -355,8 +349,8 @@ aus.register_plant({
return t.valleys > 0.3 and t.v4 > 0.6 and pos.y >= 35 and pos.y <= 50 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(30,40)
local radius = math_random(8,10)
local height = math_random(30, 40)
local radius = math_random(8, 10)
local limbs = true
aus.make_swamp_gum(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -376,8 +370,8 @@ aus.register_plant({
return t.v3 > 0.5 and t.v4 < 0.5 and pos.y >= 5 and pos.y <= 30 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(15,20)
local radius = math_random(7,9)
local height = math_random(15, 20)
local radius = math_random(7, 9)
local limbs = true
aus.make_tasmanian_myrtle(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -397,8 +391,8 @@ aus.register_plant({
return pos.y >= 31 and pos.y <= 100 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(15,20)
local radius = math_random(7,9)
local height = math_random(15, 20)
local radius = math_random(7, 9)
local limbs = true
aus.make_tasmanian_myrtle(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -418,8 +412,8 @@ aus.register_plant({
return pos.y >= 101 and pos.y <= 157 and table.contains({"tasmania"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(10,14)
local radius = math_random(5,6)
local height = math_random(10, 14)
local radius = math_random(5, 6)
local limbs = true
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,

View File

@ -1,4 +1,4 @@
-- mods/australia/biome_timor_sea.lua
-- mods/australia_modpack/australia/biome_timor_sea.lua
-- localize math routines for performance
local math_random = math.random
@ -6,16 +6,12 @@ local math_random = math.random
-- timor sea
minetest.register_biome({
name = "timor_sea",
--node_dust = "",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
node_stone = "default:stone",
--node_water_top = "",
--depth_water_top = ,
node_water = "default:water_source",
--node_river_water = "",
y_min = -192,
y_max = 3,
heat_point = 80,
@ -23,30 +19,28 @@ minetest.register_biome({
})
--
-- Ores
--
--[[
Ores
--]]
-- Blob ore first to avoid other ores inside blobs
minetest.register_ore({
ore_type = "scatter",
ore = "australia:submarine",
wherein = "default:sand",
clust_scarcity = 80*80*80,
clust_num_ores = 1,
clust_size = 12,
biomes = {"timor_sea"},
y_min = -64,
y_max = -8,
ore_type = "scatter",
ore = "australia:submarine",
wherein = "default:sand",
clust_scarcity = 80*80*80,
clust_num_ores = 1,
clust_size = 12,
biomes = {"timor_sea"},
y_min = -64,
y_max = -8,
})
--
-- Decorations
--
--[[
Decorations
--]]
local function register_grass_decoration(offset, scale, length)
minetest.register_decoration({
@ -89,20 +83,18 @@ minetest.register_decoration({
})
--
-- Trees
--
--[[
Trees
--]]
-- placeholder for Palm Tree
-- awaiting fix for L-system lighting bug #3421
-- https://github.com/minetest/minetest/issues/3421
--
-- ABM'S
--
--[[
ABM's
--]]
local function place_submarine(pos)
minetest.add_node(pos, {name = "default:dirt"})

View File

@ -1,4 +1,4 @@
-- mods/australia/biome_top_end.lua
-- mods/australia_modpack/australia/biome_top_end.lua
-- localize math routines for performance
local math_random = math.random
@ -6,15 +6,11 @@ local math_random = math.random
-- top end
minetest.register_biome({
name = "top_end",
--node_dust = "",
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:sandstone",
depth_filler = 3,
node_stone = "default:stone",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
node_river_water = "australia:muddy_river_water_source",
y_min = 4,
y_max = 31000,
@ -23,25 +19,24 @@ minetest.register_biome({
})
--
-- Ores
--
--[[
Ores
--]]
-- Blob ore first to avoid other ores inside blobs
-- Copper
minetest.register_ore({
ore_type = "blob",
ore = "default:stone_with_copper",
wherein = {"default:stone"},
clust_scarcity = 44 * 44 * 44,
clust_size = 8,
biomes = {"top_end"},
y_min = -192,
y_max = 0,
noise_threshold = 1,
noise_params = {
ore_type = "blob",
ore = "default:stone_with_copper",
wherein = {"default:stone"},
clust_scarcity = 44 * 44 * 44,
clust_size = 8,
biomes = {"top_end"},
y_min = -192,
y_max = 0,
noise_threshold = 1,
noise_params = {
offset = 0,
scale = 3,
spread = {x = 16, y = 16, z = 16},
@ -53,31 +48,31 @@ minetest.register_ore({
-- Diamond
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_diamond",
wherein = "default:stone",
clust_scarcity = 40 * 40 * 40,
clust_num_ores = 12,
clust_size = 4,
biomes = {"top_end"},
y_min = -60,
y_max = 17,
ore_type = "scatter",
ore = "default:stone_with_diamond",
wherein = "default:stone",
clust_scarcity = 40 * 40 * 40,
clust_num_ores = 12,
clust_size = 4,
biomes = {"top_end"},
y_min = -60,
y_max = 17,
})
-- Uranium from Technic modpack: technic_worldgen mod
-- Ranger
if minetest.get_modpath("technic_worldgen") then
minetest.register_ore({
ore_type = "scatter",
ore = "technic:mineral_uranium",
wherein = "default:stone",
clust_scarcity = 28 * 28 * 28,
clust_num_ores = 4,
clust_size = 3,
biomes = {"top_end"},
y_min = -192,
y_max = 19,
noise_params = {
ore_type = "scatter",
ore = "technic:mineral_uranium",
wherein = "default:stone",
clust_scarcity = 28 * 28 * 28,
clust_num_ores = 4,
clust_size = 3,
biomes = {"top_end"},
y_min = -192,
y_max = 19,
noise_params = {
offset = 0,
scale = 1,
spread = {x = 100, y = 100, z = 100},
@ -93,16 +88,16 @@ end
-- Jabiluka
if minetest.get_modpath("technic_worldgen") then
minetest.register_ore({
ore_type = "scatter",
ore = "technic:mineral_uranium",
wherein = "default:stone",
clust_scarcity = 26 * 26 * 26,
clust_num_ores = 4,
clust_size = 3,
biomes = {"top_end"},
y_min = -192,
y_max = 6,
noise_params = {
ore_type = "scatter",
ore = "technic:mineral_uranium",
wherein = "default:stone",
clust_scarcity = 26 * 26 * 26,
clust_num_ores = 4,
clust_size = 3,
biomes = {"top_end"},
y_min = -192,
y_max = 6,
noise_params = {
offset = 0,
scale = 1,
spread = {x = 100, y = 100, z = 100},
@ -115,11 +110,11 @@ if minetest.get_modpath("technic_worldgen") then
end
--[[
Decorations
--]]
--
-- Decorations
--
-- Grass
local function register_grass_decoration(offset, scale, length)
minetest.register_decoration({
deco_type = "simple",
@ -160,12 +155,12 @@ local function register_dry_grass_decoration(offset, scale, length)
})
end
-- Grasses
register_grass_decoration(-0.03, 0.09, 5)
register_grass_decoration(-0.015, 0.075, 4)
register_grass_decoration(0, 0.06, 3)
register_grass_decoration(0.015, 0.045, 2)
register_grass_decoration(0.03, 0.03, 1)
register_dry_grass_decoration(0.01, 0.05, 5)
register_dry_grass_decoration(0.03, 0.03, 4)
register_dry_grass_decoration(0.05, 0.01, 3)
@ -184,6 +179,7 @@ local function register_rivergrass(length)
end,
})
end
register_rivergrass(5)
register_rivergrass(4)
@ -221,6 +217,7 @@ aus.register_plant({
end,
})
-- Small sandstone rocks
local function register_small_sandstone_rocks(number)
minetest.register_decoration({
deco_type = "simple",
@ -235,7 +232,6 @@ local function register_small_sandstone_rocks(number)
})
end
-- Small sandstone rocks
register_small_sandstone_rocks(6)
register_small_sandstone_rocks(5)
register_small_sandstone_rocks(4)
@ -244,9 +240,9 @@ register_small_sandstone_rocks(2)
register_small_sandstone_rocks(1)
--
-- Trees
--
--[[
Trees
--]]
-- Arnhem Cypress Pine
aus.register_plant({
@ -262,7 +258,7 @@ aus.register_plant({
return pos.y >= 10 and pos.y <= 20 and table.contains({"top_end"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(10,15)
local height = math_random(10, 15)
local radius = 4
aus.make_conifer(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
@ -282,7 +278,7 @@ aus.register_plant({
return pos.y >= 21 and pos.y <= 90 and table.contains({"top_end"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(10,15)
local height = math_random(10, 15)
local radius = 4
aus.make_conifer(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
@ -302,8 +298,8 @@ aus.register_plant({
return pos.y >= 5 and pos.y <= 30 and table.contains({"top_end"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(5,6)
local radius = math_random(4,5)
local height = math_random(5, 6)
local radius = math_random(4, 5)
local limbs = true
aus.make_boab(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -323,8 +319,8 @@ aus.register_plant({
return pos.y >= 5 and pos.y <= 10 and table.contains({"top_end"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(8,13)
local radius = math_random(4,5)
local height = math_random(8, 13)
local radius = math_random(4, 5)
local limbs = true
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -344,8 +340,8 @@ aus.register_plant({
return pos.y >= 11 and pos.y <= 35 and table.contains({"top_end"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(8,13)
local radius = math_random(4,5)
local height = math_random(8, 13)
local radius = math_random(4, 5)
local limbs = true
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -365,8 +361,8 @@ aus.register_plant({
return t.v2 > 0 and t.v2 < 0.03 and pos.y >= 5 and pos.y <= 120 and table.contains({"top_end"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(5,6)
local radius = math_random(2,3)
local height = math_random(5, 6)
local radius = math_random(2, 3)
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
@ -385,8 +381,8 @@ aus.register_plant({
return t.v2 > 0.05 and t.v2 < 0.2 and t.v4 > 0.5 and pos.y >= 5 and pos.y <= 20 and table.contains({"top_end"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(6,8)
local radius = math_random(3,4)
local height = math_random(6, 8)
local radius = math_random(3, 4)
local limbs = true
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,

View File

@ -1,21 +1,9 @@
-- mods/australia/biome_underground.lua
-- localize math routines for performance
local math_random = math.random
-- mods/australia_modpack/australia/biome_underground.lua
-- underground
minetest.register_biome({
name = "underground",
--node_dust = "",
--node_top = "",
--depth_top = ,
--node_filler = "",
--depth_filler = ,
node_stone = "default:stone",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
--node_river_water = "",
y_min = -31000,
y_max = -193,
heat_point = 50,
@ -23,25 +11,24 @@ minetest.register_biome({
})
--
-- Ores
--
--[[
Ores
--]]
-- Blob ore first to avoid other ores inside blobs
-- Bluestone (Basalt)
minetest.register_ore({
ore_type = "blob",
ore = "australia:bluestone",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 8,
biomes = {"underground"},
y_min = -31000,
y_max = -193,
noise_threshold = 0.0,
noise_params = {
ore_type = "blob",
ore = "australia:bluestone",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 8,
biomes = {"underground"},
y_min = -31000,
y_max = -193,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},

View File

@ -1,4 +1,4 @@
-- mods/australia/biome_victorian_forests.lua
-- mods/australia_modpack/australia/biome_victorian_forests.lua
-- localize math routines for performance
local math_random = math.random
@ -6,15 +6,11 @@ local math_random = math.random
-- victorian forests
minetest.register_biome({
name = "victorian_forests",
--node_dust = "",
node_top = "default:dirt_with_grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 3,
node_stone = "default:stone",
--node_water_top = "",
--depth_water_top = ,
--node_water = "",
node_river_water = "australia:muddy_river_water_source",
y_min = 4,
y_max = 31000,
@ -23,25 +19,24 @@ minetest.register_biome({
})
--
-- Ores
--
--[[
Ores
--]]
-- Blob ore first to avoid other ores inside blobs
-- Bluestone (Basalt)
minetest.register_ore({
ore_type = "blob",
ore = "australia:bluestone",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 8,
biomes = {"victorian_forests"},
y_min = -192,
y_max = 222,
noise_threshold = 0.0,
noise_params = {
ore_type = "blob",
ore = "australia:bluestone",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 8,
biomes = {"victorian_forests"},
y_min = -192,
y_max = 222,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
@ -53,15 +48,15 @@ minetest.register_ore({
-- Gold
minetest.register_ore({
ore_type = "vein",
ore = "default:stone_with_gold",
wherein = {"default:stone"},
biomes = {"victorian_forests"},
y_min = -192,
y_max = 44,
random_factor = 0.23,
noise_threshold = 0.97,
noise_params = {
ore_type = "vein",
ore = "default:stone_with_gold",
wherein = {"default:stone"},
biomes = {"victorian_forests"},
y_min = -192,
y_max = 44,
random_factor = 0.23,
noise_threshold = 0.97,
noise_params = {
offset = 0,
scale = 3,
spread = {x = 73, y = 251, z = 73},
@ -95,11 +90,11 @@ minetest.register_ore({
})
--[[
Decorations
--]]
--
-- Decorations
--
-- Grass
local function register_grass_decoration(offset, scale, length)
minetest.register_decoration({
deco_type = "simple",
@ -120,7 +115,6 @@ local function register_grass_decoration(offset, scale, length)
})
end
-- Grasses
register_grass_decoration(-0.03, 0.09, 5)
register_grass_decoration(-0.015, 0.075, 4)
register_grass_decoration(0, 0.06, 3)
@ -139,6 +133,7 @@ local function register_rivergrass(length)
end,
})
end
register_rivergrass(5)
register_rivergrass(4)
@ -154,6 +149,7 @@ minetest.register_decoration({
decoration = "default:snow",
})
-- Small stone rocks
local function register_small_stone_rocks(number)
minetest.register_decoration({
deco_type = "simple",
@ -168,7 +164,6 @@ local function register_small_stone_rocks(number)
})
end
-- Small stone rocks
register_small_stone_rocks(6)
register_small_stone_rocks(5)
register_small_stone_rocks(4)
@ -177,9 +172,9 @@ register_small_stone_rocks(2)
register_small_stone_rocks(1)
--
-- Trees
--
--[[
Trees
--]]
-- Black Wattle
aus.register_plant({
@ -195,8 +190,8 @@ aus.register_plant({
return t.valleys > 0.3 and pos.y >= 5 and pos.y <= 40 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(9,15)
local radius = math_random(5,6)
local height = math_random(9, 15)
local radius = math_random(5, 6)
aus.make_black_wattle(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
@ -215,8 +210,8 @@ aus.register_plant({
return t.v4 < 0.5 and pos.y >= 5 and pos.y <= 40 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(9,15)
local radius = math_random(5,6)
local height = math_random(9, 15)
local radius = math_random(5, 6)
aus.make_black_wattle(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
@ -235,7 +230,7 @@ aus.register_plant({
return pos.y >= 41 and pos.y <= 125 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(6,8)
local height = math_random(6, 8)
local radius = 3
aus.make_black_wattle(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
@ -255,8 +250,8 @@ aus.register_plant({
return t.valleys > 0 and t.valleys < 0.3 and pos.y >= 5 and pos.y <= 40 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(12,22)
local radius = math_random(5,7)
local height = math_random(12, 22)
local radius = math_random(5, 7)
local limbs = true
aus.make_tall_gum(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -276,8 +271,8 @@ aus.register_plant({
return t.v4 > 0.5 and pos.y >= 5 and pos.y <= 40 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(12,22)
local radius = math_random(5,7)
local height = math_random(12, 22)
local radius = math_random(5, 7)
local limbs = true
aus.make_tall_gum(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -297,8 +292,8 @@ aus.register_plant({
return t.v2 > 0 and t.v2 < 0.02 and pos.y >= 5 and pos.y <= 60 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(7,10)
local radius = math_random(4,5)
local height = math_random(7, 10)
local radius = math_random(4, 5)
local limbs = true
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -318,7 +313,7 @@ aus.register_plant({
return t.v4 < 0.5 and pos.y >= 5 and pos.y <= 150 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(3,4)
local height = math_random(3, 4)
local radius = 2
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
@ -338,7 +333,7 @@ aus.register_plant({
return t.valleys > 0.3 and pos.y >= 5 and pos.y <= 150 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(3,4)
local height = math_random(3, 4)
local radius = 2
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
@ -359,8 +354,8 @@ aus.register_plant({
return pos.y >= 5 and pos.y <= 60 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(4,6)
local radius = math_random(4,6)
local height = math_random(4, 6)
local radius = math_random(4, 6)
local limbs = nil
local fruit_chance = 0.3
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs, fruit_chance, nodes.fruit)
@ -381,8 +376,8 @@ aus.register_plant({
return t.v2 > 0 and t.v2 < 0.02 and pos.y >= 5 and pos.y <= 100 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(2,3)
local radius = math_random(2,3)
local height = math_random(2, 3)
local radius = math_random(2, 3)
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
})
@ -401,8 +396,8 @@ aus.register_plant({
return t.v2 > 0 and t.v2 < 0.03 and pos.y >= 5 and pos.y <= 72 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(12,18)
local radius = math_random(6,8)
local height = math_random(12, 18)
local radius = math_random(6, 8)
local limbs = true
aus.make_river_red_gum(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -422,7 +417,7 @@ aus.register_plant({
return pos.y >= 130 and pos.y <= 180 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(2,4)
local height = math_random(2, 4)
local radius = 2
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore)
end,
@ -442,8 +437,8 @@ aus.register_plant({
return t.valleys > 0 and t.valleys < 0.3 and t.v4 > 0.6 and pos.y >= 45 and pos.y <= 64 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(30,40)
local radius = math_random(8,10)
local height = math_random(30, 40)
local radius = math_random(8, 10)
local limbs = true
aus.make_swamp_gum(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -463,8 +458,8 @@ aus.register_plant({
return t.valleys > 0.3 and t.v4 < 0.5 and pos.y >= 5 and pos.y <= 40 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(7,12)
local radius = math_random(6,8)
local height = math_random(7, 12)
local radius = math_random(6, 8)
local limbs = true
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,
@ -484,8 +479,8 @@ aus.register_plant({
return t.valleys > 0.3 and pos.y >= 41 and pos.y <= 145 and table.contains({"victorian_forests"}, t.biome)
end,
grow = function(nodes, pos, data, area)
local height = math_random(7,12)
local radius = math_random(6,8)
local height = math_random(7, 12)
local radius = math_random(6, 8)
local limbs = true
aus.make_tree(pos, data, area, height, radius, nodes.trunk, nodes.leaves, nodes.air, nodes.ignore, limbs)
end,

View File

@ -1,5 +1,36 @@
-- mods/australia/crafting.lua
-- mods/australia_modpack/australia/crafting.lua
minetest.register_craft({
output = "australia:red_stonebrick 4",
recipe = {
{"australia:red_stone", "australia:red_stone"},
{"australia:red_stone", "australia:red_stone"},
}
})
minetest.register_craft({
output = "australia:bluestone_brick 4",
recipe = {
{"australia:bluestone", "australia:bluestone"},
{"australia:bluestone", "australia:bluestone"},
}
})
minetest.register_craft({
output = "australia:salt_block",
recipe = {
{"australia:salt", "australia:salt", "australia:salt"},
{"australia:salt", "australia:salt", "australia:salt"},
{"australia:salt", "australia:salt", "australia:salt"},
}
})
minetest.register_craft({
output = "australia:salt 9",
recipe = {
{"australia:salt_block"},
}
})
-- Small rocks can be used to create cobblestone.
minetest.register_craft({
@ -29,41 +60,10 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'australia:red_stonebrick 4',
recipe = {
{'australia:red_stone', 'australia:red_stone'},
{'australia:red_stone', 'australia:red_stone'},
}
})
minetest.register_craft({
output = 'australia:bluestone_brick 4',
recipe = {
{'australia:bluestone', 'australia:bluestone'},
{'australia:bluestone', 'australia:bluestone'},
}
})
minetest.register_craft({
output = 'australia:salt_block',
recipe = {
{'australia:salt', 'australia:salt', 'australia:salt'},
{'australia:salt', 'australia:salt', 'australia:salt'},
{'australia:salt', 'australia:salt', 'australia:salt'},
}
})
minetest.register_craft({
output = 'australia:salt 9',
recipe = {
{'australia:salt_block'},
}
})
--
-- Fences
--
--[[
Fences
--]]
-- Eucalyptus Wood
minetest.register_craft({
@ -192,10 +192,9 @@ minetest.register_craft({
})
--
-- Timber
--
--[[
Timber
--]]
-- Arnhem Cypress Pine
minetest.register_craft({
@ -470,10 +469,9 @@ minetest.register_craft({
})
--
-- Cooking recipes
--
--[[
Cooking recipes
--]]
minetest.register_craft({
type = "cooking",
@ -486,4 +484,3 @@ minetest.register_craft({
output = "australia:red_stone",
recipe = "australia:red_cobble",
})

View File

@ -1,4 +1,4 @@
-- mods/australia/craftitems.lua
-- mods/australia_modpack/australia/craftitems.lua
-- Bucket muddy_water
bucket.register_liquid(
@ -11,17 +11,16 @@ bucket.register_liquid(
)
--
-- Stairs and slabs
--
--[[
Stairs and slabs
--]]
-- Eucalyptus Wood
stairs.register_stair_and_slab(
"aus_eucalyptus_wood",
"australia:eucalyptus_wood",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"aus_eucalyptus_wood.png" },
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"aus_eucalyptus_wood.png"},
"Eucalyptus Wood Stair",
"Eucalyptus Wood Slab",
default.node_sound_wood_defaults()
@ -31,8 +30,8 @@ stairs.register_stair_and_slab(
stairs.register_stair_and_slab(
"aus_blackwood",
"australia:blackwood",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"aus_blackwood.png" },
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"aus_blackwood.png"},
"Blackwood Stair",
"Blackwood Slab",
default.node_sound_wood_defaults()
@ -42,8 +41,8 @@ stairs.register_stair_and_slab(
stairs.register_stair_and_slab(
"aus_blue_gum",
"australia:blue_gum",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"aus_blue_gum.png" },
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"aus_blue_gum.png"},
"Blue Gum Stair",
"Blue Gum Slab",
default.node_sound_wood_defaults()
@ -53,8 +52,8 @@ stairs.register_stair_and_slab(
stairs.register_stair_and_slab(
"aus_celery_top_pine",
"australia:celery_top_pine",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"aus_celery_top_pine.png" },
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"aus_celery_top_pine.png"},
"Celery-top Pine Stair",
"Celery-top Pine Slab",
default.node_sound_wood_defaults()
@ -64,8 +63,8 @@ stairs.register_stair_and_slab(
stairs.register_stair_and_slab(
"aus_red_mahogany",
"australia:red_mahogany",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"aus_red_mahogany.png" },
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"aus_red_mahogany.png"},
"Red Mahogany Stair",
"Red Mahogany Slab",
default.node_sound_wood_defaults()
@ -75,8 +74,8 @@ stairs.register_stair_and_slab(
stairs.register_stair_and_slab(
"aus_huon_pine",
"australia:huon_pine",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"aus_huon_pine.png" },
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"aus_huon_pine.png"},
"Huon Pine Stair",
"Huon Pine Slab",
default.node_sound_wood_defaults()
@ -86,8 +85,8 @@ stairs.register_stair_and_slab(
stairs.register_stair_and_slab(
"aus_jarrah",
"australia:jarrah",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"aus_jarrah.png" },
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"aus_jarrah.png"},
"Jarrah Stair",
"Jarrah Slab",
default.node_sound_wood_defaults()
@ -97,8 +96,8 @@ stairs.register_stair_and_slab(
stairs.register_stair_and_slab(
"aus_karri",
"australia:karri",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"aus_karri.png" },
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"aus_karri.png"},
"Karri Stair",
"Karri Slab",
default.node_sound_wood_defaults()
@ -108,8 +107,8 @@ stairs.register_stair_and_slab(
stairs.register_stair_and_slab(
"aus_marri",
"australia:marri",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"aus_marri.png" },
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"aus_marri.png"},
"Marri Stair",
"Marri Slab",
default.node_sound_wood_defaults()
@ -119,8 +118,8 @@ stairs.register_stair_and_slab(
stairs.register_stair_and_slab(
"aus_merbau",
"australia:merbau",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"aus_merbau.png" },
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"aus_merbau.png"},
"Merbau Stair",
"Merbau Slab",
default.node_sound_wood_defaults()
@ -130,8 +129,8 @@ stairs.register_stair_and_slab(
stairs.register_stair_and_slab(
"aus_red_gum",
"australia:red_gum",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"aus_red_gum.png" },
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"aus_red_gum.png"},
"Red Gum Stair",
"Red Gum Slab",
default.node_sound_wood_defaults()
@ -141,8 +140,8 @@ stairs.register_stair_and_slab(
stairs.register_stair_and_slab(
"aus_southern_sassafras",
"australia:southern_sassafras",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"aus_southern_sassafras.png" },
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"aus_southern_sassafras.png"},
"Southern Sassafras Stair",
"Southern Sassafras Slab",
default.node_sound_wood_defaults()
@ -152,8 +151,8 @@ stairs.register_stair_and_slab(
stairs.register_stair_and_slab(
"aus_tasmanian_oak",
"australia:tasmanian_oak",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"aus_tasmanian_oak.png" },
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"aus_tasmanian_oak.png"},
"Tasmanian Oak Stair",
"Tasmanian Oak Slab",
default.node_sound_wood_defaults()
@ -163,8 +162,8 @@ stairs.register_stair_and_slab(
stairs.register_stair_and_slab(
"aus_tasmanian_myrtle",
"australia:tasmanian_myrtle",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"aus_tasmanian_myrtle.png" },
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"aus_tasmanian_myrtle.png"},
"Tasmanian Myrtle Stair",
"Tasmanian Myrtle Slab",
default.node_sound_wood_defaults()

View File

@ -1,15 +1,15 @@
-- mods/australia/functions.lua
-- mods/australia_modpack/australia/functions.lua
-- Create and initialize a table for a schematic.
function aus.schematic_array(width, height, depth)
-- Dimensions of data array.
local s = {size={x=width, y=height, z=depth}}
local s = {size = {x = width, y = height, z = depth}}
s.data = {}
for z = 0,depth-1 do
for y = 0,height-1 do
for x = 0,width-1 do
local i = z*width*height + y*width + x + 1
for z = 0, depth - 1 do
for y = 0, height - 1 do
for x = 0, width - 1 do
local i = z * width * height + y * width + x + 1
s.data[i] = {}
s.data[i].name = "air"
s.data[i].param1 = 000
@ -38,65 +38,67 @@ function table.contains(table, element)
end
end
end
return false
end
-- Round a number to the given decimal places
function math.round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
local mult = 10 ^ (idp or 0)
return math.floor(num * mult + 0.5) / mult
end
function displaytime(time)
return math.floor(time * 1000000 + 0.5) / 1000 .. " ms"
end
--
-- Convert dirt with dry grass to dirt with dry graan grass when next to dirt with grass
--
--[[
Convert dirt with dry grass to dirt with dry graan grass when next to dirt with grass.
--]]
minetest.register_abm({
nodenames = {"default:dirt_with_grass"},
neighbors = {
"default:dirt_with_dry_grass",
},
interval = 6,
chance = 67,
catch_up = false,
action = function(pos, node)
-- Most likely case, half the time it's too dark for this.
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
if (minetest.get_node_light(above) or 0) < 13 then
return
end
nodenames = {"default:dirt_with_grass"},
neighbors = {
"default:dirt_with_dry_grass",
},
interval = 6,
chance = 67,
catch_up = false,
action = function(pos, node)
-- Most likely case, half the time it's too dark for this.
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
if (minetest.get_node_light(above) or 0) < 13 then
return
end
-- Look for likely neighbors.
local p2 = minetest.find_node_near(pos, 1, {"default:dirt_with_dry_grass"})
if p2 then
-- But the node needs to be under air in this case.
local n2 = minetest.get_node(above)
if n2 and n2.name == "air" then
minetest.set_node(pos, {name = "australia:dirt_with_dry_green_grass"})
return
end
end
-- Look for likely neighbors.
local p2 = minetest.find_node_near(pos, 1, {"default:dirt_with_dry_grass"})
if p2 then
-- But the node needs to be under air in this case.
local n2 = minetest.get_node(above)
if n2 and n2.name == "air" then
minetest.set_node(pos, {name = "australia:dirt_with_dry_green_grass"})
return
end
end
-- Anything on top?
local n2 = minetest.get_node(above)
if not n2 then
return
end
-- Anything on top?
local n2 = minetest.get_node(above)
if not n2 then
return
end
local name = n2.name
-- Snow check is cheapest, so comes first.
if name == "default:snow" then
minetest.set_node(pos, {name = "default:dirt_with_snow"})
-- Most likely case first.
elseif minetest.get_item_group(name, "grass") ~= 0 then
minetest.set_node(pos, {name = "default:dirt_with_grass"})
elseif minetest.get_item_group(name, "dry_grass") ~= 0 then
minetest.set_node(pos, {name = "default:dirt_with_dry_grass"})
end
end
local name = n2.name
-- Snow check is cheapest, so comes first.
if name == "default:snow" then
minetest.set_node(pos, {name = "default:dirt_with_snow"})
-- Most likely case first.
elseif minetest.get_item_group(name, "grass") ~= 0 then
minetest.set_node(pos, {name = "default:dirt_with_grass"})
elseif minetest.get_item_group(name, "dry_grass") ~= 0 then
minetest.set_node(pos, {name = "default:dirt_with_dry_grass"})
end
end
})

View File

@ -1,8 +1,10 @@
-- mods/australia/init.lua
-- mods/australia_modpack/australia/init.lua
-- MOD: Australia
-- See README.md for licensing and other information.
-- Designed for Minetest 0.4.14.
--[[
MOD: Australia
See README.md for licensing and other information.
Designed for Minetest 0.4.14.
--]]
-- Check for necessary mod functions and abort if they aren't available.
if not minetest.get_biome_id then
@ -14,28 +16,36 @@ if not minetest.get_biome_id then
return
end
-- Set mapgen parameters.
minetest.register_on_mapgen_init(function(mgparams)
minetest.set_mapgen_params({mgname = "valleys", water_level = 0,
flags = "caves,light,decorations,nodungeons"})
minetest.set_mapgen_params({
mgname = "valleys",
water_level = 0,
flags = "caves,light,decorations,nodungeons",
})
end)
-- Definitions made by this mod that other mods can use too
-- Definitions made by this mod that other mods can use too.
aus = {}
aus.path = minetest.get_modpath("australia")
aus.schematics = {}
-- Mapgen noise paramters
--[[
Mapgen noise parameters
If you change a value here also check and, if necessary,
change the corresponding value in voxel.lua
--]]
-- Noise parameters for biome API temperature, humidity and biome blend.
aus.mg_biome_np_heat = {offset = 50, scale = 50, seed = 5349,
spread = {x = 24, y = 24, z = 24}, octaves = 3, persist = 0.5, lacunarity = 2,}
spread = {x = 1024, y = 1024, z = 1024}, octaves = 3, persist = 0.5, lacunarity = 2,}
aus.mg_biome_np_heat_blend = {offset = 0, scale = 1.5, seed = 13,
spread = {x = 8, y = 8, z = 8}, octaves = 2, persist = 1, lacunarity = 2,}
aus.mg_biome_np_humidity = {offset = 50, scale = 50, seed = 842,
spread = {x = 24, y = 24, z = 24}, octaves = 3, persist = 0.5, lacunarity = 2,}
spread = {x = 1024, y = 1024, z = 1024}, octaves = 3, persist = 0.5, lacunarity = 2,}
aus.mg_biome_np_humidity_blend = {offset = 0, scale = 1.5, seed = 90003,
spread = {x = 8, y = 8, z = 8}, octaves = 2, persist = 1, lacunarity = 2,}
@ -80,7 +90,6 @@ aus.mgvalleys_np_valley_profile = {offset = 0.6, scale = 0.5, seed = 777,
aus.mgvalleys_np_inter_valley_slope = {offset = 0, scale = 1, seed = 746,
spread = {x = 256, y = 256, z = 256}, octaves = 3, persist = 0.5, lacunarity = 2,}
minetest.set_noiseparams("mg_biome_np_heat", aus.mg_biome_np_heat)
minetest.set_noiseparams("mg_biome_np_heat_blend", aus.mg_biome_np_heat_blend)
minetest.set_noiseparams("mg_biome_np_humidity", aus.mg_biome_np_humidity)
@ -96,7 +105,10 @@ minetest.set_noiseparams("mgvalleys_np_inter_valley_fill", aus.mgvalleys_np_inte
minetest.set_noiseparams("mgvalleys_np_valley_profile", aus.mgvalleys_np_valley_profile)
minetest.set_noiseparams("mgvalleys_np_inter_valley_slope", aus.mgvalleys_np_inter_valley_slope)
-- Mapgen settings
--[[
Mapgen settings
--]]
-- How deep to make rivers
minetest.setting_set("mgvalleys_river_depth", 5)
@ -105,6 +117,10 @@ minetest.setting_set("mgvalleys_river_depth", 5)
minetest.setting_set("mgvalleys_river_size", 4)
--[[
Biomes
--]]
-- Set the following variables to true to enable each biome
aus.biome_underground = true
aus.biome_mangroves = true
@ -128,12 +144,14 @@ aus.biome_pilbara = true
aus.biome_simpson_desert = true
aus.biome_australian_alps = true
aus.registered_on_first_mapgen = {}
function aus.register_on_first_mapgen(func) -- Callback
table.insert(aus.registered_on_first_mapgen, func)
end
-- Load files
dofile(aus.path .. "/functions.lua")
dofile(aus.path .. "/nodes.lua")

View File

@ -1,27 +1,27 @@
-- mods/australia/mapgen.lua
-- mods/australia_modpack/australia/mapgen.lua
minetest.clear_registered_biomes()
minetest.clear_registered_decorations()
minetest.clear_registered_ores()
--
-- Ores
--
--[[
Ores
--]]
-- Blob ore first to avoid other ores inside blobs
-- Clay
minetest.register_ore({
ore_type = "blob",
ore = "default:clay",
wherein = {"default:sand"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -15,
y_max = 2,
noise_threshold = 0.0,
noise_params = {
ore_type = "blob",
ore = "default:clay",
wherein = {"default:sand"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -15,
y_max = 2,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
@ -33,15 +33,15 @@ minetest.register_ore({
-- Sand
minetest.register_ore({
ore_type = "blob",
ore = "default:sand",
wherein = {"default:stone", "default:sandstone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31,
y_max = 4,
noise_threshold = 0.0,
noise_params = {
ore_type = "blob",
ore = "default:sand",
wherein = {"default:stone", "default:sandstone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31,
y_max = 4,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
@ -53,15 +53,15 @@ minetest.register_ore({
-- Dirt
minetest.register_ore({
ore_type = "blob",
ore = "default:dirt",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31,
y_max = 31000,
noise_threshold = 0.0,
noise_params = {
ore_type = "blob",
ore = "default:dirt",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31,
y_max = 31000,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
@ -73,15 +73,15 @@ minetest.register_ore({
-- Gravel
minetest.register_ore({
ore_type = "blob",
ore = "default:gravel",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31000,
y_max = 31000,
noise_threshold = 0.0,
noise_params = {
ore_type = "blob",
ore = "default:gravel",
wherein = {"default:stone"},
clust_scarcity = 16 * 16 * 16,
clust_size = 5,
y_min = -31000,
y_max = 31000,
noise_threshold = 0.0,
noise_params = {
offset = 0.5,
scale = 0.2,
spread = {x = 5, y = 5, z = 5},
@ -93,180 +93,179 @@ minetest.register_ore({
-- Coal
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_coal",
wherein = "default:stone",
clust_scarcity = 8 * 8 * 8,
clust_num_ores = 8,
clust_size = 3,
y_min = -31000,
y_max = 64,
ore_type = "scatter",
ore = "default:stone_with_coal",
wherein = "default:stone",
clust_scarcity = 8 * 8 * 8,
clust_num_ores = 8,
clust_size = 3,
y_min = -31000,
y_max = 64,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_coal",
wherein = "default:stone",
clust_scarcity = 24 * 24 * 24,
clust_num_ores = 27,
clust_size = 6,
y_min = -31000,
y_max = 0,
ore_type = "scatter",
ore = "default:stone_with_coal",
wherein = "default:stone",
clust_scarcity = 24 * 24 * 24,
clust_num_ores = 27,
clust_size = 6,
y_min = -31000,
y_max = 0,
})
-- Iron
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 12 * 12 * 12,
clust_num_ores = 3,
clust_size = 2,
y_min = -15,
y_max = 2,
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 12 * 12 * 12,
clust_num_ores = 3,
clust_size = 2,
y_min = -15,
y_max = 2,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 9 * 9 * 9,
clust_num_ores = 5,
clust_size = 3,
y_min = -192,
y_max = -16,
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 9 * 9 * 9,
clust_num_ores = 5,
clust_size = 3,
y_min = -192,
y_max = -16,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 7 * 7 * 7,
clust_num_ores = 5,
clust_size = 3,
y_min = -31000,
y_max = -193,
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 7 * 7 * 7,
clust_num_ores = 5,
clust_size = 3,
y_min = -31000,
y_max = -193,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 24 * 24 * 24,
clust_num_ores = 27,
clust_size = 6,
y_min = -31000,
y_max = -193,
ore_type = "scatter",
ore = "default:stone_with_iron",
wherein = "default:stone",
clust_scarcity = 24 * 24 * 24,
clust_num_ores = 27,
clust_size = 6,
y_min = -31000,
y_max = -193,
})
--Mese
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_mese",
wherein = "default:stone",
clust_scarcity = 18 * 18 * 18,
clust_num_ores = 3,
clust_size = 2,
y_min = -255,
y_max = -193,
ore_type = "scatter",
ore = "default:stone_with_mese",
wherein = "default:stone",
clust_scarcity = 18 * 18 * 18,
clust_num_ores = 3,
clust_size = 2,
y_min = -255,
y_max = -193,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_mese",
wherein = "default:stone",
clust_scarcity = 14 * 14 * 14,
clust_num_ores = 5,
clust_size = 3,
y_min = -31000,
y_max = -256,
ore_type = "scatter",
ore = "default:stone_with_mese",
wherein = "default:stone",
clust_scarcity = 14 * 14 * 14,
clust_num_ores = 5,
clust_size = 3,
y_min = -31000,
y_max = -256,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:mese",
wherein = "default:stone",
clust_scarcity = 36 * 36 * 36,
clust_num_ores = 3,
clust_size = 2,
y_min = -31000,
y_max = -1024,
ore_type = "scatter",
ore = "default:mese",
wherein = "default:stone",
clust_scarcity = 36 * 36 * 36,
clust_num_ores = 3,
clust_size = 2,
y_min = -31000,
y_max = -1024,
})
-- Gold
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_gold",
wherein = "default:stone",
clust_scarcity = 15 * 15 * 15,
clust_num_ores = 3,
clust_size = 2,
y_min = -255,
y_max = -193,
ore_type = "scatter",
ore = "default:stone_with_gold",
wherein = "default:stone",
clust_scarcity = 15 * 15 * 15,
clust_num_ores = 3,
clust_size = 2,
y_min = -255,
y_max = -193,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_gold",
wherein = "default:stone",
clust_scarcity = 13 * 13 * 13,
clust_num_ores = 5,
clust_size = 3,
y_min = -31000,
y_max = -256,
ore_type = "scatter",
ore = "default:stone_with_gold",
wherein = "default:stone",
clust_scarcity = 13 * 13 * 13,
clust_num_ores = 5,
clust_size = 3,
y_min = -31000,
y_max = -256,
})
-- Diamond
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_diamond",
wherein = "default:stone",
clust_scarcity = 17 * 17 * 17,
clust_num_ores = 4,
clust_size = 3,
y_min = -512,
y_max = -256,
ore_type = "scatter",
ore = "default:stone_with_diamond",
wherein = "default:stone",
clust_scarcity = 17 * 17 * 17,
clust_num_ores = 4,
clust_size = 3,
y_min = -512,
y_max = -256,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_diamond",
wherein = "default:stone",
clust_scarcity = 15 * 15 * 15,
clust_num_ores = 4,
clust_size = 3,
y_min = -31000,
y_max = -513,
ore_type = "scatter",
ore = "default:stone_with_diamond",
wherein = "default:stone",
clust_scarcity = 15 * 15 * 15,
clust_num_ores = 4,
clust_size = 3,
y_min = -31000,
y_max = -513,
})
-- Copper
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_copper",
wherein = "default:stone",
clust_scarcity = 12 * 12 * 12,
clust_num_ores = 4,
clust_size = 3,
y_min = -192,
y_max = -16,
ore_type = "scatter",
ore = "default:stone_with_copper",
wherein = "default:stone",
clust_scarcity = 12 * 12 * 12,
clust_num_ores = 4,
clust_size = 3,
y_min = -192,
y_max = -16,
})
minetest.register_ore({
ore_type = "scatter",
ore = "default:stone_with_copper",
wherein = "default:stone",
clust_scarcity = 9 * 9 * 9,
clust_num_ores = 5,
clust_size = 3,
y_min = -31000,
y_max = -193,
ore_type = "scatter",
ore = "default:stone_with_copper",
wherein = "default:stone",
clust_scarcity = 9 * 9 * 9,
clust_num_ores = 5,
clust_size = 3,
y_min = -31000,
y_max = -193,
})
--
-- Biomes
--
--[[
Biomes
--]]
-- Underground
if aus.biome_underground then

View File

@ -1,28 +1,40 @@
--
-- noairblocks
--
-- Code modified from Duane Robertson's valleys_c mod
-- (https://github.com/duane-r/valleys_c).
--
-- Original code Copyright (C) 2012 Perttu Ahola <celeron55@gmail.com>
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License as published by the Free
-- Software Foundation; either version 2.1 of the License, or (at your option)
-- any later version.
--
-- This library is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
-- details.
--
-- You should have received a copy of the GNU Lesser General Public License
-- along with this library; if not, write to the Free Software Foundation, Inc.,
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-- mods/australia_modpack/australia/noairblocks.lua
--[[
Noairblocks
local water_nodes = {"default:water_source", "default:water_flowing", "default:river_water_source", "default:river_water_flowing"}
local aus_nodes = {"australia:water_source", "australia:water_flowing", "australia:river_water_source", "australia:river_water_flowing"}
Code modified from Duane Robertson's valleys_c mod
(https://github.com/duane-r/valleys_c).
Original code Copyright (C) 2012 Perttu Ahola <celeron55@gmail.com>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--]]
local water_nodes = {
"default:water_source",
"default:water_flowing",
"default:river_water_source",
"default:river_water_flowing",
}
local aus_nodes = {
"australia:water_source",
"australia:water_flowing",
"australia:river_water_source",
"australia:river_water_flowing",
}
for _, name in pairs(water_nodes) do
local water = table.copy(minetest.registered_nodes[name])
@ -37,7 +49,6 @@ for _, name in pairs(water_nodes) do
minetest.register_node(new_name, water)
end
local check_pos = {
{x=-1, y=0, z=0},
{x=1, y=0, z=0},
@ -54,16 +65,17 @@ minetest.register_abm({
action = function(pos)
for _,offset in pairs(check_pos) do
local check = vector.add(pos, offset)
local check_above = vector.add(check, {x=0,y=1,z=0})
if offset == {0,-1,0} or minetest.get_node(check_above).name ~= "air" then
local check_above = vector.add(check, {x = 0, y = 1, z = 0})
if offset == {0, -1, 0} or minetest.get_node(check_above).name ~= "air" then
local name = minetest.get_node(check).name
for node_num=1,#water_nodes do
for node_num = 1, #water_nodes do
if name == water_nodes[node_num] then
minetest.add_node(check, {name = aus_nodes[node_num]})
end
end
end
end
end,
})
@ -73,8 +85,9 @@ minetest.register_abm({
interval = 20,
chance = 1,
action = function(pos)
if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then
if minetest.get_node({x = pos.x, y = pos.y+1, z = pos.z}).name == "air" then
minetest.remove_node(pos)
end
end,
})

View File

@ -1,13 +1,14 @@
-- mods/australia_modpack/australia/plants_api.lua
aus.registered_plants = {}
-- localize math routines for performance
-- Localize math routines for performance
local math_floor = math.floor
local math_random = math.random
function aus.register_plant(params)
local n = #aus.registered_plants + 1
params.priority = math_floor(params.priority) + 1 / n
aus.registered_plants[n] = params
end
@ -32,27 +33,28 @@ aus.register_on_first_mapgen(function()
end
)
for _, plant in ipairs(aus.registered_plants) do -- convert 'nodes' into content IDs
for _, plant in ipairs(aus.registered_plants) do -- convert 'nodes' into content IDs
plant.nodes = get_content_id(plant.nodes)
end
end)
function aus.choose_generate_plant(conditions, pos, data, area, ivm)
local rand = math_random() -- Random number to choose the plant
for _, plant in ipairs(aus.registered_plants) do -- for each registered plant
local rand = math_random() -- Random number to choose the plant
for _, plant in ipairs(aus.registered_plants) do -- for each registered plant
local cover = plant.cover
if plant.check(conditions, pos) then -- Place this plant, or do not place anything (see Cover parameter)
if plant.check(conditions, pos) then -- Place this plant, or do not place anything (see Cover parameter)
if rand < cover then
if rand < plant.density then
local grow = plant.grow
local nodes = plant.nodes
if grow then -- if a grow function is defined, then run it
if grow then -- if a grow function is defined, then run it
grow(nodes, pos, data, area, ivm, conditions)
else
if type(nodes) == "number" then -- 'nodes' is just a number
if type(nodes) == "number" then -- 'nodes' is just a number
data[ivm] = nodes
else -- 'nodes' is an array
else -- 'nodes' is an array
local node = nodes[math_random(#nodes)]
local n = nodes.n or 1
local ystride = area.ystride
@ -70,4 +72,5 @@ function aus.choose_generate_plant(conditions, pos, data, area, ivm)
end
end
end
end

View File

@ -1,9 +1,10 @@
--
-- Grow trees from saplings
--
-- mods/australia_modpack/australia/saplings.lua
--[[
Grow trees from saplings
--]]
-- Sapling ABM
minetest.register_abm({
nodenames = {
"australia:arnhem_cypress_pine_sapling",
@ -54,7 +55,8 @@ minetest.register_abm({
"australia:tasmanian_myrtle_sapling",
"australia:tea_tree_sapling",
"australia:white_box_sapling",
"australia:wirewood_sapling"},
"australia:wirewood_sapling",
},
interval = 5,
chance = 90,
action = function(pos, node)

View File

@ -1,4 +1,4 @@
-- mods/australia/trees.lua
-- mods/australia_modpack/australia/trees.lua
-- Localize math routines for performance.
local math_abs = math.abs
@ -8,6 +8,7 @@ local math_max = math.max
local math_random = math.random
local math_sqrt = math.sqrt
-- Make a tree trunk 2-nodes wide.
local function make_treetrunk2(x0, y0, z0, data, area, height, trunk, air, base)
local ystride = area.ystride
local ybot = y0 - 1
@ -32,6 +33,7 @@ local function make_treetrunk2(x0, y0, z0, data, area, height, trunk, air, base)
end
end
-- Make a tree trunk 3-nodes wide.
local function make_treetrunk3(x0, y0, z0, data, area, height, trunk, air, base)
local ystride = area.ystride
local ybot = y0 - 1
@ -56,6 +58,7 @@ local function make_treetrunk3(x0, y0, z0, data, area, height, trunk, air, base)
end
end
-- Generic tree function.
function aus.make_tree(pos, data, area, height, radius, trunk, leaves, air,
ignore, limbs, fruit_chance, fruit)
local ystride = area.ystride -- Useful to get the index above
@ -64,8 +67,7 @@ function aus.make_tree(pos, data, area, height, radius, trunk, leaves, air,
data[iv] = trunk
iv = iv + ystride -- increment by one node up
end
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8},
octaves = 3, persist = 0.5}
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
pos.y = pos.y + height - 1
aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
{x = radius, y = radius, z = radius}, np, limbs, fruit_chance, fruit)
@ -80,8 +82,7 @@ function aus.make_black_box(pos, data, area, height, radius, trunk, leaves,
iv = iv + ystride -- increment by one node up
end
make_treetrunk2(pos.x, pos.y, pos.z, data, area, height, trunk, air, 0.5)
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8},
octaves = 3, persist = 0.5}
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
pos.y = pos.y + height - 1
aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
{x = radius, y = radius * 0.8, z = radius}, np, limbs)
@ -95,8 +96,7 @@ function aus.make_black_wattle(pos, data, area, height, radius, trunk, leaves,
data[iv] = trunk
iv = iv + ystride -- increment by one node up
end
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8},
octaves = 3, persist = 0.5}
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
pos.y = pos.y + height - 1
aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
{x = radius, y = radius * 1.5, z = radius}, np, limbs)
@ -111,8 +111,7 @@ function aus.make_tall_gum(pos, data, area, height, radius, trunk, leaves, air,
iv = iv + ystride -- increment by one node up
end
make_treetrunk2(pos.x, pos.y, pos.z, data, area, height, trunk, air, 0.2)
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8},
octaves = 3, persist = 0.5}
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
pos.y = pos.y + height - 1
aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
{x = radius, y = radius * 1.25, z = radius}, np, limbs)
@ -141,8 +140,7 @@ function aus.make_boab(pos, data, area, height, radius, trunk, leaves, air, igno
end
end
end
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8},
octaves = 3, persist = 0.5}
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
pos.y = pos.y + height - 1
aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
{x = radius, y = radius * 0.5, z = radius}, np, limbs)
@ -188,8 +186,7 @@ function aus.make_fan_palm(pos, data, area, height, radius, trunk, leaves, air,
data[iv] = trunk
iv = iv + ystride -- increment by one node up
end
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8},
octaves = 3, persist = 0.5}
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
pos.y = pos.y + height
aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
{x = radius, y = radius * 0.5, z = radius}, np)
@ -205,8 +202,7 @@ function aus.make_jarrah(pos, data, area, height, radius, trunk, leaves, air, ig
end
make_treetrunk2(pos.x, pos.y, pos.z, data, area, height, trunk, air, 0.8)
make_treetrunk3(pos.x, pos.y, pos.z, data, area, height, trunk, air, 0.4)
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8},
octaves = 3, persist = 0.5}
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
pos.y = pos.y + height
aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
{x = radius, y = radius, z = radius}, np, limbs)
@ -221,8 +217,7 @@ function aus.make_karri(pos, data, area, height, radius, trunk, leaves, air, ign
iv = iv + ystride -- increment by one node up
end
make_treetrunk3(pos.x, pos.y, pos.z, data, area, height, trunk, air, 0.8)
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8},
octaves = 3, persist = 0.5}
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
pos.y = pos.y + height
aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
{x = radius, y = radius, z = radius}, np, limbs)
@ -236,8 +231,7 @@ function aus.make_mangrove(pos, data, area, height, radius, trunk, leaves, air,
data[iv] = trunk
iv = iv + ystride -- increment by one node up
end
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8},
octaves = 3, persist = 0.5}
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
pos.y = pos.y + height
aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
{x = radius, y = radius * 0.5, z = radius}, np)
@ -261,7 +255,7 @@ function aus.make_mangrove(pos, data, area, height, radius, trunk, leaves, air,
end
end
-- Mangrove tree
-- Mangrove trees use schematic placement because the vocelmanipulator cannot place nodes under sea level.
function aus.generate_mangrove_tree_schematic(trunk_height, trunk, leaf)
local height = trunk_height * 2 + 1
local radius = 2
@ -270,10 +264,10 @@ function aus.generate_mangrove_tree_schematic(trunk_height, trunk, leaf)
local s = aus.schematic_array(width, height, width)
-- roots, trunk, and extra leaves
for z = -1,1 do
for y = 1,trunk_top do
for x = -1,1 do
local i = (z+radius)*width*height + y*width + (x+radius) + 1
for z = -1, 1 do
for y = 1, trunk_top do
for x = -1, 1 do
local i = (z + radius) * width * height + y * width + (x + radius) + 1
if x == 0 and z == 0 then
s.data[i].name = trunk
s.data[i].param1 = 255
@ -291,15 +285,15 @@ function aus.generate_mangrove_tree_schematic(trunk_height, trunk, leaf)
end
-- canopy
for y = 1,trunk_top+2 do
if y > trunk_height and (y == trunk_top or math_random(1,height - y) == 1) then
for y = 1, trunk_top + 2 do
if y > trunk_height and (y == trunk_top or math_random(1, height - y) == 1) then
local x, z = 0, 0
while x == 0 and z == 0 do
x = math_random(-1,1) * 2
z = math_random(-1,1) * 2
x = math_random(-1, 1) * 2
z = math_random(-1, 1) * 2
end
for j = -1,1,2 do
aus.generate_canopy(s, leaf, {x=j*x, y=y, z=j*z})
for j = -1, 1, 2 do
aus.generate_canopy(s, leaf, {x = j * x, y = y, z = j * z})
end
end
end
@ -313,14 +307,14 @@ function aus.generate_canopy(s, leaf, pos)
local rx = math_floor(s.size.x / 2)
local rz = math_floor(s.size.z / 2)
local r1 = 4 -- leaf decay radius
local probs = {255,200,150,100,75}
local probs = {255, 200, 150, 100, 75}
for z = -r1,r1 do
for y = 0,1 do
for x = -r1,r1 do
if x+pos.x >= -rx and x+pos.x <= rx and y+pos.y >= 0 and
y+pos.y < height and z+pos.z >= -rz and z+pos.z <= rz then
local i = (z+pos.z+rz)*width*height + (y+pos.y)*width + (x+pos.x+rx) + 1
for z = -r1, r1 do
for y = 0, 1 do
for x = -r1, r1 do
if x+pos.x >= -rx and x + pos.x <= rx and y + pos.y >= 0 and
y + pos.y < height and z + pos.z >= -rz and z + pos.z <= rz then
local i = (z + pos.z + rz) * width * height + (y + pos.y) * width + (x + pos.x + rx) + 1
local dist1 = math_sqrt(x^2 + y^2 + z^2)
local dist2 = math_sqrt((x+pos.x)^2 + (z+pos.z)^2)
if dist1 <= r1 then
@ -347,8 +341,7 @@ function aus.make_marri(pos, data, area, height, radius, trunk, leaves, air, ign
iv = iv + ystride -- increment by one node up
end
make_treetrunk2(pos.x, pos.y, pos.z, data, area, height, trunk, air, 0.6)
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8},
octaves = 3, persist = 0.5}
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
pos.y = pos.y + height
aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
{x = radius, y = radius, z = radius}, np, limbs)
@ -363,8 +356,7 @@ function aus.make_merbau(pos, data, area, height, radius, trunk, leaves, air, ig
iv = iv + ystride -- increment by one node up
end
make_treetrunk3(pos.x, pos.y, pos.z, data, area, height, trunk, air, 0.2)
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8},
octaves = 3, persist = 0.5}
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
pos.y = pos.y + height
aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
{x = radius, y = radius * 0.5, z = radius}, np)
@ -381,8 +373,7 @@ function aus.make_moreton_bay_fig(pos, data, area, height, radius, trunk,
end
make_treetrunk2(pos.x, pos.y, pos.z, data, area, height, trunk, air, 0.7)
make_treetrunk3(pos.x, pos.y, pos.z, data, area, height, trunk, air, 0.3)
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8},
octaves = 3, persist = 0.5}
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
pos.y = pos.y + height
aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
{x = radius, y = radius, z = radius}, np, limbs, fruit_chance, fruit)
@ -398,8 +389,7 @@ function aus.make_river_red_gum(pos, data, area, height, radius, trunk, leaves,
iv = iv + ystride -- increment by one node up
end
make_treetrunk2(pos.x, pos.y, pos.z, data, area, height, trunk, air, 0.7)
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8},
octaves = 3, persist = 0.5}
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
pos.y = pos.y + height
aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
{x = radius, y = radius, z = radius}, np, limbs)
@ -433,22 +423,21 @@ function aus.make_tasmanian_myrtle(pos, data, area, height, radius, trunk,
iv = iv + ystride -- increment by one node up
end
make_treetrunk2(pos.x, pos.y, pos.z, data, area, height, trunk, air, 0.6)
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8},
octaves = 3, persist = 0.5}
local np = {offset = 0.8, scale = 0.4, spread = {x = 8, y = 4, z = 8}, octaves = 3, persist = 0.5}
pos.y = pos.y + height
aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
{x = radius, y = radius, z = radius}, np, limbs)
end
function aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
radius, np, limbs, fruit_chance, fruit)
-- Make leaves on a tree in a noise blob.
function aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore, radius, np, limbs, fruit_chance, fruit)
limbs = limbs
fruit_chance = fruit_chance or 0
np.seed = math_random(0, 16777215) -- noise seed
local minp = vector.subtract(pos, radius) -- minimal corner of the leavesblob
local maxp = vector.add(pos, radius) -- maximal corner of the leavesblob
local int_minp = {x = math_floor(minp.x), y = math_floor(minp.y),
z = math_floor(minp.z)} -- Same positions, but with integer coordinates
-- Same positions, but with integer coordinates
local int_minp = {x = math_floor(minp.x), y = math_floor(minp.y), z = math_floor(minp.z)}
local int_maxp = {x = math_ceil(maxp.x), y = math_ceil(maxp.y), z = math_ceil(maxp.z)}
local length = vector.subtract(int_maxp, int_minp)
@ -471,7 +460,7 @@ function aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
if nval > dist then -- if the noise is bigger than the distance, make leaves
local iv = area:index(x, y, z)
if data[iv] == air or data[iv] == ignore then
-- make some branches with the leaf structure
-- make some branches within the leaf structure
if nval > dist * 1.5 and limbs and math_random(5) == 1 then
data[iv] = trunk
-- if a fruit tree add fruit
@ -489,11 +478,10 @@ function aus.make_leavesblob(pos, data, area, trunk, leaves, air, ignore,
end
-- Arnhem Cypress Pine
function aus.grow_arnhem_cypress_pine(pos)
-- individual parameters
local height = math_random(10,15)
local height = math_random(10, 15)
local radius = 4
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:arnhem_cypress_pine_tree")
@ -516,8 +504,8 @@ end
-- Black Box
function aus.grow_black_box(pos)
-- individual parameters
local height = math_random(5,10)
local radius = math_random(4,6)
local height = math_random(5, 10)
local radius = math_random(4, 6)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:black_box_tree")
@ -540,7 +528,7 @@ end
-- Black Wattle
function aus.grow_black_wattle(pos)
-- individual parameters
local height = math_random(6,8)
local height = math_random(6, 8)
local radius = 3
local limbs = false
-- voxelmanip stuff
@ -564,8 +552,8 @@ end
-- Blue Gum
function aus.grow_blue_gum(pos)
-- individual parameters
local height = math_random(12,22)
local radius = math_random(5,7)
local height = math_random(12, 22)
local radius = math_random(5, 7)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:blue_gum_tree")
@ -588,8 +576,8 @@ end
-- Boab
function aus.grow_boab(pos)
-- individual parameters
local height = math_random(5,6)
local radius = math_random(4,5)
local height = math_random(5, 6)
local radius = math_random(4, 5)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:boab_tree")
@ -612,8 +600,8 @@ end
-- Bull Banksia
function aus.grow_bull_banksia(pos)
-- individual parameters
local height = math_random(3,5)
local radius = math_random(2,3)
local height = math_random(3, 5)
local radius = math_random(2, 3)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:bull_banksia_tree")
local leaves = minetest.get_content_id("australia:bull_banksia_leaves")
@ -635,8 +623,8 @@ end
-- Celery-top Pine
function aus.grow_celery_top_pine(pos)
-- individual parameters
local height = math_random(8,10)
local radius = math_random(3,4)
local height = math_random(8, 10)
local radius = math_random(3, 4)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:celery_top_pine_tree")
local leaves = minetest.get_content_id("australia:celery_top_pine_leaves")
@ -658,7 +646,7 @@ end
-- Cherry
function aus.grow_cherry(pos)
-- individual parameters
local height = math_random(3,4)
local height = math_random(3, 4)
local radius = 3
local limbs = nil
local fruit_chance = 0.2
@ -684,8 +672,8 @@ end
-- Coast Banksia
function aus.grow_coast_banksia(pos)
-- individual parameters
local height = math_random(8,13)
local radius = math_random(5,6)
local height = math_random(8, 13)
local radius = math_random(5, 6)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:coast_banksia_tree")
local leaves = minetest.get_content_id("australia:coast_banksia_leaves")
@ -707,8 +695,8 @@ end
-- Coolabah
function aus.grow_coolabah(pos)
-- individual parameters
local height = math_random(7,10)
local radius = math_random(4,5)
local height = math_random(7, 10)
local radius = math_random(4, 5)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:coolabah_tree")
@ -731,8 +719,8 @@ end
-- Daintree Stringybark
function aus.grow_daintree_stringybark(pos)
-- individual parameters
local height = math_random(15,20)
local radius = math_random(7,9)
local height = math_random(15, 20)
local radius = math_random(7, 9)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:daintree_stringybark_tree")
@ -755,8 +743,8 @@ end
-- Darwin Woollybutt
function aus.grow_darwin_woollybutt(pos)
-- individual parameters
local height = math_random(8,13)
local radius = math_random(4,5)
local height = math_random(8, 13)
local radius = math_random(4, 5)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:darwin_woollybutt_tree")
@ -779,8 +767,8 @@ end
-- Desert Oak
function aus.grow_desert_oak(pos)
-- individual parameters
local height = math_random(4,8)
local radius = math_random(2,4)
local height = math_random(4, 8)
local radius = math_random(2, 4)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:desert_oak_tree")
local leaves = minetest.get_content_id("australia:desert_oak_leaves")
@ -802,7 +790,7 @@ end
-- Fan Palm
function aus.grow_fan_palm(pos)
-- individual parameters
local height = math_random(6,8)
local height = math_random(6, 8)
local radius = 3
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:fan_palm_tree")
@ -825,8 +813,8 @@ end
-- Flame Grevillea
function aus.grow_flame_grevillea(pos)
-- individual parameters
local height = math_random(2,3)
local radius = math_random(2,3)
local height = math_random(2, 3)
local radius = math_random(2, 3)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:flame_grevillea_tree")
local leaves = minetest.get_content_id("australia:flame_grevillea_leaves")
@ -848,7 +836,7 @@ end
-- Golden Wattle
function aus.grow_golden_wattle(pos)
-- individual parameters
local height = math_random(3,4)
local height = math_random(3, 4)
local radius = 2
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:golden_wattle_tree")
@ -871,7 +859,7 @@ end
-- Grey Mangrove
function aus.grow_grey_mangrove(pos)
-- individual parameters
local height = math_random(3,4)
local height = math_random(3, 4)
local radius = 2
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:grey_mangrove_tree")
@ -894,8 +882,8 @@ end
-- Huon Pine
function aus.grow_huon_pine(pos)
-- individual parameters
local height = math_random(8,13)
local radius = math_random(5,6)
local height = math_random(8, 13)
local radius = math_random(5, 6)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:huon_pine_tree")
@ -918,8 +906,8 @@ end
-- Illawarra Flame Tree
function aus.grow_illawarra_flame(pos)
-- individual parameters
local height = math_random(9,11)
local radius = math_random(6,7)
local height = math_random(9, 11)
local radius = math_random(6, 7)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:illawarra_flame_tree")
local leaves = minetest.get_content_id("australia:illawarra_flame_leaves")
@ -941,8 +929,8 @@ end
-- Jarrah
function aus.grow_jarrah(pos)
-- individual parameters
local height = math_random(15,20)
local radius = math_random(8,10)
local height = math_random(15, 20)
local radius = math_random(8, 10)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:jarrah_tree")
@ -965,8 +953,8 @@ end
-- Karri
function aus.grow_karri(pos)
-- individual parameters
local height = math_random(20,30)
local radius = math_random(8,10)
local height = math_random(20, 30)
local radius = math_random(8, 10)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:karri_tree")
@ -989,8 +977,8 @@ end
-- Lemon Eucalyptus
function aus.grow_lemon_eucalyptus(pos)
-- individual parameters
local height = math_random(12,18)
local radius = math_random(5,6)
local height = math_random(12, 18)
local radius = math_random(5, 6)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:lemon_eucalyptus_tree")
@ -1013,8 +1001,8 @@ end
-- Lemon Myrtle
function aus.grow_lemon_myrtle(pos)
-- individual parameters
local height = math_random(3,5)
local radius = math_random(2,3)
local height = math_random(3, 5)
local radius = math_random(2, 3)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:lemon_myrtle_tree")
local leaves = minetest.get_content_id("australia:lemon_myrtle_leaves")
@ -1036,8 +1024,8 @@ end
-- Lilly Pilly
function aus.grow_lilly_pilly(pos)
-- individual parameters
local height = math_random(4,6)
local radius = math_random(4,6)
local height = math_random(4, 6)
local radius = math_random(4, 6)
local limbs = nil
local fruit_chance = 0.3
-- voxelmanip stuff
@ -1062,8 +1050,8 @@ end
-- Macadamia
function aus.grow_macadamia(pos)
-- individual parameters
local height = math_random(6,8)
local radius = math_random(3,4)
local height = math_random(6, 8)
local radius = math_random(3, 4)
local limbs = nil
local fruit_chance = 0.3
-- voxelmanip stuff
@ -1088,8 +1076,8 @@ end
-- Mangrove Apple
function aus.grow_mangrove_apple(pos)
-- individual parameters
local height = math_random(6,8)
local radius = math_random(3,4)
local height = math_random(6, 8)
local radius = math_random(3, 4)
local limbs = nil
local fruit_chance = 0.2
-- voxelmanip stuff
@ -1114,8 +1102,8 @@ end
-- Marri
function aus.grow_marri(pos)
-- individual parameters
local height = math_random(15,20)
local radius = math_random(7,10)
local height = math_random(15, 20)
local radius = math_random(7, 10)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:marri_tree")
@ -1138,8 +1126,8 @@ end
-- Merbau
function aus.grow_merbau(pos)
-- individual parameters
local height = math_random(16,20)
local radius = math_random(4,5)
local height = math_random(16, 20)
local radius = math_random(4, 5)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:merbau_tree")
local leaves = minetest.get_content_id("australia:merbau_leaves")
@ -1161,8 +1149,8 @@ end
-- Moreton Bay Fig
function aus.grow_moreton_bay_fig(pos)
-- individual parameters
local height = math_random(15,20)
local radius = math_random(13,15)
local height = math_random(15, 20)
local radius = math_random(13, 15)
local limbs = true
local fruit_chance = 0.2
-- voxelmanip stuff
@ -1187,8 +1175,8 @@ end
-- Mulga
function aus.grow_mulga(pos)
-- individual parameters
local height = math_random(4,7)
local radius = math_random(2,3)
local height = math_random(4, 7)
local radius = math_random(2, 3)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:mulga_tree")
local leaves = minetest.get_content_id("australia:mulga_leaves")
@ -1210,8 +1198,8 @@ end
-- Paperbark
function aus.grow_paperbark(pos)
-- individual parameters
local height = math_random(6,10)
local radius = math_random(4,5)
local height = math_random(6, 10)
local radius = math_random(4, 5)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:paperbark_tree")
@ -1234,7 +1222,7 @@ end
-- Quandong
function aus.grow_quandong(pos)
-- individual parameters
local height = math_random(2,3)
local height = math_random(2, 3)
local radius = 2
local limbs = nil
local fruit_chance = 0.2
@ -1260,8 +1248,8 @@ end
-- Red Bottlebrush
function aus.grow_red_bottlebrush(pos)
-- individual parameters
local height = math_random(2,3)
local radius = math_random(2,3)
local height = math_random(2, 3)
local radius = math_random(2, 3)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:red_bottlebrush_tree")
local leaves = minetest.get_content_id("australia:red_bottlebrush_leaves")
@ -1283,8 +1271,8 @@ end
-- River Oak
function aus.grow_river_oak(pos)
-- individual parameters
local height = math_random(12,15)
local radius = math_random(4,5)
local height = math_random(12, 15)
local radius = math_random(4, 5)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:river_oak_tree")
local leaves = minetest.get_content_id("australia:river_oak_leaves")
@ -1306,8 +1294,8 @@ end
-- River Red Gum
function aus.grow_river_red_gum(pos)
-- individual parameters
local height = math_random(12,18)
local radius = math_random(6,8)
local height = math_random(12, 18)
local radius = math_random(6, 8)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:river_red_gum_tree")
@ -1330,7 +1318,7 @@ end
-- Rottnest Island Pine
function aus.grow_rottnest_island_pine(pos)
-- individual parameters
local height = math_random(3,4)
local height = math_random(3, 4)
local radius = 3
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:rottnest_island_pine_tree")
@ -1353,8 +1341,8 @@ end
-- Scribbly Gum
function aus.grow_scribbly_gum(pos)
-- individual parameters
local height = math_random(6,8)
local radius = math_random(4,5)
local height = math_random(6, 8)
local radius = math_random(4, 5)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:scribbly_gum_tree")
@ -1377,8 +1365,8 @@ end
-- Shoestring Acacia
function aus.grow_shoestring_acacia(pos)
-- individual parameters
local height = math_random(3,5)
local radius = math_random(3,4)
local height = math_random(3, 5)
local radius = math_random(3, 4)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:shoestring_acacia_tree")
local leaves = minetest.get_content_id("australia:shoestring_acacia_leaves")
@ -1400,7 +1388,7 @@ end
-- Snow Gum
function aus.grow_snow_gum(pos)
-- individual parameters
local height = math_random(2,4)
local height = math_random(2, 4)
local radius = 2
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:snow_gum_tree")
@ -1423,8 +1411,8 @@ end
-- Southern Sassafras
function aus.grow_southern_sassafras(pos)
-- individual parameters
local height = math_random(7,13)
local radius = math_random(3,4)
local height = math_random(7, 13)
local radius = math_random(3, 4)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:southern_sassafras_tree")
local leaves = minetest.get_content_id("australia:southern_sassafras_leaves")
@ -1446,8 +1434,8 @@ end
-- Stilted Mangrove
function aus.grow_stilted_mangrove(pos)
-- individual parameters
local height = math_random(4,7)
local radius = math_random(2,3)
local height = math_random(4, 7)
local radius = math_random(2, 3)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:stilted_mangrove_tree")
local leaves = minetest.get_content_id("australia:stilted_mangrove_leaves")
@ -1469,8 +1457,8 @@ end
-- Sugar Gum
function aus.grow_sugar_gum(pos)
-- individual parameters
local height = math_random(9,13)
local radius = math_random(8,10)
local height = math_random(9, 13)
local radius = math_random(8, 10)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:sugar_gum_tree")
@ -1493,8 +1481,8 @@ end
-- Swamp Bloodwood
function aus.grow_swamp_bloodwood(pos)
-- individual parameters
local height = math_random(6,8)
local radius = math_random(3,4)
local height = math_random(6, 8)
local radius = math_random(3, 4)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:swamp_bloodwood_tree")
@ -1517,8 +1505,8 @@ end
-- Swamp Gum
function aus.grow_swamp_gum(pos)
-- individual parameters
local height = math_random(30,40)
local radius = math_random(8,10)
local height = math_random(30, 40)
local radius = math_random(8, 10)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:swamp_gum_tree")
@ -1541,7 +1529,7 @@ end
-- Swamp Paperbark
function aus.grow_swamp_paperbark(pos)
-- individual parameters
local height = math_random(3,4)
local height = math_random(3, 4)
local radius = 2
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:swamp_paperbark_tree")
@ -1564,8 +1552,8 @@ end
-- Tasmanian Myrtle
function aus.grow_tasmanian_myrtle(pos)
-- individual parameters
local height = math_random(15,20)
local radius = math_random(7,9)
local height = math_random(15, 20)
local radius = math_random(7, 9)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:tasmanian_myrtle_tree")
@ -1588,8 +1576,8 @@ end
-- Tea Tree
function aus.grow_tea_tree(pos)
-- individual parameters
local height = math_random(3,4)
local radius = math_random(2,3)
local height = math_random(3, 4)
local radius = math_random(2, 3)
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:tea_tree_tree")
local leaves = minetest.get_content_id("australia:tea_tree_leaves")
@ -1611,8 +1599,8 @@ end
-- White Box
function aus.grow_white_box(pos)
-- individual parameters
local height = math_random(7,12)
local radius = math_random(6,8)
local height = math_random(7, 12)
local radius = math_random(6, 8)
local limbs = true
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:white_box_tree")
@ -1635,7 +1623,7 @@ end
-- Wirewood
function aus.grow_wirewood(pos)
-- individual parameters
local height = math_random(6,8)
local height = math_random(6, 8)
local radius = 2
-- voxelmanip stuff
local trunk = minetest.get_content_id("australia:wirewood_tree")

View File

@ -1,4 +1,4 @@
-- mods/australia/voxel.lua
-- mods/australia_modpack/australia/voxel.lua
-- This is only used to handle cases the decoration manager can't, such as
-- trees alongside rivers.
@ -50,6 +50,7 @@ noises[1] = getCppSettingNoise('mg_valleys_np_terrain_height', {
persist = 0.7,
lacunarity = 2,
})
-- Noise 2 : Valleys (2D)
noises[2] = getCppSettingNoise('mg_valleys_np_rivers', {
offset = 0,
@ -60,6 +61,7 @@ noises[2] = getCppSettingNoise('mg_valleys_np_rivers', {
persist = 0.6,
lacunarity = 2,
})
-- Noise 3 : Valleys Depth (2D)
noises[3] = getCppSettingNoise('mg_valleys_np_valley_depth', {
offset = 3,
@ -70,6 +72,7 @@ noises[3] = getCppSettingNoise('mg_valleys_np_valley_depth', {
persist = 1,
lacunarity = 2,
})
-- Noise 4 : Valleys Profile (2D)
noises[4] = getCppSettingNoise('mg_valleys_np_valley_profile', {
offset = 0.6,
@ -80,6 +83,7 @@ noises[4] = getCppSettingNoise('mg_valleys_np_valley_profile', {
persist = 1,
lacunarity = 2,
})
-- Noise 5 : Inter-valleys slopes (2D)
noises[5] = getCppSettingNoise('mg_valleys_np_inter_valley_slope', {
offset = 0,
@ -90,6 +94,7 @@ noises[5] = getCppSettingNoise('mg_valleys_np_inter_valley_slope', {
persist = 0.5,
lacunarity = 2,
})
-- Noise 6 : Inter-valleys filling (3D)
noises[6] = getCppSettingNoise('mg_valleys_np_inter_valley_fill', {
offset = 0,
@ -100,6 +105,7 @@ noises[6] = getCppSettingNoise('mg_valleys_np_inter_valley_fill', {
persist = 0.8,
lacunarity = 2,
})
-- Noise 20 : Salt lakes (2D)
noises[20] = {
offset = 0,
@ -147,15 +153,6 @@ local function getCppSettingNumeric(name, default)
return setting
end
-- Mapgen time stats
local mapgen_times = {
preparation = {},
noises = {},
collecting = {},
writing = {},
total = {},
}
-- Define parameters
local river_size = 4 / 100
@ -179,7 +176,7 @@ local data = {}
-- THE MAPGEN FUNCTION
minetest.register_on_generated(function(minp, maxp, seed)
if aus.registered_on_first_mapgen then -- Run callbacks
if aus.registered_on_first_mapgen then -- Run callbacks
for _, f in ipairs(aus.registered_on_first_mapgen) do
f()
end
@ -222,7 +219,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
-- The VoxelArea is used to convert a position into an index for the array.
local a = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
vm:get_data(data) -- data is the original array of content IDs (solely or mostly air)
vm:get_data(data) -- data is the original array of content IDs (solely or mostly air)
-- Be careful: emin ≠ minp and emax ≠ maxp !
-- The data array is not limited by minp and maxp. It exceeds it by 16 nodes in the 6 directions.
-- The real limits of data array are emin and emax.
@ -239,8 +236,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
-- Calculate the noise values
local minp2d = {x = minp.x, y = minp.z}
local chulens = vector.add(vector.subtract(maxp, minp), 1) -- Size of the generated area, used by noisemaps
local chulens_sup = {x = chulens.x, y = chulens.y + 6, z = chulens.z} -- for the noise #6 that needs extra values
local chulens = vector.add(vector.subtract(maxp, minp), 1) -- Size of the generated area, used by noisemaps
local chulens_sup = {x = chulens.x, y = chulens.y + 6, z = chulens.z} -- for noise #6 that needs extra values
local n1 = noisemap(1, minp2d, chulens)
local n2 = noisemap(2, minp2d, chulens)
@ -253,16 +250,16 @@ minetest.register_on_generated(function(minp, maxp, seed)
-- THE CORE OF THE MOD: THE MAPGEN ALGORITHM ITSELF
-- indexes for noise arrays
local i2d = 1 -- index for 2D noises
local i3d_sup = 1 -- index for noise #6 which has a special size
local i2d = 1 -- index for 2D noises
local i3d_sup = 1 -- index for noise #6 which has a special size
-- Calculate increments
local i2d_incrZ = chulens.z
local i2d_decrX = chulens.x * chulens.z - 1
local biome
for x = minp.x, maxp.x do -- for each YZ plane
for z = minp.z, maxp.z do -- for each vertical line in this plane
for x = minp.x, maxp.x do -- for each YZ plane
for z = minp.z, maxp.z do -- for each vertical line in this plane
local air_count = 0
-- take the noise values for 2D noises
local v1, v2, v3, v4, v5, v20 =
@ -275,9 +272,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
saltlake = true
end
for y = maxp.y, minp.y, -1 do -- for each node in vertical line
local ivm = a:index(x, y, z) -- index of the data array, matching the position {x, y, z}
local v6 = n6[i3d_sup] -- take the noise values for 3D noises
for y = maxp.y, minp.y, -1 do -- for each node in vertical line
local ivm = a:index(x, y, z) -- index of the data array, matching the position {x, y, z}
local v6 = n6[i3d_sup] -- take the noise values for 3D noises
local ground = math_max(heightmap[i2d], 0) - 5
-- Check for suitable ground node
@ -296,20 +293,37 @@ minetest.register_on_generated(function(minp, maxp, seed)
-- a top node
if y >= ground and data[ivm + ystride] == node["air"] then
v3 = v3 ^ 2 -- The square function changes the behaviour of this noise : very often small, and sometimes very high.
local base_ground = v1 + v3 -- v3 is here because terrain is generally higher where valleys are deep (mountains). base_ground represents the height of the rivers, most of the surface is above.
v2 = math_abs(v2) - river_size -- v2 represents the distance from the river, in arbitrary units.
local river = v2 < 0 -- the rivers are placed where v2 is negative, so where the original v2 value is close to zero.
local valleys = v3 * (1 - math_exp(- (v2 / v4) ^ 2)) -- use the curve of the function 1exp((x/a)²) to modelise valleys. Making "a" varying 0 < a ≤ 1 changes the shape of the valleys. Try it with a geometry software ! (here x = v2 and a = v4). This variable represents the height of the terrain, from the rivers.
local mountain_ground = base_ground + valleys -- approximate height of the terrain at this point (could be slightly modified by the 3D noise #6)
local slopes = v5 * valleys -- This variable represents the maximal influence of the noise #6 on the elevation. v5 is the rate of the height from rivers (variable "valleys") that is concerned.
-- The square function changes the behaviour of this noise : very often
-- small, and sometimes very high.
v3 = v3 ^ 2
-- v3 is here because terrain is generally higher where valleys are deep
-- (mountains). base_ground represents the height of the rivers, most of
-- the surface is above.
local base_ground = v1 + v3
-- v2 represents the distance from the river, in arbitrary units.
v2 = math_abs(v2) - river_size
-- The rivers are placed where v2 is negative, so where the original v2
-- value is close to zero.
local river = v2 < 0
-- Use the curve of the function 1exp((x/a)²) to modelise valleys. Making
-- "a" varying 0 < a ≤ 1 changes the shape of the valleys. Try it with a
-- geometry software! (here x = v2 and a = v4). This variable represents
-- the height of the terrain, from the rivers.
local valleys = v3 * (1 - math_exp(- (v2 / v4) ^ 2))
-- Approximate height of the terrain at this point (could be slightly
-- modified by the 3D noise #6)
local mountain_ground = base_ground + valleys
-- This variable represents the maximal influence of the noise #6 on the
-- elevation. v5 is the rate of the height from rivers (variable "valleys")
-- that is concerned.
local slopes = v5 * valleys
if saltlake and y < 40 and slopes < 0 and v2 > 0.1 and
v2 < 0.2 and data[ivm] == node["red_sand"] then
data[ivm] = node["salt"]
end
local conditions = { -- pack it in a table, for plants API
local conditions = { -- pack it in a table, for plants API
v1 = v1,
v2 = v2,
v3 = v3,
@ -333,13 +347,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
end
i2d = i2d + i2d_incrZ -- increment i2d by one Z
i2d = i2d + i2d_incrZ -- Increment i2d by one Z
end
i2d = i2d - i2d_decrX -- decrement the Z line previously incremented and increment by one X (1)
i2d = i2d - i2d_decrX -- Decrement the Z line previously incremented and increment by one X (1)
end
aus.execute_after_mapgen() -- needed for some tree roots
aus.execute_after_mapgen() -- Needed for some tree roots
-- execute voxelmanip boring stuff to write to the map...
-- Execute voxelmanip boring stuff to write to the map...
vm:set_data(data)
-- vm:set_lighting({day = 0, night = 0})
vm:calc_lighting()