Mehr Mods hinzugefügt

This commit is contained in:
N-Nachtigal 2025-05-10 23:49:11 +02:00
parent 92a55732cf
commit 9e345a25fb
2805 changed files with 2096013 additions and 0 deletions

4
mods/nether/.gitignore vendored Normal file
View file

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

2
mods/nether/LICENSE.txt Normal file
View file

@ -0,0 +1,2 @@
GPLv3 (lkloel's version)
MIT for the changes

11
mods/nether/README.md Normal file
View file

@ -0,0 +1,11 @@
For a description of this Minetest mod, please refer to the forum topic:
https://forum.minetest.net/viewtopic.php?f=9&t=10265
TODO:
* Mapgen: Find a way to get the perlin noise values inside [-1; 1] or use
another noise.
The problem is visible in the nether forest, where the mapgen code flattens
the ceiling if it is very high.
* Mapgen: Generate more detail inside the simple pyramid-like "buildings",
e.g. add a small treasure chest node which contains items

5
mods/nether/modpack.conf Normal file
View file

@ -0,0 +1,5 @@
release = 13454
author = Hybrid Dog
name = nether
description = The underworld for Minetest.
title = Nether

1
mods/nether/modpack.txt Normal file
View file

@ -0,0 +1 @@
0

View file

@ -0,0 +1,17 @@
read_globals = {
-- Defined by Minetest
"minetest", "vector", "PseudoRandom", "VoxelArea", "ItemStack", "dump",
"string",
-- Mods
"default", "stairs"
}
globals = {"nether"}
ignore = {
"212",
-- Unused argument
"411", "421", "422", "423", "431", "432",
-- Shadowing
}
-- Allow very long lines in guide.lua for the HTML code
files["guide.lua"] = {ignore = {"631"}}

View file

@ -0,0 +1,253 @@
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:torch",
recipe = {
{"nether:bark"},
{"group:stick"},
}
})
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"
or itemstack:get_count() ~= 7 then
return
end
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 not sound_allowed then -- avoid playing the sound multiple times, e.g. when middle mouse click
return
end
minetest.sound_play("default_wood_footstep", {pos=player:get_pos(), gain=0.25})
sound_allowed = false
minetest.after(0, function()
sound_allowed = true
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_lump",
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

@ -0,0 +1,346 @@
-- minetest time speed
local time_speed = tonumber(minetest.settings: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 _ = 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,
})

View file

