[nether] Update

- For #351
master
LeMagnesium 2015-12-30 17:54:04 +01:00
parent 8b2c49ad3a
commit 2e13a0d7ba
20 changed files with 171 additions and 122 deletions

2
LICENSE.txt Normal file
View File

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

21
README.md Normal file
View File

@ -0,0 +1,21 @@
[Mod] nether-pack [nether-pack]
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
Sadly lkjoel's one disappeared…
**Depends:** see [depends.txt](https://raw.githubusercontent.com/HybridDog/nether-pack/master/nether/depends.txt)
**License:** see [LICENSE.txt](https://raw.githubusercontent.com/HybridDog/nether-pack/master/LICENSE.txt)
**Download:** [zip](https://github.com/HybridDog/nether-pack/archive/master.zip), [tar.gz](https://github.com/HybridDog/nether-pack/tarball/master)
this happens really selden to me
![I'm a screenshot!](http://i.imgur.com/pMZYqt9.png)
If you got ideas or found bugs, please tell them to me.
[How to install a mod?](http://wiki.minetest.net/Installing_Mods)
TODO:
— find a way to get the perlin noise inside [-1; 1] or use another noise

View File

@ -1,11 +0,0 @@
This is a modified version of lkjoel's nether mod.
Look here if you want to see the differences:
https://github.com/HybridDog/minetest-nether/compare/lkjoel:master...master
this happens really selden to me
http://i.imgur.com/pMZYqt9.png
TODO:
— care about nether torches
— find a way to get the perlin noise inside [-1; 1] or use another noise

View File

@ -137,6 +137,14 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = "nether:torch",
recipe = {
{"nether:bark"},
{"group:stick"},
}
})
minetest.register_craft({
output = "nether:forest_wood",
recipe = {
@ -162,36 +170,38 @@ minetest.register_craft({
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)
if itemstack:get_name() ~= "nether:forest_planks"
or itemstack:get_count() ~= 7 then
return
end
local tree
for i = 1,9 do
if old_craft_grid[i]:get_name() == "nether:tree" then
tree = i
break
end
end
if not tree then -- do nth if theres no tree
return
end
local rdif = math.random(-1,1) -- add a bit randomness
local barkstack = ItemStack("nether:bark "..4-rdif)
local inv = player:get_inventory()
if not inv:room_for_item("main", barkstack) then -- disallow crafting if there's not enough free space
craft_inv:set_list("craft", old_craft_grid)
itemstack:set_name("")
return
end
itemstack:set_count(7+rdif)
inv:add_item("main", barkstack)
if not sound_allowed then -- avoid playing the sound multiple times, e.g. when middle mouse click
return
end
minetest.sound_play("default_wood_footstep", {pos=player:getpos(), gain=0.25})
sound_allowed = false
minetest.after(0, function()
sound_allowed = true
end)
end)
minetest.register_craft({

View File

@ -2,4 +2,5 @@ default
glow
riesenpilz
stairs
fence_registration?
watershed?

View File

@ -250,7 +250,7 @@ minetest.register_abm({
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)
@ -272,13 +272,13 @@ minetest.register_abm({
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)
@ -298,7 +298,7 @@ minetest.register_abm({
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)
@ -313,7 +313,7 @@ minetest.register_abm({
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
@ -339,7 +339,7 @@ minetest.register_abm({
meta:set_string("fuel_totaltime", fuel.time)
meta:set_string("fuel_time", 0)
inv:set_stack("fuel", 1, afterfuel.items[1])
end
end,

View File

@ -11,6 +11,8 @@
-- godkiller447 (ideas)
-- If I didn't list you, please let me know!
local load_time_start = os.clock()
if not rawget(_G, "nether") then
nether = {}
end
@ -1029,4 +1031,11 @@ dofile(path.."/crafting.lua")
dofile(path.."/portal.lua")
dofile(path.."/guide.lua")
nether:inform("loaded!", 1)
local time = math.floor(tonumber(os.clock()-load_time_start)*100+0.5)/100
local msg = "[nether] loaded after ca. "..time
if time > 0.05 then
minetest.log("warning", msg)
else
minetest.log("info", msg)
end

View File

@ -4,42 +4,52 @@ local nether_sound = default.node_sound_stone_defaults({
footstep = {name="nether_footstep", gain=0.4}
})
local function add_stair_and_slab(name)
local add_fence = minetest.register_fence
local function add_more_nodes(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
data.groups,
data.tiles,
data.description.." Stair",
data.description.." Slab",
data.sounds
)
if add_fence then
add_fence({fence_of = nd})
end
end
--[[
local function add_fence(name)
local def = minetest.registered_nodes[name]
local fencedef = {}
for _,i in pairs({"walkable", "sunlike_propagates"}) do
if def[i] ~= nil then
fencedef[i] = def[i]
end
end
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
if not tool
or not tool.tool_capabilities then
return false
end
local capabilities = tool.tool_capabilities
if not capabilities then
return false
end
local groups = capabilities.groupcaps
local groups = tool.tool_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
if groups.nether
and groups.nether.times[v] then
return true
end
return false
@ -55,7 +65,7 @@ minetest.register_node("nether:netherrack", {
return digging_allowed(player, 2)
end,
})
add_stair_and_slab("netherrack")
add_more_nodes("netherrack")
minetest.register_node("nether:netherrack_tiled", {
description = "Tiled Netherrack",
@ -66,7 +76,7 @@ minetest.register_node("nether:netherrack_tiled", {
return digging_allowed(player, 2)
end,
})
add_stair_and_slab("netherrack_tiled")
add_more_nodes("netherrack_tiled")
minetest.register_node("nether:netherrack_soil", {
description = "Dirty Netherrack",
@ -87,7 +97,7 @@ minetest.register_node("nether:netherrack_black", {
return digging_allowed(player, 2)
end,
})
add_stair_and_slab("netherrack_black")
add_more_nodes("netherrack_black")
minetest.register_node("nether:netherrack_blue", {
description = "Blue Netherrack",
@ -98,7 +108,7 @@ minetest.register_node("nether:netherrack_blue", {
return digging_allowed(player, 1)
end,
})
add_stair_and_slab("netherrack_blue")
add_more_nodes("netherrack_blue")
-- Netherbrick
minetest.register_node("nether:netherrack_brick", {
@ -110,7 +120,7 @@ minetest.register_node("nether:netherrack_brick", {
return digging_allowed(player, 3)
end,
})
add_stair_and_slab("netherrack_brick")
add_more_nodes("netherrack_brick")
minetest.register_node("nether:netherrack_brick_blue", {
description = "Blue Netherrack Brick",
@ -121,7 +131,7 @@ minetest.register_node("nether:netherrack_brick_blue", {
return digging_allowed(player, 3)
end,
})
add_stair_and_slab("netherrack_brick_blue")
add_more_nodes("netherrack_brick_blue")
minetest.register_node("nether:netherrack_brick_black", {
description = "Black Netherrack Brick",
@ -132,7 +142,7 @@ minetest.register_node("nether:netherrack_brick_black", {
return digging_allowed(player, 3)
end,
})
add_stair_and_slab("netherrack_brick_black")
add_more_nodes("netherrack_brick_black")
minetest.register_node("nether:white", {
description = "Siwtonic block",
@ -143,7 +153,7 @@ minetest.register_node("nether:white", {
return digging_allowed(player, 1)
end,
})
add_stair_and_slab("white")
add_more_nodes("white")
-- Nether blood
@ -169,7 +179,7 @@ minetest.register_node("nether:blood", {
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=1},
sounds = default.node_sound_wood_defaults(),
})
add_stair_and_slab("blood")
add_more_nodes("blood")
minetest.register_node("nether:blood_cooked", {
description = "Cooked Nether Blood",
@ -181,7 +191,7 @@ minetest.register_node("nether:blood_cooked", {
return digging_allowed(player, 3)
end,
})
add_stair_and_slab("blood_cooked")
add_more_nodes("blood_cooked")
minetest.register_node("nether:blood_empty", {
description = "Nether Blood Extracted",
@ -189,7 +199,7 @@ minetest.register_node("nether:blood_empty", {
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=1},
sounds = default.node_sound_wood_defaults(),
})
add_stair_and_slab("blood_empty")
add_more_nodes("blood_empty")
minetest.register_node("nether:blood_top", {
@ -198,7 +208,7 @@ minetest.register_node("nether:blood_top", {
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=1},
sounds = default.node_sound_wood_defaults(),
})
add_stair_and_slab("blood_top")
add_more_nodes("blood_top")
minetest.register_node("nether:blood_top_cooked", {
description = "Cooked Nether Blood Head",
@ -210,7 +220,7 @@ minetest.register_node("nether:blood_top_cooked", {
return digging_allowed(player, 3)
end,
})
add_stair_and_slab("blood_top_cooked")
add_more_nodes("blood_top_cooked")
minetest.register_node("nether:blood_top_empty", {
description = "Nether Blood Head Extracted",
@ -218,7 +228,7 @@ minetest.register_node("nether:blood_top_empty", {
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=1},
sounds = default.node_sound_wood_defaults(),
})
add_stair_and_slab("blood_top_empty")
add_more_nodes("blood_top_empty")
minetest.register_node("nether:blood_stem", {
@ -227,7 +237,7 @@ minetest.register_node("nether:blood_stem", {
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=1},
sounds = default.node_sound_wood_defaults(),
})
add_stair_and_slab("blood_stem")
add_more_nodes("blood_stem")
minetest.register_node("nether:blood_stem_cooked", {
description = "Cooked Nether Blood Stem",
@ -239,7 +249,7 @@ minetest.register_node("nether:blood_stem_cooked", {
return digging_allowed(player, 3)
end,
})
add_stair_and_slab("blood_stem_cooked")
add_more_nodes("blood_stem_cooked")
minetest.register_node("nether:blood_stem_empty", {
description = "Nether Blood Stem Extracted",
@ -247,7 +257,7 @@ minetest.register_node("nether:blood_stem_empty", {
groups = {tree=1, choppy=2, oddly_breakable_by_hand=1},
sounds = default.node_sound_wood_defaults(),
})
add_stair_and_slab("blood_stem_empty")
add_more_nodes("blood_stem_empty")
minetest.register_node("nether:wood", {
@ -256,7 +266,7 @@ minetest.register_node("nether:wood", {
groups = {choppy=2, oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(),
})
add_stair_and_slab("wood")
add_more_nodes("wood")
minetest.register_node("nether:wood_cooked", {
description = "Cooked Nether Blood Wood",
@ -268,7 +278,7 @@ minetest.register_node("nether:wood_cooked", {
return digging_allowed(player, 3)
end,
})
add_stair_and_slab("wood_cooked")
add_more_nodes("wood_cooked")
minetest.register_node("nether:wood_empty", {
description = "Nether Wood",
@ -276,7 +286,7 @@ minetest.register_node("nether:wood_empty", {
groups = {choppy=2, oddly_breakable_by_hand=2, wood=1},
sounds = default.node_sound_wood_defaults(),
})
add_stair_and_slab("wood_empty")
add_more_nodes("wood_empty")
minetest.register_node("nether:extractor", {
description = "Nether Blood Extractor",
@ -296,7 +306,7 @@ minetest.register_node("nether:fruit_leaves", {
sounds = default.node_sound_defaults(),
furnace_burntime = 18,
})
add_stair_and_slab("fruit_leaves")
add_more_nodes("fruit_leaves")
local function room_for_items(inv)
local free_slots = 0
@ -518,7 +528,7 @@ minetest.register_node("nether:forest_wood", {
groups = {choppy=2,oddly_breakable_by_hand=2,wood=1},
sounds = default.node_sound_wood_defaults(),
})
add_stair_and_slab("forest_wood")
add_more_nodes("forest_wood")
minetest.register_node("nether:leaves", {
description = "Nether Leaves",
@ -555,7 +565,9 @@ minetest.register_node("nether:dirt", {
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"},
tiles = {"nether_dirt_top.png", "nether_dirt.png",
{name="nether_dirt.png^nether_dirt_top_side.png", tileable_vertical = false}
},
groups = {crumbly=3,soil=1,nether_dirt=1},
drop = "nether:dirt",
sounds = default.node_sound_dirt_defaults({
@ -565,7 +577,9 @@ minetest.register_node("nether:dirt_top", {
minetest.register_node("nether:dirt_bottom", {
description = "Netherrack Dirt Transition",
tiles = {"nether_dirt.png", "nether_netherrack.png", "nether_netherrack.png^nether_dirt_transition.png"},
tiles = {"nether_dirt.png", "nether_netherrack.png",
{name="nether_netherrack.png^nether_dirt_transition.png", tileable_vertical = false}
},
groups = {nether=2},
drop = "nether:netherrack",
sounds = default.node_sound_dirt_defaults({
@ -606,7 +620,7 @@ minetest.register_node("nether:torch", {
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},
groups = {choppy=2, dig_immediate=3, attached_node=1, hot=3, igniter=1},
legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
})

View File

@ -37,7 +37,7 @@ local function save_nether_players()
end
local update_background
if damage_enabled then
--if damage_enabled then
function update_background(player, down)
if down then
player:set_sky({r=15, g=0, b=0}, "plain")
@ -45,11 +45,11 @@ if damage_enabled then
player:set_sky(nil, "regular")
end
end
else
function update_background()end
end
--else
-- function update_background()end
--end
local function player_to_nether(player, safe)
function nether.player_to_nether(player, safe)
local pname = player:get_player_name()
if table.icontains(players_in_nether, pname) then
return
@ -63,7 +63,7 @@ local function player_to_nether(player, safe)
update_background(player, true)
end
local function player_from_nether(player)
function nether.player_from_nether(player)
local pname = player:get_player_name()
local changes
for n,i in ipairs(players_in_nether) do
@ -79,7 +79,7 @@ local function player_from_nether(player)
end
if damage_enabled then
--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
@ -93,50 +93,38 @@ end
-- Chatcommands removed
--[[ Chatcommands (edited) written by sss
minetest.register_chatcommand("to_hell", {
params = "",
params = "[<player_name>]",
description = "Send someone to hell",
func = function(name, pname)
if not minetest.get_player_privs(name).nether then
local self_player = minetest.get_player_by_name(name)
if self_player then
return false, "You can't send anyone to hell."
else
return false, "Something went wrong."
end
if not minetest.check_player_privs(name, {nether=true}) then
return false, "You need the nether priv to execute this chatcommand."
end
if not player_exists(pname) then
pname = name
end
local player = minetest.get_player_by_name(pname)
if not player then
minetest.chat_send_player(name, "Something went wrong.")
return false
return false, "Something went wrong."
end
minetest.chat_send_player(pname, "Go to hell !!!")
player_to_nether(player)
return true
return true, pname.." is now in the nether."
end
})
minetest.register_chatcommand("from_hell", {
params = "",
params = "[<player_name>]",
description = "Extract from hell",
func = function(name, pname)
if not minetest.get_player_privs(name).nether then
local self_player = minetest.get_player_by_name(name)
if self_player then
return false, "You can't extract anyone from hell"
else
return false, "Something went wrong."
end
if not minetest.check_player_privs(name, {nether=true}) then
return false, "You need the nether priv to execute this chatcommand."
end
if not player_exists(pname) then
pname = name
end
local player = minetest.get_player_by_name(pname)
if not player then
minetest.chat_send_player(name, "Something went wrong.")
return false
return false, "Something went wrong."
end
minetest.chat_send_player(pname, "You are free now")
player_from_nether(player)
@ -220,6 +208,7 @@ minetest.register_abm({
nodenames = {"nether:portal"},
interval = 1,
chance = 2,
catch_up = false,
action = function(pos, node)
if not abm_allowed then
return
@ -259,7 +248,7 @@ minetest.register_abm({
remove_portal_essence(pos)
minetest.sound_play("nether_portal_usual", {to_player=pname, gain=1})
player_to_nether(obj)
nether.player_to_nether(obj)
--obj:setpos(target)
end, obj, pos, target)
@ -458,7 +447,7 @@ minetest.after(0.1, function()
end
})
end)
end
--end
vector.square = vector.square or
@ -520,11 +509,22 @@ local function netherport(pos)
return true
end
-- cache known portals
local known_portals_d = {}
local known_portals_u = {}
local function get_portal(t, z,x)
return t[z] and t[z][x]
end
local function set_portal(t, z,x, y)
t[z] = t[z] or {}
t[z][x] = y
end
function nether_port(player, pos)
if not player
or not pos
or not pos.x then
print("[nether] something failed.")
minetest.log("error", "[nether] nether_port: something failed.")
return
end
if not netherport(pos) then
@ -533,7 +533,7 @@ function nether_port(player, pos)
minetest.sound_play("nether_teleporter", {to_player=player:get_player_name()}) --MFF crabman (5/09/2015) fix positional sound don't work to player
minetest.sound_play("nether_teleporter", {pos=pos})
if pos.y < nether.start then
player_from_nether(player)
nether.player_from_nether(player)
local pos_togo = {x = 0, y = 35, z = -7}
if minetest.setting_getbool("static_spawnpoint") ~= nil then
local stsp_conf = minetest.setting_get("static_spawnpoint")
@ -541,8 +541,11 @@ function nether_port(player, pos)
end
player:moveto(pos_togo)
else
player:moveto({x=pos.x, y=portal_target+math.random(4), z=pos.z})
set_portal(known_portals_u, pos.z,pos.x, pos.y)
pos.y = get_portal(known_portals_d, pos.z,pos.x) or portal_target+math.random(4)
player:moveto(pos)
player_to_nether(player, true)
end
minetest.sound_play("nether_teleporter", {pos=pos})
return true
end

0
nether/rest/Nicht Leere Datei.lua Executable file → Normal file
View File

BIN
nether/rest/nether_fruit_leaves.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 621 B

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
nether/rest/nether_glowstone.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

BIN
nether/rest/nether_leaves.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

After

Width:  |  Height:  |  Size: 319 B

BIN
nether/rest/nether_leaves_decision/nether_leaves.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 427 B

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

After

Width:  |  Height:  |  Size: 572 B

BIN
nether/rest/nether_netherrack.png1 Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
nether/rest/nether_portal_creator.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 687 B

After

Width:  |  Height:  |  Size: 762 B

BIN
nether/rest/nether_tree.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 574 B

BIN
nether/rest/nether_tree_top.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 468 B

After

Width:  |  Height:  |  Size: 612 B

0
nether/rest/temp.txt Executable file → Normal file
View File