Add in prototype nether trees

This commit is contained in:
oilboi 2020-05-07 07:42:52 -04:00
parent aefcaa739f
commit 164fc9543e
3 changed files with 183 additions and 5 deletions

View File

@ -50,6 +50,30 @@ local np_terrain = {
--flags = "" --flags = ""
} }
minetest.register_decoration({
name = "nether:tree",
deco_type = "schematic",
place_on = {"nether:netherrack"},
sidelen = 16,
noise_params = {
offset = 0.024,
scale = 0.015,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
},
--biomes = {},
y_max = -10000,
y_min = -15000,
schematic = nethertreeSchematic,
flags = "place_center_x, place_center_z",
rotation = "random",
spawn_by = "air",
num_spawn_by = 1,
})
-- Set singlenode mapgen (air nodes only). -- Set singlenode mapgen (air nodes only).
-- Disable the engine lighting calculation since that will be done for a -- Disable the engine lighting calculation since that will be done for a
@ -172,9 +196,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
data[vi] = c_bedrock data[vi] = c_bedrock
--elseif y <= 1 then --elseif y <= 1 then
-- data[vi] = c_water -- data[vi] = c_water
elseif y > -15000 then --elseif y > -15000 then
data[vi] = c_air --data[vi] = c_air
else elseif y <= -15000 then
data[vi] = c_lava data[vi] = c_lava
end end
@ -187,13 +211,15 @@ minetest.register_on_generated(function(minp, maxp, seed)
end end
end end
end end
-- After processing, write content ID data back to the voxelmanip. -- After processing, write content ID data back to the voxelmanip.
vm:set_data(data) vm:set_data(data)
-- Calculate lighting for what has been created. -- Calculate lighting for what has been created.
--vm:calc_lighting() --vm:calc_lighting()
minetest.generate_ores(vm) minetest.generate_ores(vm)
minetest.generate_decorations(vm)
--minetest.generate_decorations(vm) --minetest.generate_decorations(vm)
vm:set_lighting({day=7,night=7}, minp, maxp) vm:set_lighting({day=7,night=7}, minp, maxp)

View File

@ -270,3 +270,121 @@ for id,ore in pairs(ores) do
end, end,
}) })
end end
local colorize_ratio = 125
minetest.register_node("nether:tree", {
description = "Nether Tree",
tiles = {"treeCore.png^[colorize:red:"..colorize_ratio,"treeCore.png^[colorize:red:"..colorize_ratio,"treeOut.png^[colorize:red:"..colorize_ratio,"treeOut.png^[colorize:red:"..colorize_ratio,"treeOut.png^[colorize:red:"..colorize_ratio,"treeOut.png^[colorize:red:"..colorize_ratio},
groups = {wood = 1, tree = 1, pathable = 1},
sounds = main.woodSound(),
--set metadata so treecapitator doesn't destroy houses
on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing.type == "node" then
return
end
local sneak = placer:get_player_control().sneak
local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
if not sneak and noddef.on_rightclick then
minetest.item_place(itemstack, placer, pointed_thing)
return
end
local pos = pointed_thing.above
minetest.item_place_node(itemstack, placer, pointed_thing)
local meta = minetest.get_meta(pos)
meta:set_string("placed", "true")
return(itemstack)
end,
light_source = 7,
--treecapitator - move treecapitator into own file using override
on_dig = function(pos, node, digger)
--check if wielding axe?
local meta = minetest.get_meta(pos)
if not meta:contains("placed") then
--remove tree
for y = -6,6 do
local name = minetest.get_node(vector.new(pos.x,pos.y+y,pos.z)).name
--print(y)
if name == "nether:tree" then
minetest.node_dig(vector.new(pos.x,pos.y+y,pos.z), node, digger)
end
end
else
minetest.node_dig(pos, node, digger)
end
end
})
minetest.register_node("nether:wood", {
description = "Nether Wood",
tiles = {"wood.png^[colorize:red:"..colorize_ratio},
groups = {wood = 1, pathable = 1},
sounds = main.woodSound(),
light_source = 7,
})
minetest.register_node("nether:leaves", {
description = "Nether Leaves",
drawtype = "allfaces_optional",
waving = 1,
walkable = false,
climbable = true,
paramtype = "light",
is_ground_content = false,
tiles = {"leaves.png^[colorize:red:"..colorize_ratio},
groups = {leaves = 1, leafdecay = 1},
sounds = main.grassSound(),
light_source = 7,
drop = {
max_items = 1,
items= {
{
-- Only drop if using a tool whose name is identical to one
-- of these.
rarity = 10,
items = {"main:sapling"},
-- Whether all items in the dropped item list inherit the
-- hardware coloring palette color from the dug node.
-- Default is 'false'.
--inherit_color = true,
},
{
-- Only drop if using a tool whose name is identical to one
-- of these.
tools = {"main:shears"},
rarity = 2,
items = {"main:leaves"},
-- Whether all items in the dropped item list inherit the
-- hardware coloring palette color from the dug node.
-- Default is 'false'.
--inherit_color = true,
},
{
-- Only drop if using a tool whose name is identical to one
-- of these.
tools = {"main:shears"},
rarity = 2,
items = {"main:stick"},
-- Whether all items in the dropped item list inherit the
-- hardware coloring palette color from the dug node.
-- Default is 'false'.
--inherit_color = true,
},
{
-- Only drop if using a tool whose name is identical to one
-- of these.
tools = {"main:shears"},
rarity = 6,
items = {"main:apple"}, --golden apples
-- Whether all items in the dropped item list inherit the
-- hardware coloring palette color from the dug node.
-- Default is 'false'.
--inherit_color = true,
},
},
},
})

