Remove nether mod for update
THIS IS NOT A STABLE VERSION AT ALL! This commit is just supposed to remove nether mod to avoid conflicts when the branch will be merged, after updates. It's also a check point from where I can rebase my updates if they break the repository.
4
mods/nether/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
## Generic ignorable patterns and files
|
||||
*~
|
||||
.*.swp
|
||||
debug.txt
|
@ -1,10 +0,0 @@
|
||||
This is a modified version of lkjoel's nether mod.
|
||||
Look here if you want to see the differences:
|
||||
https://github.com/HybridDog/minetest-nether/compare/lkjoel:master...master
|
||||
|
||||
this happens really selden to me
|
||||
http://i.imgur.com/pMZYqt9.png
|
||||
|
||||
|
||||
TODO:
|
||||
— finish nether forest
|
@ -1,3 +0,0 @@
|
||||
default
|
||||
hud
|
||||
stairs?
|
@ -1,422 +0,0 @@
|
||||
-- Minetest 0.4 Mod: Nether
|
||||
|
||||
local NETHER_DEPTH = -5000
|
||||
|
||||
minetest.register_node("nether:portal", {
|
||||
description = "Nether Portal",
|
||||
tiles = {
|
||||
"nether_transparent.png",
|
||||
"nether_transparent.png",
|
||||
"nether_transparent.png",
|
||||
"nether_transparent.png",
|
||||
{
|
||||
name = "nether_portal.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.5,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "nether_portal.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.5,
|
||||
},
|
||||
},
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
use_texture_alpha = true,
|
||||
walkable = false,
|
||||
digable = false,
|
||||
pointable = false,
|
||||
buildable_to = false,
|
||||
drop = "",
|
||||
light_source = 5,
|
||||
post_effect_color = {a=180, r=128, g=0, b=128},
|
||||
alpha = 192,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.1, 0.5, 0.5, 0.1},
|
||||
},
|
||||
},
|
||||
groups = {not_in_creative_inventory=1}
|
||||
})
|
||||
|
||||
local function build_portal(pos, target)
|
||||
local p = {x=pos.x-1, y=pos.y-1, z=pos.z}
|
||||
local p1 = {x=pos.x-1, y=pos.y-1, z=pos.z}
|
||||
local p2 = {x=p1.x+3, y=p1.y+4, z=p1.z}
|
||||
for i=1,4 do
|
||||
minetest.set_node(p, {name="default:obsidian"})
|
||||
p.y = p.y+1
|
||||
end
|
||||
for i=1,3 do
|
||||
minetest.set_node(p, {name="default:obsidian"})
|
||||
p.x = p.x+1
|
||||
end
|
||||
for i=1,4 do
|
||||
minetest.set_node(p, {name="default:obsidian"})
|
||||
p.y = p.y-1
|
||||
end
|
||||
for i=1,3 do
|
||||
minetest.set_node(p, {name="default:obsidian"})
|
||||
p.x = p.x-1
|
||||
end
|
||||
for x=p1.x,p2.x do
|
||||
for y=p1.y,p2.y do
|
||||
p = {x=x, y=y, z=p1.z}
|
||||
if not (x == p1.x or x == p2.x or y==p1.y or y==p2.y) then
|
||||
minetest.set_node(p, {name="nether:portal", param2=0})
|
||||
end
|
||||
local meta = minetest.get_meta(p)
|
||||
meta:set_string("p1", minetest.pos_to_string(p1))
|
||||
meta:set_string("p2", minetest.pos_to_string(p2))
|
||||
meta:set_string("target", minetest.pos_to_string(target))
|
||||
|
||||
if y ~= p1.y then
|
||||
for z=-2,2 do
|
||||
if z ~= 0 then
|
||||
p.z = p.z+z
|
||||
if minetest.registered_nodes[minetest.get_node(p).name].is_ground_content then
|
||||
minetest.remove_node(p)
|
||||
end
|
||||
p.z = p.z-z
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"nether:portal"},
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
action = function(pos, node)
|
||||
minetest.add_particlespawner(
|
||||
32, --amount
|
||||
4, --time
|
||||
{x=pos.x-0.25, y=pos.y-0.25, z=pos.z-0.25}, --minpos
|
||||
{x=pos.x+0.25, y=pos.y+0.25, z=pos.z+0.25}, --maxpos
|
||||
{x=-0.8, y=-0.8, z=-0.8}, --minvel
|
||||
{x=0.8, y=0.8, z=0.8}, --maxvel
|
||||
{x=0,y=0,z=0}, --minacc
|
||||
{x=0,y=0,z=0}, --maxacc
|
||||
0.5, --minexptime
|
||||
1, --maxexptime
|
||||
1, --minsize
|
||||
2, --maxsize
|
||||
false, --collisiondetection
|
||||
"nether_particle.png" --texture
|
||||
)
|
||||
for _,obj in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
|
||||
if obj:is_player() then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local target = minetest.string_to_pos(meta:get_string("target"))
|
||||
if target then
|
||||
minetest.after(3, function(obj, pos, target)
|
||||
local objpos = obj:getpos()
|
||||
objpos.y = objpos.y+0.1 -- Fix some glitches at -8000
|
||||
if minetest.get_node(objpos).name ~= "nether:portal" then
|
||||
return
|
||||
end
|
||||
|
||||
obj:setpos(target)
|
||||
|
||||
local function check_and_build_portal(pos, target)
|
||||
local n = minetest.get_node_or_nil(target)
|
||||
if n and n.name ~= "nether:portal" then
|
||||
build_portal(target, pos)
|
||||
minetest.after(2, check_and_build_portal, pos, target)
|
||||
minetest.after(4, check_and_build_portal, pos, target)
|
||||
elseif not n then
|
||||
minetest.after(1, check_and_build_portal, pos, target)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.after(1, check_and_build_portal, pos, target)
|
||||
|
||||
end, obj, pos, target)
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local function move_check(p1, max, dir)
|
||||
local p = {x=p1.x, y=p1.y, z=p1.z}
|
||||
local d = math.abs(max-p1[dir]) / (max-p1[dir])
|
||||
while p[dir] ~= max do
|
||||
p[dir] = p[dir] + d
|
||||
if minetest.get_node(p).name ~= "default:obsidian" then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
local function check_portal(p1, p2)
|
||||
if p1.x ~= p2.x then
|
||||
if not move_check(p1, p2.x, "x") then
|
||||
return false
|
||||
end
|
||||
if not move_check(p2, p1.x, "x") then
|
||||
return false
|
||||
end
|
||||
elseif p1.z ~= p2.z then
|
||||
if not move_check(p1, p2.z, "z") then
|
||||
return false
|
||||
end
|
||||
if not move_check(p2, p1.z, "z") then
|
||||
return false
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
if not move_check(p1, p2.y, "y") then
|
||||
return false
|
||||
end
|
||||
if not move_check(p2, p1.y, "y") then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local function is_portal(pos)
|
||||
for d=-3,3 do
|
||||
for y=-4,4 do
|
||||
local px = {x=pos.x+d, y=pos.y+y, z=pos.z}
|
||||
local pz = {x=pos.x, y=pos.y+y, z=pos.z+d}
|
||||
if check_portal(px, {x=px.x+3, y=px.y+4, z=px.z}) then
|
||||
return px, {x=px.x+3, y=px.y+4, z=px.z}
|
||||
end
|
||||
if check_portal(pz, {x=pz.x, y=pz.y+4, z=pz.z+3}) then
|
||||
return pz, {x=pz.x, y=pz.y+4, z=pz.z+3}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function make_portal(pos)
|
||||
local p1, p2 = is_portal(pos)
|
||||
if not p1 or not p2 then
|
||||
return false
|
||||
end
|
||||
|
||||
for d=1,2 do
|
||||
for y=p1.y+1,p2.y-1 do
|
||||
local p
|
||||
if p1.z == p2.z then
|
||||
p = {x=p1.x+d, y=y, z=p1.z}
|
||||
else
|
||||
p = {x=p1.x, y=y, z=p1.z+d}
|
||||
end
|
||||
if minetest.get_node(p).name ~= "air" then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local param2
|
||||
if p1.z == p2.z then param2 = 0 else param2 = 1 end
|
||||
|
||||
local target = {x=p1.x, y=p1.y, z=p1.z}
|
||||
target.x = target.x + 1
|
||||
if target.y < NETHER_DEPTH then
|
||||
target.y = math.random(-50, 20)
|
||||
else
|
||||
target.y = NETHER_DEPTH - math.random(500, 1500)
|
||||
end
|
||||
|
||||
for d=0,3 do
|
||||
for y=p1.y,p2.y do
|
||||
local p = {}
|
||||
if param2 == 0 then p = {x=p1.x+d, y=y, z=p1.z} else p = {x=p1.x, y=y, z=p1.z+d} end
|
||||
if minetest.get_node(p).name == "air" then
|
||||
minetest.set_node(p, {name="nether:portal", param2=param2})
|
||||
end
|
||||
local meta = minetest.get_meta(p)
|
||||
meta:set_string("p1", minetest.pos_to_string(p1))
|
||||
meta:set_string("p2", minetest.pos_to_string(p2))
|
||||
meta:set_string("target", minetest.pos_to_string(target))
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_node(":default:obsidian", {
|
||||
description = "Obsidian",
|
||||
tiles = {"default_obsidian.png"},
|
||||
is_ground_content = true,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
groups = {cracky=1,level=2},
|
||||
|
||||
on_destruct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local p1 = minetest.string_to_pos(meta:get_string("p1"))
|
||||
local p2 = minetest.string_to_pos(meta:get_string("p2"))
|
||||
local target = minetest.string_to_pos(meta:get_string("target"))
|
||||
if not p1 or not p2 then
|
||||
return
|
||||
end
|
||||
for x=p1.x,p2.x do
|
||||
for y=p1.y,p2.y do
|
||||
for z=p1.z,p2.z do
|
||||
local nn = minetest.get_node({x=x,y=y,z=z}).name
|
||||
if nn == "default:obsidian" or nn == "nether:portal" then
|
||||
if nn == "nether:portal" then
|
||||
minetest.remove_node({x=x,y=y,z=z})
|
||||
end
|
||||
local m = minetest.get_meta({x=x,y=y,z=z})
|
||||
m:set_string("p1", "")
|
||||
m:set_string("p2", "")
|
||||
m:set_string("target", "")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
meta = minetest.get_meta(target)
|
||||
if not meta then
|
||||
return
|
||||
end
|
||||
p1 = minetest.string_to_pos(meta:get_string("p1"))
|
||||
p2 = minetest.string_to_pos(meta:get_string("p2"))
|
||||
if not p1 or not p2 then
|
||||
return
|
||||
end
|
||||
for x=p1.x,p2.x do
|
||||
for y=p1.y,p2.y do
|
||||
for z=p1.z,p2.z do
|
||||
local nn = minetest.get_node({x=x,y=y,z=z}).name
|
||||
if nn == "default:obsidian" or nn == "nether:portal" then
|
||||
if nn == "nether:portal" then
|
||||
minetest.remove_node({x=x,y=y,z=z})
|
||||
end
|
||||
local m = minetest.get_meta({x=x,y=y,z=z})
|
||||
m:set_string("p1", "")
|
||||
m:set_string("p2", "")
|
||||
m:set_string("target", "")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":default:mese_crystal_fragment", {
|
||||
description = "Mese Crystal Fragment",
|
||||
inventory_image = "default_mese_crystal_fragment.png",
|
||||
on_place = function(stack,_, pt)
|
||||
if pt.under and minetest.get_node(pt.under).name == "default:obsidian" then
|
||||
local done = make_portal(pt.under)
|
||||
if done and not minetest.setting_getbool("creative_mode") then
|
||||
stack:take_item()
|
||||
end
|
||||
end
|
||||
return stack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("nether:rack", {
|
||||
description = "Netherrack",
|
||||
tiles = {"nether_rack.png"},
|
||||
is_ground_content = true,
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {{
|
||||
rarity = 3,
|
||||
items = {"nether:rack"},
|
||||
}}
|
||||
},
|
||||
groups = {cracky=3,level=2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("nether:sand", {
|
||||
description = "Nethersand",
|
||||
tiles = {"nether_sand.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3,level=2,falling_node=1},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_gravel_footstep", gain=0.45},
|
||||
}),
|
||||
})
|
||||
|
||||
minetest.register_node("nether:glowstone", {
|
||||
description = "Glowstone",
|
||||
tiles = {"nether_glowstone.png"},
|
||||
is_ground_content = true,
|
||||
light_source = 13,
|
||||
groups = {cracky=3,oddly_breakable_by_hand=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("nether:brick", {
|
||||
description = "Nether Brick",
|
||||
tiles = {"nether_brick.png"},
|
||||
groups = {cracky=2,level=2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
local air = minetest.get_content_id("air")
|
||||
local stone_with_coal = minetest.get_content_id("default:stone_with_coal")
|
||||
local stone_with_iron = minetest.get_content_id("default:stone_with_iron")
|
||||
local stone_with_mese = minetest.get_content_id("default:stone_with_mese")
|
||||
local stone_with_diamond = minetest.get_content_id("default:stone_with_diamond")
|
||||
local stone_with_gold = minetest.get_content_id("default:stone_with_gold")
|
||||
local stone_with_copper = minetest.get_content_id("default:stone_with_copper")
|
||||
local gravel = minetest.get_content_id("default:gravel")
|
||||
local dirt = minetest.get_content_id("default:dirt")
|
||||
local sand = minetest.get_content_id("default:sand")
|
||||
local cobble = minetest.get_content_id("default:cobble")
|
||||
local mossycobble = minetest.get_content_id("default:mossycobble")
|
||||
local stair_cobble = minetest.get_content_id("stairs:stair_cobble")
|
||||
local lava_source = minetest.get_content_id("default:lava_source")
|
||||
local lava_flowing = minetest.get_content_id("default:lava_flowing")
|
||||
local glowstone = minetest.get_content_id("nether:glowstone")
|
||||
local nethersand = minetest.get_content_id("nether:sand")
|
||||
local netherbrick = minetest.get_content_id("nether:brick")
|
||||
local netherrack = minetest.get_content_id("nether:rack")
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if maxp.y > NETHER_DEPTH then
|
||||
return
|
||||
end
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local data = vm:get_data()
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
for i in area:iterp(minp, maxp) do
|
||||
local d = data[i]
|
||||
if d == air or d == stone_with_coal or d == stone_with_iron then
|
||||
data[i] = air
|
||||
elseif d == stone_with_mese or d == stone_with_diamond or d == lava_source then
|
||||
data[i] = lava_source
|
||||
elseif d == lava_flowing then
|
||||
-- nothing
|
||||
elseif d == stone_with_gold then
|
||||
data[i] = glowstone
|
||||
elseif d == stone_with_copper or d == gravel or d == dirt or d == sand then
|
||||
data[i] = nethersand
|
||||
elseif d == cobble or d == mossycobble or d == stair_cobble then
|
||||
data[i] = netherbrick
|
||||
else
|
||||
data[i] = netherrack
|
||||
end
|
||||
end
|
||||
vm:set_data(data)
|
||||
--vm:set_lighting({day=0, night=0})
|
||||
vm:calc_lighting()
|
||||
vm:update_liquids()
|
||||
vm:write_to_map()
|
||||
end)
|
@ -1,210 +0,0 @@
|
||||
minetest.register_craft({
|
||||
output = "nether:fim",
|
||||
recipe = {
|
||||
{"nether:shroom_head"},
|
||||
{"nether:fruit_no_leaf"},
|
||||
{"nether:shroom_head"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:fruit_leaves",
|
||||
recipe = {
|
||||
{"nether:fruit_leaf", "nether:fruit_leaf", "nether:fruit_leaf"},
|
||||
{"nether:fruit_leaf", "nether:fruit_leaf", "nether:fruit_leaf"},
|
||||
{"nether:fruit_leaf", "nether:fruit_leaf", "nether:fruit_leaf"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:pick_mushroom",
|
||||
recipe = {
|
||||
{"nether:shroom_head", "nether:shroom_head", "nether:shroom_head"},
|
||||
{"", "nether:shroom_stem", ""},
|
||||
{"", "nether:shroom_stem", ""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:pick_wood",
|
||||
recipe = {
|
||||
{"nether:wood_cooked", "nether:wood_cooked", "nether:wood_cooked"},
|
||||
{"", "group:stick", ""},
|
||||
{"", "group:stick", ""},
|
||||
}
|
||||
})
|
||||
|
||||
for _,m in pairs({"netherrack", "netherrack_blue", "white"}) do
|
||||
local input = "nether:"..m
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:pick_"..m,
|
||||
recipe = {
|
||||
{input, input, input},
|
||||
{"", "group:stick", ""},
|
||||
{"", "group:stick", ""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:axe_"..m,
|
||||
recipe = {
|
||||
{input, input},
|
||||
{input, "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:sword_"..m,
|
||||
recipe = {
|
||||
{input},
|
||||
{input},
|
||||
{"group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:shovel_"..m,
|
||||
recipe = {
|
||||
{input},
|
||||
{"group:stick"},
|
||||
{"group:stick"},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:netherrack_brick 4",
|
||||
recipe = {
|
||||
{"nether:netherrack", "nether:netherrack"},
|
||||
{"nether:netherrack", "nether:netherrack"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:netherrack_brick_black 4",
|
||||
recipe = {
|
||||
{"nether:netherrack_black", "nether:netherrack_black"},
|
||||
{"nether:netherrack_black", "nether:netherrack_black"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:netherrack_brick_blue 4",
|
||||
recipe = {
|
||||
{"nether:netherrack_blue", "nether:netherrack_blue"},
|
||||
{"nether:netherrack_blue", "nether:netherrack_blue"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:furnace",
|
||||
recipe = {
|
||||
{"nether:netherrack_brick", "nether:netherrack_brick", "nether:netherrack_brick"},
|
||||
{"nether:netherrack_brick", "", "nether:netherrack_brick"},
|
||||
{"nether:netherrack_brick", "nether:netherrack_brick", "nether:netherrack_brick"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:extractor",
|
||||
recipe = {
|
||||
{"nether:netherrack_brick", "nether:blood_top_cooked", "nether:netherrack_brick"},
|
||||
{"nether:blood_cooked", "nether:shroom_stem", "nether:blood_cooked"},
|
||||
{"nether:netherrack_brick", "nether:blood_stem_cooked", "nether:netherrack_brick"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:wood 4",
|
||||
recipe = {
|
||||
{"nether:blood_stem"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:wood_empty 4",
|
||||
recipe = {
|
||||
{"nether:blood_stem_empty"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:stick 4",
|
||||
recipe = {
|
||||
{"nether:wood_empty"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:forest_wood",
|
||||
recipe = {
|
||||
{"nether:forest_planks", "nether:forest_planks", "nether:forest_planks"},
|
||||
{"nether:forest_planks", "", "nether:forest_planks"},
|
||||
{"nether:forest_planks", "nether:forest_planks", "nether:forest_planks"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "nether:forest_planks 8",
|
||||
recipe = {
|
||||
{"nether:forest_wood"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({ --crafting bad here, needs to become changed
|
||||
output = "nether:forest_planks 7",
|
||||
recipe = {
|
||||
{"nether:tree"},
|
||||
},
|
||||
replacements = {{"nether:tree", "nether:bark 4"}},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:paper",
|
||||
recipe = {
|
||||
{"nether:grass_dried", "nether:grass_dried", "nether:grass_dried"},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:coal",
|
||||
recipe = "nether:tree",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "nether:grass_dried",
|
||||
recipe = "nether:grass",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "nether:pearl",
|
||||
recipe = "nether:fim",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "nether:hotbed",
|
||||
recipe = "nether:blood_extracted",
|
||||
})
|
||||
|
||||
for _,i in ipairs({"nether:blood", "nether:blood_top", "nether:blood_stem", "nether:wood"}) do
|
||||
local cooked = i.."_cooked"
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = cooked,
|
||||
recipe = i,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = cooked,
|
||||
burntime = 30,
|
||||
})
|
||||
end
|
@ -1,4 +0,0 @@
|
||||
default
|
||||
glow
|
||||
riesenpilz
|
||||
stairs
|
@ -1,409 +0,0 @@
|
||||
local cube = minetest.inventorycube
|
||||
|
||||
-- the content of the guide
|
||||
local guide_infos = {
|
||||
{
|
||||
description = "mushroom",
|
||||
{"text", "You can find the nether mushroom on the ground of the nether and on netherrack"..
|
||||
"soil, it can be dug by hand."},
|
||||
{"y", -0.3},
|
||||
{"image", {1, 1, "riesenpilz_nether_shroom_side.png"}},
|
||||
{"y", 0.2},
|
||||
{"text", "If you drop it without holding aux1 (the fast key), you can split it"..
|
||||
"into its stem and head:"},
|
||||
{"image", {1, 1, "nether_shroom_top.png", 1}},
|
||||
{"image", {1, 1, "nether_shroom_stem.png"}},
|
||||
{"y", 0.2},
|
||||
{"text", "You can get more mushrooms by using a netherrack soil:\n"..
|
||||
"1. search a dark place and, if necessary, place netherrack with air about it\n"..
|
||||
"2. right click with cooked blood onto the netherrack to make it soiled\n"..
|
||||
"3. right click onto the netherrack soil with a nether mushroom"..
|
||||
"head to add some spores\n"..
|
||||
"4. dig the mushroom which grew after some time to make place for"..
|
||||
"another one"},
|
||||
{"image", {1, 1, "riesenpilz_nether_shroom_side.png", 6, 0.12}},
|
||||
{"y", 1},
|
||||
{"image", {1, 1, "nether_netherrack.png^nether_netherrack_soil.png", 1.8}},
|
||||
{"image", {1, 1, "nether_hotbed.png", 1.3, -0.4}},
|
||||
{"image", {1, 1, "nether_netherrack.png^nether_netherrack_soil.png", 3.6}},
|
||||
{"image", {1, 1, "nether_shroom_top.png", 3.1, -0.5}},
|
||||
{"image", {1, 1, "nether_netherrack.png^nether_netherrack_soil.png", 6}},
|
||||
{"image", {1, 1, "nether_netherrack.png"}},
|
||||
},
|
||||
{
|
||||
description = "tools",
|
||||
{"text", "You can craft 5 types of tools in the nether, which (except the mushroom pick)"..
|
||||
"require sticks to be crafted:"},
|
||||
{"y", 0.4},
|
||||
{"image", {1, 1, "nether_pick_mushroom.png"}},
|
||||
{"text", "strength: 1\n"..
|
||||
"The mushroom pick needs mushroom stems and heads to be crafted."},
|
||||
{"y", 0.2},
|
||||
{"image", {1, 1, "nether_pick_wood.png"}},
|
||||
{"text", "strength: 2\n"..
|
||||
"The nether wood pick can be crafted with cooked nether blood wood."},
|
||||
{"y", 0.2},
|
||||
{"image", {1, 1, "nether_axe_netherrack.png", 1}},
|
||||
{"image", {1, 1, "nether_shovel_netherrack.png", 2}},
|
||||
{"image", {1, 1, "nether_sword_netherrack.png", 3}},
|
||||
{"image", {1, 1, "nether_pick_netherrack.png"}},
|
||||
{"text", "strength: 3\n"..
|
||||
"The red netherrack tools can be crafted with usual netherrack."},
|
||||
{"y", 0.2},
|
||||
{"image", {1, 1, "nether_axe_netherrack_blue.png", 1}},
|
||||
{"image", {1, 1, "nether_shovel_netherrack_blue.png", 2}},
|
||||
{"image", {1, 1, "nether_sword_netherrack_blue.png", 3}},
|
||||
{"image", {1, 1, "nether_pick_netherrack_blue.png"}},
|
||||
{"text", "strength: 3\n"..
|
||||
"The blue netherrack tools can be crafted with blue netherrack."},
|
||||
{"y", 0.2},
|
||||
{"image", {1, 1, "nether_axe_white.png", 1}},
|
||||
{"image", {1, 1, "nether_shovel_white.png", 2}},
|
||||
{"image", {1, 1, "nether_sword_white.png", 3}},
|
||||
{"image", {1, 1, "nether_pick_white.png"}},
|
||||
{"text", "strength: 3\n"..
|
||||
"The siwtonic tools can be crafted with the"..
|
||||
"siwtonic ore."},
|
||||
},
|
||||
{
|
||||
description = "blood structures",
|
||||
{"text", "You can find blood structures on the ground and dig their nodes"..
|
||||
"even with the bare hand."},
|
||||
{"y", 0.2},
|
||||
{"text", "One contains 4 kinds of blocks:"},
|
||||
{"image", {1, 1, cube("nether_blood.png"), 1}},
|
||||
{"image", {1, 1,
|
||||
cube("nether_blood_top.png", "nether_blood.png^nether_blood_side.png", "nether_blood.png^nether_blood_side.png"),
|
||||
2}},
|
||||
{"image", {1, 1, "nether_fruit.png", 3}},
|
||||
{"image", {1, 1, cube("nether_blood_stem_top.png", "nether_blood_stem.png", "nether_blood_stem.png")}},
|
||||
{"text", "the blood stem, blood, blood head and nether fruit"},
|
||||
{"y", 0.2},
|
||||
{"text", "You can craft the stem to 4 blood wood:"},
|
||||
{"image", {1, 1, cube("nether_wood.png")}},
|
||||
{"y", 0.2},
|
||||
{"text", "The 4 blood nodes can be cooked and, except blood wood,"..
|
||||
"their blood can be extracted."},
|
||||
},
|
||||
{
|
||||
description = "fruit",
|
||||
{"text", "You can find the nether fruit at blood structures and dig"..
|
||||
"it even with the bare hand."},
|
||||
{"y", 0.05},
|
||||
{"image", {1, 1, "nether_fruit.png"}},
|
||||
{"text", "You can eat it to get a bit blood because of its acid effect:"},
|
||||
{"image", {1, 1, "nether_blood_extracted.png"}},
|
||||
{"y", 0.2},
|
||||
{"text", "If you eat it at the right place inside a portal, you teleport"..
|
||||
"instead of getting blood."},
|
||||
{"y", 0.2},
|
||||
{"text", "If you drop without holding aux1 (the fast key), you can split"..
|
||||
"it into its fruit and leaf:"},
|
||||
{"image", {1, 1, "nether_fruit_leaf.png", 1}},
|
||||
{"image", {1, 1, "nether_fruit_no_leaf.png"}},
|
||||
{"y", 0.2},
|
||||
{"text", "9 fruit leaves can be crafted to a fruit leaves block and the"..
|
||||
"fruit without leaf can be used for crafting a nether pearl."},
|
||||
{"y", 0.2},
|
||||
{"image", {1, 1, cube("nether_fruit_leaves.png")}},
|
||||
{"text", "fruit leaves block"},
|
||||
},
|
||||
{
|
||||
description = "cooking",
|
||||
{"text", "To get a furnace you need to dig at least 8 netherrack bricks.\n"..
|
||||
"They can be found at pyramid like constructions and require at"..
|
||||
"least a strength 1 nether pick to be dug.\n"..
|
||||
"For crafting the furnace, use the netherrack bricks like cobble:"},
|
||||
{"y", 0.2},
|
||||
{"image", {0.5, 0.5, cube("nether_netherrack_brick.png"), 0.5}},
|
||||
{"image", {0.5, 0.5, cube("nether_netherrack_brick.png"), 1}},
|
||||
{"image", {0.5, 0.5, cube("nether_netherrack_brick.png")}},
|
||||
{"image", {0.5, 0.5, cube("nether_netherrack_brick.png"), 1}},
|
||||
{"image", {0.5, 0.5, cube("nether_netherrack_brick.png")}},
|
||||
{"image", {0.5, 0.5, cube("nether_netherrack_brick.png"), 0.5}},
|
||||
{"image", {0.5, 0.5, cube("nether_netherrack_brick.png"), 1}},
|
||||
{"image", {0.5, 0.5, cube("nether_netherrack_brick.png")}},
|
||||
{"y", 0.2},
|
||||
{"text", "To begin cooking stuff, you can use a mushroom or fruit.\n"..
|
||||
"After that it's recommended to use cooked blood nodes."},
|
||||
{"y", 0.2},
|
||||
{"text", "Some nether items can be cooked:"},
|
||||
{"y", 0.1},
|
||||
{"image", {1, 1, cube("nether_blood_stem_top_cooked.png", "nether_blood_stem_cooked.png", "nether_blood_stem_cooked.png"), 0.35}},
|
||||
{"image", {1, 1, cube("nether_blood_cooked.png"), 1.6}},
|
||||
{"image", {1, 1,
|
||||
cube("nether_blood_top_cooked.png", "nether_blood_cooked.png^nether_blood_side_cooked.png", "nether_blood_cooked.png^nether_blood_side_cooked.png"),
|
||||
2.9}},
|
||||
{"image", {1, 1, cube("nether_wood_cooked.png"), 4.3}},
|
||||
{"y", 1},
|
||||
{"text", "cooked blood stem,cooked blood,cooked blood head,cooked blood wood,"},
|
||||
{"y", 0.2},
|
||||
{"image", {1, 1, "nether_hotbed.png", 0.3}},
|
||||
{"image", {1, 1, "nether_pearl.png", 2}},
|
||||
{"y", 1},
|
||||
{"text", "cooked extracted blood and nether pearl"},
|
||||
},
|
||||
{
|
||||
description = "extractor",
|
||||
{"text", "Here you can find out information about the nether extractor."},
|
||||
{"y", 0.4},
|
||||
{"text", "Here you can see its craft recipe:"},
|
||||
{"y", 0.2},
|
||||
{"image", {0.5, 0.5, cube("nether_blood_top_cooked.png", "nether_blood_cooked.png^nether_blood_side_cooked.png", "nether_blood_cooked.png^nether_blood_side_cooked.png"), 0.5}},
|
||||
{"image", {0.5, 0.5, cube("nether_netherrack_brick.png"), 1}},
|
||||
{"image", {0.5, 0.5, cube("nether_netherrack_brick.png")}},
|
||||
{"image", {0.5, 0.5, cube("nether_blood_extractor.png"), 2.5}},
|
||||
{"image", {0.5, 0.5, "nether_shroom_stem.png", 0.5}},
|
||||
{"image", {0.5, 0.5, cube("nether_blood_cooked.png"), 1}},
|
||||
{"image", {0.5, 0.5, cube("nether_blood_cooked.png")}},
|
||||
{"image", {0.5, 0.5, cube("nether_blood_stem_top_cooked.png", "nether_blood_stem_cooked.png", "nether_blood_stem_cooked.png"), 0.5}},
|
||||
{"image", {0.5, 0.5, cube("nether_netherrack_brick.png"), 1}},
|
||||
{"image", {0.5, 0.5, cube("nether_netherrack_brick.png")}},
|
||||
{"y", 0.2},
|
||||
{"text", "You can extract blood from the blood nodes you get from the blood"..
|
||||
"structure.\n"..
|
||||
"You can also get blood with a nether fruit."},
|
||||
{"y", 0.2},
|
||||
{"text", "So you can use it:\n"..
|
||||
"1. place it somewhere\n"..
|
||||
"2. place blood blocks next to it (4 or less)\n"..
|
||||
"3. right click with extracted blood onto it to power it\n"..
|
||||
"4. take the new extracted blood and dig the extracted nodes"},
|
||||
{"y", 0.2},
|
||||
{"text", "Example (view from the top):"},
|
||||
{"y", 0.88},
|
||||
{"image", {1, 1, "nether_blood_stem_top.png", 0.82, -0.88}},
|
||||
{"image", {1, 1, "nether_blood.png", 1.63}},
|
||||
{"image", {1, 1, "nether_blood_extractor.png", 0.82}},
|
||||
{"image", {1, 1, "nether_blood_stem_top_empty.png", 3.82, -0.88}},
|
||||
{"image", {1, 1, "nether_blood_empty.png", 4.63}},
|
||||
{"image", {1, 1, "nether_blood_empty.png", 3.001}},
|
||||
{"image", {1, 1, "nether_blood_extractor.png", 3.82}},
|
||||
{"image", {1, 1, "nether_blood.png"}},
|
||||
{"image", {1, 1, "nether_blood.png", 0.82, -0.12}},
|
||||
{"image", {1, 1, "nether_blood_empty.png", 3.82, -0.12}},
|
||||
{"y", 1.2},
|
||||
{"text", "The nether blood stem extracted can be crafted to nether wood,"..
|
||||
"which can be crafted to nether sticks."},
|
||||
},
|
||||
{
|
||||
description = "ores",
|
||||
{"text", "You can find 5 types of ores:"},
|
||||
{"y", 0.4},
|
||||
{"image", {1, 1, cube("nether_netherrack_black.png"), 4}},
|
||||
{"image", {1, 1, cube("nether_netherrack.png")}},
|
||||
{"text", "The red netherrack is generated like stone and the black"..
|
||||
"netherrack is generated like gravel.\n"..
|
||||
"Both require at least a strength 2 nether pick to be dug."},
|
||||
{"y", 0.2},
|
||||
{"image", {1, 1, cube("nether_white.png"), 4}},
|
||||
{"image", {1, 1, cube("nether_netherrack_blue.png")}},
|
||||
{"text", "The blue netherrack is generated like diamond ore and the"..
|
||||
"siwtonic ore is generated like mese blocks.\n"..
|
||||
"Both require at least a strength 3 nether pick to be dug."},
|
||||
{"y", 0.2},
|
||||
{"image", {1, 1, cube("nether_netherrack_tiled.png"), 4}},
|
||||
{"image", {1, 1, cube("glow_stone.png")}},
|
||||
{"text", "The glow stone can be used for lighting and the tiled netherrack"..
|
||||
"is generated like coal ore.\n"..
|
||||
"Glow stone requires at least a strength 1 pick to be dug.\n"..
|
||||
"Tiled netherrack requires at least a strength 2 nether pick to"..
|
||||
"be dug."},
|
||||
},
|
||||
{
|
||||
description = "vines",
|
||||
{"text", "The nether vines can be fed with blood.\n"..
|
||||
"They can be dug by hand and drop nether children."},
|
||||
{"image", {1, 1, "nether_vine.png"}},
|
||||
{"y", 0.2},
|
||||
{"text", "To let a nether child grow to a blood structure, place it at"..
|
||||
"a dark place onto a blood structure head node."},
|
||||
{"image", {1, 1, "nether_sapling.png"}},
|
||||
{"y", -0.11},
|
||||
{"image", {1, 1, "nether_blood.png^nether_blood_side.png"}},
|
||||
},
|
||||
{
|
||||
description = "pearl",
|
||||
{"text", "The nether pearl can be thrown for teleporting.\n"..
|
||||
"So cou can get one:"},
|
||||
{"y", 0.4},
|
||||
{"text", "At first you need to craft 2 mushroom heads and 1 nether fruit"..
|
||||
"without leaf together:"},
|
||||
{"image", {1, 1, "nether_shroom_top.png"}},
|
||||
{"image", {1, 1, "nether_fim.png", 3}},
|
||||
{"image", {1, 1, "nether_fruit_no_leaf.png"}},
|
||||
{"image", {1, 1, "nether_shroom_top.png"}},
|
||||
{"y", 0.2},
|
||||
{"text", "Then you need to put the result into the furnance to cook it"..
|
||||
"to a nether pearl:"},
|
||||
{"image", {1, 1, "nether_pearl.png"}},
|
||||
},
|
||||
{
|
||||
description = "bricks",
|
||||
{"text", "You can craft bricks of red, black and blue netherrack."},
|
||||
{"y", 0.4},
|
||||
{"image", {1, 1, cube("nether_netherrack_brick_black.png"), 1}},
|
||||
{"image", {1, 1, cube("nether_netherrack_brick_blue.png"), 2}},
|
||||
{"image", {1, 1, cube("nether_netherrack_brick.png")}},
|
||||
{"y", 0.2},
|
||||
{"text", "These bricks require at least a strength 1 nether pick to be dug."},
|
||||
{"y", 0.2},
|
||||
{"text", "Because the crafing recipe of bricks is well known, it's not shown here."},
|
||||
},
|
||||
{
|
||||
description = "portal",
|
||||
{"text", "Here you can find out how to built the nether portal."},
|
||||
{"y", 0.4},
|
||||
{"text", "A nether portal requires following nodes:"},
|
||||
{"y", 0.05},
|
||||
{"text", "26 nether wood\n"..
|
||||
"12 blue netherrack bricks\n"..
|
||||
"16 black netherrack\n"..
|
||||
"8 red netherrack\n"..
|
||||
"8 cooked nether blood\n"..
|
||||
"4 nether fruits\n"..
|
||||
"2 siwtonic blocks"},
|
||||
{"y", 0.2},
|
||||
{"text", "It should look approximately like this one:"},
|
||||
{"image", {5.625, 6, "nether_teleporter.png", 0, -1.5}},
|
||||
{"y", 5.5},
|
||||
{"text", "You can activate it by standing in the middle on a siwtonic"..
|
||||
"block and eating a nether fruit.\n"..
|
||||
"Don't forget to take enough stuff with you to be able to build"..
|
||||
"a portal back."},
|
||||
},
|
||||
{
|
||||
description = "nether forest",
|
||||
{"text", "The nether forest is generated in caves above the usual nether."},
|
||||
{"y", 0.2},
|
||||
{"text", "There you can find some plants:"},
|
||||
{"y", 0.2},
|
||||
{"image", {1, 1, "nether_grass_middle.png", 1}},
|
||||
{"image", {1, 1, "nether_grass_big.png", 2}},
|
||||
{"image", {1, 1, "nether_grass_small.png"}},
|
||||
{"y", 0.2},
|
||||
{"text", "The nether forest grass can be used to get paper.\n"..
|
||||
"Just dig it, put the grass into the furnace and craft paper"..
|
||||
"out of the dried grass.\n"..
|
||||
"The recipe is similar to the one of crafting paper with papyrus."},
|
||||
{"y", 0.2},
|
||||
{"image", {1, 1, cube("nether_tree_top.png", "nether_tree.png", "nether_tree.png")}},
|
||||
{"text", "Nether trunks can be found at nether trees, you can craft"..
|
||||
"nether wood out of them."},
|
||||
{"y", 0.2},
|
||||
{"image", {1, 1, "nether_glowflower.png"}},
|
||||
{"text", "Currently this flower can be used for lighting and decoration."},
|
||||
},
|
||||
}
|
||||
|
||||
-- the size of guide pages
|
||||
local guide_size = {x=15, y=10, cx=0.1, cy=-0.2}
|
||||
|
||||
-- informations about settings and ...
|
||||
local formspec_offset = {x=0.25, y=0.55}
|
||||
local font_size
|
||||
if minetest.is_singleplayer() then
|
||||
font_size = tonumber(minetest.setting_get("font_size")) or 13
|
||||
else
|
||||
font_size = 13
|
||||
end
|
||||
guide_size.fx = math.floor((guide_size.x-2*(guide_size.cx+formspec_offset.x))*font_size)
|
||||
guide_size.fy = font_size/65
|
||||
|
||||
-- the default guide formspecs
|
||||
local guide_forms = {
|
||||
contents = "size[3,"..(#guide_infos+1)*0.5 ..";]label["..guide_size.cx+0.8 ..","..guide_size.cy..";Contents:]",
|
||||
}
|
||||
|
||||
-- change the infos to formspecs
|
||||
for n,data in ipairs(guide_infos) do
|
||||
local form = ""
|
||||
local y = 0
|
||||
local x = guide_size.cx
|
||||
for _,i in ipairs(data) do
|
||||
local typ, content = unpack(i)
|
||||
if typ == "y" then
|
||||
y = y+content
|
||||
elseif typ == "x" then
|
||||
x = math.max(x, content)
|
||||
elseif typ == "text" then
|
||||
local tab = minetest.splittext(content, guide_size.fx)
|
||||
local l = guide_size.cx
|
||||
for _,str in ipairs(tab) do
|
||||
form = form.."label["..guide_size.cx..","..guide_size.cy+y..";"..str.."]"
|
||||
y = y+guide_size.fy
|
||||
l = math.max(l, #str)
|
||||
end
|
||||
x = math.max(x, l/font_size)
|
||||
elseif typ == "image" then
|
||||
local w, h, texture_name, px, py = unpack(content)
|
||||
if not px then
|
||||
form = form.."image["..guide_size.cx..","..guide_size.cy+y+h*0.3 ..";"..w..","..h..";"..texture_name.."]"
|
||||
y = y+h
|
||||
else
|
||||
px = guide_size.cx+px
|
||||
py = py or 0
|
||||
form = form.."image["..px..","..
|
||||
guide_size.cy+y+h*0.3+py ..";"..w..","..h..";"..texture_name.."]"
|
||||
x = math.max(x, px+w)
|
||||
end
|
||||
end
|
||||
end
|
||||
form = "size["..x..","..y+1 ..";]"..form.."button["..x/2-0.5 ..","..y ..";1,2;quit;back]"
|
||||
guide_forms[n] = {data.description, form}
|
||||
end
|
||||
|
||||
local desc_tab = {}
|
||||
for n,i in ipairs(guide_forms) do
|
||||
desc_tab[i[1]] = n
|
||||
end
|
||||
|
||||
-- creates contents formspec
|
||||
local y = 0
|
||||
for y,i in ipairs(guide_forms) do
|
||||
local desc, form = unpack(i)
|
||||
local s = #desc*1.3/font_size+0.3
|
||||
guide_forms.contents = guide_forms.contents.."button["..guide_size.cx+math.random()..","..guide_size.cy+y/2 ..";"..s..",1;name;"..desc.."]"
|
||||
end
|
||||
|
||||
-- shows the contents of the formspec
|
||||
local function show_guide(pname)
|
||||
minetest.show_formspec(pname, "nether_guide_contents", guide_forms["contents"])
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname == "nether_guide_contents" then
|
||||
local fname = fields.name
|
||||
local pname = player:get_player_name()
|
||||
if fname
|
||||
and pname then
|
||||
minetest.show_formspec(pname, "nether_guide", guide_forms[desc_tab[fname]][2])
|
||||
end
|
||||
elseif formname == "nether_guide" then
|
||||
local fname = fields.quit
|
||||
local pname = player:get_player_name()
|
||||
if fname
|
||||
and pname then
|
||||
minetest.show_formspec(pname, "nether_guide_contents", guide_forms["contents"])
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_chatcommand("nether_help", {
|
||||
params = "",
|
||||
description = "Shows a nether guide",
|
||||
func = function(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then
|
||||
minetest.chat_send_player(name, "Something went wrong.")
|
||||
return false
|
||||
end
|
||||
if player:getpos().y > nether.start then
|
||||
minetest.chat_send_player(name, "Usually you don't neet this guide here. You can view it in the nether.")
|
||||
return false
|
||||
end
|
||||
minetest.chat_send_player(name, "Showing guide...")
|
||||
show_guide(name)
|
||||
return true
|
||||
end
|
||||
})
|
@ -1,974 +0,0 @@
|
||||
-- Nether Mod (based on Nyanland by Jeija, Catapult by XYZ, and Livehouse by neko259)
|
||||
-- lkjoel (main developer, code, ideas, textures)
|
||||
-- == CONTRIBUTERS ==
|
||||
-- jordan4ibanez (code, ideas, textures)
|
||||
-- Gilli (code, ideas, textures, mainly for the Glowstone)
|
||||
-- Death Dealer (code, ideas, textures)
|
||||
-- LolManKuba (ideas, textures)
|
||||
-- IPushButton2653 (ideas, textures)
|
||||
-- Menche (textures)
|
||||
-- sdzen (ideas)
|
||||
-- godkiller447 (ideas)
|
||||
-- If I didn't list you, please let me know!
|
||||
|
||||
nether = nether or {}
|
||||
|
||||
--== EDITABLE OPTIONS ==--
|
||||
|
||||
--says some information.
|
||||
nether.info = true
|
||||
|
||||
-- tell everyone about the generation
|
||||
nether.inform_all = minetest.is_singleplayer()
|
||||
|
||||
--1:<a bit of information> 2:<acceptable amount of information> 3:<lots of text>
|
||||
nether.max_spam = 2
|
||||
|
||||
-- Depth of the nether
|
||||
local nether_middle = -20000
|
||||
|
||||
-- forest bottom perlin multiplication
|
||||
local f_bottom_scale = 4
|
||||
|
||||
-- forest bottom height
|
||||
local f_h_min = nether_middle+10
|
||||
|
||||
-- forest top height
|
||||
local f_h_max = f_h_min+250
|
||||
|
||||
-- Frequency of trees in the nether forest (higher is less frequent)
|
||||
local tree_rarity = 200
|
||||
|
||||
-- Frequency of glowflowers in the nether forest (higher is less frequent)
|
||||
local glowflower_rarity = 120
|
||||
|
||||
-- Frequency of nether grass in the nether forest (higher is less frequent)
|
||||
local grass_rarity = 2
|
||||
|
||||
-- Frequency of nether mushrooms in the nether forest (higher is less frequent)
|
||||
local mushroom_rarity = 80
|
||||
|
||||
-- Frequency of trees in the nether forest (higher is less frequent)
|
||||
local tree_rarity = 200
|
||||
|
||||
-- height of the nether generation's end
|
||||
nether.start = f_h_max+100
|
||||
|
||||
-- Height of the nether (bottom of the nether is nether_middle - NETHER_HEIGHT)
|
||||
local NETHER_HEIGHT = 30
|
||||
|
||||
-- Maximum amount of randomness in the map generation
|
||||
NETHER_RANDOM = 2
|
||||
|
||||
-- Frequency of Glowstone on the "roof" of the Nether (higher is less frequent)
|
||||
local GLOWSTONE_FREQ_ROOF = 500
|
||||
|
||||
-- Frequency of lava (higher is less frequent)
|
||||
local LAVA_FREQ = 100
|
||||
|
||||
local nether_structure_freq = 350
|
||||
local NETHER_SHROOM_FREQ = 100
|
||||
|
||||
-- Maximum height of lava
|
||||
--LAVA_HEIGHT = 2
|
||||
-- Frequency of Glowstone on lava (higher is less frequent)
|
||||
--GLOWSTONE_FREQ_LAVA = 2
|
||||
-- Height of nether structures
|
||||
--NETHER_TREESIZE = 2
|
||||
-- Frequency of apples in a nether structure (higher is less frequent)
|
||||
--NETHER_APPLE_FREQ = 5
|
||||
-- Frequency of healing apples in a nether structure (higher is less frequent)
|
||||
--NETHER_HEAL_APPLE_FREQ = 10
|
||||
-- Start position for the Throne of Hades (y is relative to the bottom of the nether)
|
||||
--HADES_THRONE_STARTPOS = {x=0, y=1, z=0}
|
||||
-- Spawn pos for when the nether hasn't been loaded yet (i.e. no portal in the nether) (y is relative to the bottom of the nether)
|
||||
--NETHER_SPAWNPOS = {x=0, y=5, z=0}
|
||||
-- Structure of the nether portal (all is relative to the nether portal creator block)
|
||||
|
||||
--== END OF EDITABLE OPTIONS ==--
|
||||
|
||||
if nether.info then
|
||||
function nether:inform(msg, spam, t)
|
||||
if spam <= self.max_spam then
|
||||
local info
|
||||
if t then
|
||||
info = string.format("[nether] "..msg.." after ca. %.2fs", os.clock() - t)
|
||||
else
|
||||
info = "[nether] "..msg
|
||||
end
|
||||
print(info)
|
||||
if self.inform_all then
|
||||
minetest.chat_send_all(info)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
function nether:inform()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local path = minetest.get_modpath("nether")
|
||||
dofile(path.."/weird_mapgen_noise.lua")
|
||||
dofile(path.."/items.lua")
|
||||
dofile(path.."/pearl.lua")
|
||||
|
||||
local function table_contains(t, v)
|
||||
for _,i in pairs(t) do
|
||||
if i == v then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function dif(z1, z2)
|
||||
if z1 < 0
|
||||
and z2 < 0 then
|
||||
z1,z2 = -z1,-z2
|
||||
end
|
||||
return math.abs(z1-z2)
|
||||
end
|
||||
|
||||
local function pymg(x1, x2, z1, z2)
|
||||
return math.max(dif(x1, x2), dif(z1, z2))
|
||||
end
|
||||
|
||||
local function r_area(manip, width, height, pos)
|
||||
local emerged_pos1, emerged_pos2 = manip:read_from_map(
|
||||
{x=pos.x-width, y=pos.y, z=pos.z-width},
|
||||
{x=pos.x+width, y=pos.y+height, z=pos.z+width}
|
||||
)
|
||||
return VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
|
||||
end
|
||||
|
||||
local function set_vm_data(manip, nodes, pos, t1, name, generated)
|
||||
manip:set_data(nodes)
|
||||
manip:write_to_map()
|
||||
local spam = 2
|
||||
if generated then
|
||||
spam = 3
|
||||
end
|
||||
nether:inform(name.." grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", spam, t1)
|
||||
if not generated then
|
||||
local t1 = os.clock()
|
||||
manip:update_map()
|
||||
nether:inform("map updated", spam, t1)
|
||||
end
|
||||
end
|
||||
|
||||
local function fix_light(minp, maxp)
|
||||
local manip = minetest.get_voxel_manip()
|
||||
local emerged_pos1, emerged_pos2 = manip:read_from_map(minp, maxp)
|
||||
area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
|
||||
nodes = manip:get_data()
|
||||
|
||||
manip:set_data(nodes)
|
||||
manip:write_to_map()
|
||||
manip:update_map()
|
||||
end
|
||||
|
||||
-- Generated variables
|
||||
local NETHER_BOTTOM = (nether_middle - NETHER_HEIGHT)
|
||||
nether.buildings = NETHER_BOTTOM+12
|
||||
local NETHER_ROOF_ABS = (nether_middle - NETHER_RANDOM)
|
||||
local f_yscale_top = (f_h_max-f_h_min)/2
|
||||
local f_yscale_bottom = f_yscale_top/2
|
||||
--HADES_THRONE_STARTPOS_ABS = {x=HADES_THRONE_STARTPOS.x, y=(NETHER_BOTTOM + HADES_THRONE_STARTPOS.y), z=HADES_THRONE_STARTPOS.z}
|
||||
--LAVA_Y = (NETHER_BOTTOM + LAVA_HEIGHT)
|
||||
--HADES_THRONE_ABS = {}
|
||||
--HADES_THRONE_ENDPOS_ABS = {}
|
||||
--HADES_THRONE_GENERATED = minetest.get_worldpath() .. "/netherhadesthrone.txt"
|
||||
--NETHER_SPAWNPOS_ABS = {x=NETHER_SPAWNPOS.x, y=(NETHER_BOTTOM + NETHER_SPAWNPOS.y), z=NETHER_SPAWNPOS.z}
|
||||
--[[for i,v in ipairs(HADES_THRONE) do
|
||||
v.pos.x = v.pos.x + HADES_THRONE_STARTPOS_ABS.x
|
||||
v.pos.y = v.pos.y + HADES_THRONE_STARTPOS_ABS.y
|
||||
v.pos.z = v.pos.z + HADES_THRONE_STARTPOS_ABS.z
|
||||
HADES_THRONE_ABS[i] = v
|
||||
end
|
||||
local htx = 0
|
||||
local hty = 0
|
||||
local htz = 0
|
||||
for i,v in ipairs(HADES_THRONE_ABS) do
|
||||
if v.pos.x > htx then
|
||||
htx = v.pos.x
|
||||
end
|
||||
if v.pos.y > hty then
|
||||
hty = v.pos.y
|
||||
end
|
||||
if v.pos.z > htz then
|
||||
htz = v.pos.z
|
||||
end
|
||||
end
|
||||
HADES_THRONE_ENDPOS_ABS = {x=htx, y=hty, z=htz}]]
|
||||
|
||||
local c
|
||||
local function define_contents()
|
||||
c = {
|
||||
air = minetest.get_content_id("air"),
|
||||
lava = minetest.get_content_id("default:lava_source"),
|
||||
gravel = minetest.get_content_id("default:gravel"),
|
||||
coal = minetest.get_content_id("default:stone_with_coal"),
|
||||
diamond = minetest.get_content_id("default:stone_with_diamond"),
|
||||
mese = minetest.get_content_id("default:mese"),
|
||||
|
||||
glowstone = minetest.get_content_id("glow:stone"), --https://github.com/Zeg9/minetest-glow
|
||||
|
||||
nether_shroom = minetest.get_content_id("riesenpilz:nether_shroom"),
|
||||
|
||||
netherrack = minetest.get_content_id("nether:netherrack"),
|
||||
netherrack_tiled = minetest.get_content_id("nether:netherrack_tiled"),
|
||||
netherrack_black = minetest.get_content_id("nether:netherrack_black"),
|
||||
netherrack_blue = minetest.get_content_id("nether:netherrack_blue"),
|
||||
netherrack_brick = minetest.get_content_id("nether:netherrack_brick"),
|
||||
white = minetest.get_content_id("nether:white"),
|
||||
|
||||
nether_vine = minetest.get_content_id("nether:vine"),
|
||||
blood = minetest.get_content_id("nether:blood"),
|
||||
blood_top = minetest.get_content_id("nether:blood_top"),
|
||||
blood_stem = minetest.get_content_id("nether:blood_stem"),
|
||||
nether_apple = minetest.get_content_id("nether:apple"),
|
||||
|
||||
nether_tree = minetest.get_content_id("nether:tree"),
|
||||
nether_tree_corner = minetest.get_content_id("nether:tree_corner"),
|
||||
nether_leaves = minetest.get_content_id("nether:leaves"),
|
||||
nether_grass = {
|
||||
minetest.get_content_id("nether:grass_small"),
|
||||
minetest.get_content_id("nether:grass_middle"),
|
||||
minetest.get_content_id("nether:grass_big")
|
||||
},
|
||||
glowflower = minetest.get_content_id("nether:glowflower"),
|
||||
nether_dirt = minetest.get_content_id("nether:dirt"),
|
||||
nether_dirt_top = minetest.get_content_id("nether:dirt_top"),
|
||||
nether_dirt_bottom = minetest.get_content_id("nether:dirt_bottom"),
|
||||
}
|
||||
end
|
||||
|
||||
local pr, contents_defined
|
||||
|
||||
local function return_nether_ore(id, glowstone)
|
||||
if glowstone
|
||||
and pr:next(0,GLOWSTONE_FREQ_ROOF) == 1 then
|
||||
return c.glowstone
|
||||
end
|
||||
if id == c.coal then
|
||||
return c.netherrack_tiled
|
||||
end
|
||||
if id == c.gravel then
|
||||
return c.netherrack_black
|
||||
end
|
||||
if id == c.diamond then
|
||||
return c.netherrack_blue
|
||||
end
|
||||
if id == c.mese then
|
||||
return c.white
|
||||
end
|
||||
return c.netherrack
|
||||
end
|
||||
|
||||
local f_perlins = {}
|
||||
|
||||
--local perlin1 = minetest.get_perlin(13,3, 0.5, 50) --Get map specific perlin
|
||||
-- local perlin2 = minetest.get_perlin(133,3, 0.5, 10)
|
||||
-- local perlin3 = minetest.get_perlin(112,3, 0.5, 5)
|
||||
local tmp = f_yscale_top*4
|
||||
local tmp2 = tmp/f_bottom_scale
|
||||
local perlins = {
|
||||
{
|
||||
seed = 13,
|
||||
octaves = 3,
|
||||
persist = 0.5,
|
||||
spread = {x=50, y=50, z=50},
|
||||
scale = 1,
|
||||
offset = 0,
|
||||
},
|
||||
{
|
||||
seed = 133,
|
||||
octaves = 3,
|
||||
persist = 0.5,
|
||||
spread = {x=10, y=10, z=10},
|
||||
scale = 1,
|
||||
offset = 0,
|
||||
},
|
||||
{
|
||||
seed = 112,
|
||||
octaves = 3,
|
||||
persist = 0.5,
|
||||
spread = {x=5, y=5, z=5},
|
||||
scale = 1,
|
||||
offset = 0,
|
||||
},
|
||||
--[[forest_bottom = {
|
||||
seed = 11,
|
||||
octaves = 3,
|
||||
persist = 0.8,
|
||||
spread = {x=tmp2, y=tmp2, z=tmp2},
|
||||
scale = 1,
|
||||
offset = 0,
|
||||
},]]
|
||||
forest_top = {
|
||||
seed = 21,
|
||||
octaves = 3,
|
||||
persist = 0.8,
|
||||
spread = {x=tmp, y=tmp, z=tmp},
|
||||
scale = 1,
|
||||
offset = 0,
|
||||
},
|
||||
}
|
||||
|
||||
local info = true
|
||||
local structures_enabled = true
|
||||
local vine_maxlength = math.floor(NETHER_HEIGHT/4+0.5)
|
||||
-- Create the Nether
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if not (maxp.y >= NETHER_BOTTOM-100 and minp.y <= nether.start) then --avoid big map generation
|
||||
return
|
||||
end
|
||||
local addpos = {}
|
||||
|
||||
local t1 = os.clock()
|
||||
nether:inform("generates at: x=["..minp.x.."; "..maxp.x.."]; y=["..minp.y.."; "..maxp.y.."]; z=["..minp.z.."; "..maxp.z.."]", 2)
|
||||
|
||||
if not contents_defined then
|
||||
define_contents()
|
||||
contents_defined = true
|
||||
end
|
||||
|
||||
local buildings = 0
|
||||
if maxp.y <= NETHER_BOTTOM then
|
||||
buildings = 1
|
||||
elseif minp.y <= nether.buildings then
|
||||
buildings = 2
|
||||
end
|
||||
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local data = vm:get_data()
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
|
||||
pr = PseudoRandom(seed+33)
|
||||
local tab,num = {},1
|
||||
local trees,num_trees = {},1
|
||||
|
||||
--local perlin1 = minetest.get_perlin(13,3, 0.5, 50) --Get map specific perlin
|
||||
--local perlin2 = minetest.get_perlin(133,3, 0.5, 10)
|
||||
--local perlin3 = minetest.get_perlin(112,3, 0.5, 5)
|
||||
|
||||
local side_length = maxp.x - minp.x + 1
|
||||
local map_lengths_xyz = {x=side_length, y=side_length, z=side_length}
|
||||
|
||||
local pmap1 = minetest.get_perlin_map(perlins[1], map_lengths_xyz):get2dMap_flat(minp)
|
||||
local pmap2 = minetest.get_perlin_map(perlins[2], map_lengths_xyz):get2dMap_flat(minp)
|
||||
local pmap3 = minetest.get_perlin_map(perlins[3], map_lengths_xyz):get2dMap_flat(minp)
|
||||
|
||||
local forest_possible = maxp.y > f_h_min and minp.y < f_h_max
|
||||
|
||||
--local pmap_f_bottom = minetest.get_perlin_map(perlins.forest_bottom, map_lengths_xyz):get2dMap_flat(minp)
|
||||
local perlin_f_bottom, pmap_f_top
|
||||
if forest_possible then
|
||||
perlin_f_bottom = minetest.get_perlin(11, 3, 0.8, tmp2)
|
||||
pmap_f_top = minetest.get_perlin_map(perlins.forest_top, map_lengths_xyz):get2dMap_flat(minp)
|
||||
end
|
||||
|
||||
local num2, tab2
|
||||
if buildings >= 1 then
|
||||
num2 = 1
|
||||
tab2 = nether_weird_noise({x=minp.x, y=nether.buildings-79, z=minp.z}, pymg, 200, 8, 10, 79)
|
||||
end
|
||||
|
||||
local count = 0
|
||||
for z=minp.z, maxp.z do
|
||||
for x=minp.x, maxp.x do
|
||||
|
||||
count = count+1
|
||||
|
||||
local test = pmap1[count]+1
|
||||
local test2 = pmap2[count]
|
||||
local test3 = math.abs(pmap3[count])
|
||||
|
||||
local t = math.floor(test*3+0.5)
|
||||
|
||||
if test2 < 0 then
|
||||
h = math.floor(test2*3+0.5)-1
|
||||
else
|
||||
h = 3+t+pr:next(0,NETHER_RANDOM)
|
||||
end
|
||||
|
||||
local generate_vine = false
|
||||
if test3 >= 0.72+pr:next(0,NETHER_RANDOM)/10
|
||||
and pr:next(0,NETHER_RANDOM) == 1 then
|
||||
generate_vine = true
|
||||
end
|
||||
|
||||
local bottom = NETHER_BOTTOM+h
|
||||
local top = nether_middle-pr:next(0,NETHER_RANDOM)+t
|
||||
|
||||
local py_h = 0
|
||||
local difn, noisp, py_h_g
|
||||
if buildings >= 1 then
|
||||
py_h = tab2[num2].y
|
||||
num2 = num2+1
|
||||
|
||||
difn = nether.buildings-py_h
|
||||
if difn == 5 then
|
||||
noisp = 1
|
||||
elseif difn < 5 then
|
||||
noisp = 2
|
||||
end
|
||||
py_h_g = nether.buildings-7
|
||||
end
|
||||
|
||||
if buildings == 1
|
||||
and noisp then
|
||||
if noisp == 1 then
|
||||
for y=minp.y, maxp.y do
|
||||
local p_addpos = area:index(x, y, z)
|
||||
data[p_addpos] = c.netherrack_brick
|
||||
end
|
||||
else
|
||||
for y=minp.y, maxp.y do
|
||||
local p_addpos = area:index(x, y, z)
|
||||
data[p_addpos] = c.lava
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
local r_structure = pr:next(1,nether_structure_freq)
|
||||
local r_shroom = pr:next(1,NETHER_SHROOM_FREQ)
|
||||
local r_glowstone = pr:next(0,GLOWSTONE_FREQ_ROOF)
|
||||
local r_vine_length = pr:next(1,vine_maxlength)
|
||||
|
||||
local f_bottom, f_top, is_forest, f_h_dirt
|
||||
if forest_possible then
|
||||
local p = {x=math.floor(x/f_bottom_scale), z=math.floor(z/f_bottom_scale)}
|
||||
local pstr = p.x.." "..p.z
|
||||
if not f_perlins[pstr] then
|
||||
f_perlins[pstr] = math.floor(f_h_min+(math.abs(perlin_f_bottom:get2d({x=p.x, y=p.z})+1))*f_yscale_bottom+0.5)
|
||||
end
|
||||
f_bottom = f_perlins[pstr]+math.random(0,f_bottom_scale-1)
|
||||
f_top = math.floor(f_h_max-(pmap_f_top[count]+1)*f_yscale_top+0.5)
|
||||
is_forest = f_bottom < f_top
|
||||
f_h_dirt = f_bottom-pr:next(0,1)
|
||||
end
|
||||
|
||||
for y=minp.y, maxp.y do
|
||||
local p_addpos = area:index(x, y, z)
|
||||
local d_p_addp = data[p_addpos]
|
||||
--if py_h >= maxp.y-4 then
|
||||
if y <= py_h
|
||||
and noisp then
|
||||
if noisp == 1 then
|
||||
data[p_addpos] = c.netherrack_brick
|
||||
elseif noisp == 2 then
|
||||
if y == py_h then
|
||||
data[p_addpos] = c.netherrack_brick
|
||||
elseif y == py_h_g
|
||||
and pr:next(1,3) <= 2 then
|
||||
data[p_addpos] = c.netherrack
|
||||
elseif y <= py_h_g then
|
||||
data[p_addpos] = c.lava
|
||||
else
|
||||
data[p_addpos] = c.air
|
||||
end
|
||||
end
|
||||
elseif d_p_addp ~= c.air then
|
||||
|
||||
if is_forest
|
||||
and y == f_bottom then
|
||||
data[p_addpos] = c.nether_dirt_top
|
||||
elseif is_forest
|
||||
and y < f_bottom
|
||||
and y >= f_h_dirt then
|
||||
data[p_addpos] = c.nether_dirt
|
||||
elseif is_forest
|
||||
and y == f_h_dirt-1 then
|
||||
data[p_addpos] = c.nether_dirt_bottom
|
||||
elseif is_forest
|
||||
and y == f_h_dirt+1 then
|
||||
if pr:next(1,tree_rarity) == 1 then
|
||||
trees[num_trees] = {x=x, y=y, z=z}
|
||||
num_trees = num_trees+1
|
||||
elseif pr:next(1,mushroom_rarity) == 1 then
|
||||
data[p_addpos] = c.nether_shroom
|
||||
elseif pr:next(1,glowflower_rarity) == 1 then
|
||||
data[p_addpos] = c.glowflower
|
||||
elseif pr:next(1,grass_rarity) == 1 then
|
||||
data[p_addpos] = c.nether_grass[pr:next(1,3)]
|
||||
else
|
||||
data[p_addpos] = c.air
|
||||
end
|
||||
elseif is_forest
|
||||
and y > f_bottom
|
||||
and y < f_top then
|
||||
if not table_contains(
|
||||
{c.nether_tree, c.nether_tree_corner, c.nether_leaves, c.nether_fruit},
|
||||
d_p_addp
|
||||
) then
|
||||
data[p_addpos] = c.air
|
||||
end
|
||||
|
||||
elseif y <= NETHER_BOTTOM then
|
||||
if y <= bottom then
|
||||
data[p_addpos] = return_nether_ore(d_p_addp, true)
|
||||
else
|
||||
data[p_addpos] = c.lava
|
||||
end
|
||||
elseif r_structure == 1
|
||||
and y == bottom then
|
||||
tab[num] = {x=x, y=y-1, z=z}
|
||||
num = num+1
|
||||
elseif y <= bottom then
|
||||
if pr:next(1,LAVA_FREQ) == 1 then
|
||||
data[p_addpos] = c.lava
|
||||
else
|
||||
data[p_addpos] = return_nether_ore(d_p_addp, false)
|
||||
end
|
||||
elseif r_shroom == 1
|
||||
and r_structure ~= 1
|
||||
and y == bottom+1 then
|
||||
data[p_addpos] = c.nether_shroom
|
||||
elseif (y == top and r_glowstone == 1) then
|
||||
data[p_addpos] = c.glowstone
|
||||
elseif y >= top then
|
||||
data[p_addpos] = return_nether_ore(d_p_addp, true)
|
||||
elseif y <= top-1
|
||||
and generate_vine
|
||||
and y >= top-r_vine_length then
|
||||
data[p_addpos] = c.nether_vine
|
||||
else
|
||||
data[p_addpos] = c.air
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
vm:set_data(data)
|
||||
-- vm:set_lighting(12)
|
||||
-- vm:calc_lighting()
|
||||
-- vm:update_liquids()
|
||||
vm:write_to_map()
|
||||
|
||||
nether:inform("nodes set", 2, t1)
|
||||
|
||||
local t2 = os.clock()
|
||||
|
||||
if structures_enabled then --Trees:
|
||||
for _,v in ipairs(tab) do
|
||||
nether.grow_netherstructure(v, true)
|
||||
end
|
||||
end
|
||||
|
||||
if forest_possible then --Trees:
|
||||
for _,v in ipairs(trees) do
|
||||
nether.grow_tree(v, true)
|
||||
end
|
||||
end
|
||||
|
||||
nether:inform("trees set", 2, t2)
|
||||
|
||||
t2 = os.clock()
|
||||
fix_light(minp, maxp)
|
||||
|
||||
nether:inform("map updated", 2, t2)
|
||||
|
||||
nether:inform("done", 1, t1)
|
||||
end)
|
||||
|
||||
|
||||
function nether.grow_netherstructure(pos, generated)
|
||||
local t1 = os.clock()
|
||||
|
||||
if not contents_defined then
|
||||
define_contents()
|
||||
contents_defined = true
|
||||
end
|
||||
|
||||
if not pos.x then print(dump(pos))
|
||||
nether:inform("Error: "..dump(pos), 1)
|
||||
return
|
||||
end
|
||||
|
||||
local height = 6
|
||||
local manip = minetest.get_voxel_manip()
|
||||
local area = r_area(manip, 2, height, pos)
|
||||
local nodes = manip:get_data()
|
||||
|
||||
for i = 0, height-1 do
|
||||
nodes[area:index(pos.x, pos.y+i, pos.z)] = c.blood_stem
|
||||
end
|
||||
|
||||
for i = -1,1 do
|
||||
for j = -1,1 do
|
||||
nodes[area:index(pos.x+i, pos.y+height, pos.z+j)] = c.blood_top
|
||||
end
|
||||
end
|
||||
|
||||
for k = -1, 1, 2 do
|
||||
for l = -2+1, 2 do
|
||||
local p1 = {pos.x+2*k, pos.y+height, pos.z-l*k}
|
||||
local p2 = {pos.x+l*k, pos.y+height, pos.z+2*k}
|
||||
local udat = c.blood_top
|
||||
if math.random(2) == 1 then
|
||||
nodes[area:index(p1[1], p1[2], p1[3])] = c.blood_top
|
||||
nodes[area:index(p2[1], p2[2], p2[3])] = c.blood_top
|
||||
udat = c.blood
|
||||
end
|
||||
nodes[area:index(p1[1], p1[2]-1, p1[3])] = udat
|
||||
nodes[area:index(p2[1], p2[2]-1, p2[3])] = udat
|
||||
end
|
||||
for l = 0, 1 do
|
||||
for _,p in ipairs({
|
||||
{pos.x+k, pos.y+height-1, pos.z-l*k},
|
||||
{pos.x+l*k, pos.y+height-1, pos.z+k},
|
||||
}) do
|
||||
if math.random(2) == 1 then
|
||||
nodes[area:index(p[1], p[2], p[3])] = c.nether_apple
|
||||
--elseif math.random(10) == 1 then
|
||||
-- nodes[area:index(p[1], p[2], p[3])] = c.apple
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
set_vm_data(manip, nodes, pos, t1, "blood", generated)
|
||||
end
|
||||
|
||||
|
||||
local function update_minmax(min, max, p)
|
||||
min.x = math.min(min.x, p.x)
|
||||
max.x = math.max(max.x, p.x)
|
||||
min.z = math.min(min.z, p.z)
|
||||
max.z = math.max(max.z, p.z)
|
||||
return min, max
|
||||
end
|
||||
|
||||
local fruit_chances = {}
|
||||
for y = -2,1 do --like a hyperbola
|
||||
fruit_chances[y] = math.floor(-4/(y-2)+0.5)
|
||||
end
|
||||
|
||||
local dirs = {
|
||||
{-1, 0, 12, 19},
|
||||
{1, 0, 12, 13},
|
||||
{0, 1, 4},
|
||||
{0, -1, 4, 10},
|
||||
}
|
||||
|
||||
local h_max = 26
|
||||
local h_stem_min = 3
|
||||
local h_stem_max = 7
|
||||
local h_arm_min = 2
|
||||
local h_arm_max = 6
|
||||
local r_arm_min = 1
|
||||
local r_arm_max = 5
|
||||
local fruit_rarity = 25 --a bigger number results in less fruits
|
||||
local leaf_thickness = 3 --a bigger number results in more blank trees
|
||||
|
||||
local h_trunk_max = h_max-h_arm_max
|
||||
|
||||
function nether.grow_tree(pos, generated)
|
||||
local t1 = os.clock()
|
||||
|
||||
if not contents_defined then
|
||||
define_contents()
|
||||
contents_defined = true
|
||||
end
|
||||
|
||||
local min = vector.new(pos)
|
||||
local max = vector.new(pos)
|
||||
min.y = min.y-1
|
||||
max.y = max.y+h_max
|
||||
|
||||
local trunks = {}
|
||||
local trunk_corners = {}
|
||||
local h_stem = math.random(h_stem_min, h_stem_max)
|
||||
local stems = {{x=pos.x, y=pos.y+h_stem, z=pos.z}}
|
||||
local fi
|
||||
while not fi do
|
||||
for n,p in pairs(stems) do
|
||||
local used_dirs = {}
|
||||
for _,dir in pairs(dirs) do
|
||||
if math.random(1,2) == 1 then
|
||||
table.insert(used_dirs, dir)
|
||||
end
|
||||
end
|
||||
if not used_dirs[1] then
|
||||
local dir1 = math.random(4)
|
||||
local dir2 = math.random(3)
|
||||
if dir1 <= dir2 then
|
||||
dir2 = dir2+1
|
||||
end
|
||||
used_dirs[1] = dirs[dir1]
|
||||
used_dirs[2] = dirs[dir2]
|
||||
end
|
||||
for _,dir in pairs(used_dirs) do
|
||||
local p = vector.new(p)
|
||||
local r = math.random(r_arm_min, r_arm_max)
|
||||
for j = 1,r do
|
||||
local x = p.x+j*dir[1]
|
||||
local z = p.z+j*dir[2]
|
||||
trunks[x.." "..p.y.." "..z] = dir[3]
|
||||
end
|
||||
r = r+1
|
||||
p.x = p.x+r*dir[1]
|
||||
p.z = p.z+r*dir[2]
|
||||
trunk_corners[p.x.." "..p.y.." "..p.z] = dir[4] or dir[3]
|
||||
local h = math.random(h_arm_min, h_arm_max)
|
||||
for i = 1,h do
|
||||
trunks[p.x.." "..p.y+i.." "..p.z] = true
|
||||
end
|
||||
p.y = p.y+h
|
||||
table.insert(stems, p)
|
||||
end
|
||||
if p.y > pos.y+h_trunk_max then
|
||||
fi = true
|
||||
break
|
||||
end
|
||||
stems[n] = nil
|
||||
end
|
||||
end
|
||||
local leaves = {}
|
||||
local fruits = {}
|
||||
local trunk_ps = {}
|
||||
local count = 0
|
||||
for n,par in pairs(trunks) do
|
||||
local p = {}
|
||||
p.x, p.y, p.z = unpack(string.split(n, " "))
|
||||
if par ~= true then
|
||||
p.par = par
|
||||
end
|
||||
table.insert(trunk_ps, p)
|
||||
count = count+1
|
||||
if count > leaf_thickness then
|
||||
count = 0
|
||||
for y = -2,2 do
|
||||
local fruit_chance = fruit_chances[y]
|
||||
for z = -2,2 do
|
||||
for x = -2,2 do
|
||||
local dist = math.sqrt(x*x+y*y+z*z)
|
||||
if math.floor(dist) ~= 0
|
||||
and math.random(1, dist) == 1 then
|
||||
local pstr = p.x+x.." "..p.y+y.." "..p.z+z
|
||||
if not trunks[pstr] then
|
||||
if math.random(1, fruit_rarity) == 1
|
||||
and fruit_chance
|
||||
and math.random(1, fruit_chance) == 1 then
|
||||
fruits[pstr] = true
|
||||
else
|
||||
leaves[pstr] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local leaf_ps = {}
|
||||
for n,_ in pairs(leaves) do
|
||||
local p = {}
|
||||
p.x, p.y, p.z = unpack(string.split(n, " "))
|
||||
table.insert(leaf_ps, p)
|
||||
min, max = update_minmax(min, max, p)
|
||||
end
|
||||
|
||||
for n,_ in pairs(trunks) do
|
||||
local p = {}
|
||||
p.x, _, p.z = unpack(string.split(n, " "))
|
||||
min, max = update_minmax(min, max, p)
|
||||
end
|
||||
|
||||
for i = -1,h_stem+1 do
|
||||
table.insert(trunk_ps, {x=pos.x, y=pos.y+i, z=pos.z, par=0})
|
||||
end
|
||||
|
||||
local trunk_corner_ps = {}
|
||||
for n,par in pairs(trunk_corners) do
|
||||
local p = {}
|
||||
p.x, p.y, p.z = unpack(string.split(n, " "))
|
||||
p.par = par
|
||||
table.insert(trunk_corner_ps, p)
|
||||
end
|
||||
|
||||
local fruit_ps = {}
|
||||
for n,_ in pairs(fruits) do
|
||||
local p = {}
|
||||
p.x, p.y, p.z = unpack(string.split(n, " "))
|
||||
table.insert(fruit_ps, p)
|
||||
end
|
||||
|
||||
local manip = minetest.get_voxel_manip()
|
||||
local emerged_pos1, emerged_pos2 = manip:read_from_map(min, max)
|
||||
local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
|
||||
local nodes = manip:get_data()
|
||||
local param2s = manip:get_param2_data()
|
||||
|
||||
for _,p in pairs(leaf_ps) do
|
||||
p = area:indexp(p)
|
||||
if nodes[p] == c.air then
|
||||
nodes[p] = c.nether_leaves
|
||||
param2s[p] = math.random(0,44)
|
||||
end
|
||||
end
|
||||
|
||||
for _,p in pairs(fruit_ps) do
|
||||
p = area:indexp(p)
|
||||
if nodes[p] == c.air then
|
||||
nodes[p] = c.nether_apple
|
||||
--param2s[p] = math.random(0,44)
|
||||
end
|
||||
end
|
||||
|
||||
for _,p in pairs(trunk_ps) do
|
||||
local par = p.par
|
||||
p = area:indexp(p)
|
||||
if par then
|
||||
param2s[p] = par
|
||||
end
|
||||
nodes[p] = c.nether_tree
|
||||
end
|
||||
|
||||
for _,p in pairs(trunk_corner_ps) do
|
||||
local par = p.par
|
||||
p = area:indexp(p)
|
||||
nodes[p] = c.nether_tree_corner
|
||||
param2s[p] = par
|
||||
end
|
||||
|
||||
--calculating took ca. 0.07 - 0.18 [s]
|
||||
manip:set_data(nodes)
|
||||
manip:set_param2_data(param2s)
|
||||
manip:write_to_map()
|
||||
local spam = 2
|
||||
if generated then
|
||||
spam = 3
|
||||
end
|
||||
nether:inform("a nether tree grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", spam, t1)
|
||||
if not generated then
|
||||
local t1 = os.clock()
|
||||
manip:update_map()
|
||||
nether:inform("map updated", spam, t1)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--abms
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"nether:sapling"},
|
||||
neighbors = {"nether:blood_top"},
|
||||
interval = 20,
|
||||
chance = 8,
|
||||
action = function(pos)
|
||||
local under = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
if minetest.get_node_light(pos) < 4
|
||||
and minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air"
|
||||
and minetest.get_node(under).name == "nether:blood_top" then
|
||||
nether.grow_netherstructure(under)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"nether:tree_sapling"},
|
||||
neighbors = {"group:nether_dirt"},
|
||||
interval = 864,
|
||||
chance = 100,
|
||||
action = function(pos)
|
||||
local under = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
if minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z}).name == "air"
|
||||
and minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then
|
||||
local udata = minetest.registered_nodes[minetest.get_node(under).name]
|
||||
if udata
|
||||
and udata.groups
|
||||
and udata.groups.nether_dirt then
|
||||
nether.grow_tree(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"nether:netherrack_soil"},
|
||||
neighbors = {"air"},
|
||||
interval = 20,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
local par2 = node.param2
|
||||
if par2 == 0 then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
if minetest.get_node_light(pos) > 7 then --mushrooms grow at dark places
|
||||
return
|
||||
end
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, {name="riesenpilz:nether_shroom"})
|
||||
pos.y = pos.y-1
|
||||
minetest.set_node(pos, {name="nether:netherrack_soil", param2=par2-1})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
local function grass_allowed(pos)
|
||||
local nd = minetest.get_node(pos).name
|
||||
if nd == "air" then
|
||||
return true
|
||||
end
|
||||
if nd == "ignore" then
|
||||
return 0
|
||||
end
|
||||
local data = minetest.registered_nodes[nd]
|
||||
local drawtype = data.drawtype
|
||||
if drawtype
|
||||
and drawtype ~= "normal"
|
||||
and drawtype ~= "liquid"
|
||||
and drawtype ~= "flowingliquid" then
|
||||
return true
|
||||
end
|
||||
local light = data.light_source
|
||||
if light
|
||||
and light > 0 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"nether:dirt"},
|
||||
interval = 20,
|
||||
chance = 9,
|
||||
action = function(pos)
|
||||
local allowed = grass_allowed({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
if allowed == 0 then
|
||||
return
|
||||
end
|
||||
if allowed then
|
||||
minetest.set_node(pos, {name="nether:dirt_top"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"nether:dirt_top"},
|
||||
interval = 30,
|
||||
chance = 9,
|
||||
action = function(pos)
|
||||
local allowed = grass_allowed({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
if allowed == 0 then
|
||||
return
|
||||
end
|
||||
if not allowed then
|
||||
minetest.set_node(pos, {name="nether:dirt"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.register_privilege("nether", "Allows sending players to nether and extracting them")
|
||||
|
||||
dofile(path.."/crafting.lua")
|
||||
dofile(path.."/portal.lua")
|
||||
dofile(path.."/guide.lua")
|
||||
|
||||
nether:inform("loaded!", 1)
|
@ -1,983 +0,0 @@
|
||||
local nether_sound = default.node_sound_stone_defaults({
|
||||
dig = {name="nether_dig", gain=0.7},
|
||||
dug = {name="nether_dug", gain=1},
|
||||
footstep = {name="nether_footstep", gain=0.4}
|
||||
})
|
||||
|
||||
local function add_stair_and_slab(name)
|
||||
local nd = "nether:"..name
|
||||
if not string.find(name, "nether") then
|
||||
name = "nether_"..name
|
||||
end
|
||||
local data = minetest.registered_nodes[nd]
|
||||
stairs.register_stair_and_slab(name, nd,
|
||||
data.groups,
|
||||
data.tiles,
|
||||
data.description.." Stair",
|
||||
data.description.." Slab",
|
||||
data.sounds
|
||||
)
|
||||
end
|
||||
|
||||
local function digging_allowed(player, v)
|
||||
if not player then
|
||||
return false
|
||||
end
|
||||
local tool = minetest.registered_tools[player:get_wielded_item():get_name()]
|
||||
if not tool then
|
||||
return false
|
||||
end
|
||||
local capabilities = tool.tool_capabilities
|
||||
if not capabilities then
|
||||
return false
|
||||
end
|
||||
local groups = capabilities.groupcaps
|
||||
if not groups then
|
||||
return false
|
||||
end
|
||||
local nether = groups.nether
|
||||
if not nether then
|
||||
return false
|
||||
end
|
||||
if nether.times[v] then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Netherrack
|
||||
minetest.register_node("nether:netherrack", {
|
||||
description = "Netherrack",
|
||||
tiles = {"nether_netherrack.png"},
|
||||
groups = {nether=2},
|
||||
sounds = nether_sound,
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 2)
|
||||
end,
|
||||
})
|
||||
add_stair_and_slab("netherrack")
|
||||
|
||||
minetest.register_node("nether:netherrack_tiled", {
|
||||
description = "Tiled Netherrack",
|
||||
tiles = {"nether_netherrack_tiled.png"},
|
||||
groups = {nether=2},
|
||||
sounds = nether_sound,
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 2)
|
||||
end,
|
||||
})
|
||||
add_stair_and_slab("netherrack_tiled")
|
||||
|
||||
minetest.register_node("nether:netherrack_soil", {
|
||||
description = "Dirty Netherrack",
|
||||
tiles = {"nether_netherrack.png^nether_netherrack_soil.png"},
|
||||
groups = {nether=2},
|
||||
sounds = nether_sound,
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 2)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("nether:netherrack_black", {
|
||||
description = "Black Netherrack",
|
||||
tiles = {"nether_netherrack_black.png"},
|
||||
groups = {nether=2},
|
||||
sounds = nether_sound,
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 2)
|
||||
end,
|
||||
})
|
||||
add_stair_and_slab("netherrack_black")
|
||||
|
||||
minetest.register_node("nether:netherrack_blue", {
|
||||
description = "Blue Netherrack",
|
||||
tiles = {"nether_netherrack_blue.png"},
|
||||
groups = {nether=1},
|
||||
sounds = nether_sound,
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 1)
|
||||
end,
|
||||
})
|
||||
add_stair_and_slab("netherrack_blue")
|
||||
|
||||
-- Netherbrick
|
||||
minetest.register_node("nether:netherrack_brick", {
|
||||
description = "Netherrack Brick",
|
||||
tiles = {"nether_netherrack_brick.png"},
|
||||
groups = {nether=3},
|
||||
sounds = nether_sound,
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 3)
|
||||
end,
|
||||
})
|
||||
add_stair_and_slab("netherrack_brick")
|
||||
|
||||
minetest.register_node("nether:netherrack_brick_blue", {
|
||||
description = "Blue Netherrack Brick",
|
||||
tiles = {"nether_netherrack_brick_blue.png"},
|
||||
groups = {nether=3},
|
||||
sounds = nether_sound,
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 3)
|
||||
end,
|
||||
})
|
||||
add_stair_and_slab("netherrack_brick_blue")
|
||||
|
||||
minetest.register_node("nether:netherrack_brick_black", {
|
||||
description = "Black Netherrack Brick",
|
||||
tiles = {"nether_netherrack_brick_black.png"},
|
||||
groups = {nether=3},
|
||||
sounds = nether_sound,
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 3)
|
||||
end,
|
||||
})
|
||||
add_stair_and_slab("netherrack_brick_black")
|
||||
|
||||
minetest.register_node("nether:white", {
|
||||
description = "Siwtonic block",
|
||||
tiles = {"nether_white.png"},
|
||||
groups = {nether=1},
|
||||
sounds = nether_sound,
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 1)
|
||||
end,
|
||||
})
|
||||
add_stair_and_slab("white")
|
||||
|
||||
|
||||
-- Nether blood
|
||||
minetest.register_node("nether:sapling", {
|
||||
description = "Nether Blood Child",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"nether_sapling.png"},
|
||||
inventory_image = "nether_sapling.png",
|
||||
wield_image = "nether_sapling.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
groups = {snappy=2, oddly_breakable_by_hand=2, attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("nether:blood", {
|
||||
description = "Nether Blood",
|
||||
tiles = {"nether_blood.png"},
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
add_stair_and_slab("blood")
|
||||
|
||||
minetest.register_node("nether:blood_cooked", {
|
||||
description = "Cooked Nether Blood",
|
||||
tiles = {"nether_blood_cooked.png"},
|
||||
groups = {nether=3},
|
||||
sounds = nether_sound,
|
||||
furnace_burntime = 10,
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 3)
|
||||
end,
|
||||
})
|
||||
add_stair_and_slab("blood_cooked")
|
||||
|
||||
minetest.register_node("nether:blood_empty", {
|
||||
description = "Nether Blood Extracted",
|
||||
tiles = {"nether_blood_empty.png"},
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
add_stair_and_slab("blood_empty")
|
||||
|
||||
|
||||
minetest.register_node("nether:blood_top", {
|
||||
description = "Nether Blood Head",
|
||||
tiles = {"nether_blood_top.png", "nether_blood.png", "nether_blood.png^nether_blood_side.png"},
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
add_stair_and_slab("blood_top")
|
||||
|
||||
minetest.register_node("nether:blood_top_cooked", {
|
||||
description = "Cooked Nether Blood Head",
|
||||
tiles = {"nether_blood_top_cooked.png", "nether_blood_cooked.png", "nether_blood_cooked.png^nether_blood_side_cooked.png"},
|
||||
groups = {nether=3},
|
||||
sounds = nether_sound,
|
||||
furnace_burntime = 10,
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 3)
|
||||
end,
|
||||
})
|
||||
add_stair_and_slab("blood_top_cooked")
|
||||
|
||||
minetest.register_node("nether:blood_top_empty", {
|
||||
description = "Nether Blood Head Extracted",
|
||||
tiles = {"nether_blood_top_empty.png", "nether_blood_empty.png", "nether_blood_empty.png^nether_blood_side_empty.png"},
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
add_stair_and_slab("blood_top_empty")
|
||||
|
||||
|
||||
minetest.register_node("nether:blood_stem", {
|
||||
description = "Nether Blood Stem",
|
||||
tiles = {"nether_blood_stem_top.png", "nether_blood_stem_top.png", "nether_blood_stem.png"},
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
add_stair_and_slab("blood_stem")
|
||||
|
||||
minetest.register_node("nether:blood_stem_cooked", {
|
||||
description = "Cooked Nether Blood Stem",
|
||||
tiles = {"nether_blood_stem_top_cooked.png", "nether_blood_stem_top_cooked.png", "nether_blood_stem_cooked.png"},
|
||||
groups = {nether=3},
|
||||
sounds = nether_sound,
|
||||
furnace_burntime = 30,
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 3)
|
||||
end,
|
||||
})
|
||||
add_stair_and_slab("blood_stem_cooked")
|
||||
|
||||
minetest.register_node("nether:blood_stem_empty", {
|
||||
description = "Nether Blood Stem Extracted",
|
||||
tiles = {"nether_blood_stem_top_empty.png", "nether_blood_stem_top_empty.png", "nether_blood_stem_empty.png"},
|
||||
groups = {tree=1, choppy=2, oddly_breakable_by_hand=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
add_stair_and_slab("blood_stem_empty")
|
||||
|
||||
|
||||
minetest.register_node("nether:wood", {
|
||||
description = "Nether Blood Wood",
|
||||
tiles = {"nether_wood.png"},
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
add_stair_and_slab("wood")
|
||||
|
||||
minetest.register_node("nether:wood_cooked", {
|
||||
description = "Cooked Nether Blood Wood",
|
||||
tiles = {"nether_wood_cooked.png"},
|
||||
groups = {nether=3},
|
||||
sounds = nether_sound,
|
||||
furnace_burntime = 8,
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 3)
|
||||
end,
|
||||
})
|
||||
add_stair_and_slab("wood_cooked")
|
||||
|
||||
minetest.register_node("nether:wood_empty", {
|
||||
description = "Nether Wood",
|
||||
tiles = {"nether_wood_empty.png"},
|
||||
groups = {choppy=2, oddly_breakable_by_hand=2, wood=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
add_stair_and_slab("wood_empty")
|
||||
|
||||
minetest.register_node("nether:extractor", {
|
||||
description = "Nether Blood Extractor",
|
||||
tiles = {"nether_blood_extractor.png"},
|
||||
groups = {nether=3},
|
||||
sounds = nether_sound,
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 3)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Nether fruit
|
||||
minetest.register_node("nether:fruit_leaves", {
|
||||
description = "Nether Fruit Leaves",
|
||||
tiles = {"nether_fruit_leaves.png"},
|
||||
groups = {fleshy=3, dig_immediate=2},
|
||||
sounds = default.node_sound_defaults(),
|
||||
furnace_burntime = 18,
|
||||
})
|
||||
add_stair_and_slab("fruit_leaves")
|
||||
|
||||
local function room_for_items(inv)
|
||||
local free_slots = 0
|
||||
for _,i in ipairs(inv:get_list("main")) do
|
||||
if i:get_count() == 0 then
|
||||
free_slots = free_slots+1
|
||||
end
|
||||
end
|
||||
if free_slots < 2 then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
local drop_mushroom = minetest.registered_nodes["riesenpilz:nether_shroom"].on_drop
|
||||
minetest.override_item("riesenpilz:nether_shroom", {
|
||||
on_drop = function(itemstack, dropper, pos)
|
||||
if dropper:get_player_control().aux1 then
|
||||
return drop_mushroom(itemstack, dropper, pos)
|
||||
end
|
||||
local inv = dropper:get_inventory()
|
||||
if not inv then
|
||||
return
|
||||
end
|
||||
if not room_for_items(inv) then
|
||||
return
|
||||
end
|
||||
minetest.sound_play("nether_remove_leaf", {pos = pos, gain = 0.25})
|
||||
itemstack:take_item()
|
||||
inv:add_item("main", "nether:shroom_head")
|
||||
inv:add_item("main", "nether:shroom_stem")
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("nether:apple", {
|
||||
description = "Nether Fruit",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"nether_fruit_top.png", "nether_fruit_bottom.png", "nether_fruit.png", "nether_fruit.png^[transformFX", "nether_fruit.png^[transformFX", "nether_fruit.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/6, -1/4, -1/6, 1/6, -1/6, 1/6},
|
||||
|
||||
{-1/6, -1/6, -1/4, 1/6, 1/6, 1/4},
|
||||
{-1/4, -1/6, -1/6, 1/4, 1/6, 1/6},
|
||||
|
||||
{-1/4, 1/6, -1/12, 1/4, 1/4, 1/12},
|
||||
{-1/12, 1/6, -1/4, 1/12, 1/4, 1/4},
|
||||
|
||||
{-1/6, 1/6, -1/6, 1/6, 1/3, 1/6},
|
||||
|
||||
{-1/12, 1/3, -1/12, 0, 5/12, 0},
|
||||
|
||||
{-1/12, 5/12, -1/6, 0, 0.5, 1/12},
|
||||
{-1/6, 5/12, -1/12, 1/12, 0.5, 0},
|
||||
}
|
||||
},
|
||||
paramtype = "light",
|
||||
groups = {fleshy=3, dig_immediate=3},
|
||||
on_use = function(itemstack, user)
|
||||
local inv = user:get_inventory()
|
||||
if not inv then
|
||||
return
|
||||
end
|
||||
itemstack:take_item()
|
||||
if nether_port(user, vector.round(user:getpos())) then
|
||||
return itemstack
|
||||
end
|
||||
local amount = math.random(4, 6)
|
||||
local p_hunger = tonumber(hud.hunger[user:get_player_name()])
|
||||
p_hunger = p_hunger+9
|
||||
if p_hunger > 30 then p_hunger = 30 end
|
||||
hud.hunger[user:get_player_name()] = p_hunger
|
||||
hud.set_hunger(user)
|
||||
inv:add_item("main", {name="nether:blood_extracted", count=math.floor(amount/3)})
|
||||
user:set_hp(user:get_hp()-amount)
|
||||
return itemstack
|
||||
end,
|
||||
sounds = default.node_sound_defaults(),
|
||||
furnace_burntime = 6,
|
||||
})
|
||||
|
||||
local drop_fruit = minetest.registered_nodes["nether:apple"].on_drop
|
||||
minetest.override_item("nether:apple", {
|
||||
on_drop = function(itemstack, dropper, pos)
|
||||
if dropper:get_player_control().aux1 then
|
||||
return drop_fruit(itemstack, dropper, pos)
|
||||
end
|
||||
local inv = dropper:get_inventory()
|
||||
if not inv then
|
||||
return
|
||||
end
|
||||
if not room_for_items(inv) then
|
||||
return
|
||||
end
|
||||
minetest.sound_play("nether_remove_leaf", {pos = pos, gain = 0.25})
|
||||
itemstack:take_item()
|
||||
inv:add_item("main", "nether:fruit_leaf")
|
||||
inv:add_item("main", "nether:fruit_no_leaf")
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
-- Nether vine
|
||||
minetest.register_node("nether:vine", {
|
||||
description = "Nether vine",
|
||||
walkable = false,
|
||||
drop = "nether:sapling",
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
tiles = { "nether_vine.png" },
|
||||
drawtype = "plantlike",
|
||||
inventory_image = "nether_vine.png",
|
||||
groups = { snappy = 3,flammable=2 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
after_dig_node = function(pos, _, _, digger)
|
||||
if digger then
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local nn = minetest.get_node(p)
|
||||
if nn.name == "nether:vine" then
|
||||
minetest.node_dig(p, nn, digger)
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
-- forest stuff
|
||||
|
||||
for n,i in pairs({"small", "middle", "big"}) do
|
||||
minetest.register_node("nether:grass_"..i, {
|
||||
description = "Nehter Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
tiles = {"nether_grass_"..i..".png"},
|
||||
inventory_image = "nether_grass_"..i..".png",
|
||||
wield_image = "nether_grass_"..i..".png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "nether:grass "..n,
|
||||
groups = {snappy=3,flora=1,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node("nether:glowflower", {
|
||||
description = "Glowing Flower",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"nether_glowflower.png"},
|
||||
inventory_image = "nether_glowflower.png",
|
||||
wield_image = "nether_glowflower.png",
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
light_source = 10,
|
||||
groups = {snappy=3,flammable=2,flower=1,flora=1,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.15, -0.5, -0.15, 0.15, 0.2, 0.15 },
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("nether:tree_sapling", {
|
||||
description = "Nether Tree Sapling",
|
||||
drawtype = "plantlike",
|
||||
tiles = {"nether_tree_sapling.png"},
|
||||
inventory_image = "nether_tree_sapling.png",
|
||||
wield_image = "nether_tree_sapling.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
groups = {snappy=2, oddly_breakable_by_hand=2, attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("nether:tree", {
|
||||
description = "Nehter Trunk",
|
||||
tiles = {"nether_tree_top.png", "nether_tree_top.png", "nether_tree.png"},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
minetest.register_node("nether:tree_corner", {
|
||||
description = "Nehter Trunk Corner",
|
||||
tiles = {"nether_tree.png^[transformR180", "nether_tree_top.png", "nether_tree_corner.png^[transformFY",
|
||||
"nether_tree_corner.png^[transformR180", "nether_tree.png", "nether_tree_top.png"},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,not_in_creative_inventory=1},
|
||||
drop = "nether:tree",
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
minetest.register_node("nether:forest_wood", {
|
||||
description = "Nether Wood Block",
|
||||
tiles = {"nether_forest_wood.png"},
|
||||
groups = {choppy=2,oddly_breakable_by_hand=2,wood=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
add_stair_and_slab("forest_wood")
|
||||
|
||||
minetest.register_node("nether:leaves", {
|
||||
description = "Nether Leaves",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
visual_scale = math.sqrt(math.sqrt(2)),
|
||||
tiles = {"nether_leaves.png"},
|
||||
inventory_image = "nether_leaves.png",
|
||||
wield_image = "nether_leaves.png",
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3, leafdecay=3, leaves=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
items = {"nether:tree_sapling"},
|
||||
rarity = 30,
|
||||
},
|
||||
{
|
||||
items = {"nether:leaves"},
|
||||
}
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("nether:dirt", {
|
||||
description = "Nether Dirt",
|
||||
tiles = {"nether_dirt.png"},
|
||||
groups = {crumbly=3,soil=1,nether_dirt=1},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("nether:dirt_top", {
|
||||
description = "Nether Dirt Top",
|
||||
tiles = {"nether_dirt_top.png", "nether_dirt.png", "nether_dirt.png^nether_dirt_top_side.png"},
|
||||
groups = {crumbly=3,soil=1,nether_dirt=1},
|
||||
drop = "nether:dirt",
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.25},
|
||||
}),
|
||||
})
|
||||
|
||||
minetest.register_node("nether:dirt_bottom", {
|
||||
description = "Netherrack Dirt Transition",
|
||||
tiles = {"nether_dirt.png", "nether_netherrack.png", "nether_netherrack.png^nether_dirt_transition.png"},
|
||||
groups = {nether=2},
|
||||
drop = "nether:netherrack",
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
dig = {name="nether_dig", gain=0.7},
|
||||
dug = {name="nether_dug", gain=1},
|
||||
}),
|
||||
can_dig = function(_, player)
|
||||
return digging_allowed(player, 2)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- Nether torch
|
||||
minetest.register_node("nether:torch", {
|
||||
description = "Nether Torch",
|
||||
drawtype = "torchlike",
|
||||
tiles = {"nether_torch_on_floor.png", "nether_torch_on_ceiling.png", "nether_torch.png"},
|
||||
inventory_image = "nether_torch_on_floor.png",
|
||||
wield_image = "nether_torch_on_floor.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
light_source = LIGHT_MAX-1,
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1},
|
||||
wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
|
||||
wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
|
||||
},
|
||||
groups = {choppy=2, dig_immediate=3, attached_node=1, hot=2},
|
||||
legacy_wallmounted = true,
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("nether:portal", {
|
||||
description = "Nether Portal Essence",
|
||||
tiles = {"nether_transparent.png", "nether_transparent.png", "nether_transparent.png", "nether_transparent.png", "nether_portal_stuff.png"},
|
||||
inventory_image = "nether_portal_stuff.png",
|
||||
wield_image = "nether_portal_stuff.png",
|
||||
light_source = LIGHT_MAX - 2,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
use_texture_alpha = true,
|
||||
walkable = false,
|
||||
digable = false,
|
||||
pointable = false,
|
||||
buildable_to = false,
|
||||
drop = "",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
post_effect_color = {a=200, r=50, g=0, b=60},--{a=180, r=128, g=0, b=128}
|
||||
drawtype = "nodebox",
|
||||
paramtype2 = "facedir",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.1, 0.5, 0.5, 0.1},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem("nether:grass", {
|
||||
description = "Nehter Grass",
|
||||
inventory_image = "nether_grass.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("nether:grass_dried", {
|
||||
description = "Dried Nehter Grass",
|
||||
inventory_image = "nether_grass_dried.png",
|
||||
furnace_burntime = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("nether:forest_planks", {
|
||||
description = "Nether Wooden Planks",
|
||||
inventory_image = "nether_forest_planks.png",
|
||||
stack_max = 990,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("nether:bark", {
|
||||
description = "Nether Trunk Bark",
|
||||
inventory_image = "nether_bark.png",
|
||||
furnace_burntime = 5,
|
||||
})
|
||||
|
||||
-- Nether Pearl
|
||||
minetest.register_craftitem("nether:pearl", {
|
||||
description = "Nether Pearl",
|
||||
inventory_image = "nether_pearl.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("nether:stick", {
|
||||
description = "Nether Stick",
|
||||
inventory_image = "nether_stick.png",
|
||||
groups = {stick=1},
|
||||
})
|
||||
|
||||
local tmp = {}
|
||||
minetest.register_craftitem("nether:shroom_head", {
|
||||
description = "Nether Mushroom Head",
|
||||
inventory_image = "nether_shroom_top.png",
|
||||
furnace_burntime = 3,
|
||||
on_place = function(itemstack, _, pointed_thing)
|
||||
if not pointed_thing then
|
||||
return
|
||||
end
|
||||
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||
local node = minetest.get_node(pos)
|
||||
local pstr = pos.x.." "..pos.y.." "..pos.z
|
||||
|
||||
if node.name == "nether:netherrack_soil"
|
||||
and not tmp[pstr] then
|
||||
minetest.sound_play("default_grass_footstep", {pos=pos})
|
||||
minetest.set_node(pos, {name="nether:netherrack_soil", param2=math.max(node.param2, math.random(3, 10))})
|
||||
tmp[pstr] = true
|
||||
minetest.after(3, function() tmp[pos.x.." "..pos.y.." "..pos.z] = nil end)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craftitem("nether:shroom_stem", {
|
||||
description = "Nether Mushroom Stem",
|
||||
inventory_image = "nether_shroom_stem.png",
|
||||
furnace_burntime = 3,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("nether:fruit_leaf", {
|
||||
description = "Nether Fruit Leaf",
|
||||
inventory_image = "nether_fruit_leaf.png",
|
||||
furnace_burntime = 2,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("nether:fruit_no_leaf", {
|
||||
description = "Nether Fruit Without Leaf",
|
||||
inventory_image = "nether_fruit_no_leaf.png",
|
||||
furnace_burntime = 4,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("nether:fim", {
|
||||
description = "Nether FIM", --fruit in mushroom
|
||||
inventory_image = "nether_fim.png",
|
||||
furnace_burntime = 10,
|
||||
})
|
||||
|
||||
local blood_exno = {}
|
||||
for _,i in ipairs({"nether:blood", "nether:blood_top", "nether:blood_stem"}) do
|
||||
blood_exno[i] = i.."_empty"
|
||||
end
|
||||
|
||||
minetest.register_craftitem("nether:blood_extracted", {
|
||||
description = "Blood",
|
||||
inventory_image = "nether_blood_extracted.png",
|
||||
on_place = function(itemstack, _, pointed_thing)
|
||||
if not pointed_thing then
|
||||
return
|
||||
end
|
||||
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
|
||||
if not node then
|
||||
return
|
||||
end
|
||||
|
||||
if node.name == "nether:vine" then
|
||||
pos = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, {name = "nether:vine"})
|
||||
end
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if node.name ~= "nether:extractor" then
|
||||
return
|
||||
end
|
||||
itemstack:take_item()
|
||||
minetest.after(1, function(pos)
|
||||
for i = -1,1,2 do
|
||||
for _,p in ipairs({
|
||||
{x=pos.x+i, y=pos.y, z=pos.z},
|
||||
{x=pos.x, y=pos.y, z=pos.z+i},
|
||||
}) do
|
||||
local nodename = blood_exno[minetest.get_node(p).name]
|
||||
if nodename then
|
||||
minetest.set_node(p, {name=nodename})
|
||||
p = vector.add(p, {x=math.random()-0.5, y=math.random()+0.5, z=math.random()-0.5})
|
||||
minetest.sound_play("nether_extract_blood", {pos = p, gain = 1})
|
||||
minetest.add_item(p, "nether:blood_extracted")
|
||||
end
|
||||
end
|
||||
end
|
||||
end, pos)
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craftitem("nether:hotbed", {
|
||||
description = "Cooked Blood",
|
||||
inventory_image = "nether_hotbed.png",
|
||||
on_place = function(itemstack, _, pointed_thing)
|
||||
if not pointed_thing then
|
||||
return
|
||||
end
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if node.name ~= "nether:netherrack" then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.sound_play("default_place_node", {pos=pos})
|
||||
minetest.set_node(pos, {name = "nether:netherrack_soil"})
|
||||
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.register_tool("nether:pick_mushroom", {
|
||||
description = "Nether Mushroom Pickaxe",
|
||||
inventory_image = "nether_pick_mushroom.png",
|
||||
tool_capabilities = {
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
cracky = {times={[3]=3}, uses=1, maxlevel=1},
|
||||
nether = {times={[3]=3}, uses=1, maxlevel=1},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("nether:pick_wood", {
|
||||
description = "Nether Wood Pickaxe",
|
||||
inventory_image = "nether_pick_wood.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.2,
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
cracky = {times={[3]=1.6}, uses=10, maxlevel=1},
|
||||
nether = {times={[2]=6, [3]=1.6}, uses=10, maxlevel=1},
|
||||
},
|
||||
damage_groups = {fleshy=2},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("nether:pick_netherrack", {
|
||||
description = "Netherrack Pickaxe",
|
||||
inventory_image = "nether_pick_netherrack.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.3,
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
cracky = {times={[2]=2.0, [3]=1.20}, uses=20, maxlevel=1},
|
||||
nether = {times={[1]=16, [2]=2, [3]=1.20}, uses=20, maxlevel=1},
|
||||
},
|
||||
damage_groups = {fleshy=3},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("nether:pick_netherrack_blue", {
|
||||
description = "Blue Netherrack Pickaxe",
|
||||
inventory_image = "nether_pick_netherrack_blue.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=30, maxlevel=2},
|
||||
nether = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=30, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=4},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("nether:pick_white", {
|
||||
description = "Siwtonic Pickaxe",
|
||||
inventory_image = "nether_pick_white.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.9,
|
||||
max_drop_level=3,
|
||||
groupcaps={
|
||||
cracky = {times={[1]=1, [2]=0.8, [3]=0.3}, uses=180, maxlevel=3},
|
||||
nether = {times={[1]=1, [2]=0.5, [3]=0.3}, uses=180, maxlevel=3},
|
||||
},
|
||||
damage_groups = {fleshy=5},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("nether:axe_netherrack", {
|
||||
description = "Netherrack Axe",
|
||||
inventory_image = "nether_axe_netherrack.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.3,
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
choppy={times={[1]=2.9, [2]=1.9, [3]=1.4}, uses=20, maxlevel=1},
|
||||
},
|
||||
damage_groups = {fleshy=4},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("nether:axe_netherrack_blue", {
|
||||
description = "Blue Netherrack Axe",
|
||||
inventory_image = "nether_axe_netherrack_blue.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.9,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
choppy={times={[1]=2.5, [2]=1.5, [3]=1}, uses=30, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=6},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("nether:axe_white", {
|
||||
description = "Siwtonic Axe",
|
||||
inventory_image = "nether_axe_white.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.9,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
choppy={times={[1]=1.2, [2]=0.5, [3]=0.3}, uses=180, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=8},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("nether:shovel_netherrack", {
|
||||
description = "Netherrack Shovel",
|
||||
inventory_image = "nether_shovel_netherrack.png",
|
||||
wield_image = "nether_shovel_netherrack.png^[transformR90",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.4,
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
crumbly = {times={[1]=1.7, [2]=1.1, [3]=0.45}, uses=22, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=2},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("nether:shovel_netherrack_blue", {
|
||||
description = "Blue Netherrack Shovel",
|
||||
inventory_image = "nether_shovel_netherrack_blue.png",
|
||||
wield_image = "nether_shovel_netherrack_blue.png^[transformR90",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.1,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
crumbly = {times={[1]=1.4, [2]=0.8, [3]=0.35}, uses=50, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=3},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("nether:shovel_white", {
|
||||
description = "Siwtonic Shovel",
|
||||
inventory_image = "nether_shovel_white.png",
|
||||
wield_image = "nether_shovel_white.png^[transformR90",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
crumbly = {times={[1]=0.95, [2]=0.45, [3]=0.1}, uses=151, maxlevel=3},
|
||||
},
|
||||
damage_groups = {fleshy=4},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("nether:sword_netherrack", {
|
||||
description = "Netherrack Sword",
|
||||
inventory_image = "nether_sword_netherrack.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1,
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
snappy={times={[2]=1.3, [3]=0.38}, uses=40, maxlevel=1},
|
||||
},
|
||||
damage_groups = {fleshy=5},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("nether:sword_netherrack_blue", {
|
||||
description = "Blue Netherrack Sword",
|
||||
inventory_image = "nether_sword_netherrack_blue.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.8,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
snappy={times={[1]=2.5, [2]=1.1, [3]=0.33}, uses=40, maxlevel=2},
|
||||
},
|
||||
damage_groups = {fleshy=7},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("nether:sword_white", {
|
||||
description = "Siwtonic Sword",
|
||||
inventory_image = "nether_sword_white.png",
|
||||
wield_image = "nether_sword_white.png^[transformR90",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.7,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
snappy={times={[1]=1.7, [2]=0.8, [3]=0.2}, uses=100, maxlevel=3},
|
||||
},
|
||||
damage_groups = {fleshy=11},
|
||||
},
|
||||
})
|
||||
|
@ -1,114 +0,0 @@
|
||||
local function table_contains(t, v)
|
||||
for _,i in pairs(t) do
|
||||
if v == i then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local teleportball_player
|
||||
local function throw_pearl(item, player)
|
||||
local playerpos = player:getpos()
|
||||
local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.625,z=playerpos.z}, "nether:pearl_entity")
|
||||
local dir = player:get_look_dir()
|
||||
obj:setvelocity({x=dir.x*30, y=dir.y*30, z=dir.z*30})
|
||||
obj:setacceleration({x=dir.x*-3, y=-dir.y^8*80-10, z=dir.z*-3})
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
item:take_item()
|
||||
end
|
||||
teleportball_player = player
|
||||
return item
|
||||
end
|
||||
|
||||
local ENTITY = {
|
||||
timer=0,
|
||||
collisionbox = {0,0,0,0,0,0}, --not pointable
|
||||
physical = false, -- Collides with things
|
||||
textures = {"nether_pearl.png"},
|
||||
lastpos={},
|
||||
player = "",
|
||||
}
|
||||
|
||||
local allowed_nodes = {"air", "default:water_source"}
|
||||
local function teleport_player(pos, player)
|
||||
local nd2 = minetest.get_node(pos).name
|
||||
pos.y = pos.y+1
|
||||
local nd3 = minetest.get_node(pos).name
|
||||
if table_contains(allowed_nodes, nd2)
|
||||
and table_contains(allowed_nodes, nd3) then
|
||||
pos.y = pos.y-1.4
|
||||
player:moveto(pos)
|
||||
pos.y = pos.y-0.6
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
ENTITY.on_step = function(self, dtime)
|
||||
self.timer=self.timer+dtime
|
||||
|
||||
--[[ local delay = self.delay
|
||||
if delay < 0.1 then
|
||||
self.delay = delay+dtime
|
||||
return
|
||||
end
|
||||
self.delay = 0]]
|
||||
local pos = self.object:getpos()
|
||||
local lastpos = self.lastpos
|
||||
if lastpos.x
|
||||
and vector.equals(vector.round(lastpos), vector.round(pos)) then
|
||||
return
|
||||
end
|
||||
local player = self.player
|
||||
if not player
|
||||
or player == "" then
|
||||
self.player = teleportball_player
|
||||
player = teleportball_player
|
||||
end
|
||||
if not player then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
if lastpos.x then --If there is no lastpos for some reason.
|
||||
local free, p = minetest.line_of_sight(lastpos, pos)
|
||||
if not free then
|
||||
local nd1 = minetest.get_node(p).name
|
||||
if not table_contains(allowed_nodes, nd1)
|
||||
and nd1 ~= "ignore" then
|
||||
self.object:remove()
|
||||
minetest.after(0, function(p) --minetest.after us used that the sound is played after the teleportation
|
||||
minetest.sound_play("nether_pearl", {pos=p, max_hear_distance=10})
|
||||
end, p)
|
||||
p.y = p.y+1
|
||||
if teleport_player(p, player) then
|
||||
return
|
||||
end
|
||||
p.y = p.y-2
|
||||
for i = -1,1,2 do
|
||||
for _,j in pairs({{i, 0}, {0, i}}) do
|
||||
if teleport_player({x=p.x+j[1], y=p.y, z=p.z+j[2]}, player) then
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
for i = -1,1,2 do
|
||||
for j = -1,1,2 do
|
||||
if teleport_player({x=p.x+j, y=p.y, z=p.z+i}, player) then
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.timer > 20 then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
self.lastpos = vector.new(pos)
|
||||
end
|
||||
|
||||
minetest.register_entity("nether:pearl_entity", ENTITY)
|
||||
|
||||
minetest.override_item("nether:pearl", {on_use = throw_pearl})
|
@ -1,536 +0,0 @@
|
||||
--code copied from Pilzadam's nether mod and edited
|
||||
local portal_target = nether.buildings+1
|
||||
local damage_enabled = minetest.setting_getbool("enable_damage")
|
||||
|
||||
local abm_allowed
|
||||
minetest.after(5, function()
|
||||
abm_allowed = true
|
||||
end)
|
||||
|
||||
table.icontains = table.icontains or function(t, v)
|
||||
for _,i in ipairs(t) do
|
||||
if i == v then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
players_in_nether = {}
|
||||
local file = io.open(minetest.get_worldpath()..'/nether_players', "r")
|
||||
if file then
|
||||
local contents = file:read('*all')
|
||||
io.close(file)
|
||||
if contents then
|
||||
players_in_nether = string.split(contents, " ")
|
||||
end
|
||||
end
|
||||
|
||||
local function save_nether_players()
|
||||
local output = ''
|
||||
for _,name in ipairs(players_in_nether) do
|
||||
output = output..name..' '
|
||||
end
|
||||
local f = io.open(minetest.get_worldpath()..'/nether_players', "w")
|
||||
f:write(output)
|
||||
io.close(f)
|
||||
end
|
||||
|
||||
local function player_to_nether(player, safe)
|
||||
local pname = player:get_player_name()
|
||||
if table.icontains(players_in_nether, pname) then
|
||||
return
|
||||
end
|
||||
table.insert(players_in_nether, pname)
|
||||
save_nether_players()
|
||||
if not safe then
|
||||
minetest.chat_send_player(pname, "For any reason you arrived here. Type /nether_help to find out things like craft recipes.")
|
||||
player:set_hp(0)
|
||||
end
|
||||
player:set_sky({r=15, g=0, b=0}, "plain")
|
||||
end
|
||||
|
||||
local function player_from_nether(player)
|
||||
local pname = player:get_player_name()
|
||||
local changes
|
||||
for n,i in ipairs(players_in_nether) do
|
||||
if i == pname then
|
||||
table.remove(players_in_nether, n)
|
||||
changes = true
|
||||
end
|
||||
end
|
||||
if changes then
|
||||
save_nether_players()
|
||||
end
|
||||
player:set_sky(nil, "regular")
|
||||
end
|
||||
|
||||
|
||||
if damage_enabled then
|
||||
local function player_exists(name)
|
||||
for _,player in pairs(minetest.get_connected_players()) do
|
||||
if player:get_player_name() == name then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Chatcommands (edited) written by sss
|
||||
--[[
|
||||
minetest.register_chatcommand("to_hell", {
|
||||
params = "",
|
||||
description = "Send someone to hell",
|
||||
func = function(name, pname)
|
||||
if not minetest.check_player_privs(name, {nether=true}) then
|
||||
local self_player = minetest.get_player_by_name(name)
|
||||
if self_player then
|
||||
minetest.chat_send_player(name, "You can't send anyone to hell, go to hell instead")
|
||||
player_to_nether(self_player)
|
||||
else
|
||||
minetest.chat_send_player(name, "Something went wrong.")
|
||||
end
|
||||
return false
|
||||
end
|
||||
if not player_exists(pname) then
|
||||
pname = name
|
||||
end
|
||||
local player = minetest.get_player_by_name(pname)
|
||||
if not player then
|
||||
minetest.chat_send_player(name, "Something went wrong.")
|
||||
return false
|
||||
end
|
||||
minetest.chat_send_player(pname, "Go to hell !!!")
|
||||
player_to_nether(player)
|
||||
return true
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("from_hell", {
|
||||
params = "",
|
||||
description = "Extract from hell",
|
||||
func = function(name, pname)
|
||||
if not minetest.check_player_privs(name, {nether=true}) then
|
||||
local self_player = minetest.get_player_by_name(name)
|
||||
if self_player then
|
||||
minetest.chat_send_player(name, "You can't send anyone to hell, go to hell instead")
|
||||
player_to_nether(self_player)
|
||||
else
|
||||
minetest.chat_send_player(name, "Something went wrong.")
|
||||
end
|
||||
return false
|
||||
end
|
||||
if not player_exists(pname) then
|
||||
pname = name
|
||||
end
|
||||
local player = minetest.get_player_by_name(pname)
|
||||
if not player then
|
||||
minetest.chat_send_player(name, "Something went wrong.")
|
||||
return false
|
||||
end
|
||||
minetest.chat_send_player(pname, "You are free now")
|
||||
player_from_nether(player)
|
||||
player:moveto({x=pos.x, y=100, z=pos.z})
|
||||
return true
|
||||
end
|
||||
})
|
||||
--]]
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
local pname = player:get_player_name()
|
||||
if not table.icontains(players_in_nether, pname) then
|
||||
return
|
||||
end
|
||||
local target = vector.add(player:getpos(), {x=math.random(-100,100), y=0, z=math.random(-100,100)})
|
||||
target.y = portal_target + math.random(4)
|
||||
player:moveto(target)
|
||||
minetest.after(0, function(pname, target)
|
||||
local player = minetest.get_player_by_name(pname)
|
||||
if player then
|
||||
player:moveto(target)
|
||||
end
|
||||
end, pname, target)
|
||||
return true
|
||||
end)
|
||||
|
||||
local function update_players()
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
local pname = player:get_player_name()
|
||||
local ppos = player:getpos()
|
||||
if table.icontains(players_in_nether, pname) then
|
||||
if ppos.y > nether.start then
|
||||
player:moveto({x=ppos.x, y=portal_target, z=ppos.z})
|
||||
player:set_sky({r=15, g=0, b=0}, "plain")
|
||||
--[[minetest.kick_player(pname, "\n1. Maybe you were not allowed to teleport out of the nether."..
|
||||
"\n2. Maybe the server lagged."..
|
||||
"\n3. please rejoin")]]
|
||||
end
|
||||
elseif ppos.y < nether.start then
|
||||
player:set_sky(nil, "regular")
|
||||
player:moveto({x=ppos.x, y=20, z=ppos.z})
|
||||
--[[minetest.kick_player(pname, "\n1. Maybe you were not allowed to teleport to the nether."..
|
||||
"\n2. Maybe the server lagged."..
|
||||
"\n3. please rejoin")]]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local timer = 0 --doesn't work if the server lags
|
||||
minetest.register_globalstep(function(dtime)
|
||||
timer = timer + dtime;
|
||||
if timer >= 2 then
|
||||
--minetest.after(1, update_players)
|
||||
update_players()
|
||||
timer = 0
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
minetest.after(0, function(player)
|
||||
if player:getpos().y < nether.start then
|
||||
player:set_sky({r=15, g=0, b=0}, "plain")
|
||||
end
|
||||
end, player)
|
||||
end)
|
||||
|
||||
local function remove_portal_essence(pos)
|
||||
for z = -1,1 do
|
||||
for y = -2,2 do
|
||||
for x = -1,1 do
|
||||
local p = {x=pos.x+x, y=pos.y+y, z=pos.z+z}
|
||||
if minetest.get_node(p).name == "nether:portal" then
|
||||
minetest.remove_node(p)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"nether:portal"},
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
action = function(pos, node)
|
||||
if not abm_allowed then
|
||||
return
|
||||
end
|
||||
minetest.add_particlespawner({
|
||||
amount = 32,
|
||||
time = 4,
|
||||
minpos = {x=pos.x-0.25, y=pos.y-0.5, z=pos.z-0.25},
|
||||
maxpos = {x=pos.x+0.25, y=pos.y+0.34, z=pos.z+0.25},
|
||||
minvel = {x=0, y=1, z=0},
|
||||
maxvel = {x=0, y=2, z=0},
|
||||
minacc = {x=-0.5,y=-3,z=-0.3},
|
||||
maxacc = {x=0.5,y=-0.4,z=0.3},
|
||||
minexptime = 1,
|
||||
maxexptime = 1,
|
||||
minsize = 0.4,
|
||||
maxsize = 3,
|
||||
collisiondetection = true,
|
||||
texture = "nether_portal_particle.png",
|
||||
})
|
||||
for _,obj in pairs(minetest.get_objects_inside_radius(pos, 1)) do
|
||||
if obj:is_player() then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local target = minetest.string_to_pos(meta:get_string("target"))
|
||||
if target then
|
||||
minetest.after(3, function(obj, pos, target)
|
||||
local pname = obj:get_player_name()
|
||||
if table.icontains(players_in_nether, pname) then
|
||||
return
|
||||
end
|
||||
local objpos = obj:getpos()
|
||||
objpos.y = objpos.y+0.1 -- Fix some glitches at -8000
|
||||
if minetest.get_node(vector.round(objpos)).name ~= "nether:portal" then
|
||||
return
|
||||
end
|
||||
|
||||
remove_portal_essence(pos)
|
||||
|
||||
minetest.sound_play("nether_portal_usual", {to_player=pname, gain=1})
|
||||
player_to_nether(obj)
|
||||
--obj:setpos(target)
|
||||
|
||||
end, obj, pos, target)
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local function move_check(p1, max, dir)
|
||||
local p = {x=p1.x, y=p1.y, z=p1.z}
|
||||
local d = math.abs(max-p1[dir]) / (max-p1[dir])
|
||||
while p[dir] ~= max do
|
||||
p[dir] = p[dir] + d
|
||||
if minetest.get_node(p).name ~= "default:obsidian" then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
local function check_portal(p1, p2)
|
||||
if p1.x ~= p2.x then
|
||||
if not move_check(p1, p2.x, "x") then
|
||||
return false
|
||||
end
|
||||
if not move_check(p2, p1.x, "x") then
|
||||
return false
|
||||
end
|
||||
elseif p1.z ~= p2.z then
|
||||
if not move_check(p1, p2.z, "z") then
|
||||
return false
|
||||
end
|
||||
if not move_check(p2, p1.z, "z") then
|
||||
return false
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
if not move_check(p1, p2.y, "y") then
|
||||
return false
|
||||
end
|
||||
if not move_check(p2, p1.y, "y") then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local function is_portal(pos)
|
||||
for d=-3,3 do
|
||||
for y=-4,4 do
|
||||
local px = {x=pos.x+d, y=pos.y+y, z=pos.z}
|
||||
local pz = {x=pos.x, y=pos.y+y, z=pos.z+d}
|
||||
if check_portal(px, {x=px.x+3, y=px.y+4, z=px.z}) then
|
||||
return px, {x=px.x+3, y=px.y+4, z=px.z}
|
||||
end
|
||||
if check_portal(pz, {x=pz.x, y=pz.y+4, z=pz.z+3}) then
|
||||
return pz, {x=pz.x, y=pz.y+4, z=pz.z+3}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function make_portal(pos)
|
||||
local p1, p2 = is_portal(pos)
|
||||
if not p1
|
||||
or not p2 then
|
||||
print("[nether] something failed.")
|
||||
return false
|
||||
end
|
||||
|
||||
if p1.y < nether.start then
|
||||
print("[nether] aborted, obsidian portals can't be used to get out")
|
||||
return
|
||||
end
|
||||
|
||||
for d=1,2 do
|
||||
for y=p1.y+1,p2.y-1 do
|
||||
local p
|
||||
if p1.z == p2.z then
|
||||
p = {x=p1.x+d, y=y, z=p1.z}
|
||||
else
|
||||
p = {x=p1.x, y=y, z=p1.z+d}
|
||||
end
|
||||
if minetest.get_node(p).name ~= "air" then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local param2
|
||||
if p1.z == p2.z then
|
||||
param2 = 0
|
||||
else
|
||||
param2 = 1
|
||||
end
|
||||
|
||||
local target = {x=p1.x, y=p1.y, z=p1.z}
|
||||
target.x = target.x + 1
|
||||
target.y = portal_target + math.random(4)
|
||||
|
||||
for d=0,3 do
|
||||
for y=p1.y,p2.y do
|
||||
local p = {}
|
||||
if param2 == 0 then
|
||||
p = {x=p1.x+d, y=y, z=p1.z}
|
||||
else
|
||||
p = {x=p1.x, y=y, z=p1.z+d}
|
||||
end
|
||||
if minetest.get_node(p).name == "air" then
|
||||
minetest.set_node(p, {name="nether:portal", param2=param2})
|
||||
end
|
||||
local meta = minetest.get_meta(p)
|
||||
meta:set_string("p1", minetest.pos_to_string(p1))
|
||||
meta:set_string("p2", minetest.pos_to_string(p2))
|
||||
meta:set_string("target", minetest.pos_to_string(target))
|
||||
end
|
||||
end
|
||||
print("[nether] construction accepted.")
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.override_item("default:obsidian", {
|
||||
on_destruct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local p1 = minetest.string_to_pos(meta:get_string("p1"))
|
||||
local p2 = minetest.string_to_pos(meta:get_string("p2"))
|
||||
local target = minetest.string_to_pos(meta:get_string("target"))
|
||||
if not p1 or not p2 then
|
||||
return
|
||||
end
|
||||
for x=p1.x,p2.x do
|
||||
for y=p1.y,p2.y do
|
||||
for z=p1.z,p2.z do
|
||||
local nn = minetest.get_node({x=x,y=y,z=z}).name
|
||||
if nn == "default:obsidian" or nn == "nether:portal" then
|
||||
if nn == "nether:portal" then
|
||||
minetest.remove_node({x=x,y=y,z=z})
|
||||
end
|
||||
local m = minetest.get_meta({x=x,y=y,z=z})
|
||||
m:set_string("p1", "")
|
||||
m:set_string("p2", "")
|
||||
m:set_string("target", "")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
meta = minetest.get_meta(target)
|
||||
if not meta then
|
||||
return
|
||||
end
|
||||
p1 = minetest.string_to_pos(meta:get_string("p1"))
|
||||
p2 = minetest.string_to_pos(meta:get_string("p2"))
|
||||
if not p1 or not p2 then
|
||||
return
|
||||
end
|
||||
for x=p1.x,p2.x do
|
||||
for y=p1.y,p2.y do
|
||||
for z=p1.z,p2.z do
|
||||
local nn = minetest.get_node({x=x,y=y,z=z}).name
|
||||
if nn == "default:obsidian" or nn == "nether:portal" then
|
||||
if nn == "nether:portal" then
|
||||
minetest.remove_node({x=x,y=y,z=z})
|
||||
end
|
||||
local m = minetest.get_meta({x=x,y=y,z=z})
|
||||
m:set_string("p1", "")
|
||||
m:set_string("p2", "")
|
||||
m:set_string("target", "")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.after(0.1, function()
|
||||
minetest.override_item("default:mese_crystal_fragment", {
|
||||
on_place = function(stack, player, pt)
|
||||
if pt.under
|
||||
and minetest.get_node(pt.under).name == "default:obsidian" then
|
||||
print("[nether] tries to enable a portal")
|
||||
local done = make_portal(pt.under)
|
||||
if done then
|
||||
minetest.chat_send_player(
|
||||
player:get_player_name(),
|
||||
"Warning: If you are in the nether you may not be able to find the way out!"
|
||||
)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
stack:take_item()
|
||||
end
|
||||
end
|
||||
end
|
||||
return stack
|
||||
end
|
||||
})
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
vector.square = vector.square or
|
||||
function(r)
|
||||
local tab, n = {}, 1
|
||||
for i = -r+1, r do
|
||||
for j = -1, 1, 2 do
|
||||
local a, b = r*j, i*j
|
||||
tab[n] = {a, b}
|
||||
tab[n+1] = {b, a}
|
||||
n=n+2
|
||||
end
|
||||
end
|
||||
return tab
|
||||
end
|
||||
|
||||
local function netherport(pos)
|
||||
local x, y, z = pos.x, pos.y, pos.z
|
||||
for _,i in ipairs({-1, 3}) do
|
||||
if minetest.get_node({x=x, y=y+i, z=z}).name ~= "nether:white" then
|
||||
return
|
||||
end
|
||||
end
|
||||
for _,sn in ipairs(vector.square(1)) do
|
||||
if minetest.get_node({x=x+sn[1], y=y-1, z=z+sn[2]}).name ~= "nether:netherrack"
|
||||
or minetest.get_node({x=x+sn[1], y=y+3, z=z+sn[2]}).name ~= "nether:blood_cooked" then
|
||||
return
|
||||
end
|
||||
end
|
||||
for _,sn in ipairs(vector.square(2)) do
|
||||
if minetest.get_node({x=x+sn[1], y=y-1, z=z+sn[2]}).name ~= "nether:netherrack_black"
|
||||
or minetest.get_node({x=x+sn[1], y=y+3, z=z+sn[2]}).name ~= "nether:wood_empty" then
|
||||
return
|
||||
end
|
||||
end
|
||||
for i = -1,1,2 do
|
||||
for j = -1,1,2 do
|
||||
if minetest.get_node({x=x+i, y=y+2, z=z+j}).name ~= "nether:apple" then
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
for i = -2,2,4 do
|
||||
for j = 0,2 do
|
||||
for k = -2,2,4 do
|
||||
if minetest.get_node({x=x+i, y=y+j, z=z+k}).name ~= "nether:netherrack_brick_blue" then
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for i = -1,1 do
|
||||
for j = -1,1 do
|
||||
if minetest.get_node({x=x+i, y=y+4, z=z+j}).name ~= "nether:wood_empty" then
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function nether_port(player, pos)
|
||||
if not player
|
||||
or not pos
|
||||
or not pos.x then
|
||||
print("[nether] something failed.")
|
||||
return
|
||||
end
|
||||
if not netherport(pos) then
|
||||
return
|
||||
end
|
||||
minetest.sound_play("nether_teleporter", {pos=pos})
|
||||
if pos.y < nether.start then
|
||||
player_from_nether(player)
|
||||
local pos_togo = {x = 0, y = 35, z = -7}
|
||||
if minetest.setting_getbool("static_spawnpoint") ~= nil then
|
||||
stsp_conf = minetest.setting_get("static_spawnpoint")
|
||||
pos_togo = {x = stsp_conf:split(",")[1],y = stsp_conf:split(",")[2],z = stsp_conf:split(",")[3]}
|
||||
end
|
||||
player:moveto(pos_togo)
|
||||
else
|
||||
player:moveto({x=pos.x, y=portal_target+math.random(4), z=pos.z})
|
||||
player_to_nether(player, true)
|
||||
end
|
||||
return true
|
||||
end
|
@ -1,365 +0,0 @@
|
||||
--[[ Nether leaves
|
||||
minetest.register_node("nether:leaves", {
|
||||
description = "Nether Leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
-- visual_scale = 1.189, --scale^2=sqrt(2)
|
||||
tiles = {"nether_leaves.png"},
|
||||
paramtype = "light",
|
||||
groups = {snappy=3, leafdecay=2},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})]]
|
||||
|
||||
--[[ Nether Lava
|
||||
minetest.register_node("nether:lava_flowing", {
|
||||
description = "Nether Lava (flowing)",
|
||||
inventory_image = minetest.inventorycube("default_lava.png"),
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"default_lava.png"},
|
||||
paramtype = "light",
|
||||
light_source = LIGHT_MAX - 1,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "nether:lava_flowing",
|
||||
liquid_alternative_source = "default:lava_source",
|
||||
liquid_viscosity = LAVA_VISC,
|
||||
damage_per_second = 4*2,
|
||||
post_effect_color = {a=192, r=255, g=64, b=0},
|
||||
special_materials = {
|
||||
{image="default_lava.png", backface_culling=false},
|
||||
{image="default_lava.png", backface_culling=true},
|
||||
},
|
||||
groups = {lava=3, liquid=2, hot=3},
|
||||
})
|
||||
|
||||
minetest.register_node("nether:lava_source", {
|
||||
description = "Nether Lava",
|
||||
inventory_image = minetest.inventorycube("default_lava.png"),
|
||||
drawtype = "liquid",
|
||||
tiles = {"default_lava.png"},
|
||||
paramtype = "light",
|
||||
light_source = LIGHT_MAX - 1,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "nether:lava_flowing",
|
||||
liquid_alternative_source = "default:lava_source",
|
||||
liquid_viscosity = LAVA_VISC,
|
||||
damage_per_second = 4*2,
|
||||
post_effect_color = {a=192, r=255, g=64, b=0},
|
||||
special_materials = {
|
||||
-- New-style lava source material (mostly unused)
|
||||
{image="default_lava.png", backface_culling=false},
|
||||
},
|
||||
groups = {lava=3, liquid=2, hot=3},
|
||||
})]]
|
||||
|
||||
-- Throne of Hades
|
||||
HADES_THRONE = {
|
||||
-- Lava Moat
|
||||
{pos={x=-1,y=-1,z=-1}, block="default:lava_source"},
|
||||
{pos={x=-1,y=-1,z=0}, block="default:lava_source"},
|
||||
{pos={x=-1,y=-1,z=1}, block="default:lava_source"},
|
||||
{pos={x=-1,y=-1,z=2}, block="default:lava_source"},
|
||||
{pos={x=-1,y=-1,z=3}, block="default:lava_source"},
|
||||
{pos={x=-1,y=-1,z=4}, block="default:lava_source"},
|
||||
{pos={x=-1,y=-1,z=5}, block="default:lava_source"},
|
||||
{pos={x=-1,y=-1,z=6}, block="default:lava_source"},
|
||||
{pos={x=-1,y=-1,z=7}, block="default:lava_source"},
|
||||
{pos={x=0,y=-1,z=7}, block="default:lava_source"},
|
||||
{pos={x=1,y=-1,z=7}, block="default:lava_source"},
|
||||
{pos={x=2,y=-1,z=7}, block="default:lava_source"},
|
||||
{pos={x=3,y=-1,z=7}, block="default:lava_source"},
|
||||
{pos={x=4,y=-1,z=7}, block="default:lava_source"},
|
||||
{pos={x=5,y=-1,z=7}, block="default:lava_source"},
|
||||
{pos={x=6,y=-1,z=7}, block="default:lava_source"},
|
||||
{pos={x=6,y=-1,z=6}, block="default:lava_source"},
|
||||
{pos={x=6,y=-1,z=5}, block="default:lava_source"},
|
||||
{pos={x=6,y=-1,z=4}, block="default:lava_source"},
|
||||
{pos={x=6,y=-1,z=3}, block="default:lava_source"},
|
||||
{pos={x=6,y=-1,z=2}, block="default:lava_source"},
|
||||
{pos={x=6,y=-1,z=1}, block="default:lava_source"},
|
||||
{pos={x=6,y=-1,z=0}, block="default:lava_source"},
|
||||
{pos={x=6,y=-1,z=-1}, block="default:lava_source"},
|
||||
{pos={x=5,y=-1,z=-1}, block="default:lava_source"},
|
||||
{pos={x=4,y=-1,z=-1}, block="default:lava_source"},
|
||||
{pos={x=3,y=-1,z=-1}, block="default:lava_source"},
|
||||
{pos={x=2,y=-1,z=-1}, block="default:lava_source"},
|
||||
{pos={x=1,y=-1,z=-1}, block="default:lava_source"},
|
||||
{pos={x=0,y=-1,z=-1}, block="default:lava_source"},
|
||||
-- Floor 1
|
||||
{pos={x=0,y=0,z=0}, block="nether:netherrack"},
|
||||
{pos={x=0,y=0,z=1}, block="nether:netherrack"},
|
||||
{pos={x=0,y=0,z=2}, block="nether:netherrack"},
|
||||
{pos={x=0,y=0,z=3}, block="nether:netherrack"},
|
||||
{pos={x=0,y=0,z=4}, block="nether:netherrack"},
|
||||
{pos={x=0,y=0,z=5}, block="nether:netherrack"},
|
||||
{pos={x=1,y=0,z=5}, block="nether:netherrack"},
|
||||
{pos={x=2,y=0,z=5}, block="nether:netherrack"},
|
||||
{pos={x=3,y=0,z=5}, block="nether:netherrack"},
|
||||
{pos={x=4,y=0,z=5}, block="nether:netherrack"},
|
||||
{pos={x=5,y=0,z=5}, block="nether:netherrack"},
|
||||
{pos={x=0,y=0,z=6}, block="nether:netherrack"},
|
||||
{pos={x=1,y=0,z=6}, block="nether:netherrack"},
|
||||
{pos={x=2,y=0,z=6}, block="nether:netherrack"},
|
||||
{pos={x=3,y=0,z=6}, block="nether:netherrack"},
|
||||
{pos={x=4,y=0,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=0,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=0,z=4}, block="nether:netherrack"},
|
||||
{pos={x=5,y=0,z=3}, block="nether:netherrack"},
|
||||
{pos={x=5,y=0,z=2}, block="nether:netherrack"},
|
||||
{pos={x=5,y=0,z=1}, block="nether:netherrack"},
|
||||
{pos={x=5,y=0,z=0}, block="nether:netherrack"},
|
||||
{pos={x=4,y=0,z=0}, block="nether:netherrack"},
|
||||
{pos={x=3,y=0,z=0}, block="nether:netherrack"},
|
||||
{pos={x=2,y=0,z=0}, block="nether:netherrack"},
|
||||
{pos={x=1,y=0,z=0}, block="nether:netherrack"},
|
||||
-- Floor 2
|
||||
{pos={x=0,y=1,z=0}, block="nether:netherrack"},
|
||||
{pos={x=0,y=1,z=1}, block="nether:netherrack"},
|
||||
{pos={x=0,y=1,z=2}, block="nether:netherrack"},
|
||||
{pos={x=0,y=1,z=3}, block="nether:netherrack"},
|
||||
{pos={x=0,y=1,z=4}, block="nether:netherrack"},
|
||||
{pos={x=0,y=1,z=5}, block="nether:netherrack"},
|
||||
{pos={x=1,y=1,z=5}, block="nether:netherrack"},
|
||||
{pos={x=2,y=1,z=5}, block="nether:netherrack"},
|
||||
{pos={x=3,y=1,z=5}, block="nether:netherrack"},
|
||||
{pos={x=4,y=1,z=5}, block="nether:netherrack"},
|
||||
{pos={x=5,y=1,z=5}, block="nether:netherrack"},
|
||||
{pos={x=0,y=1,z=6}, block="nether:netherrack"},
|
||||
{pos={x=1,y=1,z=6}, block="nether:netherrack"},
|
||||
{pos={x=2,y=1,z=6}, block="nether:netherrack"},
|
||||
{pos={x=3,y=1,z=6}, block="nether:netherrack"},
|
||||
{pos={x=4,y=1,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=1,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=1,z=4}, block="nether:netherrack"},
|
||||
{pos={x=5,y=1,z=3}, block="nether:netherrack"},
|
||||
{pos={x=5,y=1,z=2}, block="nether:netherrack"},
|
||||
{pos={x=5,y=1,z=1}, block="nether:netherrack"},
|
||||
{pos={x=5,y=1,z=0}, block="nether:netherrack"},
|
||||
{pos={x=4,y=1,z=0}, block="nether:netherrack"},
|
||||
{pos={x=3,y=1,z=1}, block="nether:netherrack"},
|
||||
{pos={x=2,y=1,z=1}, block="nether:netherrack"},
|
||||
{pos={x=1,y=1,z=0}, block="nether:netherrack"},
|
||||
{pos={x=1,y=1,z=1}, block="nether:netherrack"},
|
||||
{pos={x=4,y=1,z=1}, block="nether:netherrack"},
|
||||
-- Floor 3
|
||||
{pos={x=0,y=2,z=0}, block="nether:netherrack"},
|
||||
{pos={x=0,y=2,z=1}, block="nether:netherrack"},
|
||||
{pos={x=0,y=2,z=2}, block="nether:netherrack"},
|
||||
{pos={x=0,y=2,z=3}, block="nether:netherrack"},
|
||||
{pos={x=0,y=2,z=4}, block="nether:netherrack"},
|
||||
{pos={x=0,y=2,z=5}, block="nether:netherrack"},
|
||||
{pos={x=1,y=2,z=5}, block="nether:netherrack"},
|
||||
{pos={x=2,y=2,z=5}, block="nether:netherrack"},
|
||||
{pos={x=3,y=2,z=5}, block="nether:netherrack"},
|
||||
{pos={x=4,y=2,z=5}, block="nether:netherrack"},
|
||||
{pos={x=5,y=2,z=5}, block="nether:netherrack"},
|
||||
{pos={x=0,y=2,z=6}, block="nether:netherrack"},
|
||||
{pos={x=1,y=2,z=6}, block="nether:netherrack"},
|
||||
{pos={x=2,y=2,z=6}, block="nether:netherrack"},
|
||||
{pos={x=3,y=2,z=6}, block="nether:netherrack"},
|
||||
{pos={x=4,y=2,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=2,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=2,z=4}, block="nether:netherrack"},
|
||||
{pos={x=5,y=2,z=3}, block="nether:netherrack"},
|
||||
{pos={x=5,y=2,z=2}, block="nether:netherrack"},
|
||||
{pos={x=5,y=2,z=1}, block="nether:netherrack"},
|
||||
{pos={x=5,y=2,z=0}, block="nether:netherrack"},
|
||||
{pos={x=4,y=2,z=0}, block="nether:netherrack"},
|
||||
{pos={x=3,y=2,z=2}, block="nether:netherrack"},
|
||||
{pos={x=2,y=2,z=2}, block="nether:netherrack"},
|
||||
{pos={x=1,y=2,z=0}, block="nether:netherrack"},
|
||||
{pos={x=1,y=2,z=1}, block="nether:netherrack"},
|
||||
{pos={x=4,y=2,z=1}, block="nether:netherrack"},
|
||||
{pos={x=1,y=2,z=2}, block="nether:netherrack"},
|
||||
{pos={x=4,y=2,z=2}, block="nether:netherrack"},
|
||||
-- Floor 4
|
||||
{pos={x=0,y=3,z=0}, block="nether:netherrack"},
|
||||
{pos={x=0,y=3,z=1}, block="nether:netherrack"},
|
||||
{pos={x=0,y=3,z=2}, block="nether:netherrack"},
|
||||
{pos={x=0,y=3,z=3}, block="nether:netherrack"},
|
||||
{pos={x=0,y=3,z=4}, block="nether:netherrack"},
|
||||
{pos={x=0,y=3,z=5}, block="nether:netherrack"},
|
||||
{pos={x=1,y=3,z=5}, block="nether:netherrack"},
|
||||
{pos={x=2,y=3,z=5}, block="nether:netherrack"},
|
||||
{pos={x=3,y=3,z=5}, block="nether:netherrack"},
|
||||
{pos={x=4,y=3,z=5}, block="nether:netherrack"},
|
||||
{pos={x=5,y=3,z=5}, block="nether:netherrack"},
|
||||
{pos={x=0,y=3,z=6}, block="nether:netherrack"},
|
||||
{pos={x=1,y=3,z=6}, block="nether:netherrack"},
|
||||
{pos={x=2,y=3,z=6}, block="nether:netherrack"},
|
||||
{pos={x=3,y=3,z=6}, block="nether:netherrack"},
|
||||
{pos={x=4,y=3,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=3,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=3,z=4}, block="nether:netherrack"},
|
||||
{pos={x=5,y=3,z=3}, block="nether:netherrack"},
|
||||
{pos={x=5,y=3,z=2}, block="nether:netherrack"},
|
||||
{pos={x=5,y=3,z=1}, block="nether:netherrack"},
|
||||
{pos={x=5,y=3,z=0}, block="nether:netherrack"},
|
||||
{pos={x=4,y=3,z=0}, block="nether:netherrack"},
|
||||
{pos={x=3,y=3,z=3}, block="nether:netherrack"},
|
||||
{pos={x=2,y=3,z=3}, block="nether:netherrack"},
|
||||
{pos={x=1,y=3,z=0}, block="nether:netherrack"},
|
||||
{pos={x=1,y=3,z=1}, block="nether:netherrack"},
|
||||
{pos={x=4,y=3,z=1}, block="nether:netherrack"},
|
||||
{pos={x=1,y=3,z=2}, block="nether:netherrack"},
|
||||
{pos={x=4,y=3,z=2}, block="nether:netherrack"},
|
||||
{pos={x=1,y=3,z=3}, block="nether:netherrack"},
|
||||
{pos={x=4,y=3,z=3}, block="nether:netherrack"},
|
||||
{pos={x=1,y=3,z=4}, block="nether:netherrack"},
|
||||
{pos={x=4,y=3,z=4}, block="nether:netherrack"},
|
||||
{pos={x=2,y=3,z=4}, block="nether:netherrack"},
|
||||
{pos={x=2,y=3,z=5}, block="nether:netherrack"},
|
||||
{pos={x=3,y=3,z=4}, block="nether:netherrack"},
|
||||
{pos={x=3,y=3,z=5}, block="nether:netherrack"},
|
||||
-- Floor 5
|
||||
{pos={x=2,y=4,z=4}, block="nether:netherrack"},
|
||||
{pos={x=2,y=4,z=5}, block="nether:netherrack"},
|
||||
{pos={x=3,y=4,z=4}, block="nether:netherrack"},
|
||||
{pos={x=3,y=4,z=5}, block="nether:netherrack"},
|
||||
{pos={x=2,y=4,z=6}, block="nether:netherrack"},
|
||||
{pos={x=3,y=4,z=6}, block="nether:netherrack"},
|
||||
-- Torches on floor 5
|
||||
{pos={x=0,y=4,z=4}, block="nether:torch_bottom"},
|
||||
{pos={x=1,y=4,z=4}, block="nether:torch_bottom"},
|
||||
{pos={x=0,y=4,z=5}, block="nether:torch_bottom"},
|
||||
{pos={x=1,y=4,z=5}, block="nether:torch_bottom"},
|
||||
{pos={x=4,y=4,z=4}, block="nether:torch_bottom"},
|
||||
{pos={x=5,y=4,z=4}, block="nether:torch_bottom"},
|
||||
{pos={x=4,y=4,z=5}, block="nether:torch_bottom"},
|
||||
{pos={x=5,y=4,z=5}, block="nether:torch_bottom"},
|
||||
{pos={x=0,y=4,z=0}, block="nether:torch_bottom"},
|
||||
{pos={x=1,y=4,z=0}, block="nether:torch_bottom"},
|
||||
{pos={x=0,y=4,z=1}, block="nether:torch_bottom"},
|
||||
{pos={x=1,y=4,z=1}, block="nether:torch_bottom"},
|
||||
{pos={x=4,y=4,z=0}, block="nether:torch_bottom"},
|
||||
{pos={x=5,y=4,z=0}, block="nether:torch_bottom"},
|
||||
{pos={x=4,y=4,z=1}, block="nether:torch_bottom"},
|
||||
{pos={x=5,y=4,z=1}, block="nether:torch_bottom"},
|
||||
{pos={x=0,y=4,z=2}, block="nether:torch_bottom"},
|
||||
{pos={x=1,y=4,z=2}, block="nether:torch_bottom"},
|
||||
{pos={x=0,y=4,z=3}, block="nether:torch_bottom"},
|
||||
{pos={x=1,y=4,z=3}, block="nether:torch_bottom"},
|
||||
{pos={x=4,y=4,z=2}, block="nether:torch_bottom"},
|
||||
{pos={x=5,y=4,z=2}, block="nether:torch_bottom"},
|
||||
{pos={x=4,y=4,z=3}, block="nether:torch_bottom"},
|
||||
{pos={x=5,y=4,z=3}, block="nether:torch_bottom"},
|
||||
{pos={x=4,y=4,z=6}, block="nether:torch_bottom"},
|
||||
{pos={x=5,y=4,z=6}, block="nether:torch_bottom"},
|
||||
{pos={x=0,y=4,z=6}, block="nether:torch_bottom"},
|
||||
{pos={x=1,y=4,z=6}, block="nether:torch_bottom"},
|
||||
-- Nether Portal
|
||||
{pos={x=1,y=5,z=6}, portalblock=true},
|
||||
}
|
||||
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if minp.y <= 99 then
|
||||
return
|
||||
end
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local data = vm:get_data()
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
|
||||
local perlin1 = minetest.get_perlin(13,3, 0.5, 50) --Get map specific perlin
|
||||
local perlin2 = minetest.get_perlin(133,3, 0.5, 10)
|
||||
for x=minp.x, maxp.x, 1 do
|
||||
for z=minp.z, maxp.z, 1 do
|
||||
local test = perlin1:get2d({x=x, y=z})+1
|
||||
local test2 = perlin2:get2d({x=x, y=z})
|
||||
-- print(test)
|
||||
if test2 < 0 then
|
||||
h = 200+math.floor(test2*3+0.5)
|
||||
else
|
||||
h = 203+math.floor(test*3+0.5)
|
||||
end
|
||||
for y=minp.y, maxp.y, 1 do
|
||||
p_addpos = area:index(x, y, z)
|
||||
if y <= h then
|
||||
data[p_addpos] = c_netherrack
|
||||
elseif y <= 201 then
|
||||
data[p_addpos] = c_lava
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vm:set_data(data)
|
||||
--vm:set_lighting({day=0, night=0})
|
||||
vm:calc_lighting()
|
||||
vm:update_liquids()
|
||||
vm:write_to_map()
|
||||
end)
|
||||
|
||||
|
||||
We don't want the Throne of Hades to get regenerated (especially since it will screw up portals)
|
||||
if (minp.x <= HADES_THRONE_STARTPOS_ABS.x)
|
||||
and (maxp.x >= HADES_THRONE_STARTPOS_ABS.x)
|
||||
and (minp.y <= HADES_THRONE_STARTPOS_ABS.y)
|
||||
and (maxp.y >= HADES_THRONE_STARTPOS_ABS.y)
|
||||
and (minp.z <= HADES_THRONE_STARTPOS_ABS.z)
|
||||
and (maxp.z >= HADES_THRONE_STARTPOS_ABS.z)
|
||||
and (nether:fileexists(HADES_THRONE_GENERATED) == false) then
|
||||
-- Pass 3: Make way for the Throne of Hades!
|
||||
for x=(HADES_THRONE_STARTPOS_ABS.x - 1), (HADES_THRONE_ENDPOS_ABS.x + 1), 1 do
|
||||
for z=(HADES_THRONE_STARTPOS_ABS.z - 1), (HADES_THRONE_ENDPOS_ABS.z + 1), 1 do
|
||||
-- Notice I did not put a -1 for the beginning. This is because we don't want the throne to float
|
||||
for y=HADES_THRONE_STARTPOS_ABS.y, (HADES_THRONE_ENDPOS_ABS.y + 1), 1 do
|
||||
addpos = {x=x, y=y, z=z}
|
||||
minetest.add_node(addpos, {name="air"})
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Pass 4: Throne of Hades
|
||||
for i,v in ipairs(HADES_THRONE_ABS) do
|
||||
if v.portalblock == true then
|
||||
NETHER_PORTALS_FROM_NETHER[table.getn(NETHER_PORTALS_FROM_NETHER)+1] = v.pos
|
||||
nether:save_portal_from_nether(v.pos)
|
||||
nether:createportal(v.pos)
|
||||
else
|
||||
minetest.add_node(v.pos, {name=v.block})
|
||||
end
|
||||
end
|
||||
nether:touch(HADES_THRONE_GENERATED)
|
||||
end
|
||||
|
||||
--[[ Create a nether tree
|
||||
function nether:grow_nethertree(pos)
|
||||
--TRUNK
|
||||
pos.y=pos.y+1
|
||||
local trunkpos={x=pos.x, z=pos.z}
|
||||
for y=pos.y, pos.y+4+math.random(2) do
|
||||
trunkpos.y=y
|
||||
minetest.add_node(trunkpos, {name="nether:tree"})
|
||||
end
|
||||
--LEAVES
|
||||
local leafpos={}
|
||||
for x=(trunkpos.x-NETHER_TREESIZE), (trunkpos.x+NETHER_TREESIZE), 1 do
|
||||
for y=(trunkpos.y-NETHER_TREESIZE), (trunkpos.y+NETHER_TREESIZE), 1 do
|
||||
for z=(trunkpos.z-NETHER_TREESIZE), (trunkpos.z+NETHER_TREESIZE), 1 do
|
||||
if (x-trunkpos.x)*(x-trunkpos.x)
|
||||
+(y-trunkpos.y)*(y-trunkpos.y)
|
||||
+(z-trunkpos.z)*(z-trunkpos.z)
|
||||
<= NETHER_TREESIZE*NETHER_TREESIZE + NETHER_TREESIZE then
|
||||
leafpos={x=x, y=y, z=z}
|
||||
if minetest.get_node(leafpos).name=="air" then
|
||||
if math.random(NETHER_APPLE_FREQ) == 1 then
|
||||
if math.random(NETHER_HEAL_APPLE_FREQ) == 1 then
|
||||
minetest.add_node(leafpos, {name="default:apple"})
|
||||
else
|
||||
minetest.add_node(leafpos, {name="nether:apple"})
|
||||
end
|
||||
else
|
||||
minetest.add_node(leafpos, {name="nether:leaves"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end]]
|
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 319 B |
Before Width: | Height: | Size: 452 B |
Before Width: | Height: | Size: 572 B |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 762 B |
Before Width: | Height: | Size: 574 B |
Before Width: | Height: | Size: 612 B |
@ -1,166 +0,0 @@
|
||||
-- Floor 1
|
||||
{pos={x=0,y=0,z=0}, block="nether:netherrack"},
|
||||
{pos={x=0,y=0,z=1}, block="nether:netherrack"},
|
||||
{pos={x=0,y=0,z=2}, block="nether:netherrack"},
|
||||
{pos={x=0,y=0,z=3}, block="nether:netherrack"},
|
||||
{pos={x=0,y=0,z=4}, block="nether:netherrack"},
|
||||
{pos={x=0,y=0,z=5}, block="nether:netherrack"},
|
||||
{pos={x=1,y=0,z=5}, block="nether:netherrack"},
|
||||
{pos={x=2,y=0,z=5}, block="nether:netherrack"},
|
||||
{pos={x=3,y=0,z=5}, block="nether:netherrack"},
|
||||
{pos={x=4,y=0,z=5}, block="nether:netherrack"},
|
||||
{pos={x=5,y=0,z=5}, block="nether:netherrack"},
|
||||
{pos={x=0,y=0,z=6}, block="nether:netherrack"},
|
||||
{pos={x=1,y=0,z=6}, block="nether:netherrack"},
|
||||
{pos={x=2,y=0,z=6}, block="nether:netherrack"},
|
||||
{pos={x=3,y=0,z=6}, block="nether:netherrack"},
|
||||
{pos={x=4,y=0,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=0,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=0,z=4}, block="nether:netherrack"},
|
||||
{pos={x=5,y=0,z=3}, block="nether:netherrack"},
|
||||
{pos={x=5,y=0,z=2}, block="nether:netherrack"},
|
||||
{pos={x=5,y=0,z=1}, block="nether:netherrack"},
|
||||
{pos={x=5,y=0,z=0}, block="nether:netherrack"},
|
||||
{pos={x=4,y=0,z=0}, block="nether:netherrack"},
|
||||
{pos={x=3,y=0,z=0}, block="nether:netherrack"},
|
||||
{pos={x=2,y=0,z=0}, block="nether:netherrack"},
|
||||
{pos={x=1,y=0,z=0}, block="nether:netherrack"},
|
||||
-- Floor 2
|
||||
{pos={x=0,y=1,z=0}, block="nether:netherrack"},
|
||||
{pos={x=0,y=1,z=1}, block="nether:netherrack"},
|
||||
{pos={x=0,y=1,z=2}, block="nether:netherrack"},
|
||||
{pos={x=0,y=1,z=3}, block="nether:netherrack"},
|
||||
{pos={x=0,y=1,z=4}, block="nether:netherrack"},
|
||||
{pos={x=0,y=1,z=5}, block="nether:netherrack"},
|
||||
{pos={x=1,y=1,z=5}, block="nether:netherrack"},
|
||||
{pos={x=2,y=1,z=5}, block="nether:netherrack"},
|
||||
{pos={x=3,y=1,z=5}, block="nether:netherrack"},
|
||||
{pos={x=4,y=1,z=5}, block="nether:netherrack"},
|
||||
{pos={x=5,y=1,z=5}, block="nether:netherrack"},
|
||||
{pos={x=0,y=1,z=6}, block="nether:netherrack"},
|
||||
{pos={x=1,y=1,z=6}, block="nether:netherrack"},
|
||||
{pos={x=2,y=1,z=6}, block="nether:netherrack"},
|
||||
{pos={x=3,y=1,z=6}, block="nether:netherrack"},
|
||||
{pos={x=4,y=1,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=1,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=1,z=4}, block="nether:netherrack"},
|
||||
{pos={x=5,y=1,z=3}, block="nether:netherrack"},
|
||||
{pos={x=5,y=1,z=2}, block="nether:netherrack"},
|
||||
{pos={x=5,y=1,z=1}, block="nether:netherrack"},
|
||||
{pos={x=5,y=1,z=0}, block="nether:netherrack"},
|
||||
{pos={x=4,y=1,z=0}, block="nether:netherrack"},
|
||||
{pos={x=3,y=1,z=1}, block="nether:netherrack"},
|
||||
{pos={x=2,y=1,z=1}, block="nether:netherrack"},
|
||||
{pos={x=1,y=1,z=0}, block="nether:netherrack"},
|
||||
{pos={x=1,y=1,z=1}, block="nether:netherrack"},
|
||||
{pos={x=4,y=1,z=1}, block="nether:netherrack"},
|
||||
-- Floor 3
|
||||
{pos={x=0,y=2,z=0}, block="nether:netherrack"},
|
||||
{pos={x=0,y=2,z=1}, block="nether:netherrack"},
|
||||
{pos={x=0,y=2,z=2}, block="nether:netherrack"},
|
||||
{pos={x=0,y=2,z=3}, block="nether:netherrack"},
|
||||
{pos={x=0,y=2,z=4}, block="nether:netherrack"},
|
||||
{pos={x=0,y=2,z=5}, block="nether:netherrack"},
|
||||
{pos={x=1,y=2,z=5}, block="nether:netherrack"},
|
||||
{pos={x=2,y=2,z=5}, block="nether:netherrack"},
|
||||
{pos={x=3,y=2,z=5}, block="nether:netherrack"},
|
||||
{pos={x=4,y=2,z=5}, block="nether:netherrack"},
|
||||
{pos={x=5,y=2,z=5}, block="nether:netherrack"},
|
||||
{pos={x=0,y=2,z=6}, block="nether:netherrack"},
|
||||
{pos={x=1,y=2,z=6}, block="nether:netherrack"},
|
||||
{pos={x=2,y=2,z=6}, block="nether:netherrack"},
|
||||
{pos={x=3,y=2,z=6}, block="nether:netherrack"},
|
||||
{pos={x=4,y=2,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=2,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=2,z=4}, block="nether:netherrack"},
|
||||
{pos={x=5,y=2,z=3}, block="nether:netherrack"},
|
||||
{pos={x=5,y=2,z=2}, block="nether:netherrack"},
|
||||
{pos={x=5,y=2,z=1}, block="nether:netherrack"},
|
||||
{pos={x=5,y=2,z=0}, block="nether:netherrack"},
|
||||
{pos={x=4,y=2,z=0}, block="nether:netherrack"},
|
||||
{pos={x=3,y=2,z=2}, block="nether:netherrack"},
|
||||
{pos={x=2,y=2,z=2}, block="nether:netherrack"},
|
||||
{pos={x=1,y=2,z=0}, block="nether:netherrack"},
|
||||
{pos={x=1,y=2,z=1}, block="nether:netherrack"},
|
||||
{pos={x=4,y=2,z=1}, block="nether:netherrack"},
|
||||
{pos={x=1,y=2,z=2}, block="nether:netherrack"},
|
||||
{pos={x=4,y=2,z=2}, block="nether:netherrack"},
|
||||
-- Floor 4
|
||||
{pos={x=0,y=3,z=0}, block="nether:netherrack"},
|
||||
{pos={x=0,y=3,z=1}, block="nether:netherrack"},
|
||||
{pos={x=0,y=3,z=2}, block="nether:netherrack"},
|
||||
{pos={x=0,y=3,z=3}, block="nether:netherrack"},
|
||||
{pos={x=0,y=3,z=4}, block="nether:netherrack"},
|
||||
{pos={x=0,y=3,z=5}, block="nether:netherrack"},
|
||||
{pos={x=1,y=3,z=5}, block="nether:netherrack"},
|
||||
{pos={x=2,y=3,z=5}, block="nether:netherrack"},
|
||||
{pos={x=3,y=3,z=5}, block="nether:netherrack"},
|
||||
{pos={x=4,y=3,z=5}, block="nether:netherrack"},
|
||||
{pos={x=5,y=3,z=5}, block="nether:netherrack"},
|
||||
{pos={x=0,y=3,z=6}, block="nether:netherrack"},
|
||||
{pos={x=1,y=3,z=6}, block="nether:netherrack"},
|
||||
{pos={x=2,y=3,z=6}, block="nether:netherrack"},
|
||||
{pos={x=3,y=3,z=6}, block="nether:netherrack"},
|
||||
{pos={x=4,y=3,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=3,z=6}, block="nether:netherrack"},
|
||||
{pos={x=5,y=3,z=4}, block="nether:netherrack"},
|
||||
{pos={x=5,y=3,z=3}, block="nether:netherrack"},
|
||||
{pos={x=5,y=3,z=2}, block="nether:netherrack"},
|
||||
{pos={x=5,y=3,z=1}, block="nether:netherrack"},
|
||||
{pos={x=5,y=3,z=0}, block="nether:netherrack"},
|
||||
{pos={x=4,y=3,z=0}, block="nether:netherrack"},
|
||||
{pos={x=3,y=3,z=3}, block="nether:netherrack"},
|
||||
{pos={x=2,y=3,z=3}, block="nether:netherrack"},
|
||||
{pos={x=1,y=3,z=0}, block="nether:netherrack"},
|
||||
{pos={x=1,y=3,z=1}, block="nether:netherrack"},
|
||||
{pos={x=4,y=3,z=1}, block="nether:netherrack"},
|
||||
{pos={x=1,y=3,z=2}, block="nether:netherrack"},
|
||||
{pos={x=4,y=3,z=2}, block="nether:netherrack"},
|
||||
{pos={x=1,y=3,z=3}, block="nether:netherrack"},
|
||||
{pos={x=4,y=3,z=3}, block="nether:netherrack"},
|
||||
{pos={x=1,y=3,z=4}, block="nether:netherrack"},
|
||||
{pos={x=4,y=3,z=4}, block="nether:netherrack"},
|
||||
{pos={x=2,y=3,z=4}, block="nether:netherrack"},
|
||||
{pos={x=2,y=3,z=5}, block="nether:netherrack"},
|
||||
{pos={x=3,y=3,z=4}, block="nether:netherrack"},
|
||||
{pos={x=3,y=3,z=5}, block="nether:netherrack"},
|
||||
-- Floor 5
|
||||
{pos={x=2,y=4,z=4}, block="nether:netherrack"},
|
||||
{pos={x=2,y=4,z=5}, block="nether:netherrack"},
|
||||
{pos={x=3,y=4,z=4}, block="nether:netherrack"},
|
||||
{pos={x=3,y=4,z=5}, block="nether:netherrack"},
|
||||
{pos={x=2,y=4,z=6}, block="nether:netherrack"},
|
||||
{pos={x=3,y=4,z=6}, block="nether:netherrack"},
|
||||
-- Torches on floor 5
|
||||
{pos={x=0,y=4,z=4}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=1,y=4,z=4}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=0,y=4,z=5}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=1,y=4,z=5}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=4,y=4,z=4}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=5,y=4,z=4}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=4,y=4,z=5}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=5,y=4,z=5}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=0,y=4,z=0}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=1,y=4,z=0}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=0,y=4,z=1}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=1,y=4,z=1}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=4,y=4,z=0}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=5,y=4,z=0}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=4,y=4,z=1}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=5,y=4,z=1}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=0,y=4,z=2}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=1,y=4,z=2}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=0,y=4,z=3}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=1,y=4,z=3}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=4,y=4,z=2}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=5,y=4,z=2}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=4,y=4,z=3}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=5,y=4,z=3}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=4,y=4,z=6}, block="nether:nether_torch_bottom"},
|
||||
{pos={x=5,y=4,z=6}, block="nether:nether_torch_bottom"},
|
||||
-- Floor 6
|
||||
{pos={x=2,y=5,z=6}, block="nether:netherrack"},
|
||||
{pos={x=3,y=5,z=6}, block="nether:netherrack"},
|
||||
-- Floor 7
|
||||
{pos={x=2,y=6,z=6}, block="nether:netherrack"},
|
||||
{pos={x=3,y=6,z=6}, block="nether:netherrack"},
|
Before Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 289 B |
Before Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 448 B |
Before Width: | Height: | Size: 541 B |
Before Width: | Height: | Size: 474 B |
Before Width: | Height: | Size: 303 B |
Before Width: | Height: | Size: 726 B |
Before Width: | Height: | Size: 478 B |
Before Width: | Height: | Size: 493 B |
Before Width: | Height: | Size: 401 B |
Before Width: | Height: | Size: 446 B |
Before Width: | Height: | Size: 607 B |
Before Width: | Height: | Size: 532 B |
Before Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 764 B |
Before Width: | Height: | Size: 544 B |
Before Width: | Height: | Size: 463 B |
Before Width: | Height: | Size: 709 B |
Before Width: | Height: | Size: 471 B |
Before Width: | Height: | Size: 673 B |
Before Width: | Height: | Size: 449 B |
Before Width: | Height: | Size: 699 B |
Before Width: | Height: | Size: 481 B |
Before Width: | Height: | Size: 807 B |
Before Width: | Height: | Size: 669 B |
Before Width: | Height: | Size: 670 B |
Before Width: | Height: | Size: 528 B |
Before Width: | Height: | Size: 222 B |
Before Width: | Height: | Size: 488 B |
Before Width: | Height: | Size: 775 B |
Before Width: | Height: | Size: 550 B |
Before Width: | Height: | Size: 244 B |
Before Width: | Height: | Size: 211 B |
Before Width: | Height: | Size: 359 B |
Before Width: | Height: | Size: 519 B |
Before Width: | Height: | Size: 529 B |
Before Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 516 B |
Before Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 352 B |
Before Width: | Height: | Size: 218 B |
Before Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 280 B |
Before Width: | Height: | Size: 427 B |
Before Width: | Height: | Size: 603 B |
Before Width: | Height: | Size: 582 B |
Before Width: | Height: | Size: 490 B |
Before Width: | Height: | Size: 831 B |
Before Width: | Height: | Size: 693 B |
Before Width: | Height: | Size: 682 B |
Before Width: | Height: | Size: 547 B |
Before Width: | Height: | Size: 726 B |