Skip to content

Commit

Permalink
Rainforest: Add emergent jungle tree and sapling
Browse files Browse the repository at this point in the history
Height 20 to 32 nodes.
Dependent on chunksize >= 5.
Base limited to maximum altitude y = 32.
Craft sapling from 9 jungle saplings.
  • Loading branch information
paramat committed Feb 19, 2018
1 parent 495fa32 commit b90aabe
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 0 deletions.
1 change: 1 addition & 0 deletions mods/default/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ paramat (CC BY-SA 3.0):
default_silver_sandstone_block.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
default_bookshelf_slot.png -- Derived from a texture by Gambit (CC-BY-SA 3.0)
default_marram_grass_*.png -- Derived from textures by TumeniNodes (CC-BY-SA 3.0)
default_emergent_jungle_sapling.png

TumeniNodes (CC BY-SA 3.0):
default_desert_cobble.png -- Derived from a texture by brunob.santos (CC BY-SA 3.0)
Expand Down
19 changes: 19 additions & 0 deletions mods/default/crafting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -763,14 +763,26 @@ minetest.register_craft({
}
})

minetest.register_craft({
output = "default:emergent_jungle_sapling",
recipe = {
{"default:junglesapling", "default:junglesapling", "default:junglesapling"},
{"default:junglesapling", "default:junglesapling", "default:junglesapling"},
{"default:junglesapling", "default:junglesapling", "default:junglesapling"},
}
})


--
-- Crafting (tool repair)
--

minetest.register_craft({
type = "toolrepair",
additional_wear = -0.02,
})


--
-- Cooking recipes
--
Expand Down Expand Up @@ -849,6 +861,7 @@ minetest.register_craft({
cooktime = 5,
})


--
-- Fuels
--
Expand Down Expand Up @@ -964,6 +977,12 @@ minetest.register_craft({
burntime = 6,
})

minetest.register_craft({
type = "fuel",
recipe = "default:emergent_jungle_sapling",
burntime = 7,
})


minetest.register_craft({
type = "fuel",
Expand Down
28 changes: 28 additions & 0 deletions mods/default/mapgen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1705,6 +1705,34 @@ function default.register_decorations()
rotation = "random",
})

-- Emergent jungle tree
-- Due to 32 node height, altitude is limited and prescence depends on chunksize

local chunksize = tonumber(minetest.get_mapgen_setting("chunksize"))
if chunksize >= 5 then
minetest.register_decoration({
deco_type = "schematic",
place_on = {"default:dirt_with_rainforest_litter"},
sidelen = 80,
noise_params = {
offset = 0.0,
scale = 0.0025,
spread = {x = 250, y = 250, z = 250},
seed = 2685,
octaves = 3,
persist = 0.7
},
biomes = {"rainforest"},
y_min = 1,
y_max = 32,
schematic = minetest.get_modpath("default") ..
"/schematics/emergent_jungle_tree.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
place_offset_y = -4,
})
end

-- Jungle tree and log

minetest.register_decoration({
Expand Down
36 changes: 36 additions & 0 deletions mods/default/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ default:jungletree
default:junglewood
default:jungleleaves
default:junglesapling
default:emergent_jungle_sapling
default:pine_tree
default:pine_wood
Expand Down Expand Up @@ -775,6 +776,41 @@ minetest.register_node("default:junglesapling", {
end,
})

minetest.register_node("default:emergent_jungle_sapling", {
description = "Emergent Jungle Tree Sapling",
drawtype = "plantlike",
tiles = {"default_emergent_jungle_sapling.png"},
inventory_image = "default_emergent_jungle_sapling.png",
wield_image = "default_emergent_jungle_sapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
on_timer = default.grow_sapling,
selection_box = {
type = "fixed",
fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16}
},
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
attached_node = 1, sapling = 1},
sounds = default.node_sound_leaves_defaults(),

on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(300, 1500))
end,

on_place = function(itemstack, placer, pointed_thing)
itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
"default:emergent_jungle_sapling",
-- minp, maxp to be checked, relative to sapling pos
{x = -3, y = -5, z = -3},
{x = 3, y = 31, z = 3},
-- maximum interval of interior volume check
4)

return itemstack
end,
})


minetest.register_node("default:pine_tree", {
description = "Pine Tree",
Expand Down
Binary file added mods/default/schematics/emergent_jungle_tree.mts
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions mods/default/trees.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ function default.grow_sapling(pos)
minetest.log("action", "An acacia bush sapling grows into a bush at "..
minetest.pos_to_string(pos))
default.grow_acacia_bush(pos)
elseif node.name == "default:emergent_jungle_sapling" then
minetest.log("action", "An emergent jungle sapling grows into a tree at "..
minetest.pos_to_string(pos))
default.grow_new_emergent_jungle_tree(pos)
end
end

Expand Down Expand Up @@ -394,6 +398,16 @@ function default.grow_new_jungle_tree(pos)
end


-- New emergent jungle tree

function default.grow_new_emergent_jungle_tree(pos)
local path = minetest.get_modpath("default") ..
"/schematics/emergent_jungle_tree_from_sapling.mts"
minetest.place_schematic({x = pos.x - 3, y = pos.y - 5, z = pos.z - 3},
path, "random", nil, false)
end


-- New pine tree

function default.grow_new_pine_tree(pos)
Expand Down

0 comments on commit b90aabe

Please sign in to comment.