at least a bit history

This commit is contained in:
HybridDog 2015-02-18 18:34:03 +01:00
parent 4dba4e8cb1
commit 7c75dafcdb
136 changed files with 3573 additions and 861 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
## Generic ignorable patterns and files
*~
.*.swp
debug.txt

View File

@ -1,3 +1,10 @@
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:
— change the portal
— add a teleportation ball
— finish nether forest

243
nether/crafting.lua Normal file
View File

@ -0,0 +1,243 @@
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({
output = "nether:forest_planks 7",
recipe = {
{"nether:tree"},
},
})
local sound_allowed = true
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
if itemstack:get_name() == "nether:forest_planks"
and itemstack:get_count() == 7 then
local tree
for i = 1,9 do
if old_craft_grid[i]:get_name() == "nether:tree" then
tree = i
break
end
end
if not tree then -- do nth if theres no tree
return
end
local rdif = math.random(-1,1) -- add a bit randomness
local barkstack = ItemStack("nether:bark "..4-rdif)
local inv = player:get_inventory()
if not inv:room_for_item("main", barkstack) then -- disallow crafting if there's not enough free space
craft_inv:set_list("craft", old_craft_grid)
itemstack:set_name("")
return
end
itemstack:set_count(7+rdif)
inv:add_item("main", barkstack)
if sound_allowed then
minetest.sound_play("default_wood_footstep", {pos=player:getpos(), gain=0.25})
sound_allowed = false
minetest.after(0, function()
sound_allowed = true
end)
end
end
end)
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

View File

@ -1,3 +1,4 @@
default
riesenpilz
glow
riesenpilz
stairs

346
nether/furnace.lua Normal file
View File

@ -0,0 +1,346 @@
-- minetest time speed
local time_speed = tonumber(minetest.setting_get("time_speed"))
if not time_speed then
time_speed = 1
else
time_speed = time_speed/72
end
local function get_date()
return os.date("%y %d %H %M %S")
end
-- returns the time difference in seconds
local function get_timediff(d1, d2)
local d = string.split(d1, " ")
for n,i in pairs(string.split(d2, " ")) do
d[n] = i-d[n]
end
local secs = 0
local y,d,h,m,s = unpack(d)
if s ~= 0 then
secs = secs+s
end
if m ~= 0 then
secs = secs+m*60
end
if h ~= 0 then
secs = secs+h*3600 -- 60*60
end
if d ~= 0 then
secs = secs+d*86400 -- 60*60*24
end
if y ~= 0 then
secs = secs+y*31557600 -- 60*60*24*365.25
end
--secs = math.floor(secs+0.5)
if secs < 0 then
minetest.log("action", "play warzone2100?")
end
return secs*time_speed
end
-- copied from older default furnace code and edited a bit
function nether.get_furnace_active_formspec(pos, percent)
local formspec =
"size[8,9]"..
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100-percent)..":default_furnace_fire_fg.png]"..
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"
return formspec
end
nether.furnace_inactive_formspec =
"size[8,9]"..
"image[2,2;1,1;default_furnace_fire_bg.png]"..
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"
minetest.register_node("nether:furnace", {
description = "Furnace",
tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"},
paramtype2 = "facedir",
groups = {cracky=2},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", nether.furnace_inactive_formspec)
meta:set_string("infotext", "Furnace")
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
meta:set_string("last_active", get_date())
local inv = meta:get_inventory()
if listname == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext","Furnace is empty")
end
return stack:get_count()
else
return 0
end
elseif listname == "src" then
return stack:get_count()
elseif listname == "dst" then
return 0
end
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
meta:set_string("last_active", get_date())
local inv = meta:get_inventory()
local stack = inv:get_stack(from_list, from_index)
if to_list == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext","Furnace is empty")
end
return count
else
return 0
end
elseif to_list == "src" then
return count
elseif to_list == "dst" then
return 0
end
end,
})
minetest.register_node("nether:furnace_active", {
description = "Furnace",
tiles = {
"default_furnace_top.png",
"default_furnace_bottom.png",
"default_furnace_side.png",
"default_furnace_side.png",
"default_furnace_side.png",
{
image = "default_furnace_front_active.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1.5
},
}
},
paramtype2 = "facedir",
light_source = 8,
drop = "nether:furnace",
groups = {cracky=2, not_in_creative_inventory=1,hot=1},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", nether.furnace_inactive_formspec)
meta:set_string("infotext", "Furnace");
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("fuel") then
return false
elseif not inv:is_empty("dst") then
return false
elseif not inv:is_empty("src") then
return false
end
return true
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
meta:set_string("last_active", get_date())
local inv = meta:get_inventory()
if listname == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext","Furnace is empty")
end
return stack:get_count()
else
return 0
end
elseif listname == "src" then
return stack:get_count()
elseif listname == "dst" then
return 0
end
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
meta:set_string("last_active", get_date())
local inv = meta:get_inventory()
local stack = inv:get_stack(from_list, from_index)
if to_list == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext","Furnace is empty")
end
return count
else
return 0
end
elseif to_list == "src" then
return count
elseif to_list == "dst" then
return 0
end
end,
})
local function swap_node(pos,name)
local node = minetest.get_node(pos)
if node.name == name then
return
end
node.name = name
minetest.swap_node(pos,node)
end
minetest.register_abm({
nodenames = {"nether:furnace","nether:furnace_active"},
interval = 1.0,
chance = 1,
action = function(pos)
local meta = minetest.get_meta(pos)
if meta:get_string("timedif") == "" then
meta:set_float("timedif", 0.0)
end
-- lag shouldn't control the furnace speed
local current_time = get_date()
local last_time = meta:get_string("last_active")
if last_time == "" then
meta:set_string("last_active", current_time)
return
end
if last_time == current_time then
return
end
local timediff = get_timediff(last_time, current_time)+meta:get_string("timedif")
local times = math.floor(timediff)
meta:set_string("last_active", current_time)
meta:set_float("timedif", timediff-times)
for i = 1,times do
for _,name in pairs({
"fuel_totaltime",
"fuel_time",
"src_totaltime",
"src_time",
}) do
if meta:get_string(name) == "" then
meta:set_float(name, 0.0)
end
end
local inv = meta:get_inventory()
local srclist = inv:get_list("src")
local cooked = nil
local aftercooked
if srclist then
cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
local was_active = false
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
was_active = true
meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
meta:set_float("src_time", meta:get_float("src_time") + 1)
if cooked
and cooked.item
and meta:get_float("src_time") >= cooked.time then
-- check if there's room for output in "dst" list
if inv:room_for_item("dst",cooked.item) then
-- Put result in "dst" list
inv:add_item("dst", cooked.item)
-- take stuff from "src" list
inv:set_stack("src", 1, aftercooked.items[1])
else
--print("Could not insert '"..cooked.item:to_string().."'")
end
meta:set_string("src_time", 0)
end
end
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
meta:set_string("infotext","Furnace active: "..percent.."%")
swap_node(pos,"nether:furnace_active")
meta:set_string("formspec",nether.get_furnace_active_formspec(pos, percent))
return
end
local fuel = nil
local afterfuel
local cooked = nil
local fuellist = inv:get_list("fuel")
local srclist = inv:get_list("src")
if srclist then
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
end
if fuellist then
fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
end
if not fuel or fuel.time <= 0 then
meta:set_string("infotext","Furnace out of fuel")
swap_node(pos,"nether:furnace")
meta:set_string("formspec", nether.furnace_inactive_formspec)
return
end
if cooked.item:is_empty() then
if was_active then
meta:set_string("infotext","Furnace is empty")
swap_node(pos,"nether:furnace")
meta:set_string("formspec", nether.furnace_inactive_formspec)
end
return
end
meta:set_string("fuel_totaltime", fuel.time)
meta:set_string("fuel_time", 0)
inv:set_stack("fuel", 1, afterfuel.items[1])
end
end,
})