@ -0,0 +1,276 @@
-- The content of the guide
local guide_infos = {
{"Nether Mushroom",
[[Nether mushrooms can be found on the nether's ground and on Dirty Netherrack. They can be dug by hand.
<item name=riesenpilz:nether_shroom width=100>
<my_h2><b>Crafting Items</b></my_h2>
If we drop a Nether mushroom without holding the fast key, we can split it into its stem and head. We can use them to craft a Nether Mushroom Pickaxe, a Nether Blood Extractor, and an uncooked Nether Pearl.
<item name=nether:shroom_head width=100> <item name=nether:shroom_stem width=100>
<my_h2><b>Cultivating Mushrooms</b></my_h2>
We can get more mushrooms using Dirty Netherrack:
1. Search a dark place (light level <= 7) and, if necessary, place Netherrack with air above it
<img name=nether_netherrack.png width=100>
2. Right click with Cooked Blood onto the Netherrack to turn it into Dirty Netherrack
<item name=nether:hotbed width=100> <img name=nether_netherrack.png^nether_netherrack_soil.png width=100>
3. Right click onto the Dirty Netherrack with a Nether mushroom head to add some spores
<item name=nether:shroom_head width=100> <img name=nether_netherrack.png^nether_netherrack_soil.png width=100>
4. Wait
5. Dig the Nether mushroom which grew after some time to make place for another one. After some time new spores need to be added (step 3).
<img name=riesenpilz_nether_shroom_side.png width=100>
<img name=nether_netherrack.png^nether_netherrack_soil.png width=100>
]]},
{"Blood Structures",
[[We can find blood structures on the ground and dig their nodes with the bare hand. They contain four kinds of nodes: Nether Blood Stem, Nether Blood, Nether Blood Head, and Nether Fruit.
<item name=nether:blood_stem width=100> <item name=nether:blood width=100> <item name=nether:apple width=100>
We can craft four Nether Blood Wood nodes with the stem.
<item name=nether:wood width=100>
The four red blood nodes can be cooked in a furnace and, except Nether Blood Wood, their blood can be extracted with a Nether Blood Extractor.
<my_h2><b>Nether Fruit</b></my_h2>
<item name=nether:apple width=100>
Eating a Nether Fruit decreases life but it might work against hunger and give us blood:
<item name=nether:blood_extracted width=100>
If we eat it at the right place inside a portal, we will teleport instead of getting blood.
If we drop it without holding the fast key, we can split it into its fruit and leaf:
<item name=nether:fruit_leaf width=100> <item name=nether:fruit_no_leaf width=100>
We can craft a fruit leave block out of 9 fruit leaves
The fruit can be used to craft a nether pearl.
<item name=nether:fruit_leaves width=100>
A fruit leaves block
<my_h2><b>Cultivating Blood Structures</b></my_h2>
If we dig a Nether vine we get a Nether Blood Child. If this sapling is put in a dark place (light level <= 3) on top of a Nether Blood Head node, it grows into a new blood structure after some time.
<img name=nether_sapling.png width=100>
<img name=nether_blood.png^nether_blood_side.png width=100>
]]},
{"Tools",
[[We can craft five kinds of tools in the nether, which (except the Nether Mushroom Pickaxe) require sticks to be crafted. To obtain Nether Sticks we can use the Nether Blood Extractor.
<my_h2><b>Nether Mushroom Pickaxe</b></my_h2>
<item name=nether:pick_mushroom width=100>
Strength: 1
This pickaxe needs mushroom stems and heads to be crafted.
<my_h2><b>Nether Wood Pickaxe</b></my_h2>
<item name=nether:pick_wood width=100>
Strength: 2
This pickaxe can be crafted with Cooked Nether Blood Wood.
<my_h2><b>Netherrack Tools</b></my_h2>
<item name=nether:axe_netherrack width=100> <item name=nether:shovel_netherrack width=100> <item name=nether:sword_netherrack width=100> <item name=nether:pick_netherrack width=100>
Strength: 3
The red Netherrack tools can be crafted with usual Netherrack.
<my_h2><b>Faster Tools</b></my_h2>
<item name=nether:axe_netherrack_blue width=100> <item name=nether:shovel_netherrack_blue width=100> <item name=nether:sword_netherrack_blue width=100> <item name=nether:pick_netherrack_blue width=100>
Strength: 3
The blue Netherrack tools can be crafted with Blue Netherrack.
<item name=nether:axe_white width=100> <item name=nether:shovel_white width=100> <item name=nether:sword_white width=100> <item name=nether:pick_white width=100>
Strength: 3
The Siwtonic tools can be crafted with the Siwtonic block.
]]},
{"Cooking",
[[To get a furnace we need to dig at least 8 Netherrack Bricks. They can be found at pyramid-like constructions and require at least a strength 1 nether pickaxe to be dug.
To begin cooking things, we can use a mushroom or fruit to power a furnace. After that it is recommended to use cooked blood nodes.
<my_h2><b>Craft Recipe</b></my_h2>
To craft the furnace, we can use the netherrack bricks like cobble:
<item name=nether:netherrack_brick width=100> <item name=nether:netherrack_brick width=100> <item name=nether:netherrack_brick width=100>
<item name=nether:netherrack_brick width=100> <img name=nether_transparent.png width=100> <item name=nether:netherrack_brick width=100>
<item name=nether:netherrack_brick width=100> <item name=nether:netherrack_brick width=100> <item name=nether:netherrack_brick width=100>
<my_h2><b>Cooking Outputs</b></my_h2>
Some nether items can be cooked, for example the Blood Structure's nodes.
<item name=nether:blood_stem_cooked width=100> <item name=nether:blood_cooked width=100> <item name=nether:blood_top_cooked width=100> <item name=nether:wood_cooked width=100>
Other cookable items are Blood and an item to get a Nether Pearl.
<item name=nether:hotbed width=100> <item name=nether:pearl width=100>
]]},
{"Nether Blood Extractor",
[[With this extractor we can separate Blood from the Blood Structure's nodes. An alternative way to get Blood is to eat Nether Fruits. The Nether Blood Extractor enables us to obtain a Nether Blood Stem Extracted, which we can craft to (empty) Nether Wood and then to Nether Sticks.
<my_h2><b>Craft Recipe</b></my_h2>
We can craft the Nether Blood Extractor as follows:
<item name=nether:netherrack_brick width=100> <item name=nether:blood_top_cooked width=100> <item name=nether:netherrack_brick width=100>
<item name=nether:blood_cooked width=100> <item name=nether:shroom_stem width=100> <item name=nether:blood_cooked width=100> <img name=nether_transparent.png width=100> <item name=nether:extractor width=100>
<item name=nether:netherrack_brick width=100> <item name=nether:blood_stem_cooked width=100> <item name=nether:netherrack_brick width=100>
<my_h2><b>Usage</b></my_h2>
We can feed the extractor with Blood to make it separate Blood from neighbouring nodes:
1. Place the Nether Blood Extractor somewhere
2. Place four or fewer Blood Structure's nodes next to it. Example viewed from the top:
<img name=nether_transparent.png width=100> <img name=nether_blood_stem_top.png width=100> <img name=nether_transparent.png width=100>
<img name=nether_blood.png width=100> <img name=nether_blood_extractor.png width=100> <img name=nether_blood.png width=100>
<img name=nether_transparent.png width=100> <img name=nether_blood.png width=100> <img name=nether_transparent.png width=100>
3. Right click the extractor with Blood to power it
<img name=nether_transparent.png width=100> <img name=nether_blood_stem_top_empty.png width=100> <img name=nether_transparent.png width=100>
<img name=nether_blood_empty.png width=100> <img name=nether_blood_extractor.png width=100> <img name=nether_blood_empty.png width=100>
<img name=nether_transparent.png width=100> <img name=nether_blood_empty.png width=100> <img name=nether_transparent.png width=100>
4. Take the new extracted blood and dig the extracted nodes
]]},
{"Ores and Bricks",
[[Digging ores requires a pickaxe from the nether of a sufficient strength. Pickaxes from the overworld do not work in general.
<my_h2><b>Strength 1</b></my_h2>
<item name=glow:stone width=100>
The Glowing stone can be dug with pickaxes from the overworld or a pickaxe from the nether with a strenght of least one. We can find it on the nether's and nether forest's ceiling and use it for lighting.
<my_h2><b>Strength 2</b></my_h2>
<item name=nether:netherrack width=100> <item name=nether:netherrack_tiled width=100> <item name=nether:netherrack_black width=100>
The (red) Netherrack is generated like stone, Tiled Netherrack is generated like coal ore and the Black Netherrack is generated like gravel.
<my_h2><b>Strength 3</b></my_h2>
<item name=nether:netherrack_blue width=100> <item name=nether:white width=100>
The Blue Netherrack is generated like diamond ore and the Siwtonic block is generated like mese blocks.
<my_h2><b>Bricks</b></my_h2>
There are three types of Bricks: red, Blue, and Black Netherrack Brick. We can craft them from the corresponding Netherrack nodes and additionally, the (red) Netherrack Brick is generated in pyramid-like structures in the nether. In comparison to the Netherrack nodes, all three Bricks can be dug with a pickaxe with strength 1.
<item name=nether:netherrack_brick width=100> <item name=nether:netherrack_brick_blue width=100> <item name=nether:netherrack_brick_black width=100>
]]},
{"Nether Vines",
[[Nether vines are at the ceiling of the nether and can be dug by hand. They drop Nether Blood Child nodes, from which we can grow Blood Structures. By feeding Blood to a Nether vine with air beneath it, it grows one node.
<item name=nether:vine width=100>
]]},
{"Portals",
[[This nether mod supports two types of portals: the well-known Minecraft-like one made of Obsidian, and a portal which is specific to this mod. The Obsidian portal allows us to reach the nether from the overworld, but it is one-way and kills us.
<my_h2><b>Build Instructions</b></my_h2>
A nether portal requires the following nodes:
<item name=nether:wood_empty width=100> <item name=nether:netherrack_black width=100> <item name=nether:netherrack_brick_blue width=100> <item name=nether:netherrack width=100> <item name=nether:blood_cooked width=100> <item name=nether:apple width=100> <item name=nether:white width=100>
* 25 (empty) Nether Wood (height 5-6)
* 16 Black Netherrack (height 1)
* 12 Blue Netherrack Bricks (height 2-4)
* 8 (red) Netherrack (height 1)
* 8 Cooked Nether Blood (height 5)
* 4 Nether Fruits (height 4)
* 2 Siwtonic blocks (height 1 and 5)
The heights in parenthesis correspond to the relative vertical positions of the nodes. When built, the portal should look approximately like this one:
<img name=nether_teleporter.png width=600>
<my_h2><b>Usage</b></my_h2>
Before using the portal the first time, we may want to fill our inventory with enough items so that we can build a second portal on the overworld to get back.
We can activate the portal as follows:
1. Stand in the middle on the Siwtonic block
2. Eat a Nether Fruit. If the portal was built correctly, we can hear a special sound and are teleported to the overworld.
If two portals in the nether and overworld have the same X and Z coordinates, they teleport us to the centre, i.e. onto the Siwtonic block, of the opposite portal when eating a Nether Fruit.
]]},
{"Pearls",
[[The nether pearl can be used to teleport by throwing it.
<my_h2><b>Craft Recipe</b></my_h2>
First, we need to craft two Nether Mushroom Heads and a Nether Fruit Without Leaf together as follows:
<item name=nether:shroom_head width=100>
<item name=nether:fruit_no_leaf width=100>
<item name=nether:shroom_head width=100>
This gives us the Nether Fruit in Mushroom (FIM), which we can cook in a furnace to obtain a Nether Pearl.
<item name=nether:fim width=100> <item name=nether:pearl width=100>
]]},
{"Nether Forest",
[[The nether forest is generated in caves above the nether and contains decorative plants.
<my_h2><b>Grass and Flower</b></my_h2>
<item name=nether:grass_big width=100> <item name=nether:grass_middle width=100> <item name=nether:grass_small width=100>
We can craft the Nether Grass item to another grass item, which can be cooked to get Dried Nether Grass. We can then craft this dried grass to paper.
<item name=nether:glowflower width=100>
The Glowing Flower can be used for lighting and decoration.
<my_h2><b>Nether Tree</b></my_h2>
<item name=nether:tree width=100>
Nether trunks can be found at Nether Trees and be crafted into Nether Wood Blocks via Nether Wood Planks. Furthermore, the Nether Tree Saplings grow even in the overworld if they have Nether Dirt beneath them.
]]}
}
-- The guide formspecs
local guide_forms = {}
-- Convert the guide content to formspecs
for n,data in ipairs(guide_infos) do
local title, html_content = data[1], data[2]
--~ local html_text = "<global background=#242424 size=24><tag name=my_h1 size=35>" ..
local html_text = "<global size=24><tag name=my_h1 size=35>" ..
"<tag name=my_h2 size=30>" ..
"<my_h1><b><center>" .. title .. "</b></center></my_h1>\n" ..
html_content
local spec_width = 16
local spec_height = 16
local html_padding = 0.5
local form = ("formspec_version[4]size[%g,%g;]" ..
"hypertext[%g,%g;%g,%g;html;%s]button[%g,%g;2,0.8;quit;Back]"
):format(
spec_width, spec_height,
html_padding, html_padding,
spec_width - 2 * html_padding, spec_height - 1 - 2 * html_padding,
minetest.formspec_escape(html_text),
0.5 * spec_width - 1, spec_height - 1)
guide_forms[n] = {title, form}
end
local title_to_index = {}
for n, i in ipairs(guide_forms) do
title_to_index[i[1]] = n
end
-- Create the contents formspec
guide_forms.contents = "formspec_version[4]size[6," .. (#guide_infos) + 2 ..
";]label[2,0.8;Contents:]"
for i, data in ipairs(guide_forms) do
local desc = data[1]
local y = i + 0.5 + 0.1
guide_forms.contents = guide_forms.contents ..
"button[0.5," .. y .. ";5,0.8;name;" .. desc .. "]"
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[title_to_index[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
return false, "Something went wrong."
end
if not nether.overworld_help and player:get_pos().y > nether.start then
return false, "Usually you don't neet this guide here. " ..
"You can view it in the nether."
end
minetest.chat_send_player(name, "Showing guide...")
-- Show the Contents (overview) page
minetest.show_formspec(name, "nether_guide_contents",
guide_forms["contents"])
return true
end
})

1039
mods/nether/nether/init.lua Normal file

File diff suppressed because it is too large Load diff

1034
mods/nether/nether/items.lua Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,3 @@
name = nether
depends = default,glow,riesenpilz
optional_depends = creative,fence_registration,function_delayer,stairs,watershed

View file

@ -0,0 +1,190 @@
local function throw_pearl(item, player)
local playerpos = player:get_pos()
playerpos.y = playerpos.y+1.625
local obj = minetest.add_entity(playerpos, "nether:pearl_entity")
local dir = player:get_look_dir()
obj:set_velocity(vector.multiply(dir, 30))
obj:set_acceleration({x=dir.x*-3, y=-dir.y^8*80-10, z=dir.z*-3})
local pname = player:get_player_name()
obj:get_luaentity().player = pname
if not minetest.is_creative_enabled(pname) then
item:take_item()
return item
end
end
local function get_node(pos)
local name = minetest.get_node(pos).name
if name ~= "ignore" then
return name
end
minetest.get_voxel_manip():read_from_map(pos, pos)
name = minetest.get_node_or_nil(pos)
if not name then
return
end
return name.name
end
local softs = {}
local function is_soft(pos)
local name = get_node(pos)
if not name then
return false
end
local is_soft = softs[name]
if is_soft ~= nil then
return is_soft
end
if not minetest.registered_nodes[name] then
softs[name] = false
return false
end
is_soft = minetest.registered_nodes[name].walkable == false
softs[name] = is_soft
return is_soft
end
-- teleports the player there if there's free space
local function teleport_player(pos, player)
if not is_soft(pos) then
return false
end
if not is_soft({x=pos.x, y=pos.y+1, z=pos.z})
and not is_soft({x=pos.x, y=pos.y-1, z=pos.z}) then
return false
end
pos.y = pos.y+0.05
player:move_to(pos)
return true
end
--[[
local dg_ps = {}
local function forceload(pos)
dg_ps[#dg_ps+1] = pos
minetest.forceload_block(pos)
minetest.after(5, function(pos)
minetest.forceload_free_block(pos)
for i,p in pairs(dg_ps) do
if vector.equals(p, pos) then
dg_ps[i] = nil
return
end
end
end, pos)
end
minetest.register_on_shutdown(function()
for _,p in pairs(dg_ps) do
minetest.forceload_free_block(p)
end
end)--]]
minetest.register_entity("nether:pearl_entity", {
collisionbox = {0,0,0,0,0,0}, --not pointable
visual_size = {x=0.1, y=0.1},
physical = false, -- Collides with things
textures = {"nether_pearl.png"},
on_activate = function(self, staticdata)
if not staticdata
or staticdata == "" then
return
end
local tmp = minetest.deserialize(staticdata)
if not tmp then
minetest.log("error", "[nether] pearl: invalid staticdata ")
return
end
self.player = tmp.player
end,
get_staticdata = function(self)
--forceload(vector.round(self.object:get_pos()))
return minetest.serialize({
player = self.player,
})
end,
timer = 0,
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--]]
if self.timer > 20 then
self.object:remove()
return
end
local pos = self.object:get_pos()
local rpos = vector.round(pos)
local lastpos = self.lastpos
if not lastpos then
self.lastpos = vector.new(rpos)
return
end
if lastpos.x
and vector.equals(vector.round(lastpos), rpos) then
return
end
local player = self.player
if not player then
minetest.log("error", "[nether] pearl: missing playername")
self.object:remove()
return
end
player = minetest.get_player_by_name(player)
if not player then
minetest.log("error", "[nether] pearl: missing player")
self.object:remove()
return
end
if not get_node(rpos) then
minetest.log("error", "[nether] pearl: missing node")
self.object:remove()
return
end
self.lastpos = vector.new(pos)
local free, p = minetest.line_of_sight(lastpos, pos)
if free then
return
end
if is_soft(p) then
return
end
self.object:remove()
minetest.after(0, function(p) --minetest.after is 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(vector.new(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
})
minetest.override_item("nether:pearl", {on_use = throw_pearl})

View file

@ -0,0 +1,697 @@
--code copied from Pilzadam's nether mod and edited
-- kills the player if he uses PilzAdam portal
local portal_target = nether.buildings+1
local damage_enabled = minetest.settings:get_bool"enable_damage"
local mclike_portal = false
local abm_allowed
minetest.after(5, function()
abm_allowed = true
end)
local save_path = minetest.get_worldpath() .. "/nether_players"
local players_in_nether = {}
-- Load the list of players which are trapped in the nether
-- (or would be trapped if nether.trap_players was true)
do
local file = io.open(save_path, "r")
if file then
local contents = file:read"*all"
io.close(file)
if contents then
local playernames = string.split(contents, " ")
for i = 1,#playernames do
players_in_nether[playernames[i]] = true
end
end
end
end
local function save_nether_players()
local playernames,n = {},1
for name in pairs(players_in_nether) do
playernames[n] = name
n = n+1
end
local f = io.open(save_path, "w")
assert(f, "Could not open nether_players file for writing.")
f:write(table.concat(playernames, " "))
io.close(f)
end
local update_background
if nether.trap_players 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
-- returns nodename if area is generated, else calls generation function
local function generated_or_generate(pos)
local node = minetest.get_node_or_nil(pos)
if node then
return node.name
end
minetest.get_voxel_manip():read_from_map(pos, pos)
node = minetest.get_node_or_nil(pos)
if not node then
minetest.emerge_area(vector.subtract(pos, 80), vector.add(pos, 80))
return false
end
return node.name
end
-- where the player appears after dying
local function get_player_died_target(player)
local target = vector.add(player:get_pos(),
{x=math.random(-100,100), y=0, z=math.random(-100,100)})
target.y = portal_target + math.random(4)
return target
end
-- used for obsidian portal
local function obsidian_teleport(player, pname, target)
minetest.chat_send_player(pname, "For any reason you arrived here. Type " ..
"/nether_help to find out things like craft recipes.")
players_in_nether[pname] = true
save_nether_players()
update_background(player, true)
if target then
player:set_pos(target)
else
player:set_hp(0)
end
end
-- teleports players to nether or helps it
local function player_to_nether(player, pos)
local pname = player:get_player_name()
players_in_nether[pname] = true
save_nether_players()
update_background(player, true)
if pos then
player:set_pos(pos)
return
end
minetest.chat_send_player(pname, "For any reason you arrived here. " ..
"Type /nether_help to find out things like craft recipes.")
if nether.trap_players then
player:set_hp(0)
end
if not damage_enabled or not nether.trap_players then
player:set_pos(get_player_died_target(player))
end
end
local function player_from_nether(player, pos)
local pname = player:get_player_name()
if players_in_nether[pname] then
players_in_nether[pname] = nil
save_nether_players()
end
update_background(player, false)
player:set_pos(pos)
end
local function player_exists(name)
local players = minetest.get_connected_players()
for i = 1,#players do
if players[i]:get_player_name() == name then
return true
end
end
return false
end
-- Chatcommands (edited) written by sss
minetest.register_chatcommand("to_hell", {
params = "[<player_name>]",
description = "Send someone to hell",
func = function(name, pname)
if not minetest.check_player_privs(name, {nether=true}) then
return false,
"You need the nether privilege to execute this chatcommand."
end
if not player_exists(pname) then
pname = name
end
local player = minetest.get_player_by_name(pname)
if not player then
return false, "Something went wrong."
end
minetest.chat_send_player(pname, "Go to hell !!!")
player_to_nether(player)
return true, pname.." is now in the nether."
end
})
minetest.register_chatcommand("from_hell", {
params = "[<player_name>]",
description = "Extract from hell",
func = function(name, pname)
if not minetest.check_player_privs(name, {nether=true}) then
return false,
"You need the nether priv to execute this chatcommand."
end
if not player_exists(pname) then
pname = name
end
local player = minetest.get_player_by_name(pname)
if not player then
return false, "Something went wrong."
end
minetest.chat_send_player(pname, "You are free now")
local pos = player:get_pos()
player_from_nether(player, {x=pos.x, y=100, z=pos.z})
return true, pname.." is now out of the nether."
end
})
-- Disallow teleportation and change spawn positions if the nether traps players
if nether.trap_players then
-- randomly set player position when he/she dies in nether
minetest.register_on_respawnplayer(function(player)
local pname = player:get_player_name()
if not players_in_nether[pname] then
return
end
local target = get_player_died_target(player)
player:set_pos(target)
minetest.after(0, function(pname, target)
-- fixes respawn bug
local player = minetest.get_player_by_name(pname)
if player then
player:move_to(target)
end
end, pname, target)
return true
end)
-- override set_pos etc. to disallow player teleportion by e.g. travelnet
local function can_teleport(player, pos)
if not player:is_player() then
-- the same metatable is used for entities
return true
end
local pname = player:get_player_name()
local in_nether = players_in_nether[pname] == true
-- test if the target is valid
if pos.y < nether.start then
if in_nether then
return true
end
elseif not in_nether then
return true
end
-- test if the current position is valid
local current_pos = player:get_pos()
local now_in_nether = current_pos.y < nether.start
if now_in_nether ~= in_nether then
if in_nether then
minetest.log("action", "Player \"" .. pname ..
"\" has to be in the nether, teleporting it!")
update_background(player, true)
current_pos.y = portal_target
player:set_pos(current_pos)
else
minetest.log("action", "Player \"" .. pname ..
"\" must not be in the nether, teleporting it!")
update_background(player, false)
current_pos.y = 20
player:set_pos(current_pos)
end
return false
end
minetest.chat_send_player(pname,
"You can not simply teleport to or from the nether!")
minetest.log("action", "Player \"" .. pname ..
"\" attempted to teleport from or to the nether, ignoring.")
return false
end
local methods = {"set_pos", "move_to", "setpos", "moveto"}
local metatable_overridden
minetest.register_on_joinplayer(function(player)
-- set the background when the player joins
if player:get_pos().y < nether.start then
update_background(player, true)
end
-- overide set_pos etc. if not yet done
if metatable_overridden then
return
end
metatable_overridden = true
local mt = getmetatable(player)
for i = 1,#methods do
local methodname = methods[i]
local origfunc = mt[methodname]
mt[methodname] = function(...)
if can_teleport(...) then
origfunc(...)
end
end
end
end)
end
-- removes the violet stuff from the obsidian portal
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
-- change parts of the particledefinition instead of recreating it every time
local particledef = {
amount = 32,
time = 4,
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,
}
-- teleports player to neter (obsidian portal)
local function obsi_teleport_player(player, pos, target)
local pname = player:get_player_name()
if players_in_nether[pname] then
return
end
local objpos = player:get_pos()
objpos.y = objpos.y+0.1 -- Fix some glitches at -8000
if minetest.get_node(vector.round(objpos)).name ~= "nether:portal" then
return
end
local has_teleported
if damage_enabled then
obsidian_teleport(player, pname)
has_teleported = true
elseif not mclike_portal then
local target = vector.round(get_player_died_target(player))
if generated_or_generate(target) then
obsidian_teleport(player, pname, target)
has_teleported = true
end
end
if not has_teleported then
-- e.g. ungenerated area
return
end
remove_portal_essence(pos)
minetest.sound_play("nether_portal_usual", {to_player=pname, gain=1})
end
-- abm for particles of the obsidian portal essence and for teleporting
minetest.register_abm({
nodenames = {"nether:portal"},
interval = 1,
chance = 2,
catch_up = false,
action = function(pos, node)
if not abm_allowed then
return
end
particledef.minpos = {x=pos.x-0.25, y=pos.y-0.5, z=pos.z-0.25}
particledef.maxpos = {x=pos.x+0.25, y=pos.y+0.34, z=pos.z+0.25}
particledef.texture = "nether_portal_particle.png^[transform" ..
math.random(0, 7)
minetest.add_particlespawner(particledef)
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, obsi_teleport_player, 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
-- tests if it's an obsidian portal
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
-- put here the function for creating a second portal
local create_second_portal
if mclike_portal then
function create_second_portal(target)
-- change target here
end
end
-- adds the violet portal essence
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
local in_nether = p1.y < nether.start
if in_nether
and not mclike_portal 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
if in_nether then
target.y = 0
create_second_portal(target)
else
target.y = portal_target + math.random(4)
end
if not generated_or_generate(target)
and mclike_portal then
return false
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
print("[nether] construction accepted.")
return true
end
-- destroy the portal when destroying obsidian
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
})
-- override mese crystal fragment for making an obsidian portal
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
local done = make_portal(pt.under)
if done then
local pname = player:get_player_name()
minetest.chat_send_player(pname,
"Warning: If you are in the nether you may not be " ..
"able to find the way out!")
if not minetest.is_creative_enabled(pname) then
stack:take_item()
end
end
end
return stack
end
})
end)
-- a not filled square
local function vector_square(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 is_netherportal(pos)
local x, y, z = pos.x, pos.y, pos.z
for _,i in pairs({-1, 3}) do
if minetest.get_node({x=x, y=y+i, z=z}).name ~= "nether:white" then
return
end
end
for _,sn in pairs(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 pairs(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
-- cache known portals
local known_portals_d = {}
local known_portals_u = {}
local function get_portal(t, z,x)
return t[z] and t[z][x]
end
local function set_portal(t, z,x, y)
t[z] = t[z] or {}
t[z][x] = y
end
local function get_player_nodepos(player)
local pos = player:get_pos()
pos.y = pos.y + player:get_properties().collisionbox[2] + 0.5
return vector.round(pos)
end
-- used when a player eats that fruit in a portal
function nether.teleport_player(player)
if not player then
minetest.log("error", "[nether] Missing player.")
return
end
local pos = get_player_nodepos(player)
if not is_netherportal(pos) then
return
end
minetest.sound_play("nether_teleporter", {pos=pos})
local meta = minetest.get_meta({x=pos.x, y=pos.y-1, z=pos.z})
if pos.y < nether.start then
set_portal(known_portals_d, pos.z,pos.x, pos.y)
local my = tonumber(meta:get_string("y"))
local y = get_portal(known_portals_u, pos.z,pos.x)
if y then
if y ~= my then
meta:set_string("y", y)
end
else
y = my or 100
end
pos.y = y - 0.3
player_from_nether(player, pos)
else
set_portal(known_portals_u, pos.z,pos.x, pos.y)
local my = tonumber(meta:get_string("y"))
local y = get_portal(known_portals_d, pos.z,pos.x)
if y then
if y ~= my then
meta:set_string("y", y)
end
else
y = my or portal_target+math.random(4)
end
pos.y = y - 0.3
player_to_nether(player, pos)
end
minetest.sound_play("nether_teleporter", {pos=pos})
return true
end

View file

@ -0,0 +1,24 @@
local default_settings = {
trap_players = true,
log_to_chat = false,
log_level = 2,
overworld_help = true,
}
nether.settings = {}
for name,dv in pairs(default_settings) do
local setting
local setting_name = "nether." .. name
if type(dv) == "boolean" then
setting = minetest.settings:get_bool(setting_name)
elseif type(dv) == "number" then
setting = tonumber(minetest.settings:get(setting_name))
else
error"[nether] Only boolean and number settings are available"
end
if setting == nil then
setting = dv
end
nether[name] = setting
end

View file

@ -0,0 +1,23 @@
# If enabled, regular players which are in the nether can leave it only with
# a nether portal and other ways of teleportation, e.g. the /spawn
# chatcommand, are blocked. Similarly, the nether can only be entered with a
# portal.
# This forces the players to investigate the nether and build a portal with
# hellish effort to go back to their home in the overworld.
# It is recommended to disable this setting in creative mode or if damage is
# disabled.
nether.trap_players (Trap players) bool true
# If enabled, show log messages in the chat and not only in debug.txt
nether.log_to_chat (Log messages to chat) bool false
# Specify how much text is printed for debugging purposes
# 0: Disabled
# 1: A bit of information
# 2: Acceptable amount of information
# 3: Lots of text
nether.log_level (Log level) int 2 0 3
# If disabled, players cannot view the nether guide with /nether_help
# in the overworld.
nether.overworld_help (Overworld help) bool true

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.

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: 448 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.

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: 446 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: 442 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: 463 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.

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.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

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