View File

@ -32,3 +32,37 @@ minetest.register_chatcommand("nether", {
minetest.place_schematic(pos, portalSchematic,"0",nil,true,"place_center_x, place_center_z") minetest.place_schematic(pos, portalSchematic,"0",nil,true,"place_center_x, place_center_z")
end, end,
}) })
--[[
left - > right
bottom - > top
front -> back
]]--
nethertreeSchematic = {
size = {x = 3, y = 6, z = 3},
data = {
-- The side of the bush, with the air on top
{name = "air"}, {name = "air"}, {name = "air"},
{name = "air"}, {name = "air"}, {name = "air"},
{name = "air"}, {name = "air"}, {name = "air"},
{name = "nether:leaves"}, {name = "nether:leaves"}, {name = "nether:leaves"}, -- lower layer
{name = "nether:leaves"}, {name = "nether:leaves"}, {name = "nether:leaves"}, -- middle layer
{name = "air"}, {name = "air"}, {name = "air"}, -- top layer
-- The center of the bush, with stem at the base and a pointy leave 2 nodes above
{name = "air"}, {name = "nether:tree"}, {name = "air"},
{name = "air"}, {name = "nether:tree"}, {name = "air"},
{name = "air"}, {name = "nether:tree"}, {name = "air"},
{name = "nether:leaves"}, {name = "nether:tree"}, {name = "nether:leaves"}, -- lower layer
{name = "nether:leaves"}, {name = "nether:tree"}, {name = "nether:leaves"}, -- middle layer
{name = "air"}, {name = "nether:leaves"}, {name = "air"}, -- top layer
-- The other side of the bush, same as first side
{name = "air"}, {name = "air"}, {name = "air"},
{name = "air"}, {name = "air"}, {name = "air"},
{name = "air"}, {name = "air"}, {name = "air"},
{name = "nether:leaves"}, {name = "nether:leaves"}, {name = "nether:leaves"}, -- lower layer
{name = "nether:leaves"}, {name = "nether:leaves"}, {name = "nether:leaves"}, -- middle layer
{name = "air"}, {name = "air"}, {name = "air"}, -- top layer
}
}