diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d9c069a --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +## Generic ignorable patterns and files +*~ +.*.swp +debug.txt diff --git a/README.txt b/README.txt index aefc4da..570b021 100644 --- a/README.txt +++ b/README.txt @@ -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 diff --git a/nether/crafting.lua b/nether/crafting.lua new file mode 100644 index 0000000..8490551 --- /dev/null +++ b/nether/crafting.lua @@ -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 diff --git a/nether/depends.txt b/nether/depends.txt index 55c207a..06355e5 100644 --- a/nether/depends.txt +++ b/nether/depends.txt @@ -1,3 +1,4 @@ default -riesenpilz glow +riesenpilz +stairs diff --git a/nether/furnace.lua b/nether/furnace.lua new file mode 100644 index 0000000..ee293cd --- /dev/null +++ b/nether/furnace.lua @@ -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, +}) diff --git a/nether/guide.lua b/nether/guide.lua new file mode 100644 index 0000000..4bb9322 --- /dev/null +++ b/nether/guide.lua @@ -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 +}) diff --git a/nether/init.lua b/nether/init.lua index 31f751c..bcc730d 100644 --- a/nether/init.lua +++ b/nether/init.lua @@ -11,95 +11,119 @@ -- godkiller447 (ideas) -- If I didn't list you, please let me know! +if not rawget(_G, "nether") then + nether = {} +end + --== EDITABLE OPTIONS ==-- +--says some information. +nether.info = true + +-- tell everyone about the generation +nether.inform_all = minetest.is_singleplayer() + +--1: 2: 3: +nether.max_spam = 2 + -- Depth of the nether -NETHER_DEPTH = -20000 --- Height of the nether (bottom of the nether is NETHER_DEPTH - NETHER_HEIGHT) -NETHER_HEIGHT = 30 +local nether_middle = -20000 + +-- forest bottom perlin multiplication +local f_bottom_scale = 4 + +-- forest bottom height +local f_h_min = nether_middle+10 + +-- forest top height +local f_h_max = f_h_min+250 + +-- Frequency of trees in the nether forest (higher is less frequent) +local tree_rarity = 200 + +-- Frequency of glowflowers in the nether forest (higher is less frequent) +local glowflower_rarity = 120 + +-- Frequency of nether grass in the nether forest (higher is less frequent) +local grass_rarity = 2 + +-- Frequency of nether mushrooms in the nether forest (higher is less frequent) +local mushroom_rarity = 80 + +-- Frequency of trees in the nether forest (higher is less frequent) +local tree_rarity = 200 + +-- height of the nether generation's end +nether.start = f_h_max+100 + +-- Height of the nether (bottom of the nether is nether_middle - NETHER_HEIGHT) +local NETHER_HEIGHT = 30 + -- Maximum amount of randomness in the map generation NETHER_RANDOM = 2 + -- Frequency of Glowstone on the "roof" of the Nether (higher is less frequent) -GLOWSTONE_FREQ_ROOF = 500 --- Frequency of Glowstone on lava (higher is less frequent) -GLOWSTONE_FREQ_LAVA = 2 +local GLOWSTONE_FREQ_ROOF = 500 + -- Frequency of lava (higher is less frequent) -LAVA_FREQ = 100 +local LAVA_FREQ = 100 + +local nether_structure_freq = 350 +local NETHER_SHROOM_FREQ = 100 + -- Maximum height of lava -LAVA_HEIGHT = 2 -NETHER_TREE_FREQ = 350 -NETHER_SHROOM_FREQ = 100 --- Height of nether trees -NETHER_TREESIZE = 2 --- Frequency of apples in a nether tree (higher is less frequent) -NETHER_APPLE_FREQ = 5 --- Frequency of healing apples in a nether tree (higher is less frequent) -NETHER_HEAL_APPLE_FREQ = 10 +--LAVA_HEIGHT = 2 +-- Frequency of Glowstone on lava (higher is less frequent) +--GLOWSTONE_FREQ_LAVA = 2 +-- Height of nether structures +--NETHER_TREESIZE = 2 +-- Frequency of apples in a nether structure (higher is less frequent) +--NETHER_APPLE_FREQ = 5 +-- Frequency of healing apples in a nether structure (higher is less frequent) +--NETHER_HEAL_APPLE_FREQ = 10 -- Start position for the Throne of Hades (y is relative to the bottom of the nether) -HADES_THRONE_STARTPOS = {x=0, y=1, z=0} +--HADES_THRONE_STARTPOS = {x=0, y=1, z=0} -- Spawn pos for when the nether hasn't been loaded yet (i.e. no portal in the nether) (y is relative to the bottom of the nether) -NETHER_SPAWNPOS = {x=0, y=5, z=0} +--NETHER_SPAWNPOS = {x=0, y=5, z=0} -- Structure of the nether portal (all is relative to the nether portal creator block) -NETHER_PORTAL = { - -- Floor 1 - {pos={x=0,y=0,z=0}, block="default:obsidian"}, - {pos={x=1,y=0,z=0}, block="default:obsidian"}, - {pos={x=2,y=0,z=0}, block="default:obsidian"}, - {pos={x=3,y=0,z=0}, block="default:obsidian"}, - {pos={x=0,y=0,z=1}, block="default:obsidian"}, - {pos={x=1,y=0,z=1}, block="default:obsidian"}, - {pos={x=2,y=0,z=1}, block="default:obsidian"}, - {pos={x=3,y=0,z=1}, block="default:obsidian"}, - {pos={x=0,y=0,z=-1}, block="default:obsidian"}, - {pos={x=1,y=0,z=-1}, block="default:obsidian"}, - {pos={x=2,y=0,z=-1}, block="default:obsidian"}, - {pos={x=3,y=0,z=-1}, block="default:obsidian"}, - -- Floor 2 - {pos={x=0,y=1,z=0}, block="default:obsidian"}, - {pos={x=1,y=1,z=0}, block="nether:portal"}, - {pos={x=2,y=1,z=0}, block="nether:portal"}, - {pos={x=3,y=1,z=0}, block="default:obsidian"}, - {pos={x=0,y=1,z=1}, block="default:obsidian"}, - {pos={x=3,y=1,z=1}, block="default:obsidian"}, - {pos={x=0,y=1,z=-1}, block="default:obsidian"}, - {pos={x=3,y=1,z=-1}, block="default:obsidian"}, - -- Floor 3 - {pos={x=0,y=2,z=0}, block="default:obsidian"}, - {pos={x=1,y=2,z=0}, block="nether:portal"}, - {pos={x=2,y=2,z=0}, block="nether:portal"}, - {pos={x=3,y=2,z=0}, block="default:obsidian"}, - {pos={x=0,y=2,z=1}, block="default:obsidian"}, - {pos={x=3,y=2,z=1}, block="default:obsidian"}, - {pos={x=0,y=2,z=-1}, block="default:obsidian"}, - {pos={x=3,y=2,z=-1}, block="default:obsidian"}, - -- Floor 4 - {pos={x=0,y=3,z=0}, block="default:obsidian"}, - {pos={x=1,y=3,z=0}, block="nether:portal"}, - {pos={x=2,y=3,z=0}, block="nether:portal"}, - {pos={x=3,y=3,z=0}, block="default:obsidian"}, - {pos={x=0,y=3,z=1}, block="default:obsidian"}, - {pos={x=3,y=3,z=1}, block="default:obsidian"}, - {pos={x=0,y=3,z=-1}, block="default:obsidian"}, - {pos={x=3,y=3,z=-1}, block="default:obsidian"}, - -- Floor 5 - {pos={x=0,y=4,z=0}, block="default:obsidian"}, - {pos={x=1,y=4,z=0}, block="default:obsidian"}, - {pos={x=2,y=4,z=0}, block="default:obsidian"}, - {pos={x=3,y=4,z=0}, block="default:obsidian"}, - {pos={x=0,y=4,z=1}, block="default:obsidian"}, - {pos={x=1,y=4,z=1}, block="default:obsidian"}, - {pos={x=2,y=4,z=1}, block="default:obsidian"}, - {pos={x=3,y=4,z=1}, block="default:obsidian"}, - {pos={x=0,y=4,z=-1}, block="default:obsidian"}, - {pos={x=1,y=4,z=-1}, block="default:obsidian"}, - {pos={x=2,y=4,z=-1}, block="default:obsidian"}, - {pos={x=3,y=4,z=-1}, block="default:obsidian"}, -} --== END OF EDITABLE OPTIONS ==-- +if nether.info then + function nether:inform(msg, spam, t) + if spam <= self.max_spam then + local info + if t then + info = string.format("[nether] "..msg.." after ca. %.2fs", os.clock() - t) + else + info = "[nether] "..msg + end + print(info) + if self.inform_all then + minetest.chat_send_all(info) + end + end + end +else + function nether:inform() + end +end + + local path = minetest.get_modpath("nether") dofile(path.."/weird_mapgen_noise.lua") +dofile(path.."/items.lua") +dofile(path.."/furnace.lua") +dofile(path.."/pearl.lua") + +local function table_contains(t, v) + for _,i in pairs(t) do + if i == v then + return true + end + end + return false +end local function dif(z1, z2) if z1 < 0 @@ -121,24 +145,44 @@ local function r_area(manip, width, height, pos) return VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2}) end -local function set_vm_data(manip, nodes, pos, t1, name) +local function set_vm_data(manip, nodes, pos, t1, name, generated) + manip:set_data(nodes) + manip:write_to_map() + local spam = 2 + if generated then + spam = 3 + end + nether:inform(name.." grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", spam, t1) + if not generated then + local t1 = os.clock() + manip:update_map() + nether:inform("map updated", spam, t1) + end +end + +local function fix_light(minp, maxp) + local manip = minetest.get_voxel_manip() + local emerged_pos1, emerged_pos2 = manip:read_from_map(minp, maxp) + area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2}) + nodes = manip:get_data() + manip:set_data(nodes) manip:write_to_map() - print(string.format("[nether] "..name.." grew at ("..pos.x.."|"..pos.y.."|"..pos.z..") after ca. %.2fs", os.clock() - t1)) - local t1 = os.clock() manip:update_map() - print(string.format("[nether] map updated after ca. %.2fs", os.clock() - t1)) end -- Generated variables -NETHER_BOTTOM = (NETHER_DEPTH - NETHER_HEIGHT) -NETHER_ROOF_ABS = (NETHER_DEPTH - NETHER_RANDOM) +local NETHER_BOTTOM = (nether_middle - NETHER_HEIGHT) +nether.buildings = NETHER_BOTTOM+12 +local NETHER_ROOF_ABS = (nether_middle - NETHER_RANDOM) +local f_yscale_top = (f_h_max-f_h_min)/2 +local f_yscale_bottom = f_yscale_top/2 --HADES_THRONE_STARTPOS_ABS = {x=HADES_THRONE_STARTPOS.x, y=(NETHER_BOTTOM + HADES_THRONE_STARTPOS.y), z=HADES_THRONE_STARTPOS.z} -LAVA_Y = (NETHER_BOTTOM + LAVA_HEIGHT) +--LAVA_Y = (NETHER_BOTTOM + LAVA_HEIGHT) --HADES_THRONE_ABS = {} --HADES_THRONE_ENDPOS_ABS = {} --HADES_THRONE_GENERATED = minetest.get_worldpath() .. "/netherhadesthrone.txt" -NETHER_SPAWNPOS_ABS = {x=NETHER_SPAWNPOS.x, y=(NETHER_BOTTOM + NETHER_SPAWNPOS.y), z=NETHER_SPAWNPOS.z} +--NETHER_SPAWNPOS_ABS = {x=NETHER_SPAWNPOS.x, y=(NETHER_BOTTOM + NETHER_SPAWNPOS.y), z=NETHER_SPAWNPOS.z} --[[for i,v in ipairs(HADES_THRONE) do v.pos.x = v.pos.x + HADES_THRONE_STARTPOS_ABS.x v.pos.y = v.pos.y + HADES_THRONE_STARTPOS_ABS.y @@ -160,250 +204,144 @@ for i,v in ipairs(HADES_THRONE_ABS) do end end HADES_THRONE_ENDPOS_ABS = {x=htx, y=hty, z=htz}]] -local nether = {} --- == General Utility Functions == +local c +local function define_contents() + c = { + air = minetest.get_content_id("air"), + lava = minetest.get_content_id("default:lava_source"), + gravel = minetest.get_content_id("default:gravel"), + coal = minetest.get_content_id("default:stone_with_coal"), + diamond = minetest.get_content_id("default:stone_with_diamond"), + mese = minetest.get_content_id("default:mese"), --- Check if file exists -function nether:fileexists(file) - file = io.open(file, "r") - if file ~= nil then - file:close() - return true - else - return false - end + glowstone = minetest.get_content_id("glow:stone"), --https://github.com/Zeg9/minetest-glow + + nether_shroom = minetest.get_content_id("riesenpilz:nether_shroom"), + + netherrack = minetest.get_content_id("nether:netherrack"), + netherrack_tiled = minetest.get_content_id("nether:netherrack_tiled"), + netherrack_black = minetest.get_content_id("nether:netherrack_black"), + netherrack_blue = minetest.get_content_id("nether:netherrack_blue"), + netherrack_brick = minetest.get_content_id("nether:netherrack_brick"), + white = minetest.get_content_id("nether:white"), + + nether_vine = minetest.get_content_id("nether:vine"), + blood = minetest.get_content_id("nether:blood"), + blood_top = minetest.get_content_id("nether:blood_top"), + blood_stem = minetest.get_content_id("nether:blood_stem"), + nether_apple = minetest.get_content_id("nether:apple"), + + nether_tree = minetest.get_content_id("nether:tree"), + nether_tree_corner = minetest.get_content_id("nether:tree_corner"), + nether_leaves = minetest.get_content_id("nether:leaves"), + nether_grass = { + minetest.get_content_id("nether:grass_small"), + minetest.get_content_id("nether:grass_middle"), + minetest.get_content_id("nether:grass_big") + }, + glowflower = minetest.get_content_id("nether:glowflower"), + nether_dirt = minetest.get_content_id("nether:dirt"), + nether_dirt_top = minetest.get_content_id("nether:dirt_top"), + nether_dirt_bottom = minetest.get_content_id("nether:dirt_bottom"), + } end --- Simple "touch" function -function nether:touch(file) - if nether:fileexists(file) ~= true then - file = io.open(file, "w") - if file ~= nil then - file:write("") - file:close() - end - end -end +local pr, contents_defined --- Print a message -function nether:printm(message) - print("[Nether] " .. message) -end - --- Print an error message -function nether:printerror(message) - nether:printm("Error! " .. message) -end - --- == Nether related stuff == - --- Find if a position is inside the Nether -function nether:inside_nether(pos) - if pos.y >= NETHER_BOTTOM and pos.y <= NETHER_DEPTH then - return true - end - return false -end - ---[[ 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}, -})]] - --- Netherrack -minetest.register_node("nether:netherrack", { - description = "Netherrack", - tiles = {"nether_netherrack.png"}, - groups = {cracky=3, oddly_breakable_by_hand=3}, - sounds = default.node_sound_stone_defaults(), -}) - --- Netherbrick -minetest.register_node("nether:netherrack_brick", { - description = "Netherrack Brick", - tiles = {"nether_netherrack.png^nether_brick_shadow.png"}, - groups = {cracky=3, oddly_breakable_by_hand=3}, - sounds = default.node_sound_stone_defaults(), -}) - --- Nether tree -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(), -}) - -minetest.register_node("nether:blood_top", { - description = "Nether Blood", - 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(), -}) - -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(), -}) - ---[[ 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 apple -minetest.register_node("nether:apple", { - description = "Nether Apple", - drawtype = "plantlike", - tiles = {"nether_apple.png"}, - inventory_image = "nether_apple.png", - paramtype = "light", - sunlight_propagates = true, - walkable = false, - groups = {fleshy=3, dig_immediate=3}, - on_use = minetest.item_eat(-4), - sounds = default.node_sound_defaults(), -}) - --- Nether vine -minetest.register_node("nether:vine", { - description = "Nether vine", - walkable = false, - drop = '', - 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) - local p = {x=pos.x, y=pos.y-1, z=pos.z} - local vine = "nether:vine" - while minetest.get_node(p).name == vine do - minetest.remove_node(p) - p.y = p.y-1 - end - end -}) - --- Nether torch -minetest.register_node("nether:torch", { - description = "Nether Torch", - drawtype = "torchlike", - tiles = {"nether_torch_on_floor.png", "nether_torch_on_ceiling.png", "nether_torch.png"}, - inventory_image = "nether_torch_on_floor.png", - wield_image = "nether_torch_on_floor.png", - paramtype = "light", - paramtype2 = "wallmounted", - sunlight_propagates = true, - walkable = false, - light_source = LIGHT_MAX - 1, - selection_box = { - type = "wallmounted", - wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1}, - wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1}, - wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1}, - }, - groups = {choppy=2, dig_immediate=3}, - legacy_wallmounted = true, - sounds = default.node_sound_defaults(), -}) - --- Nether Pearl -minetest.register_craftitem("nether:pearl", { - description = "Nether Pearl", - wield_image = "nether_pearl.png", - inventory_image = "nether_pearl.png", - visual = "sprite", - physical = true, - textures = {"nether_pearl.png"}, -}) - -local c_air = minetest.get_content_id("air") -local c_netherrack = minetest.get_content_id("nether:netherrack") -local c_netherrack_brick = minetest.get_content_id("nether:netherrack_brick") -local c_glowstone = minetest.get_content_id("glow:stone") --https://github.com/Zeg9/minetest-glow -local c_lava = minetest.get_content_id("default:lava_source") -local c_nether_shroom = minetest.get_content_id("riesenpilz:nether_shroom") -local c_nether_vine = minetest.get_content_id("nether:vine") - -local function return_nether_ore(glowstone) +local function return_nether_ore(id, glowstone) if glowstone and pr:next(0,GLOWSTONE_FREQ_ROOF) == 1 then - return c_glowstone + return c.glowstone end - return c_netherrack + if id == c.coal then + return c.netherrack_tiled + end + if id == c.gravel then + return c.netherrack_black + end + if id == c.diamond then + return c.netherrack_blue + end + if id == c.mese then + return c.white + end + return c.netherrack end +local f_perlins = {} + +--local perlin1 = minetest.get_perlin(13,3, 0.5, 50) --Get map specific perlin +-- local perlin2 = minetest.get_perlin(133,3, 0.5, 10) +-- local perlin3 = minetest.get_perlin(112,3, 0.5, 5) +local tmp = f_yscale_top*4 +local tmp2 = tmp/f_bottom_scale +local perlins = { + { + seed = 13, + octaves = 3, + persist = 0.5, + spread = {x=50, y=50, z=50}, + scale = 1, + offset = 0, + }, + { + seed = 133, + octaves = 3, + persist = 0.5, + spread = {x=10, y=10, z=10}, + scale = 1, + offset = 0, + }, + { + seed = 112, + octaves = 3, + persist = 0.5, + spread = {x=5, y=5, z=5}, + scale = 1, + offset = 0, + }, + --[[forest_bottom = { + seed = 11, + octaves = 3, + persist = 0.8, + spread = {x=tmp2, y=tmp2, z=tmp2}, + scale = 1, + offset = 0, + },]] + forest_top = { + seed = 21, + octaves = 3, + persist = 0.8, + spread = {x=tmp, y=tmp, z=tmp}, + scale = 1, + offset = 0, + }, +} + local info = true -local trees_enabled = true +local structures_enabled = true local vine_maxlength = math.floor(NETHER_HEIGHT/4+0.5) -- Create the Nether minetest.register_on_generated(function(minp, maxp, seed) - if not (maxp.y >= NETHER_BOTTOM-100 and minp.y <= NETHER_DEPTH+100) then --avoid big map generation + if not (maxp.y >= NETHER_BOTTOM-100 and minp.y <= nether.start) then --avoid big map generation return end local addpos = {} - if info then - t1 = os.clock() - local geninfo = "[nether] generates at: x=["..minp.x.."; "..maxp.x.."]; y=["..minp.y.."; "..maxp.y.."]; z=["..minp.z.."; "..maxp.z.."]" - print(geninfo) - minetest.chat_send_all(geninfo) + local t1 = os.clock() + nether:inform("generates at: x=["..minp.x.."; "..maxp.x.."]; y=["..minp.y.."; "..maxp.y.."]; z=["..minp.z.."; "..maxp.z.."]", 2) + + if not contents_defined then + define_contents() + contents_defined = true + end + + local buildings = 0 + if maxp.y <= NETHER_BOTTOM then + buildings = 1 + elseif minp.y <= nether.buildings then + buildings = 2 end local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") @@ -412,24 +350,43 @@ minetest.register_on_generated(function(minp, maxp, seed) pr = PseudoRandom(seed+33) local tab,num = {},1 - local num2 = 1 + local trees,num_trees = {},1 - local perlin1 = minetest.get_perlin(13,3, 0.5, 50) --Get map specific perlin - local perlin2 = minetest.get_perlin(133,3, 0.5, 10) - local perlin3 = minetest.get_perlin(112,3, 0.5, 5) - local tab2 = nether_weird_noise(minp, pymg, 20, 8) + --local perlin1 = minetest.get_perlin(13,3, 0.5, 50) --Get map specific perlin + --local perlin2 = minetest.get_perlin(133,3, 0.5, 10) + --local perlin3 = minetest.get_perlin(112,3, 0.5, 5) + local side_length = maxp.x - minp.x - 1 -- maybe mistake here + local map_lengths_xyz = {x=side_length, y=side_length, z=side_length} + + local pmap1 = minetest.get_perlin_map(perlins[1], map_lengths_xyz):get2dMap_flat(minp) + local pmap2 = minetest.get_perlin_map(perlins[2], map_lengths_xyz):get2dMap_flat(minp) + local pmap3 = minetest.get_perlin_map(perlins[3], map_lengths_xyz):get2dMap_flat(minp) + + local forest_possible = maxp.y > f_h_min and minp.y < f_h_max + + --local pmap_f_bottom = minetest.get_perlin_map(perlins.forest_bottom, map_lengths_xyz):get2dMap_flat(minp) + local perlin_f_bottom, pmap_f_top + if forest_possible then + perlin_f_bottom = minetest.get_perlin(11, 3, 0.8, tmp2) + pmap_f_top = minetest.get_perlin_map(perlins.forest_top, map_lengths_xyz):get2dMap_flat(minp) + end + + local num2, tab2 + if buildings >= 1 then + num2 = 1 + tab2 = nether_weird_noise({x=minp.x, y=nether.buildings-79, z=minp.z}, pymg, 200, 8, 10, 79) + end + + local count = 0 for z=minp.z, maxp.z do for x=minp.x, maxp.x do - local r_tree = pr:next(1,NETHER_TREE_FREQ) - local r_shroom = pr:next(1,NETHER_SHROOM_FREQ) - local r_glowstone = pr:next(0,GLOWSTONE_FREQ_ROOF) - local r_vine_length = pr:next(1,vine_maxlength) + count = count+1 - local test = perlin1:get2d({x=x, y=z})+1 - local test2 = perlin2:get2d({x=x, y=z}) - local test3 = math.abs(perlin3:get2d({x=x, y=z})) + local test = pmap1[count]+1 + local test2 = pmap2[count] + local test3 = math.abs(pmap3[count]) local t = math.floor(test*3+0.5) @@ -446,197 +403,206 @@ minetest.register_on_generated(function(minp, maxp, seed) end local bottom = NETHER_BOTTOM+h - local top = NETHER_DEPTH-pr:next(0,NETHER_RANDOM)+t + local top = nether_middle-pr:next(0,NETHER_RANDOM)+t - local py_h = tab2[num2].y - num2 = num2+1 + local py_h = 0 + local difn, noisp, py_h_g + if buildings >= 1 then + py_h = tab2[num2].y + num2 = num2+1 - for y=minp.y, maxp.y, 1 do - local p_addpos = area:index(x, y, z) - --if py_h >= maxp.y-4 then - if y == py_h then - data[p_addpos] = c_netherrack_brick - --[[else - data[p_addpos] = c_air - end]] - elseif data[p_addpos] ~= c_air then - if y <= NETHER_BOTTOM then - if y <= bottom then - data[p_addpos] = return_nether_ore(1) - else - data[p_addpos] = c_lava - end - elseif r_tree == 1 - and y == bottom then - tab[num] = {x=x, y=y-1, z=z} - num = num+1 - elseif y <= bottom then - if pr:next(1,LAVA_FREQ) == 1 then - data[p_addpos] = c_lava - else - data[p_addpos] = return_nether_ore(0) - end - elseif r_shroom == 1 - and r_tree ~= 1 - and y == bottom+1 then - data[p_addpos] = c_nether_shroom - elseif (y == top and r_glowstone == 1) then - data[p_addpos] = c_glowstone - elseif y >= top then - data[p_addpos] = return_nether_ore(1) - elseif y <= top-1 - and generate_vine - and y >= top-r_vine_length then - data[p_addpos] = c_nether_vine - else - data[p_addpos] = c_air + difn = nether.buildings-py_h + if difn == 5 then + noisp = 1 + elseif difn < 5 then + noisp = 2 + end + py_h_g = nether.buildings-7 + end + + if buildings == 1 + and noisp then + if noisp == 1 then + for y=minp.y, maxp.y do + local p_addpos = area:index(x, y, z) + data[p_addpos] = c.netherrack_brick + end + else + for y=minp.y, maxp.y do + local p_addpos = area:index(x, y, z) + data[p_addpos] = c.lava + end + end + else + + local r_structure = pr:next(1,nether_structure_freq) + local r_shroom = pr:next(1,NETHER_SHROOM_FREQ) + local r_glowstone = pr:next(0,GLOWSTONE_FREQ_ROOF) + local r_vine_length = pr:next(1,vine_maxlength) + + local f_bottom, f_top, is_forest, f_h_dirt + if forest_possible then + local p = {x=math.floor(x/f_bottom_scale), z=math.floor(z/f_bottom_scale)} + local pstr = p.x.." "..p.z + if not f_perlins[pstr] then + f_perlins[pstr] = math.floor(f_h_min+(math.abs(perlin_f_bottom:get2d({x=p.x, y=p.z})+1))*f_yscale_bottom+0.5) + end + f_bottom = f_perlins[pstr]+math.random(0,f_bottom_scale-1) + f_top = math.floor(f_h_max-(pmap_f_top[count]+1)*f_yscale_top+0.5) + is_forest = f_bottom < f_top + f_h_dirt = f_bottom-pr:next(0,1) + end + + for y=minp.y, maxp.y do + local p_addpos = area:index(x, y, z) + local d_p_addp = data[p_addpos] + --if py_h >= maxp.y-4 then + if y <= py_h + and noisp then + if noisp == 1 then + data[p_addpos] = c.netherrack_brick + elseif noisp == 2 then + if y == py_h then + data[p_addpos] = c.netherrack_brick + elseif y == py_h_g + and pr:next(1,3) <= 2 then + data[p_addpos] = c.netherrack + elseif y <= py_h_g then + data[p_addpos] = c.lava + else + data[p_addpos] = c.air + end + end + elseif d_p_addp ~= c.air then + + if is_forest + and y == f_bottom then + data[p_addpos] = c.nether_dirt_top + elseif is_forest + and y < f_bottom + and y >= f_h_dirt then + data[p_addpos] = c.nether_dirt + elseif is_forest + and y == f_h_dirt-1 then + data[p_addpos] = c.nether_dirt_bottom + elseif is_forest + and y == f_h_dirt+1 then + if pr:next(1,tree_rarity) == 1 then + trees[num_trees] = {x=x, y=y, z=z} + num_trees = num_trees+1 + elseif pr:next(1,mushroom_rarity) == 1 then + data[p_addpos] = c.nether_shroom + elseif pr:next(1,glowflower_rarity) == 1 then + data[p_addpos] = c.glowflower + elseif pr:next(1,grass_rarity) == 1 then + data[p_addpos] = c.nether_grass[pr:next(1,3)] + else + data[p_addpos] = c.air + end + elseif is_forest + and y > f_bottom + and y < f_top then + if not table_contains( + {c.nether_tree, c.nether_tree_corner, c.nether_leaves, c.nether_fruit}, + d_p_addp + ) then + data[p_addpos] = c.air + end + + elseif y <= NETHER_BOTTOM then + if y <= bottom then + data[p_addpos] = return_nether_ore(d_p_addp, true) + else + data[p_addpos] = c.lava + end + elseif r_structure == 1 + and y == bottom then + tab[num] = {x=x, y=y-1, z=z} + num = num+1 + elseif y <= bottom then + if pr:next(1,LAVA_FREQ) == 1 then + data[p_addpos] = c.lava + else + data[p_addpos] = return_nether_ore(d_p_addp, false) + end + elseif r_shroom == 1 + and r_structure ~= 1 + and y == bottom+1 then + data[p_addpos] = c.nether_shroom + elseif (y == top and r_glowstone == 1) then + data[p_addpos] = c.glowstone + elseif y >= top then + data[p_addpos] = return_nether_ore(d_p_addp, true) + elseif y <= top-1 + and generate_vine + and y >= top-r_vine_length then + data[p_addpos] = c.nether_vine + else + data[p_addpos] = c.air + end end end --- d_p_addpos = data[p_addpos] end end end vm:set_data(data) -- vm:set_lighting(12) - vm:calc_lighting() - vm:update_liquids() +-- vm:calc_lighting() +-- vm:update_liquids() vm:write_to_map() - if trees_enabled then --Trees: + + nether:inform("nodes set", 2, t1) + + local t2 = os.clock() + + if structures_enabled then --Trees: for _,v in ipairs(tab) do - nether:grow_nethertree(v) + nether.grow_netherstructure(v, true) end 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 + + if forest_possible then --Trees: + for _,v in ipairs(trees) do + nether.grow_tree(v, true) 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]] - if info then - local geninfo = string.format("[nether] done after: %.2fs", os.clock() - t1) - print(geninfo) - minetest.chat_send_all(geninfo) end + + nether:inform("trees set", 2, t2) + + t2 = os.clock() + fix_light(minp, maxp) + + nether:inform("map updated", 2, t2) + + nether:inform("done", 1, t1) end) ---[[minetest.register_on_generated(function(minp, maxp, seed) - if minp.y <= 99 then + +function nether.grow_netherstructure(pos, generated) + local t1 = os.clock() + + if not contents_defined then + define_contents() + contents_defined = true + end + + if not pos.x then print(dump(pos)) + nether:inform("Error: "..dump(pos), 1) return end - local 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)]] - - --- Return the name of the node below a position -function nether:nodebelow(pos) - return minetest.get_node({x=pos.x, y=(pos.y-1), z=pos.z}).name -end - --- Check if we can add a "sticky" node (i.e. it has to stick to something else, or else it won't be added) --- This is largely based on Gilli's code -function nether:can_add_sticky_node(pos) - local objname - for x = -1, 1 do - for y = -1, 1 do - for z = -1, 1 do - local p = {x=pos.x+x, y=pos.y+y, z=pos.z+z} - local n = minetest.get_node(p) - objname = n.name - if minetest.registered_nodes[objname].walkable == true then - return true - end - end - end - end - return false -end - --- Add a "sticky" node -function nether:add_sticky_node(pos, opts) - if nether:can_add_sticky_node(pos) == true then - minetest.add_node(pos, opts) - return true - else - return false - end -end - - -local nether_c_blood = minetest.get_content_id("nether:blood") -local nether_c_blood_top = minetest.get_content_id("nether:blood_top") -local nether_c_blood_stem = minetest.get_content_id("nether:blood_stem") -local nether_c_apple = minetest.get_content_id("default:apple") -local nether_c_nether_apple = minetest.get_content_id("nether:apple") - -function nether:grow_nethertree(pos) - local t1 = os.clock() local height = 6 local manip = minetest.get_voxel_manip() local area = r_area(manip, 2, height, pos) local nodes = manip:get_data() for i = 0, height-1 do - nodes[area:index(pos.x, pos.y+i, pos.z)] = nether_c_blood_stem + nodes[area:index(pos.x, pos.y+i, pos.z)] = c.blood_stem end for i = -1,1 do for j = -1,1 do - nodes[area:index(pos.x+i, pos.y+height, pos.z+j)] = nether_c_blood_top + nodes[area:index(pos.x+i, pos.y+height, pos.z+j)] = c.blood_top end end @@ -644,11 +610,11 @@ function nether:grow_nethertree(pos) for l = -2+1, 2 do local p1 = {pos.x+2*k, pos.y+height, pos.z-l*k} local p2 = {pos.x+l*k, pos.y+height, pos.z+2*k} - local udat = nether_c_blood_top + local udat = c.blood_top if math.random(2) == 1 then - nodes[area:index(p1[1], p1[2], p1[3])] = nether_c_blood_top - nodes[area:index(p2[1], p2[2], p2[3])] = nether_c_blood_top - udat = nether_c_blood + nodes[area:index(p1[1], p1[2], p1[3])] = c.blood_top + nodes[area:index(p2[1], p2[2], p2[3])] = c.blood_top + udat = c.blood end nodes[area:index(p1[1], p1[2]-1, p1[3])] = udat nodes[area:index(p2[1], p2[2]-1, p2[3])] = udat @@ -659,400 +625,352 @@ function nether:grow_nethertree(pos) {pos.x+l*k, pos.y+height-1, pos.z+k}, }) do if math.random(2) == 1 then - nodes[area:index(p[1], p[2], p[3])] = nether_c_nether_apple - elseif math.random(10) == 1 then - nodes[area:index(p[1], p[2], p[3])] = nether_c_apple + nodes[area:index(p[1], p[2], p[3])] = c.nether_apple + --elseif math.random(10) == 1 then + -- nodes[area:index(p[1], p[2], p[3])] = c.apple end end end end - set_vm_data(manip, nodes, pos, t1, "blood") + set_vm_data(manip, nodes, pos, t1, "blood", 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"}) + + +local function update_minmax(min, max, p) + min.x = math.min(min.x, p.x) + max.x = math.max(max.x, p.x) + min.z = math.min(min.z, p.z) + max.z = math.max(max.z, p.z) + return min, max +end + +local fruit_chances = {} +for y = -2,1 do --like a hyperbola + fruit_chances[y] = math.floor(-4/(y-2)+0.5) +end + +local dirs = { + {-1, 0, 12, 19}, + {1, 0, 12, 13}, + {0, 1, 4}, + {0, -1, 4, 10}, +} + +local h_max = 26 +local h_stem_min = 3 +local h_stem_max = 7 +local h_arm_min = 2 +local h_arm_max = 6 +local r_arm_min = 1 +local r_arm_max = 5 +local fruit_rarity = 25 --a bigger number results in less fruits +local leaf_thickness = 3 --a bigger number results in more blank trees + +local h_trunk_max = h_max-h_arm_max + +function nether.grow_tree(pos, generated) + local t1 = os.clock() + + if not contents_defined then + define_contents() + contents_defined = true end - --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"}) + + local min = vector.new(pos) + local max = vector.new(pos) + min.y = min.y-1 + max.y = max.y+h_max + + local trunks = {} + local trunk_corners = {} + local h_stem = math.random(h_stem_min, h_stem_max) + local stems = {{x=pos.x, y=pos.y+h_stem, z=pos.z}} + local fi + while not fi do + for n,p in pairs(stems) do + local used_dirs = {} + for _,dir in pairs(dirs) do + if math.random(1,2) == 1 then + table.insert(used_dirs, dir) + end + end + if not used_dirs[1] then + local dir1 = math.random(4) + local dir2 = math.random(3) + if dir1 <= dir2 then + dir2 = dir2+1 + end + used_dirs[1] = dirs[dir1] + used_dirs[2] = dirs[dir2] + end + for _,dir in pairs(used_dirs) do + local p = vector.new(p) + local r = math.random(r_arm_min, r_arm_max) + for j = 1,r do + local x = p.x+j*dir[1] + local z = p.z+j*dir[2] + trunks[x.." "..p.y.." "..z] = dir[3] + end + r = r+1 + p.x = p.x+r*dir[1] + p.z = p.z+r*dir[2] + trunk_corners[p.x.." "..p.y.." "..p.z] = dir[4] or dir[3] + local h = math.random(h_arm_min, h_arm_max) + for i = 1,h do + trunks[p.x.." "..p.y+i.." "..p.z] = true + end + p.y = p.y+h + table.insert(stems, p) + end + if p.y > pos.y+h_trunk_max then + fi = true + break + end + stems[n] = nil + end + end + local leaves = {} + local fruits = {} + local trunk_ps = {} + local count = 0 + for n,par in pairs(trunks) do + local p = {} + p.x, p.y, p.z = unpack(string.split(n, " ")) + if par ~= true then + p.par = par + end + table.insert(trunk_ps, p) + count = count+1 + if count > leaf_thickness then + count = 0 + for y = -2,2 do + local fruit_chance = fruit_chances[y] + for z = -2,2 do + for x = -2,2 do + local dist = math.sqrt(x*x+y*y+z*z) + if math.floor(dist) ~= 0 + and math.random(1, dist) == 1 then + local pstr = p.x+x.." "..p.y+y.." "..p.z+z + if not trunks[pstr] then + if math.random(1, fruit_rarity) == 1 + and fruit_chance + and math.random(1, fruit_chance) == 1 then + fruits[pstr] = true + else + leaves[pstr] = true + end end - else - minetest.add_node(leafpos, {name="nether:leaves"}) - end - end + end + end end end end end -end]] --- == PORTAL RELATED STUFF == -NETHER_PORTALS_TO_NETHER = {} -NETHER_PORTALS_FROM_NETHER = {} -NETHER_PORTALS_TO_NETHER_FILE = minetest.get_worldpath() .. "/portalstonether.txt" -NETHER_PORTALS_FROM_NETHER_FILE = minetest.get_worldpath() .. "/portalsfromnether.txt" + local leaf_ps = {} + for n,_ in pairs(leaves) do + local p = {} + p.x, p.y, p.z = unpack(string.split(n, " ")) + table.insert(leaf_ps, p) + min, max = update_minmax(min, max, p) + end --- Count the number of times a position appears in a table -function table_count(tt, item) - local count - count = 0 - for ii,xx in pairs(tt) do - if (item.x == xx.x) and (item.y == xx.y) and (item.z == xx.z) then - count = count + 1 + for n,_ in pairs(trunks) do + local p = {} + p.x, _, p.z = unpack(string.split(n, " ")) + min, max = update_minmax(min, max, p) + end + + for i = -1,h_stem+1 do + table.insert(trunk_ps, {x=pos.x, y=pos.y+i, z=pos.z, par=0}) + end + + local trunk_corner_ps = {} + for n,par in pairs(trunk_corners) do + local p = {} + p.x, p.y, p.z = unpack(string.split(n, " ")) + p.par = par + table.insert(trunk_corner_ps, p) + end + + local fruit_ps = {} + for n,_ in pairs(fruits) do + local p = {} + p.x, p.y, p.z = unpack(string.split(n, " ")) + table.insert(fruit_ps, p) + end + + local manip = minetest.get_voxel_manip() + local emerged_pos1, emerged_pos2 = manip:read_from_map(min, max) + local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2}) + local nodes = manip:get_data() + local param2s = manip:get_param2_data() + + for _,p in pairs(leaf_ps) do + p = area:indexp(p) + if nodes[p] == c.air then + nodes[p] = c.nether_leaves + param2s[p] = math.random(0,44) end end - return count + + for _,p in pairs(fruit_ps) do + p = area:indexp(p) + if nodes[p] == c.air then + nodes[p] = c.nether_apple + --param2s[p] = math.random(0,44) + end + end + + for _,p in pairs(trunk_ps) do + local par = p.par + p = area:indexp(p) + if par then + param2s[p] = par + end + nodes[p] = c.nether_tree + end + + for _,p in pairs(trunk_corner_ps) do + local par = p.par + p = area:indexp(p) + nodes[p] = c.nether_tree_corner + param2s[p] = par + end + + --calculating took ca. 0.07 - 0.18 [s] + manip:set_data(nodes) + manip:set_param2_data(param2s) + manip:write_to_map() + local spam = 2 + if generated then + spam = 3 + end + nether:inform("a nether tree grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", spam, t1) + if not generated then + local t1 = os.clock() + manip:update_map() + nether:inform("map updated", spam, t1) + end end --- Remove duplicate positions from table -function table_unique(tt) - local newtable - newtable = {} - for ii,xx in ipairs(tt) do - if(table_count(newtable, xx) == 0) then - newtable[#newtable+1] = xx - end - end - return newtable -end - --- Copied from neko259 with a few minor edits from lkjoel -function split(pString, pPattern) - local Table = {} - local fpat = "(.-)" .. pPattern - local last_end = 1 - local s, e, cap = pString:find(fpat, 1) - while s do - if s ~= 1 or cap ~= "" then - table.insert(Table,cap) - end - last_end = e+1 - s, e, cap = pString:find(fpat, last_end) - end - if last_end <= #pString then - cap = pString:sub(last_end) - table.insert(Table, cap) - end - return Table -end - --- Save a portal to nether -function nether:save_portal_to_nether(pos) - local file = io.open(NETHER_PORTALS_TO_NETHER_FILE, "a") - if file ~= nil then - file:write("x" .. pos.x .. "\ny" .. pos.y .. "\nz" .. pos.z .. "\np", "\n") - file:close() - else - nether:printerror("Cannot write portal to file!") - end -end - --- Save all nether portals -function nether:save_portals_to_nether() - local array2 = NETHER_PORTALS_TO_NETHER - NETHER_PORTALS_TO_NETHER = table_unique(array2) - file = io.open(NETHER_PORTALS_TO_NETHER_FILE, "w") - if file ~= nil then - file:write("") - file:close() - for i,v in ipairs(NETHER_PORTALS_TO_NETHER) do - nether:save_portal_to_nether(v) - end - else - nether:printerror("Cannot create portal file!") - end -end - --- Save a portal from nether -function nether:save_portal_from_nether(pos) - local file = io.open(NETHER_PORTALS_FROM_NETHER_FILE, "a") - if file ~= nil then - file:write("x" .. pos.x .. "\ny" .. pos.y .. "\nz" .. pos.z .. "\np", "\n") - file:close() - else - nether:printerror("Cannot write portal to file!") - end -end - --- Save all portals from nether -function nether:save_portals_from_nether() - local array2 = NETHER_PORTALS_FROM_NETHER - NETHER_PORTALS_FROM_NETHER = table_unique(array2) - file = io.open(NETHER_PORTALS_FROM_NETHER_FILE, "w") - if file ~= nil then - file:write("") - file:close() - for i,v in ipairs(NETHER_PORTALS_FROM_NETHER) do - nether:save_portal_from_nether(v) - end - else - nether:printerror("Cannot create portal file!") - end -end - --- Read portals to nether -function nether:read_portals_to_nether() - local array = {} - local array2 = {} - local file = io.open(NETHER_PORTALS_TO_NETHER_FILE, "r") - if file ~= nil then - for line in io.lines(NETHER_PORTALS_TO_NETHER_FILE) do - if not (line == "" or line == nil) then - if line:sub(1, 1) == "p" then - array2[table.getn(array2)+1] = array - elseif line:sub(1, 1) == "x" then - array.x = tonumber(split(line, "x")[1]) - elseif line:sub(1, 1) == "y" then - array.y = tonumber(split(line, "y")[1]) - elseif line:sub(1, 1) == "z" then - array.z = tonumber(split(line, "z")[1]) - end - end - end - else - file = io.open(NETHER_PORTALS_TO_NETHER_FILE, "w") - if file ~= nil then - file:write("") - file:close() - else - nether:printerror("Cannot create portal file!") - end - end - NETHER_PORTALS_TO_NETHER = table_unique(array2) -end - --- Read portals from nether -function nether:read_portals_from_nether() - local array = {} - local array2 = {} - local file = io.open(NETHER_PORTALS_FROM_NETHER_FILE, "r") - if file ~= nil then - for line in io.lines(NETHER_PORTALS_FROM_NETHER_FILE) do - if not (line == "" or line == nil) then - if line:sub(1, 1) == "p" then - array2[table.getn(array2)+1] = array - elseif line:sub(1, 1) == "x" then - array.x = tonumber(split(line, "x")[1]) - elseif line:sub(1, 1) == "y" then - array.y = tonumber(split(line, "y")[1]) - elseif line:sub(1, 1) == "z" then - array.z = tonumber(split(line, "z")[1]) - end - end - end - else - file = io.open(NETHER_PORTALS_FROM_NETHER_FILE, "w") - if file ~= nil then - file:write("") - file:close() - else - nether:printerror("Cannot create portal file!") - end - end - NETHER_PORTALS_FROM_NETHER = table_unique(array2) -end - -nether:read_portals_to_nether() -nether:read_portals_from_nether() - --- Teleport the player -function nether:teleport_player(from_nether, player) - local randomportal = 1 - local coin = math.floor(math.random(0, 1)) - if coin == 0 then - coin = -1 - else - coin = 1 - end - local coin2 = math.floor(math.random(1, 2)) - local num = 1 - local forgetit = false - if from_nether == true then - num = table.getn(NETHER_PORTALS_TO_NETHER) - if num == 1 then - randomportal = 1 - elseif num < 1 then - forgetit = true - teleportpos = NETHER_SPAWNPOS_ABS - else - randomportal = math.floor(math.random(1, num)) - end - if forgetit == false then - portalpos = NETHER_PORTALS_TO_NETHER[randomportal] - end - else - num = table.getn(NETHER_PORTALS_FROM_NETHER) - if num == 1 then - randomportal = 1 - elseif num < 1 then - forgetit = true - teleportpos = NETHER_SPAWNPOS_ABS - else - randomportal = math.floor(math.random(1, num)) - end - if forgetit == false then - portalpos = NETHER_PORTALS_FROM_NETHER[randomportal] - end - end - if forgetit == false then - teleportpos = {x=portalpos.x + coin2, y=portalpos.y + 1, z=portalpos.z + coin} - end - player:setpos(teleportpos) -end - --- Creates a portal -function nether:createportal(pos) - local currx - local curry - local currz - local currpos = {} - for i,v in ipairs(NETHER_PORTAL) do - currx = v.pos.x + pos.x - curry = v.pos.y + pos.y - currz = v.pos.z + pos.z - currpos = {x=currx, y=curry, z=currz} - minetest.add_node(currpos, {name=v.block}) - end -end - --- Portal Creator -minetest.register_node("nether:portal_creator", { - tiles = {"nether_portal_creator.png"}, - description = "Nether Portal Creator", -}) - -minetest.register_on_placenode(function(pos, node) - if node.name == "nether:portal_creator" then - if nether:inside_nether(pos) then - NETHER_PORTALS_FROM_NETHER[table.getn(NETHER_PORTALS_FROM_NETHER)+1] = pos - nether:save_portal_from_nether(pos) - else - NETHER_PORTALS_TO_NETHER[table.getn(NETHER_PORTALS_TO_NETHER)+1] = pos - nether:save_portal_to_nether(pos) - end - nether:createportal(pos) - end - nodeupdate(pos) -end) +--abms minetest.register_abm({ - nodenames = "nether:portal_creator", - interval = 1, - chance = 1, + nodenames = {"nether:sapling"}, + neighbors = {"nether:blood_top"}, + interval = 20, + chance = 8, action = function(pos) - nether:createportal(pos) + local under = {x=pos.x, y=pos.y-1, z=pos.z} + if minetest.get_node_light(pos) < 4 + and minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" + and minetest.get_node(under).name == "nether:blood_top" then + nether.grow_netherstructure(under) + end end }) --- Portal Stuff -minetest.register_node("nether:portal", { - description = "Nether Portal", - drawtype = "glasslike", - tiles = {"nether_portal_stuff.png"}, - inventory_image = "nether_portal_stuff.png", - wield_image = "nether_portal_stuff.png", - light_source = LIGHT_MAX - 2, - paramtype = "light", - sunlight_propagates = true, - use_texture_alpha = true, - walkable = false, - digable = false, - pointable = false, - legacy_wallmounted = false, --- buildable_to = true, - drop = "", - groups = {not_in_creative_inventory=1}, - post_effect_color = {a=200, r=50, g=0, b=60}, - metadata_name = "generic" +minetest.register_abm({ + nodenames = {"nether:tree_sapling"}, + neighbors = {"group:nether_dirt"}, + interval = 864, + chance = 100, + action = function(pos) + if minetest.get_node({x=pos.x, y=pos.y+2, z=pos.z}).name == "air" + and minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then + local udata = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name] + if udata + and udata.groups + and udata.groups.nether_dirt then + nether.grow_tree(pos) + end + end + end }) minetest.register_abm({ - nodenames = {"nether:portal"}, - interval = 1, - chance = 1, + nodenames = {"nether:netherrack_soil"}, + neighbors = {"air"}, + interval = 20, + chance = 20, action = function(pos, node) - minetest.add_particlespawner( - 32, --amount - 4, --time - {x=pos.x-0.47, y=pos.y-0.5, z=pos.z-1}, --minpos - {x=pos.x+0.47, y=pos.y+0.34, z=pos.z+1}, --maxpos - {x=0, y=1, z=0}, --minvel - {x=0, y=2, z=0}, --maxvel - {x=-0.5,y=-3,z=-0.3}, --minacc - {x=0.5,y=-0.4,z=0.3}, --maxacc - 1, --minexptime - 2, --maxexptime - 0.4, --minsize - 3, --maxsize - true, --collisiondetection - "nether_portal_particle.png" --texture - ) - local objs = minetest.get_objects_inside_radius(pos, 1) - if objs[1] ~= nil then - local nodemeta = minetest.get_meta(pos) - for _,obj in pairs(objs) do - local objpos = obj:getpos() - local objmeta = minetest.get_meta(objpos) - local objplayername = obj:get_player_name() - if objpos.y > pos.y-1 - and objpos.y < pos.y - and objplayername ~= nil - and objplayername ~= "" then - local innether = nether:inside_nether(obj:getpos()) - local objstring1 = objmeta:get_string("teleportingfromnether") - if innether - and ( - objstring1 == "" - or objstring1 == nil - ) then - objmeta:set_string("teleportingfromnether", "true") - objmeta:set_string("teleportingtonether", "") - nether:teleport_player(innether, obj) - return - end - local objstring2 = objmeta:get_string("teleportingtonether") - if not innether - and ( - objstring2 == "" - or objstring2 == nil - ) then - objmeta:set_string("teleportingtonether", "true") - objmeta:set_string("teleportingfromnether", "") - nether:teleport_player(innether, obj) - end - end - end + local par2 = node.param2 + if par2 == 0 then + return end - end, + pos.y = pos.y+1 + if (minetest.get_node_light(pos) or 16) > 7 then --mushrooms grow at dark places + return + end + if minetest.get_node(pos).name == "air" then + minetest.set_node(pos, {name="riesenpilz:nether_shroom"}) + pos.y = pos.y-1 + minetest.set_node(pos, {name="nether:netherrack_soil", param2=par2-1}) + end + end }) --- CRAFTING DEFINITIONS -minetest.register_craft({ - output = "nether:portal_creator", - recipe = { - {"default:obsidian", "default:obsidian", "default:obsidian"}, - {"default:obsidian", "nether:pearl", "default:obsidian"}, - {"default:obsidian", "default:obsidian", "default:obsidian"}, - } +local function grass_allowed(pos) + local nd = minetest.get_node(pos).name + if nd == "air" then + return true + end + if nd == "ignore" then + return 0 + end + local data = minetest.registered_nodes[nd] + local drawtype = data.drawtype + if drawtype + and drawtype ~= "normal" + and drawtype ~= "liquid" + and drawtype ~= "flowingliquid" then + return true + end + local light = data.light_source + if light + and light > 0 then + return true + end + return false +end + +minetest.register_abm({ + nodenames = {"nether:dirt"}, + interval = 20, + chance = 9, + action = function(pos) + local allowed = grass_allowed({x=pos.x, y=pos.y+1, z=pos.z}) + if allowed == 0 then + return + end + if allowed then + minetest.set_node(pos, {name="nether:dirt_top"}) + end + end }) -print("Nether mod loaded!") +minetest.register_abm({ + nodenames = {"nether:dirt_top"}, + interval = 30, + chance = 9, + action = function(pos) + local allowed = grass_allowed({x=pos.x, y=pos.y+1, z=pos.z}) + if allowed == 0 then + return + end + if not allowed then + minetest.set_node(pos, {name="nether:dirt"}) + end + end +}) + + +minetest.register_privilege("nether", "Allows sending players to nether and extracting them") + +dofile(path.."/crafting.lua") +dofile(path.."/portal.lua") +dofile(path.."/guide.lua") + +nether:inform("loaded!", 1) diff --git a/nether/items.lua b/nether/items.lua new file mode 100644 index 0000000..427d1f1 --- /dev/null +++ b/nether/items.lua @@ -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}, + }, +}) + diff --git a/nether/pearl.lua b/nether/pearl.lua new file mode 100644 index 0000000..25dfac2 --- /dev/null +++ b/nether/pearl.lua @@ -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}) diff --git a/nether/portal.lua b/nether/portal.lua new file mode 100644 index 0000000..0677639 --- /dev/null +++ b/nether/portal.lua @@ -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 diff --git a/nether/Nicht Leere Datei.lua b/nether/rest/Nicht Leere Datei.lua similarity index 64% rename from nether/Nicht Leere Datei.lua rename to nether/rest/Nicht Leere Datei.lua index 2cc5a64..ed3353f 100644 --- a/nether/Nicht Leere Datei.lua +++ b/nether/rest/Nicht Leere Datei.lua @@ -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]] diff --git a/nether/rest/nether_fruit_leaves.png b/nether/rest/nether_fruit_leaves.png new file mode 100644 index 0000000..c230ae5 Binary files /dev/null and b/nether/rest/nether_fruit_leaves.png differ diff --git a/nether/nether_glowstone.png b/nether/rest/nether_glowstone.png similarity index 100% rename from nether/nether_glowstone.png rename to nether/rest/nether_glowstone.png diff --git a/nether/rest/nether_leaves.png b/nether/rest/nether_leaves.png new file mode 100644 index 0000000..b6d304d Binary files /dev/null and b/nether/rest/nether_leaves.png differ diff --git a/nether/rest/nether_leaves_decision/nether_leaves.png b/nether/rest/nether_leaves_decision/nether_leaves.png new file mode 100644 index 0000000..bed6162 Binary files /dev/null and b/nether/rest/nether_leaves_decision/nether_leaves.png differ diff --git a/nether/rest/nether_leaves_decision/nether_leaves_high_cont.png b/nether/rest/nether_leaves_decision/nether_leaves_high_cont.png new file mode 100644 index 0000000..7ad8059 Binary files /dev/null and b/nether/rest/nether_leaves_decision/nether_leaves_high_cont.png differ diff --git a/nether/nether_netherrack.png1 b/nether/rest/nether_netherrack.png1 similarity index 100% rename from nether/nether_netherrack.png1 rename to nether/rest/nether_netherrack.png1 diff --git a/nether/textures/nether_portal_creator.png b/nether/rest/nether_portal_creator.png similarity index 100% rename from nether/textures/nether_portal_creator.png rename to nether/rest/nether_portal_creator.png diff --git a/nether/rest/nether_tree.png b/nether/rest/nether_tree.png new file mode 100644 index 0000000..0c4cd89 Binary files /dev/null and b/nether/rest/nether_tree.png differ diff --git a/nether/rest/nether_tree_top.png b/nether/rest/nether_tree_top.png new file mode 100644 index 0000000..eb82f06 Binary files /dev/null and b/nether/rest/nether_tree_top.png differ diff --git a/nether/temp.txt b/nether/rest/temp.txt similarity index 100% rename from nether/temp.txt rename to nether/rest/temp.txt diff --git a/nether/sounds/nether_dig.1.ogg b/nether/sounds/nether_dig.1.ogg new file mode 100644 index 0000000..4c49832 Binary files /dev/null and b/nether/sounds/nether_dig.1.ogg differ diff --git a/nether/sounds/nether_dig.2.ogg b/nether/sounds/nether_dig.2.ogg new file mode 100644 index 0000000..c69b45e Binary files /dev/null and b/nether/sounds/nether_dig.2.ogg differ diff --git a/nether/sounds/nether_dug.1.ogg b/nether/sounds/nether_dug.1.ogg new file mode 100644 index 0000000..a6dfa9e Binary files /dev/null and b/nether/sounds/nether_dug.1.ogg differ diff --git a/nether/sounds/nether_dug.2.ogg b/nether/sounds/nether_dug.2.ogg new file mode 100644 index 0000000..cc7666b Binary files /dev/null and b/nether/sounds/nether_dug.2.ogg differ diff --git a/nether/sounds/nether_extract_blood.1.ogg b/nether/sounds/nether_extract_blood.1.ogg new file mode 100644 index 0000000..c69d486 Binary files /dev/null and b/nether/sounds/nether_extract_blood.1.ogg differ diff --git a/nether/sounds/nether_extract_blood.2.ogg b/nether/sounds/nether_extract_blood.2.ogg new file mode 100644 index 0000000..bf41821 Binary files /dev/null and b/nether/sounds/nether_extract_blood.2.ogg differ diff --git a/nether/sounds/nether_extract_blood.3.ogg b/nether/sounds/nether_extract_blood.3.ogg new file mode 100644 index 0000000..db3a39c Binary files /dev/null and b/nether/sounds/nether_extract_blood.3.ogg differ diff --git a/nether/sounds/nether_extract_blood.4.ogg b/nether/sounds/nether_extract_blood.4.ogg new file mode 100644 index 0000000..2ac3495 Binary files /dev/null and b/nether/sounds/nether_extract_blood.4.ogg differ diff --git a/nether/sounds/nether_extract_blood.5.ogg b/nether/sounds/nether_extract_blood.5.ogg new file mode 100644 index 0000000..5d628d9 Binary files /dev/null and b/nether/sounds/nether_extract_blood.5.ogg differ diff --git a/nether/sounds/nether_extract_blood.6.ogg b/nether/sounds/nether_extract_blood.6.ogg new file mode 100644 index 0000000..618d6d6 Binary files /dev/null and b/nether/sounds/nether_extract_blood.6.ogg differ diff --git a/nether/sounds/nether_extract_blood.7.ogg b/nether/sounds/nether_extract_blood.7.ogg new file mode 100644 index 0000000..fd0a7fe Binary files /dev/null and b/nether/sounds/nether_extract_blood.7.ogg differ diff --git a/nether/sounds/nether_footstep.1.ogg b/nether/sounds/nether_footstep.1.ogg new file mode 100644 index 0000000..15f31a0 Binary files /dev/null and b/nether/sounds/nether_footstep.1.ogg differ diff --git a/nether/sounds/nether_footstep.2.ogg b/nether/sounds/nether_footstep.2.ogg new file mode 100644 index 0000000..fbc200a Binary files /dev/null and b/nether/sounds/nether_footstep.2.ogg differ diff --git a/nether/sounds/nether_footstep.3.ogg b/nether/sounds/nether_footstep.3.ogg new file mode 100644 index 0000000..1648043 Binary files /dev/null and b/nether/sounds/nether_footstep.3.ogg differ diff --git a/nether/sounds/nether_pearl.ogg b/nether/sounds/nether_pearl.ogg new file mode 100644 index 0000000..90dde6a Binary files /dev/null and b/nether/sounds/nether_pearl.ogg differ diff --git a/nether/sounds/nether_portal_usual.ogg b/nether/sounds/nether_portal_usual.ogg new file mode 100644 index 0000000..cf1f84a Binary files /dev/null and b/nether/sounds/nether_portal_usual.ogg differ diff --git a/nether/sounds/nether_remove_leaf.1.ogg b/nether/sounds/nether_remove_leaf.1.ogg new file mode 100644 index 0000000..224b424 Binary files /dev/null and b/nether/sounds/nether_remove_leaf.1.ogg differ diff --git a/nether/sounds/nether_remove_leaf.2.ogg b/nether/sounds/nether_remove_leaf.2.ogg new file mode 100644 index 0000000..c02ef1c Binary files /dev/null and b/nether/sounds/nether_remove_leaf.2.ogg differ diff --git a/nether/sounds/nether_remove_leaf.3.ogg b/nether/sounds/nether_remove_leaf.3.ogg new file mode 100644 index 0000000..c5b79ba Binary files /dev/null and b/nether/sounds/nether_remove_leaf.3.ogg differ diff --git a/nether/sounds/nether_teleporter.1.ogg b/nether/sounds/nether_teleporter.1.ogg new file mode 100644 index 0000000..65e4803 Binary files /dev/null and b/nether/sounds/nether_teleporter.1.ogg differ diff --git a/nether/sounds/nether_teleporter.2.ogg b/nether/sounds/nether_teleporter.2.ogg new file mode 100644 index 0000000..eaafec9 Binary files /dev/null and b/nether/sounds/nether_teleporter.2.ogg differ diff --git a/nether/sounds/nether_teleporter.3.ogg b/nether/sounds/nether_teleporter.3.ogg new file mode 100644 index 0000000..949dd93 Binary files /dev/null and b/nether/sounds/nether_teleporter.3.ogg differ diff --git a/nether/textures/nether_apple.png b/nether/textures/nether_apple.png deleted file mode 100644 index cb87330..0000000 Binary files a/nether/textures/nether_apple.png and /dev/null differ diff --git a/nether/textures/nether_axe_netherrack.png b/nether/textures/nether_axe_netherrack.png new file mode 100644 index 0000000..5f9076c Binary files /dev/null and b/nether/textures/nether_axe_netherrack.png differ diff --git a/nether/textures/nether_axe_netherrack_blue.png b/nether/textures/nether_axe_netherrack_blue.png new file mode 100644 index 0000000..cfd9e6f Binary files /dev/null and b/nether/textures/nether_axe_netherrack_blue.png differ diff --git a/nether/textures/nether_axe_white.png b/nether/textures/nether_axe_white.png new file mode 100644 index 0000000..44f3de0 Binary files /dev/null and b/nether/textures/nether_axe_white.png differ diff --git a/nether/textures/nether_bark.png b/nether/textures/nether_bark.png new file mode 100644 index 0000000..69e079a Binary files /dev/null and b/nether/textures/nether_bark.png differ diff --git a/nether/textures/nether_blood_cooked.png b/nether/textures/nether_blood_cooked.png new file mode 100644 index 0000000..ac72a3d Binary files /dev/null and b/nether/textures/nether_blood_cooked.png differ diff --git a/nether/textures/nether_blood_empty.png b/nether/textures/nether_blood_empty.png new file mode 100644 index 0000000..d1d8dda Binary files /dev/null and b/nether/textures/nether_blood_empty.png differ diff --git a/nether/textures/nether_blood_extracted.png b/nether/textures/nether_blood_extracted.png new file mode 100644 index 0000000..9f2ca0f Binary files /dev/null and b/nether/textures/nether_blood_extracted.png differ diff --git a/nether/textures/nether_blood_extractor.png b/nether/textures/nether_blood_extractor.png new file mode 100644 index 0000000..49897f6 Binary files /dev/null and b/nether/textures/nether_blood_extractor.png differ diff --git a/nether/textures/nether_blood_side.png b/nether/textures/nether_blood_side.png index 468a8dc..086b645 100644 Binary files a/nether/textures/nether_blood_side.png and b/nether/textures/nether_blood_side.png differ diff --git a/nether/textures/nether_blood_side_cooked.png b/nether/textures/nether_blood_side_cooked.png new file mode 100644 index 0000000..60f86ba Binary files /dev/null and b/nether/textures/nether_blood_side_cooked.png differ diff --git a/nether/textures/nether_blood_side_empty.png b/nether/textures/nether_blood_side_empty.png new file mode 100644 index 0000000..9df720b Binary files /dev/null and b/nether/textures/nether_blood_side_empty.png differ diff --git a/nether/textures/nether_blood_stem_cooked.png b/nether/textures/nether_blood_stem_cooked.png new file mode 100644 index 0000000..e1c200b Binary files /dev/null and b/nether/textures/nether_blood_stem_cooked.png differ diff --git a/nether/textures/nether_blood_stem_empty.png b/nether/textures/nether_blood_stem_empty.png new file mode 100644 index 0000000..008d49d Binary files /dev/null and b/nether/textures/nether_blood_stem_empty.png differ diff --git a/nether/textures/nether_blood_stem_top_cooked.png b/nether/textures/nether_blood_stem_top_cooked.png new file mode 100644 index 0000000..4ed2403 Binary files /dev/null and b/nether/textures/nether_blood_stem_top_cooked.png differ diff --git a/nether/textures/nether_blood_stem_top_empty.png b/nether/textures/nether_blood_stem_top_empty.png new file mode 100644 index 0000000..16223a5 Binary files /dev/null and b/nether/textures/nether_blood_stem_top_empty.png differ diff --git a/nether/textures/nether_blood_top_cooked.png b/nether/textures/nether_blood_top_cooked.png new file mode 100644 index 0000000..7385db1 Binary files /dev/null and b/nether/textures/nether_blood_top_cooked.png differ diff --git a/nether/textures/nether_blood_top_empty.png b/nether/textures/nether_blood_top_empty.png new file mode 100644 index 0000000..815d998 Binary files /dev/null and b/nether/textures/nether_blood_top_empty.png differ diff --git a/nether/textures/nether_brick_shadow.png b/nether/textures/nether_brick_shadow.png deleted file mode 100644 index 1d4ba10..0000000 Binary files a/nether/textures/nether_brick_shadow.png and /dev/null differ diff --git a/nether/textures/nether_dirt.png b/nether/textures/nether_dirt.png new file mode 100644 index 0000000..8eea86e Binary files /dev/null and b/nether/textures/nether_dirt.png differ diff --git a/nether/textures/nether_dirt_normal.png b/nether/textures/nether_dirt_normal.png new file mode 100644 index 0000000..5e117c1 Binary files /dev/null and b/nether/textures/nether_dirt_normal.png differ diff --git a/nether/textures/nether_dirt_top.png b/nether/textures/nether_dirt_top.png new file mode 100644 index 0000000..1bb0fba Binary files /dev/null and b/nether/textures/nether_dirt_top.png differ diff --git a/nether/textures/nether_dirt_top_normal.png b/nether/textures/nether_dirt_top_normal.png new file mode 100644 index 0000000..885f03d Binary files /dev/null and b/nether/textures/nether_dirt_top_normal.png differ diff --git a/nether/textures/nether_dirt_top_side.png b/nether/textures/nether_dirt_top_side.png new file mode 100644 index 0000000..577367a Binary files /dev/null and b/nether/textures/nether_dirt_top_side.png differ diff --git a/nether/textures/nether_dirt_top_side_normal.png b/nether/textures/nether_dirt_top_side_normal.png new file mode 100644 index 0000000..9aa7c9a Binary files /dev/null and b/nether/textures/nether_dirt_top_side_normal.png differ diff --git a/nether/textures/nether_dirt_transition.png b/nether/textures/nether_dirt_transition.png new file mode 100644 index 0000000..9937ff3 Binary files /dev/null and b/nether/textures/nether_dirt_transition.png differ diff --git a/nether/textures/nether_dirt_transition_normal.png b/nether/textures/nether_dirt_transition_normal.png new file mode 100644 index 0000000..137e2e8 Binary files /dev/null and b/nether/textures/nether_dirt_transition_normal.png differ diff --git a/nether/textures/nether_fim.png b/nether/textures/nether_fim.png new file mode 100644 index 0000000..eaa319c Binary files /dev/null and b/nether/textures/nether_fim.png differ diff --git a/nether/textures/nether_forest_planks.png b/nether/textures/nether_forest_planks.png new file mode 100644 index 0000000..2001002 Binary files /dev/null and b/nether/textures/nether_forest_planks.png differ diff --git a/nether/textures/nether_forest_wood.png b/nether/textures/nether_forest_wood.png new file mode 100644 index 0000000..69f8d1e Binary files /dev/null and b/nether/textures/nether_forest_wood.png differ diff --git a/nether/textures/nether_forest_wood_normal.png b/nether/textures/nether_forest_wood_normal.png new file mode 100644 index 0000000..5212894 Binary files /dev/null and b/nether/textures/nether_forest_wood_normal.png differ diff --git a/nether/textures/nether_fruit.png b/nether/textures/nether_fruit.png new file mode 100644 index 0000000..8fb46af Binary files /dev/null and b/nether/textures/nether_fruit.png differ diff --git a/nether/textures/nether_fruit_bottom.png b/nether/textures/nether_fruit_bottom.png new file mode 100644 index 0000000..f6436cb Binary files /dev/null and b/nether/textures/nether_fruit_bottom.png differ diff --git a/nether/textures/nether_fruit_leaf.png b/nether/textures/nether_fruit_leaf.png new file mode 100644 index 0000000..784c2f7 Binary files /dev/null and b/nether/textures/nether_fruit_leaf.png differ diff --git a/nether/textures/nether_fruit_leaves.png b/nether/textures/nether_fruit_leaves.png new file mode 100644 index 0000000..4f41ff3 Binary files /dev/null and b/nether/textures/nether_fruit_leaves.png differ diff --git a/nether/textures/nether_fruit_no_leaf.png b/nether/textures/nether_fruit_no_leaf.png new file mode 100644 index 0000000..19d6c99 Binary files /dev/null and b/nether/textures/nether_fruit_no_leaf.png differ diff --git a/nether/textures/nether_fruit_top.png b/nether/textures/nether_fruit_top.png new file mode 100644 index 0000000..3945e17 Binary files /dev/null and b/nether/textures/nether_fruit_top.png differ diff --git a/nether/textures/nether_glowflower.png b/nether/textures/nether_glowflower.png new file mode 100644 index 0000000..5784ce5 Binary files /dev/null and b/nether/textures/nether_glowflower.png differ diff --git a/nether/textures/nether_grass.png b/nether/textures/nether_grass.png new file mode 100644 index 0000000..2e11a1f Binary files /dev/null and b/nether/textures/nether_grass.png differ diff --git a/nether/textures/nether_grass_big.png b/nether/textures/nether_grass_big.png new file mode 100644 index 0000000..53ed795 Binary files /dev/null and b/nether/textures/nether_grass_big.png differ diff --git a/nether/textures/nether_grass_dried.png b/nether/textures/nether_grass_dried.png new file mode 100644 index 0000000..8f2af2b Binary files /dev/null and b/nether/textures/nether_grass_dried.png differ diff --git a/nether/textures/nether_grass_middle.png b/nether/textures/nether_grass_middle.png new file mode 100644 index 0000000..b5c82fa Binary files /dev/null and b/nether/textures/nether_grass_middle.png differ diff --git a/nether/textures/nether_grass_small.png b/nether/textures/nether_grass_small.png new file mode 100644 index 0000000..b540c49 Binary files /dev/null and b/nether/textures/nether_grass_small.png differ diff --git a/nether/textures/nether_hotbed.png b/nether/textures/nether_hotbed.png new file mode 100644 index 0000000..96b9063 Binary files /dev/null and b/nether/textures/nether_hotbed.png differ diff --git a/nether/textures/nether_leaves.png b/nether/textures/nether_leaves.png index b6d304d..a5ef808 100644 Binary files a/nether/textures/nether_leaves.png and b/nether/textures/nether_leaves.png differ diff --git a/nether/textures/nether_netherrack.png b/nether/textures/nether_netherrack.png index 91372f2..e30280c 100644 Binary files a/nether/textures/nether_netherrack.png and b/nether/textures/nether_netherrack.png differ diff --git a/nether/textures/nether_netherrack_black.png b/nether/textures/nether_netherrack_black.png new file mode 100644 index 0000000..8b130d5 Binary files /dev/null and b/nether/textures/nether_netherrack_black.png differ diff --git a/nether/textures/nether_netherrack_black_normal.png b/nether/textures/nether_netherrack_black_normal.png new file mode 100644 index 0000000..aebf5fe Binary files /dev/null and b/nether/textures/nether_netherrack_black_normal.png differ diff --git a/nether/textures/nether_netherrack_blue.png b/nether/textures/nether_netherrack_blue.png new file mode 100644 index 0000000..03f4bf5 Binary files /dev/null and b/nether/textures/nether_netherrack_blue.png differ diff --git a/nether/textures/nether_netherrack_blue_normal.png b/nether/textures/nether_netherrack_blue_normal.png new file mode 100644 index 0000000..ff6a573 Binary files /dev/null and b/nether/textures/nether_netherrack_blue_normal.png differ diff --git a/nether/textures/nether_netherrack_brick.png b/nether/textures/nether_netherrack_brick.png new file mode 100644 index 0000000..b9199b7 Binary files /dev/null and b/nether/textures/nether_netherrack_brick.png differ diff --git a/nether/textures/nether_netherrack_brick_black.png b/nether/textures/nether_netherrack_brick_black.png new file mode 100644 index 0000000..7efb179 Binary files /dev/null and b/nether/textures/nether_netherrack_brick_black.png differ diff --git a/nether/textures/nether_netherrack_brick_blue.png b/nether/textures/nether_netherrack_brick_blue.png new file mode 100644 index 0000000..9db6250 Binary files /dev/null and b/nether/textures/nether_netherrack_brick_blue.png differ diff --git a/nether/textures/nether_netherrack_normal.png b/nether/textures/nether_netherrack_normal.png new file mode 100644 index 0000000..5e2eafd Binary files /dev/null and b/nether/textures/nether_netherrack_normal.png differ diff --git a/nether/textures/nether_netherrack_soil.png b/nether/textures/nether_netherrack_soil.png new file mode 100644 index 0000000..dedab0e Binary files /dev/null and b/nether/textures/nether_netherrack_soil.png differ diff --git a/nether/textures/nether_netherrack_soil_normal.png b/nether/textures/nether_netherrack_soil_normal.png new file mode 100644 index 0000000..b939572 Binary files /dev/null and b/nether/textures/nether_netherrack_soil_normal.png differ diff --git a/nether/textures/nether_netherrack_tiled.png b/nether/textures/nether_netherrack_tiled.png new file mode 100644 index 0000000..dcaa06a Binary files /dev/null and b/nether/textures/nether_netherrack_tiled.png differ diff --git a/nether/textures/nether_netherrack_tiled_normal.png b/nether/textures/nether_netherrack_tiled_normal.png new file mode 100644 index 0000000..ca51e52 Binary files /dev/null and b/nether/textures/nether_netherrack_tiled_normal.png differ diff --git a/nether/textures/nether_pearl.png b/nether/textures/nether_pearl.png index 830333f..e3a1b70 100644 Binary files a/nether/textures/nether_pearl.png and b/nether/textures/nether_pearl.png differ diff --git a/nether/textures/nether_pick_mushroom.png b/nether/textures/nether_pick_mushroom.png new file mode 100644 index 0000000..a0e3029 Binary files /dev/null and b/nether/textures/nether_pick_mushroom.png differ diff --git a/nether/textures/nether_pick_netherrack.png b/nether/textures/nether_pick_netherrack.png new file mode 100644 index 0000000..922a097 Binary files /dev/null and b/nether/textures/nether_pick_netherrack.png differ diff --git a/nether/textures/nether_pick_netherrack_blue.png b/nether/textures/nether_pick_netherrack_blue.png new file mode 100644 index 0000000..e8757fb Binary files /dev/null and b/nether/textures/nether_pick_netherrack_blue.png differ diff --git a/nether/textures/nether_pick_white.png b/nether/textures/nether_pick_white.png new file mode 100644 index 0000000..8bd46cb Binary files /dev/null and b/nether/textures/nether_pick_white.png differ diff --git a/nether/textures/nether_pick_wood.png b/nether/textures/nether_pick_wood.png new file mode 100644 index 0000000..0973dfe Binary files /dev/null and b/nether/textures/nether_pick_wood.png differ diff --git a/nether/textures/nether_portal_particle.png b/nether/textures/nether_portal_particle.png index f598e7a..e619dc8 100644 Binary files a/nether/textures/nether_portal_particle.png and b/nether/textures/nether_portal_particle.png differ diff --git a/nether/textures/nether_portal_stuff.png b/nether/textures/nether_portal_stuff.png index 5f47e7e..9a91adb 100644 Binary files a/nether/textures/nether_portal_stuff.png and b/nether/textures/nether_portal_stuff.png differ diff --git a/nether/textures/nether_portal_stuff_normal.png b/nether/textures/nether_portal_stuff_normal.png new file mode 100644 index 0000000..0e013bf Binary files /dev/null and b/nether/textures/nether_portal_stuff_normal.png differ diff --git a/nether/textures/nether_sapling.png b/nether/textures/nether_sapling.png new file mode 100644 index 0000000..f0aea81 Binary files /dev/null and b/nether/textures/nether_sapling.png differ diff --git a/nether/textures/nether_shovel_netherrack.png b/nether/textures/nether_shovel_netherrack.png new file mode 100644 index 0000000..3cb91b6 Binary files /dev/null and b/nether/textures/nether_shovel_netherrack.png differ diff --git a/nether/textures/nether_shovel_netherrack_blue.png b/nether/textures/nether_shovel_netherrack_blue.png new file mode 100644 index 0000000..03caa1c Binary files /dev/null and b/nether/textures/nether_shovel_netherrack_blue.png differ diff --git a/nether/textures/nether_shovel_white.png b/nether/textures/nether_shovel_white.png new file mode 100644 index 0000000..989e29e Binary files /dev/null and b/nether/textures/nether_shovel_white.png differ diff --git a/nether/textures/nether_shroom_stem.png b/nether/textures/nether_shroom_stem.png new file mode 100644 index 0000000..d4ab203 Binary files /dev/null and b/nether/textures/nether_shroom_stem.png differ diff --git a/nether/textures/nether_shroom_top.png b/nether/textures/nether_shroom_top.png new file mode 100644 index 0000000..6dd58c7 Binary files /dev/null and b/nether/textures/nether_shroom_top.png differ diff --git a/nether/textures/nether_stick.png b/nether/textures/nether_stick.png new file mode 100644 index 0000000..c287e16 Binary files /dev/null and b/nether/textures/nether_stick.png differ diff --git a/nether/textures/nether_sword_netherrack.png b/nether/textures/nether_sword_netherrack.png new file mode 100644 index 0000000..d0824e3 Binary files /dev/null and b/nether/textures/nether_sword_netherrack.png differ diff --git a/nether/textures/nether_sword_netherrack_blue.png b/nether/textures/nether_sword_netherrack_blue.png new file mode 100644 index 0000000..90a26ee Binary files /dev/null and b/nether/textures/nether_sword_netherrack_blue.png differ diff --git a/nether/textures/nether_sword_white.png b/nether/textures/nether_sword_white.png new file mode 100644 index 0000000..73f41f7 Binary files /dev/null and b/nether/textures/nether_sword_white.png differ diff --git a/nether/textures/nether_teleporter.png b/nether/textures/nether_teleporter.png new file mode 100644 index 0000000..eaac926 Binary files /dev/null and b/nether/textures/nether_teleporter.png differ diff --git a/nether/textures/nether_torch.png b/nether/textures/nether_torch.png index c57f323..317c880 100644 Binary files a/nether/textures/nether_torch.png and b/nether/textures/nether_torch.png differ diff --git a/nether/textures/nether_torch_on_ceiling.png b/nether/textures/nether_torch_on_ceiling.png index aa54c19..43cb69a 100644 Binary files a/nether/textures/nether_torch_on_ceiling.png and b/nether/textures/nether_torch_on_ceiling.png differ diff --git a/nether/textures/nether_torch_on_floor.png b/nether/textures/nether_torch_on_floor.png index 1875314..c5d5da0 100644 Binary files a/nether/textures/nether_torch_on_floor.png and b/nether/textures/nether_torch_on_floor.png differ diff --git a/nether/textures/nether_transparent.png b/nether/textures/nether_transparent.png new file mode 100644 index 0000000..d0ff224 Binary files /dev/null and b/nether/textures/nether_transparent.png differ diff --git a/nether/textures/nether_tree.png b/nether/textures/nether_tree.png index 0c4cd89..99101b3 100644 Binary files a/nether/textures/nether_tree.png and b/nether/textures/nether_tree.png differ diff --git a/nether/textures/nether_tree_corner.png b/nether/textures/nether_tree_corner.png new file mode 100644 index 0000000..4b79eb5 Binary files /dev/null and b/nether/textures/nether_tree_corner.png differ diff --git a/nether/textures/nether_tree_sapling.png b/nether/textures/nether_tree_sapling.png new file mode 100644 index 0000000..14686be Binary files /dev/null and b/nether/textures/nether_tree_sapling.png differ diff --git a/nether/textures/nether_tree_top.png b/nether/textures/nether_tree_top.png index eb82f06..f58589e 100644 Binary files a/nether/textures/nether_tree_top.png and b/nether/textures/nether_tree_top.png differ diff --git a/nether/textures/nether_vine.png b/nether/textures/nether_vine.png index bc7101d..a8a6632 100644 Binary files a/nether/textures/nether_vine.png and b/nether/textures/nether_vine.png differ diff --git a/nether/textures/nether_white.png b/nether/textures/nether_white.png new file mode 100644 index 0000000..47d412c Binary files /dev/null and b/nether/textures/nether_white.png differ diff --git a/nether/textures/nether_wood.png b/nether/textures/nether_wood.png new file mode 100644 index 0000000..8604e02 Binary files /dev/null and b/nether/textures/nether_wood.png differ diff --git a/nether/textures/nether_wood_cooked.png b/nether/textures/nether_wood_cooked.png new file mode 100644 index 0000000..761f1d6 Binary files /dev/null and b/nether/textures/nether_wood_cooked.png differ diff --git a/nether/textures/nether_wood_empty.png b/nether/textures/nether_wood_empty.png new file mode 100644 index 0000000..6c848d6 Binary files /dev/null and b/nether/textures/nether_wood_empty.png differ diff --git a/nether/textures/nether_wood_empty_normal.png b/nether/textures/nether_wood_empty_normal.png new file mode 100644 index 0000000..43628f5 Binary files /dev/null and b/nether/textures/nether_wood_empty_normal.png differ diff --git a/nether/weird_mapgen_noise.lua b/nether/weird_mapgen_noise.lua index 42540e3..4fa9bed 100644 --- a/nether/weird_mapgen_noise.lua +++ b/nether/weird_mapgen_noise.lua @@ -5,19 +5,20 @@ end local r_chs = {} -function nether_weird_noise(minp, fct, s, seed, range) +function nether_weird_noise(minp, fct, s, seed, range, scale) if not r_chs[s] then r_chs[s] = math.floor(s/3+0.5) end + scale = scale or 15 local r_ch = r_chs[s] - local maxp = vector.add(minp, 16) + local maxp = vector.add(minp, scale) local tab,n = {},1 local sm = range or (s+r_ch)*2 - for z = -sm, 16+sm do + for z = -sm, scale+sm do local pz = z+minp.z if pz%s == 0 then - for x = -sm, 16+sm do + for x = -sm, scale+sm do local px = x+minp.x if px%s == 0 then local pr = get_random(px, pz, seed) @@ -33,7 +34,6 @@ function nether_weird_noise(minp, fct, s, seed, range) for x = minp.x, maxp.x do local h = sm for _,i in ipairs(tab) do - --local dist = vector.distance(i, {x=x, y=0, z=z}) h = math.min(h, fct(x, i.x, z, i.z)) end tab2[n] = {x=x, y=maxp.y-h, z=z} @@ -45,10 +45,6 @@ end --[[ local function dif(z1, z2) - if z1 < 0 - and z2 < 0 then - z1,z2 = -z1,-z2 - end return math.abs(z1-z2) end @@ -68,7 +64,7 @@ minetest.register_node("ac:wmg", { description = "wmg", tiles = {"ac_block.png"}, groups = {snappy=1,bendy=2,cracky=1}, - sounds = default_stone_sounds, + sounds = default.node_sound_stone_defaults(), on_construct = function(pos) local minp = vector.chunkcorner(pos) for _,p in ipairs(weird_noise(minp, pymg, 20, 8, 4)) do