Tweaked and Tidied code

master
TenPlus1 2015-07-25 16:45:29 +01:00
parent f37b81262a
commit 170b62ecde
7 changed files with 259 additions and 118 deletions

View File

@ -1 +1 @@
This is a mod that causes Minetest to use the Ethereal v7 mapgen. Ethereal mod uses the v7 mapgen to add many new biomes to the world.

View File

@ -1,6 +1,6 @@
--[[ --[[
Minetest Ethereal Mod 1.16 (22nd July 2015) Minetest Ethereal Mod 1.16 (25th July 2015)
Created by ChinChow Created by ChinChow
@ -29,7 +29,7 @@ ethereal.junglee = 1 -- Jungle grass with tall jungle trees
ethereal.desert = 1 -- Desert sand with cactus ethereal.desert = 1 -- Desert sand with cactus
ethereal.grove = 1 -- Banana groves and ferns ethereal.grove = 1 -- Banana groves and ferns
ethereal.mushroom = 1 -- Purple grass with giant mushrooms ethereal.mushroom = 1 -- Purple grass with giant mushrooms
ethereal.desertstone = 1 -- Desert stone with smaller cactus ethereal.sandstone = 1 -- Sandstone with smaller cactus
ethereal.quicksand = 1 -- Quicksand banks ethereal.quicksand = 1 -- Quicksand banks
ethereal.lake = 1 -- Small sandy lake areas with gravel below, also used for ocean floor ethereal.lake = 1 -- Small sandy lake areas with gravel below, also used for ocean floor
ethereal.plains = 1 -- Dry dirt with scorched trees ethereal.plains = 1 -- Dry dirt with scorched trees
@ -54,7 +54,9 @@ dofile(minetest.get_modpath("ethereal").."/extra.lua")
dofile(minetest.get_modpath("ethereal").."/sealife.lua") dofile(minetest.get_modpath("ethereal").."/sealife.lua")
dofile(minetest.get_modpath("ethereal").."/fences.lua") dofile(minetest.get_modpath("ethereal").."/fences.lua")
dofile(minetest.get_modpath("ethereal").."/gates.lua") dofile(minetest.get_modpath("ethereal").."/gates.lua")
dofile(minetest.get_modpath("ethereal").."/stairs.lua") if stairs and not stairs.mod then
dofile(minetest.get_modpath("ethereal").."/stairs.lua")
end
dofile(minetest.get_modpath("ethereal").."/mapgen_v7n.lua") -- 0.4.12+ dofile(minetest.get_modpath("ethereal").."/mapgen_v7n.lua") -- 0.4.12+
-- Xanadu server Only -- Xanadu server Only

View File

@ -32,9 +32,19 @@ minetest.register_node("ethereal:acacia_leaves", {
else else
minetest.override_item("default:acacia_leaves", { minetest.override_item("default:acacia_leaves", {
drawtype = leaftype, drawtype = leaftype,
tiles = {"moretrees_acacia_leaves.png"},
inventory_image = "moretrees_acacia_leaves.png",
visual_scale = 1.2, visual_scale = 1.2,
walkable = false,
drop = {
max_items = 1,
items = {
{items = {"ethereal:acacia_sapling"}, rarity = 20},
{items = {"ethereal:acacia_leaves"}}
}
},
}) })
print ("dont need ethereal's acacia leaves") minetest.register_alias("ethereal:acacia_leaves", "default:acacia_leaves")
end end
-- Willow Twig -- Willow Twig
@ -208,6 +218,7 @@ minetest.override_item("default:pine_needles", {
visual_scale = 1.2, visual_scale = 1.2,
tiles = {"pine_leaves.png"}, tiles = {"pine_leaves.png"},
inventory_image = "pine_leaves.png", inventory_image = "pine_leaves.png",
walkable = false,
drop = { drop = {
max_items = 1, max_items = 1,
items = { items = {

View File

@ -34,11 +34,23 @@ minetest.register_biome({
depth_top = 1, depth_top = 1,
node_filler = "default:dirt", node_filler = "default:dirt",
depth_filler = 5, depth_filler = 5,
y_min = 1, y_min = 3,
y_max = 71, y_max = 71,
heat_point = 45, heat_point = 45,
humidity_point = 75, humidity_point = 75,
}) })
minetest.register_biome({
name = "bamboo_ocean",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
y_min = -192,
y_max = 2,
heat_point = 45,
humidity_point = 75,
})
end end
if ethereal.mesa == 1 then if ethereal.mesa == 1 then
@ -53,6 +65,18 @@ minetest.register_biome({
heat_point = 25, heat_point = 25,
humidity_point = 28, humidity_point = 28,
}) })
minetest.register_biome({
name = "mesa_ocean",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
y_min = -192,
y_max = 1,
heat_point = 25,
humidity_point = 28,
})
end end
if ethereal.alpine == 1 then if ethereal.alpine == 1 then
@ -132,11 +156,23 @@ minetest.register_biome({
depth_top = 1, depth_top = 1,
node_filler = "default:dirt", node_filler = "default:dirt",
depth_filler = 5, depth_filler = 5,
y_min = 1, y_min = 2,
y_max = 41, y_max = 41,
heat_point = 15, heat_point = 15,
humidity_point = 30, humidity_point = 30,
}) })
minetest.register_biome({
name = "grayness_ocean",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
y_min = -192,
y_max = 1,
heat_point = 15,
humidity_point = 30,
})
end end
if ethereal.grassytwo == 1 then if ethereal.grassytwo == 1 then
@ -207,6 +243,18 @@ minetest.register_biome({
heat_point = 35, heat_point = 35,
humidity_point = 20, humidity_point = 20,
}) })
minetest.register_biome({
name = "desert_ocean",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
y_min = -192,
y_max = 2,
heat_point = 35,
humidity_point = 20,
})
end end
if ethereal.grove == 1 then if ethereal.grove == 1 then
@ -221,6 +269,18 @@ minetest.register_biome({
heat_point = 40, heat_point = 40,
humidity_point = 60, humidity_point = 60,
}) })
minetest.register_biome({
name = "grove_ocean",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
y_min = -192,
y_max = 2,
heat_point = 40,
humidity_point = 60,
})
end end
if ethereal.mushroom == 1 then if ethereal.mushroom == 1 then
@ -230,14 +290,26 @@ minetest.register_biome({
depth_top = 1, depth_top = 1,
node_filler = "default:dirt", node_filler = "default:dirt",
depth_filler = 5, depth_filler = 5,
y_min = 1, y_min = 3,
y_max = 50, y_max = 50,
heat_point = 45, heat_point = 45,
humidity_point = 65, humidity_point = 65,
}) })
minetest.register_biome({
name = "mushroom_ocean",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
y_min = -192,
y_max = 2,
heat_point = 45,
humidity_point = 65,
})
end end
if ethereal.desertstone == 1 then if ethereal.sandstone == 1 then
minetest.register_biome({ minetest.register_biome({
name = "desertstone", name = "desertstone",
node_top = "default:sandstone", node_top = "default:sandstone",
@ -249,6 +321,18 @@ minetest.register_biome({
heat_point = 50, heat_point = 50,
humidity_point = 20, humidity_point = 20,
}) })
minetest.register_biome({
name = "sandstone_ocean",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
y_min = -192,
y_max = 2,
heat_point = 50,
humidity_point = 20,
})
end end
if ethereal.quicksand == 1 then if ethereal.quicksand == 1 then
@ -293,6 +377,18 @@ minetest.register_biome({
heat_point = 55, heat_point = 55,
humidity_point = 25, humidity_point = 25,
}) })
minetest.register_biome({
name = "plains_ocean",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
y_min = -192,
y_max = 2,
heat_point = 55,
humidity_point = 25,
})
end end
if ethereal.fiery == 1 then if ethereal.fiery == 1 then
@ -307,6 +403,18 @@ minetest.register_biome({
heat_point = 80, heat_point = 80,
humidity_point = 10, humidity_point = 10,
}) })
minetest.register_biome({
name = "fiery_ocean",
node_top = "default:sand",
depth_top = 1,
node_filler = "default:sand",
depth_filler = 2,
y_min = -192,
y_max = 4,
heat_point = 80,
humidity_point = 10,
})
end end
if ethereal.sandclay == 1 then if ethereal.sandclay == 1 then
@ -704,16 +812,25 @@ minetest.register_on_generated(function(minp, maxp, seed)
local divlen = 8 local divlen = 8
local divs = (maxp.x - minp.x) / divlen + 1 local divs = (maxp.x - minp.x) / divlen + 1
local pr, x, z local pr, x, z
for divx=0,divs-1 do for divx = 0, divs - 1 do
for divz=0,divs-1 do for divz = 0, divs - 1 do
-- find random positions for palm tree -- find random positions for palm tree
pr = PseudoRandom(seed + 1) pr = PseudoRandom(seed + 1)
x = pr:next(minp.x + math.floor((divx + 0) * divlen), minp.x + math.floor((divx + 1) * divlen)) x = pr:next(minp.x + math.floor((divx + 0) * divlen),
z = pr:next(minp.z + math.floor((divz + 0) * divlen), minp.z + math.floor((divz + 1) * divlen)) minp.x + math.floor((divx + 1) * divlen))
z = pr:next(minp.z + math.floor((divz + 0) * divlen),
minp.z + math.floor((divz + 1) * divlen))
nn = minetest.get_node_or_nil({x = x, y = 1, z = z}) nn = minetest.get_node_or_nil({x = x, y = 1, z = z})
-- only on sand and beside water
if nn and nn.name == "default:sand" if nn and nn.name == "default:sand"
and minetest.find_node_near({x = x, y = 1,z = z}, 1, "default:water_source") then and minetest.find_node_near(
minetest.place_schematic({x = x - 4, y = 2, z = z - 4}, path.."palmtree.mts", 0, '', 0) {x = x, y = 1, z = z}, 1,
"default:water_source") then
minetest.place_schematic({
x = x - 4,
y = 2,
z = z - 4
}, path .. "palmtree.mts", "random", {}, false)
end end
end end
end end

View File

@ -219,6 +219,7 @@ minetest.register_node("ethereal:coconut", {
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
tiles = {"moretrees_coconut.png"}, tiles = {"moretrees_coconut.png"},
inventory_image = "moretrees_coconut.png",
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = {-0.35, -0.35, -0.35, 0.35, 0.35, 0.35} fixed = {-0.35, -0.35, -0.35, 0.35, 0.35, 0.35}

View File

@ -1,14 +1,12 @@
-- Function to Register Saplings -- Register Saplings
ethereal.register_sapling = function(sapling_node_name, sapling_descr, sapling_texture) ethereal.register_sapling = function(name, desc, texture)
-- if the sapling does not exist yet, create a node for it
if not minetest.registered_nodes[sapling_node_name] then minetest.register_node(name .. "_sapling", {
minetest.register_node( sapling_node_name, { description = desc .. " Tree Sapling",
description = sapling_descr,
drawtype = "plantlike", drawtype = "plantlike",
visual_scale = 1.0, visual_scale = 1.0,
tiles = {sapling_texture}, tiles = {texture .. "_sapling.png"},
inventory_image = sapling_texture, inventory_image = texture .. "_sapling.png",
wield_image = sapling_texture,
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = false, is_ground_content = false,
@ -23,39 +21,23 @@ ethereal.register_sapling = function(sapling_node_name, sapling_descr, sapling_t
}, },
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
}) })
end
end end
-- Register Saplings ethereal.register_sapling("ethereal:willow", "Willow", "willow")
ethereal.register_sapling("ethereal:willow_sapling", "Willow Sapling", "willow_sapling.png") ethereal.register_sapling("ethereal:yellow_tree", "Healing", "yellow_tree")
ethereal.register_sapling("ethereal:yellow_tree_sapling", "Healing Tree Sapling", "yellow_tree_sapling.png") ethereal.register_sapling("ethereal:tree", "Apple", "ethereal_tree")
ethereal.register_sapling("ethereal:tree_sapling", "Tree Sapling", "ethereal_tree_sapling.png") ethereal.register_sapling("ethereal:jungle_tree","Jungle", "ethereal_jungle_tree")
ethereal.register_sapling("ethereal:jungle_tree_sapling","Jungletree Sapling", "ethereal_jungle_tree_sapling.png") ethereal.register_sapling("ethereal:pine_tree", "Pine", "ethereal_pine_tree")
ethereal.register_sapling("ethereal:pine_tree_sapling", "Pine Sapling", "ethereal_pine_tree_sapling.png") ethereal.register_sapling("ethereal:big_tree", "Big", "ethereal_big_tree")
ethereal.register_sapling("ethereal:big_tree_sapling", "Big Tree Sapling", "ethereal_big_tree_sapling.png") ethereal.register_sapling("ethereal:banana_tree", "Banana", "banana_tree")
ethereal.register_sapling("ethereal:banana_tree_sapling", "Banana Tree Sapling", "banana_tree_sapling.png") ethereal.register_sapling("ethereal:frost_tree", "Frost", "ethereal_frost_tree")
ethereal.register_sapling("ethereal:frost_tree_sapling", "Frost Sapling", "ethereal_frost_tree_sapling.png") ethereal.register_sapling("ethereal:gray_tree", "Gray", "ethereal_gray_tree")
ethereal.register_sapling("ethereal:gray_tree_sapling", "Gray Sapling", "ethereal_gray_tree_sapling.png") ethereal.register_sapling("ethereal:mushroom", "Mushroom", "ethereal_mushroom")
ethereal.register_sapling("ethereal:mushroom_sapling", "Mushroom Sapling", "ethereal_mushroom_sapling.png") ethereal.register_sapling("ethereal:palm", "Palm", "moretrees_palm")
ethereal.register_sapling("ethereal:palm_sapling", "Palm Sapling", "moretrees_palm_sapling.png") ethereal.register_sapling("ethereal:redwood", "Redwood", "redwood")
ethereal.register_sapling("ethereal:redwood_sapling", "Redwood Sapling", "redwood_sapling.png") ethereal.register_sapling("ethereal:orange_tree", "Orange", "orange_tree")
ethereal.register_sapling("ethereal:orange_tree_sapling", "Orange Tree Sapling", "orange_tree_sapling.png") ethereal.register_sapling("ethereal:acacia", "Acacia", "moretrees_acacia")
ethereal.register_sapling("ethereal:acacia_sapling", "Acacia Sapling", "moretrees_acacia_sapling.png")
-- current routine
ethereal.place_tree = function (pos, ofx, ofz, schem)
-- Remove Sapling and Place Tree Schematic
minetest.set_node(pos, {name = "air"})
pos.x = pos.x - ofx
pos.z = pos.z - ofz
minetest.place_schematic(
pos,
minetest.get_modpath("ethereal").."/schematics/"..schem..".mts",
"0", {}, false
)
end
-- new routine
ethereal.add_tree = function (pos, ofx, ofz, schem) ethereal.add_tree = function (pos, ofx, ofz, schem)
-- check for schematic -- check for schematic
if not schem then if not schem then
@ -70,40 +52,69 @@ ethereal.add_tree = function (pos, ofx, ofz, schem)
) )
end end
local path = minetest.get_modpath("ethereal").."/schematics/"
ethereal.grow_sapling = function (pos, node) ethereal.grow_sapling = function (pos, node)
local under = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z}) local under = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z})
if under then under = under.name else return end if under then under = under.name else return end
-- Check if Sapling is growing on correct substrate -- Check if Sapling is growing on correct substrate
if (node.name == "ethereal:yellow_tree_sapling" and under == "default:dirt_with_snow") then if node.name == "ethereal:yellow_tree_sapling"
ethereal.place_tree(pos, 4, 4, "yellowtree") and under == "default:dirt_with_snow" then
elseif (node.name == "ethereal:tree_sapling" and under == "ethereal:green_dirt") then ethereal.add_tree(pos, 4, 4, path .. "yellowtree.mts")
elseif node.name == "ethereal:tree_sapling"
and under == "ethereal:green_dirt" then
ethereal.add_tree(pos, 1, 1, ethereal.appletree) ethereal.add_tree(pos, 1, 1, ethereal.appletree)
elseif (node.name == "ethereal:jungle_tree_sapling" and under == "ethereal:jungle_dirt") then
ethereal.place_tree(pos, 6, 6, "jungletree") elseif node.name == "ethereal:jungle_tree_sapling"
elseif (node.name == "ethereal:pine_tree_sapling" and under == "ethereal:cold_dirt") then and under == "ethereal:jungle_dirt" then
ethereal.place_tree(pos, 3, 3, "pinetree") ethereal.add_tree(pos, 6, 6, path .. "jungletree.mts")
elseif (node.name == "ethereal:big_tree_sapling" and under == "ethereal:green_dirt") then
ethereal.place_tree(pos, 4, 4, "bigtree") elseif node.name == "ethereal:pine_tree_sapling"
elseif (node.name == "ethereal:banana_tree_sapling" and under == "ethereal:grove_dirt") then and under == "ethereal:cold_dirt" then
ethereal.add_tree(pos, 3, 3, path .. "pinetree.mts")
elseif node.name == "ethereal:big_tree_sapling"
and under == "ethereal:green_dirt" then
ethereal.add_tree(pos, 4, 4, path .. "bigtree.mts")
elseif node.name == "ethereal:banana_tree_sapling"
and under == "ethereal:grove_dirt" then
ethereal.add_tree(pos, 3, 3, ethereal.bananatree) ethereal.add_tree(pos, 3, 3, ethereal.bananatree)
elseif (node.name == "ethereal:frost_tree_sapling" and under == "ethereal:crystal_dirt") then
ethereal.place_tree(pos, 4, 4, "frosttrees") elseif node.name == "ethereal:frost_tree_sapling"
elseif (node.name == "ethereal:gray_tree_sapling" and under == "ethereal:gray_dirt") then and under == "ethereal:crystal_dirt" then
ethereal.place_tree(pos, 2, 2, "graytrees") ethereal.add_tree(pos, 4, 4, path .. "frosttrees.mts")
elseif (node.name == "ethereal:mushroom_sapling" and under == "ethereal:mushroom_dirt") then
ethereal.place_tree(pos, 4, 4, "mushroomone") elseif node.name == "ethereal:gray_tree_sapling"
elseif (node.name == "ethereal:palm_sapling" and under == "default:sand") then and under == "ethereal:gray_dirt" then
ethereal.place_tree(pos, 4, 4, "palmtree") ethereal.add_tree(pos, 2, 2, path .. "graytrees.mts")
elseif (node.name == "ethereal:willow_sapling" and under == "ethereal:gray_dirt") then
ethereal.place_tree(pos, 5, 5, "willow") elseif node.name == "ethereal:mushroom_sapling"
elseif (node.name == "ethereal:redwood_sapling" and under == "bakedclay:red") then and under == "ethereal:mushroom_dirt" then
ethereal.place_tree(pos, 9, 9, "redwood") ethereal.add_tree(pos, 4, 4, path .. "mushroomone.mts")
elseif (node.name == "ethereal:orange_tree_sapling" and under == "ethereal:prairie_dirt") then
elseif node.name == "ethereal:palm_sapling"
and under == "default:sand" then
ethereal.add_tree(pos, 4, 4, path .. "palmtree.mts")
elseif node.name == "ethereal:willow_sapling"
and under == "ethereal:gray_dirt" then
ethereal.add_tree(pos, 5, 5, path .. "willow.mts")
elseif node.name == "ethereal:redwood_sapling"
and under == "bakedclay:red" then
ethereal.add_tree(pos, 9, 9, path .. "redwood.mts")
elseif node.name == "ethereal:orange_tree_sapling"
and under == "ethereal:prairie_dirt" then
ethereal.add_tree(pos, 1, 1, ethereal.orangetree) ethereal.add_tree(pos, 1, 1, ethereal.orangetree)
elseif (node.name == "ethereal:acacia_sapling" and under == "default:desert_sand") then
ethereal.place_tree(pos, 5, 5, "acaciatree") elseif node.name == "ethereal:acacia_sapling"
and under == "default:desert_sand" then
ethereal.add_tree(pos, 5, 5, path .. "acaciatree.mts")
end end
end end

View File

@ -3,9 +3,8 @@
-- Acacia Trunk (thanks to VanessaE for acacia textures) -- Acacia Trunk (thanks to VanessaE for acacia textures)
if minetest.registered_nodes["default:acacia_tree"] then if minetest.registered_nodes["default:acacia_tree"] then
minetest.register_alias("ethereal:acacia_trunk", "default:acacia_tree") minetest.register_alias("ethereal:acacia_trunk", "default:acacia_tree")
minetest.register_alias("ethereal:acacia_leaves", "default:acacia_leaves")
minetest.register_alias("ethereal:acacia_wood", "default:acacia_wood") minetest.register_alias("ethereal:acacia_wood", "default:acacia_wood")
print ("acacia tree in default game") print ("using acacia tree in default game")
else else
minetest.register_node("ethereal:acacia_trunk", { minetest.register_node("ethereal:acacia_trunk", {
description = "Acacia Trunk", description = "Acacia Trunk",