383
nether/guide.lua Normal file
View File

@ -0,0 +1,383 @@
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 it 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 empty blood stem can be crafted to empty 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", "21 empty nether wooden planks\n"..
"12 blue netherrack bricks\n"..
"12 black netherrack\n"..
"8 red netherrack\n"..
"8 cooked nether wood\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
})

File diff suppressed because it is too large Load Diff

990
nether/items.lua Normal file
View File

@ -0,0 +1,990 @@
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)
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 = "Nether 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 = "Nether 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 = "Nether 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",
{
name = "nether_torch.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
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 = 13,
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(),
})
local invisible = "nether_transparent.png"
minetest.register_node("nether:portal", {
description = "Nether Portal Essence",
tiles = {invisible, invisible, invisible, invisible, "nether_portal_stuff.png"},
inventory_image = "nether_portal_stuff.png",
wield_image = "nether_portal_stuff.png",
light_source = 12,
paramtype = "light",
sunlight_propagates = true,
use_texture_alpha = true,
walkable = false,
digable = false,
pointable = false,
buildable_to = false,
drop = "",
can_dig = function() return false end,
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 = "Nether Grass",
inventory_image = "nether_grass.png",
})
minetest.register_craftitem("nether:grass_dried", {
description = "Dried Nether 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},
},
})

114
nether/pearl.lua Normal file
View File

@ -0,0 +1,114 @@
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})

544
nether/portal.lua Normal file
View File

@ -0,0 +1,544 @@
--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
local 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 update_background
if damage_enabled then
function update_background(player, down)
if down then
player:set_sky({r=15, g=0, b=0}, "plain")
else
player:set_sky(nil, "regular")
end
end
else
function update_background()end
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
update_background(player, true)
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
update_background(player)
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)
local pos = player:getpos()
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})
update_background(player, true)
--[[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
update_background(player)
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
update_background(player, true)
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^[transform"..math.random(0,7),
})
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)
player:moveto({x=pos.x, y=100, z=pos.z})
else
player:moveto({x=pos.x, y=portal_target+math.random(4), z=pos.z})
player_to_nether(player, true)
end
return true
end

View File

@ -1,3 +1,63 @@
--[[ 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
@ -197,3 +257,109 @@ HADES_THRONE = {
{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]]

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 762 B

After

Width:  |  Height:  |  Size: 762 B

BIN
nether/rest/nether_tree.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 B

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 709 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 B

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 660 B

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

Some files were not shown because too many files have changed in this diff Show More