46 Commits

Author SHA1 Message Date
dbcd72aa25 try html formspec:
problems:
* image width and height doesn't seem to work
* font is too small
2022-08-19 11:18:17 +02:00
817efcdd29 Add settingtypes.txt to configure player trapping and message logging
There are also some changes to fix problems when trapping is enabled while damage is disabled or the other way round.
2022-08-16 17:25:41 +02:00
6507e43dc5 Do not ignore the portal code if damage is enabled and the "nether_players" file does not exist
I have accidentally introduced the bug in commit 4a7dd247e7.
It was discovered thanks to the people who reported it on the Minetest forum.
2022-08-15 15:47:16 +02:00
27bf94c4d0 Fix portal player y pos being off by 1 node sometimes 2022-07-26 17:52:25 +02:00
27be1dd740 Mention the problematic guide in the Readme 2021-12-22 19:07:12 +01:00
c35d18a519 Fix some deprecation warnings 2021-12-22 18:46:56 +01:00
fb1eca6c11 Add .luacheckrc and do some code fixes 2021-12-22 18:46:52 +01:00
be64a982f8 Remove the invisible folder 2021-12-22 17:53:32 +01:00
56f5909e0f Relicense; WTFPL allows it 2021-12-22 17:45:59 +01:00
7cdd0471a2 depends.txt -> mod.conf 2021-12-22 17:44:27 +01:00
b876d8f2b9 Move the mod description to the forum to reduce duplicate text 2021-12-22 17:39:40 +01:00
870b6a9d47 Fix nether leaves visual_scale
Also, update README
2019-03-10 12:35:51 +01:00
0d4a302103 fix creative dig 2018-09-10 00:10:11 +02:00
fadf202663 Fix object teleportation from and to nether 2018-08-18 20:00:40 +02:00
df2d49edb0 Override player:set_pos etc. to disallow teleports from/to nether
constantly testing the player position is not longer necessary.
2018-08-15 19:52:39 +02:00
4a7dd247e7 Do not use players_in_nether as list but hashmap
Also, comment broken function
2018-08-15 17:31:15 +02:00
2f3522598c portal.lua: Fix some 80 char line breaks 2018-08-15 16:57:23 +02:00
020ab700ff Fix get_node vs get_node_or_nil usage 2018-08-15 16:52:04 +02:00
5925dc5606 mapgen: Use buffers for memory usage optimisation 2018-03-18 18:39:44 +01:00
6e2ffa04ea guide: fix portal indrigents 2017-12-31 22:02:22 +01:00
8a3d0b0634 Update debug messages 2017-12-26 09:58:32 +01:00
2ce9440fdf Use the light update parameter of write_to_map instead of the obsolete update_map (vmanip)
And use minetest.fix_light instead of a custom function (surprisingly it didn't cause a noticeable performance difference)
Also, a few code style changes
2017-12-26 09:39:17 +01:00
12dc8ae004 Fix code style
I've also made a few other changes:
Use minetest.pos_to_string instead of manually creating the string
Do not use table_contains to test if a node id belongs to a nether tree, instead use lua table hashmap behaviour
2017-12-26 09:19:11 +01:00
69b3e65c85 Fix missing unknown node test in grass_allowed 2017-12-26 08:40:18 +01:00
0a2dbbb0f8 Fix small stuff (thanks to warnings from luacheck) 2017-12-25 21:23:34 +01:00
6019bbce66 Do not use old vector_extras functions 2017-12-25 21:22:32 +01:00
acdf694356 Fixes https://github.com/HybridDog/nether-pack/issues/6
```
Use:
local tab = minetest.wrap_text(content, guide_size.fx, true)
Needs 3rd argument 'true' to ensure 'tab' is a table.
See 649eef9e4f/builtin/common/misc_helpers.lua (L311)
```
2017-12-25 20:48:41 +01:00
DS
d32ede7e8a make netherrack and co. digable with creative hand 2017-07-08 14:26:15 +02:00
e8a666f34e replace deprecated setting methods 2017-07-05 18:52:46 +02:00
DS
a7da195aa1 fix a crash caused by the none existing minetest.splittext function
It was replaced with minetest.wrap_text. Hopefully that won't make problems.
2017-07-05 18:38:38 +02:00
afb77f0a1d Update README.md 2017-02-03 23:19:10 +01:00
c33e306849 reduce index calculations (untested)
M  nether/init.lua
2016-09-15 11:57:06 +02:00
dac86dae07 🐈
M  modpack.txt
2016-08-08 15:51:58 +02:00
6d92487f20 🐈 2016-05-26 12:17:06 +02:00
578919c469 fix old newbie mistake 2016-05-04 18:42:45 +02:00
03da51be24 add support to the function delayer mod 2016-05-04 18:36:22 +02:00
b2dd95eb50 Don't use globalsteps 2016-05-04 18:32:17 +02:00
99eceb10eb assume player:getpos always returns a vector
remove patch file
2016-05-04 18:27:36 +02:00
2a3e553b9c fix crash nether if player cancel join server "/nether/portal.lua:243: attempt to index a nil value" 2016-05-04 18:24:57 +02:00
0e9bdc48b2 fix unknow item default:coal 2016-05-04 18:21:40 +02:00
501ce57e59 update readme 2016-05-04 18:18:04 +02:00
3ba23a4c88 New nether guide Much better formspecs based on original code Reworked many sentences 2016-05-04 18:11:02 +02:00
780b95bfbc further optimazion of ws func 2016-05-04 17:43:37 +02:00
f3cec2fe06 🐈 2016-03-10 20:47:16 +01:00
06099dcec3 🐈 2016-02-06 12:04:17 +01:00
b5807be921 use functions from vector_extras which should improve speed 2016-01-10 13:42:16 +01:00
27 changed files with 733 additions and 1107 deletions

View File

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

View File

@ -1,22 +1,15 @@
[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)
For a description of this Minetest mod, please refer to the forum topic:
https://forum.minetest.net/viewtopic.php?f=9&t=10265
TODO:
— find a way to get the perlin noise inside [-1; 1] or use another noise
— add something containing items to that buildings
TODO:
* Find a way to get the perlin noise inside [-1; 1] or use another noise
* Add some node which containing items to the simple pyramid "buildings"
* Change the sky background, fog, etc. in the nether
* Improve the guide formspec.
Writing it in Markdown would be nice.
These could be useful:
* https://forum.minetest.net/viewtopic.php?t=23855
Minetest Bedrock Markup Language
* https://github.com/mpeterv/markdown
Markdown to HTML converter; Minetest formspecs support HTML

View File

@ -0,0 +1 @@
0

View File

@ -1,365 +0,0 @@
--[[ Nether leaves
minetest.register_node("nether:leaves", {
description = "Nether Leaves",
drawtype = "allfaces_optional",
-- visual_scale = 1.189, --scale^2=sqrt(2)
tiles = {"nether_leaves.png"},
paramtype = "light",
groups = {snappy=3, leafdecay=2},
sounds = default.node_sound_leaves_defaults(),
})]]
--[[ Nether Lava
minetest.register_node("nether:lava_flowing", {
description = "Nether Lava (flowing)",
inventory_image = minetest.inventorycube("default_lava.png"),
drawtype = "flowingliquid",
tiles = {"default_lava.png"},
paramtype = "light",
light_source = LIGHT_MAX - 1,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
liquidtype = "flowing",
liquid_alternative_flowing = "nether:lava_flowing",
liquid_alternative_source = "default:lava_source",
liquid_viscosity = LAVA_VISC,
damage_per_second = 4*2,
post_effect_color = {a=192, r=255, g=64, b=0},
special_materials = {
{image="default_lava.png", backface_culling=false},
{image="default_lava.png", backface_culling=true},
},
groups = {lava=3, liquid=2, hot=3},
})
minetest.register_node("nether:lava_source", {
description = "Nether Lava",
inventory_image = minetest.inventorycube("default_lava.png"),
drawtype = "liquid",
tiles = {"default_lava.png"},
paramtype = "light",
light_source = LIGHT_MAX - 1,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
liquidtype = "source",
liquid_alternative_flowing = "nether:lava_flowing",
liquid_alternative_source = "default:lava_source",
liquid_viscosity = LAVA_VISC,
damage_per_second = 4*2,
post_effect_color = {a=192, r=255, g=64, b=0},
special_materials = {
-- New-style lava source material (mostly unused)
{image="default_lava.png", backface_culling=false},
},
groups = {lava=3, liquid=2, hot=3},
})]]
-- Throne of Hades
HADES_THRONE = {
-- Lava Moat
{pos={x=-1,y=-1,z=-1}, block="default:lava_source"},
{pos={x=-1,y=-1,z=0}, block="default:lava_source"},
{pos={x=-1,y=-1,z=1}, block="default:lava_source"},
{pos={x=-1,y=-1,z=2}, block="default:lava_source"},
{pos={x=-1,y=-1,z=3}, block="default:lava_source"},
{pos={x=-1,y=-1,z=4}, block="default:lava_source"},
{pos={x=-1,y=-1,z=5}, block="default:lava_source"},
{pos={x=-1,y=-1,z=6}, block="default:lava_source"},
{pos={x=-1,y=-1,z=7}, block="default:lava_source"},
{pos={x=0,y=-1,z=7}, block="default:lava_source"},
{pos={x=1,y=-1,z=7}, block="default:lava_source"},
{pos={x=2,y=-1,z=7}, block="default:lava_source"},
{pos={x=3,y=-1,z=7}, block="default:lava_source"},
{pos={x=4,y=-1,z=7}, block="default:lava_source"},
{pos={x=5,y=-1,z=7}, block="default:lava_source"},
{pos={x=6,y=-1,z=7}, block="default:lava_source"},
{pos={x=6,y=-1,z=6}, block="default:lava_source"},
{pos={x=6,y=-1,z=5}, block="default:lava_source"},
{pos={x=6,y=-1,z=4}, block="default:lava_source"},
{pos={x=6,y=-1,z=3}, block="default:lava_source"},
{pos={x=6,y=-1,z=2}, block="default:lava_source"},
{pos={x=6,y=-1,z=1}, block="default:lava_source"},
{pos={x=6,y=-1,z=0}, block="default:lava_source"},
{pos={x=6,y=-1,z=-1}, block="default:lava_source"},
{pos={x=5,y=-1,z=-1}, block="default:lava_source"},
{pos={x=4,y=-1,z=-1}, block="default:lava_source"},
{pos={x=3,y=-1,z=-1}, block="default:lava_source"},
{pos={x=2,y=-1,z=-1}, block="default:lava_source"},
{pos={x=1,y=-1,z=-1}, block="default:lava_source"},
{pos={x=0,y=-1,z=-1}, block="default:lava_source"},
-- Floor 1
{pos={x=0,y=0,z=0}, block="nether:netherrack"},
{pos={x=0,y=0,z=1}, block="nether:netherrack"},
{pos={x=0,y=0,z=2}, block="nether:netherrack"},
{pos={x=0,y=0,z=3}, block="nether:netherrack"},
{pos={x=0,y=0,z=4}, block="nether:netherrack"},
{pos={x=0,y=0,z=5}, block="nether:netherrack"},
{pos={x=1,y=0,z=5}, block="nether:netherrack"},
{pos={x=2,y=0,z=5}, block="nether:netherrack"},
{pos={x=3,y=0,z=5}, block="nether:netherrack"},
{pos={x=4,y=0,z=5}, block="nether:netherrack"},
{pos={x=5,y=0,z=5}, block="nether:netherrack"},
{pos={x=0,y=0,z=6}, block="nether:netherrack"},
{pos={x=1,y=0,z=6}, block="nether:netherrack"},
{pos={x=2,y=0,z=6}, block="nether:netherrack"},
{pos={x=3,y=0,z=6}, block="nether:netherrack"},
{pos={x=4,y=0,z=6}, block="nether:netherrack"},
{pos={x=5,y=0,z=6}, block="nether:netherrack"},
{pos={x=5,y=0,z=4}, block="nether:netherrack"},
{pos={x=5,y=0,z=3}, block="nether:netherrack"},
{pos={x=5,y=0,z=2}, block="nether:netherrack"},
{pos={x=5,y=0,z=1}, block="nether:netherrack"},
{pos={x=5,y=0,z=0}, block="nether:netherrack"},
{pos={x=4,y=0,z=0}, block="nether:netherrack"},
{pos={x=3,y=0,z=0}, block="nether:netherrack"},
{pos={x=2,y=0,z=0}, block="nether:netherrack"},
{pos={x=1,y=0,z=0}, block="nether:netherrack"},
-- Floor 2
{pos={x=0,y=1,z=0}, block="nether:netherrack"},
{pos={x=0,y=1,z=1}, block="nether:netherrack"},
{pos={x=0,y=1,z=2}, block="nether:netherrack"},
{pos={x=0,y=1,z=3}, block="nether:netherrack"},
{pos={x=0,y=1,z=4}, block="nether:netherrack"},
{pos={x=0,y=1,z=5}, block="nether:netherrack"},
{pos={x=1,y=1,z=5}, block="nether:netherrack"},
{pos={x=2,y=1,z=5}, block="nether:netherrack"},
{pos={x=3,y=1,z=5}, block="nether:netherrack"},
{pos={x=4,y=1,z=5}, block="nether:netherrack"},
{pos={x=5,y=1,z=5}, block="nether:netherrack"},
{pos={x=0,y=1,z=6}, block="nether:netherrack"},
{pos={x=1,y=1,z=6}, block="nether:netherrack"},
{pos={x=2,y=1,z=6}, block="nether:netherrack"},
{pos={x=3,y=1,z=6}, block="nether:netherrack"},
{pos={x=4,y=1,z=6}, block="nether:netherrack"},
{pos={x=5,y=1,z=6}, block="nether:netherrack"},
{pos={x=5,y=1,z=4}, block="nether:netherrack"},
{pos={x=5,y=1,z=3}, block="nether:netherrack"},
{pos={x=5,y=1,z=2}, block="nether:netherrack"},
{pos={x=5,y=1,z=1}, block="nether:netherrack"},
{pos={x=5,y=1,z=0}, block="nether:netherrack"},
{pos={x=4,y=1,z=0}, block="nether:netherrack"},
{pos={x=3,y=1,z=1}, block="nether:netherrack"},
{pos={x=2,y=1,z=1}, block="nether:netherrack"},
{pos={x=1,y=1,z=0}, block="nether:netherrack"},
{pos={x=1,y=1,z=1}, block="nether:netherrack"},
{pos={x=4,y=1,z=1}, block="nether:netherrack"},
-- Floor 3
{pos={x=0,y=2,z=0}, block="nether:netherrack"},
{pos={x=0,y=2,z=1}, block="nether:netherrack"},
{pos={x=0,y=2,z=2}, block="nether:netherrack"},
{pos={x=0,y=2,z=3}, block="nether:netherrack"},
{pos={x=0,y=2,z=4}, block="nether:netherrack"},
{pos={x=0,y=2,z=5}, block="nether:netherrack"},
{pos={x=1,y=2,z=5}, block="nether:netherrack"},
{pos={x=2,y=2,z=5}, block="nether:netherrack"},
{pos={x=3,y=2,z=5}, block="nether:netherrack"},
{pos={x=4,y=2,z=5}, block="nether:netherrack"},
{pos={x=5,y=2,z=5}, block="nether:netherrack"},
{pos={x=0,y=2,z=6}, block="nether:netherrack"},
{pos={x=1,y=2,z=6}, block="nether:netherrack"},
{pos={x=2,y=2,z=6}, block="nether:netherrack"},
{pos={x=3,y=2,z=6}, block="nether:netherrack"},
{pos={x=4,y=2,z=6}, block="nether:netherrack"},
{pos={x=5,y=2,z=6}, block="nether:netherrack"},
{pos={x=5,y=2,z=4}, block="nether:netherrack"},
{pos={x=5,y=2,z=3}, block="nether:netherrack"},
{pos={x=5,y=2,z=2}, block="nether:netherrack"},
{pos={x=5,y=2,z=1}, block="nether:netherrack"},
{pos={x=5,y=2,z=0}, block="nether:netherrack"},
{pos={x=4,y=2,z=0}, block="nether:netherrack"},
{pos={x=3,y=2,z=2}, block="nether:netherrack"},
{pos={x=2,y=2,z=2}, block="nether:netherrack"},
{pos={x=1,y=2,z=0}, block="nether:netherrack"},
{pos={x=1,y=2,z=1}, block="nether:netherrack"},
{pos={x=4,y=2,z=1}, block="nether:netherrack"},
{pos={x=1,y=2,z=2}, block="nether:netherrack"},
{pos={x=4,y=2,z=2}, block="nether:netherrack"},
-- Floor 4
{pos={x=0,y=3,z=0}, block="nether:netherrack"},
{pos={x=0,y=3,z=1}, block="nether:netherrack"},
{pos={x=0,y=3,z=2}, block="nether:netherrack"},
{pos={x=0,y=3,z=3}, block="nether:netherrack"},
{pos={x=0,y=3,z=4}, block="nether:netherrack"},
{pos={x=0,y=3,z=5}, block="nether:netherrack"},
{pos={x=1,y=3,z=5}, block="nether:netherrack"},
{pos={x=2,y=3,z=5}, block="nether:netherrack"},
{pos={x=3,y=3,z=5}, block="nether:netherrack"},
{pos={x=4,y=3,z=5}, block="nether:netherrack"},
{pos={x=5,y=3,z=5}, block="nether:netherrack"},
{pos={x=0,y=3,z=6}, block="nether:netherrack"},
{pos={x=1,y=3,z=6}, block="nether:netherrack"},
{pos={x=2,y=3,z=6}, block="nether:netherrack"},
{pos={x=3,y=3,z=6}, block="nether:netherrack"},
{pos={x=4,y=3,z=6}, block="nether:netherrack"},
{pos={x=5,y=3,z=6}, block="nether:netherrack"},
{pos={x=5,y=3,z=4}, block="nether:netherrack"},
{pos={x=5,y=3,z=3}, block="nether:netherrack"},
{pos={x=5,y=3,z=2}, block="nether:netherrack"},
{pos={x=5,y=3,z=1}, block="nether:netherrack"},
{pos={x=5,y=3,z=0}, block="nether:netherrack"},
{pos={x=4,y=3,z=0}, block="nether:netherrack"},
{pos={x=3,y=3,z=3}, block="nether:netherrack"},
{pos={x=2,y=3,z=3}, block="nether:netherrack"},
{pos={x=1,y=3,z=0}, block="nether:netherrack"},
{pos={x=1,y=3,z=1}, block="nether:netherrack"},
{pos={x=4,y=3,z=1}, block="nether:netherrack"},
{pos={x=1,y=3,z=2}, block="nether:netherrack"},
{pos={x=4,y=3,z=2}, block="nether:netherrack"},
{pos={x=1,y=3,z=3}, block="nether:netherrack"},
{pos={x=4,y=3,z=3}, block="nether:netherrack"},
{pos={x=1,y=3,z=4}, block="nether:netherrack"},
{pos={x=4,y=3,z=4}, block="nether:netherrack"},
{pos={x=2,y=3,z=4}, block="nether:netherrack"},
{pos={x=2,y=3,z=5}, block="nether:netherrack"},
{pos={x=3,y=3,z=4}, block="nether:netherrack"},
{pos={x=3,y=3,z=5}, block="nether:netherrack"},
-- Floor 5
{pos={x=2,y=4,z=4}, block="nether:netherrack"},
{pos={x=2,y=4,z=5}, block="nether:netherrack"},
{pos={x=3,y=4,z=4}, block="nether:netherrack"},
{pos={x=3,y=4,z=5}, block="nether:netherrack"},
{pos={x=2,y=4,z=6}, block="nether:netherrack"},
{pos={x=3,y=4,z=6}, block="nether:netherrack"},
-- Torches on floor 5
{pos={x=0,y=4,z=4}, block="nether:torch_bottom"},
{pos={x=1,y=4,z=4}, block="nether:torch_bottom"},
{pos={x=0,y=4,z=5}, block="nether:torch_bottom"},
{pos={x=1,y=4,z=5}, block="nether:torch_bottom"},
{pos={x=4,y=4,z=4}, block="nether:torch_bottom"},
{pos={x=5,y=4,z=4}, block="nether:torch_bottom"},
{pos={x=4,y=4,z=5}, block="nether:torch_bottom"},
{pos={x=5,y=4,z=5}, block="nether:torch_bottom"},
{pos={x=0,y=4,z=0}, block="nether:torch_bottom"},
{pos={x=1,y=4,z=0}, block="nether:torch_bottom"},
{pos={x=0,y=4,z=1}, block="nether:torch_bottom"},
{pos={x=1,y=4,z=1}, block="nether:torch_bottom"},
{pos={x=4,y=4,z=0}, block="nether:torch_bottom"},
{pos={x=5,y=4,z=0}, block="nether:torch_bottom"},
{pos={x=4,y=4,z=1}, block="nether:torch_bottom"},
{pos={x=5,y=4,z=1}, block="nether:torch_bottom"},
{pos={x=0,y=4,z=2}, block="nether:torch_bottom"},
{pos={x=1,y=4,z=2}, block="nether:torch_bottom"},
{pos={x=0,y=4,z=3}, block="nether:torch_bottom"},
{pos={x=1,y=4,z=3}, block="nether:torch_bottom"},
{pos={x=4,y=4,z=2}, block="nether:torch_bottom"},
{pos={x=5,y=4,z=2}, block="nether:torch_bottom"},
{pos={x=4,y=4,z=3}, block="nether:torch_bottom"},
{pos={x=5,y=4,z=3}, block="nether:torch_bottom"},
{pos={x=4,y=4,z=6}, block="nether:torch_bottom"},
{pos={x=5,y=4,z=6}, block="nether:torch_bottom"},
{pos={x=0,y=4,z=6}, block="nether:torch_bottom"},
{pos={x=1,y=4,z=6}, block="nether:torch_bottom"},
-- Nether Portal
{pos={x=1,y=5,z=6}, portalblock=true},
}
minetest.register_on_generated(function(minp, maxp, seed)
if minp.y <= 99 then
return
end
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local data = vm:get_data()
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
local perlin1 = minetest.get_perlin(13,3, 0.5, 50) --Get map specific perlin
local perlin2 = minetest.get_perlin(133,3, 0.5, 10)
for x=minp.x, maxp.x, 1 do
for z=minp.z, maxp.z, 1 do
local test = perlin1:get2d({x=x, y=z})+1
local test2 = perlin2:get2d({x=x, y=z})
-- print(test)
if test2 < 0 then
h = 200+math.floor(test2*3+0.5)
else
h = 203+math.floor(test*3+0.5)
end
for y=minp.y, maxp.y, 1 do
p_addpos = area:index(x, y, z)
if y <= h then
data[p_addpos] = c_netherrack
elseif y <= 201 then
data[p_addpos] = c_lava
end
end
end
end
vm:set_data(data)
--vm:set_lighting({day=0, night=0})
vm:calc_lighting()
vm:update_liquids()
vm:write_to_map()
end)
We don't want the Throne of Hades to get regenerated (especially since it will screw up portals)
if (minp.x <= HADES_THRONE_STARTPOS_ABS.x)
and (maxp.x >= HADES_THRONE_STARTPOS_ABS.x)
and (minp.y <= HADES_THRONE_STARTPOS_ABS.y)
and (maxp.y >= HADES_THRONE_STARTPOS_ABS.y)
and (minp.z <= HADES_THRONE_STARTPOS_ABS.z)
and (maxp.z >= HADES_THRONE_STARTPOS_ABS.z)
and (nether:fileexists(HADES_THRONE_GENERATED) == false) then
-- Pass 3: Make way for the Throne of Hades!
for x=(HADES_THRONE_STARTPOS_ABS.x - 1), (HADES_THRONE_ENDPOS_ABS.x + 1), 1 do
for z=(HADES_THRONE_STARTPOS_ABS.z - 1), (HADES_THRONE_ENDPOS_ABS.z + 1), 1 do
-- Notice I did not put a -1 for the beginning. This is because we don't want the throne to float
for y=HADES_THRONE_STARTPOS_ABS.y, (HADES_THRONE_ENDPOS_ABS.y + 1), 1 do
addpos = {x=x, y=y, z=z}
minetest.add_node(addpos, {name="air"})
end
end
end
-- Pass 4: Throne of Hades
for i,v in ipairs(HADES_THRONE_ABS) do
if v.portalblock == true then
NETHER_PORTALS_FROM_NETHER[table.getn(NETHER_PORTALS_FROM_NETHER)+1] = v.pos
nether:save_portal_from_nether(v.pos)
nether:createportal(v.pos)
else
minetest.add_node(v.pos, {name=v.block})
end
end
nether:touch(HADES_THRONE_GENERATED)
end
--[[ Create a nether tree
function nether:grow_nethertree(pos)
--TRUNK
pos.y=pos.y+1
local trunkpos={x=pos.x, z=pos.z}
for y=pos.y, pos.y+4+math.random(2) do
trunkpos.y=y
minetest.add_node(trunkpos, {name="nether:tree"})
end
--LEAVES
local leafpos={}
for x=(trunkpos.x-NETHER_TREESIZE), (trunkpos.x+NETHER_TREESIZE), 1 do
for y=(trunkpos.y-NETHER_TREESIZE), (trunkpos.y+NETHER_TREESIZE), 1 do
for z=(trunkpos.z-NETHER_TREESIZE), (trunkpos.z+NETHER_TREESIZE), 1 do
if (x-trunkpos.x)*(x-trunkpos.x)
+(y-trunkpos.y)*(y-trunkpos.y)
+(z-trunkpos.z)*(z-trunkpos.z)
<= NETHER_TREESIZE*NETHER_TREESIZE + NETHER_TREESIZE then
leafpos={x=x, y=y, z=z}
if minetest.get_node(leafpos).name=="air" then
if math.random(NETHER_APPLE_FREQ) == 1 then
if math.random(NETHER_HEAL_APPLE_FREQ) == 1 then
minetest.add_node(leafpos, {name="default:apple"})
else
minetest.add_node(leafpos, {name="nether:apple"})
end
else
minetest.add_node(leafpos, {name="nether:leaves"})
end
end
end
end
end
end
end]]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 612 B

View File

@ -1,166 +0,0 @@
-- Floor 1
{pos={x=0,y=0,z=0}, block="nether:netherrack"},
{pos={x=0,y=0,z=1}, block="nether:netherrack"},
{pos={x=0,y=0,z=2}, block="nether:netherrack"},
{pos={x=0,y=0,z=3}, block="nether:netherrack"},
{pos={x=0,y=0,z=4}, block="nether:netherrack"},
{pos={x=0,y=0,z=5}, block="nether:netherrack"},
{pos={x=1,y=0,z=5}, block="nether:netherrack"},
{pos={x=2,y=0,z=5}, block="nether:netherrack"},
{pos={x=3,y=0,z=5}, block="nether:netherrack"},
{pos={x=4,y=0,z=5}, block="nether:netherrack"},
{pos={x=5,y=0,z=5}, block="nether:netherrack"},
{pos={x=0,y=0,z=6}, block="nether:netherrack"},
{pos={x=1,y=0,z=6}, block="nether:netherrack"},
{pos={x=2,y=0,z=6}, block="nether:netherrack"},
{pos={x=3,y=0,z=6}, block="nether:netherrack"},
{pos={x=4,y=0,z=6}, block="nether:netherrack"},
{pos={x=5,y=0,z=6}, block="nether:netherrack"},
{pos={x=5,y=0,z=4}, block="nether:netherrack"},
{pos={x=5,y=0,z=3}, block="nether:netherrack"},
{pos={x=5,y=0,z=2}, block="nether:netherrack"},
{pos={x=5,y=0,z=1}, block="nether:netherrack"},
{pos={x=5,y=0,z=0}, block="nether:netherrack"},
{pos={x=4,y=0,z=0}, block="nether:netherrack"},
{pos={x=3,y=0,z=0}, block="nether:netherrack"},
{pos={x=2,y=0,z=0}, block="nether:netherrack"},
{pos={x=1,y=0,z=0}, block="nether:netherrack"},
-- Floor 2
{pos={x=0,y=1,z=0}, block="nether:netherrack"},
{pos={x=0,y=1,z=1}, block="nether:netherrack"},
{pos={x=0,y=1,z=2}, block="nether:netherrack"},
{pos={x=0,y=1,z=3}, block="nether:netherrack"},
{pos={x=0,y=1,z=4}, block="nether:netherrack"},
{pos={x=0,y=1,z=5}, block="nether:netherrack"},
{pos={x=1,y=1,z=5}, block="nether:netherrack"},
{pos={x=2,y=1,z=5}, block="nether:netherrack"},
{pos={x=3,y=1,z=5}, block="nether:netherrack"},
{pos={x=4,y=1,z=5}, block="nether:netherrack"},
{pos={x=5,y=1,z=5}, block="nether:netherrack"},
{pos={x=0,y=1,z=6}, block="nether:netherrack"},
{pos={x=1,y=1,z=6}, block="nether:netherrack"},
{pos={x=2,y=1,z=6}, block="nether:netherrack"},
{pos={x=3,y=1,z=6}, block="nether:netherrack"},
{pos={x=4,y=1,z=6}, block="nether:netherrack"},
{pos={x=5,y=1,z=6}, block="nether:netherrack"},
{pos={x=5,y=1,z=4}, block="nether:netherrack"},
{pos={x=5,y=1,z=3}, block="nether:netherrack"},
{pos={x=5,y=1,z=2}, block="nether:netherrack"},
{pos={x=5,y=1,z=1}, block="nether:netherrack"},
{pos={x=5,y=1,z=0}, block="nether:netherrack"},
{pos={x=4,y=1,z=0}, block="nether:netherrack"},
{pos={x=3,y=1,z=1}, block="nether:netherrack"},
{pos={x=2,y=1,z=1}, block="nether:netherrack"},
{pos={x=1,y=1,z=0}, block="nether:netherrack"},
{pos={x=1,y=1,z=1}, block="nether:netherrack"},
{pos={x=4,y=1,z=1}, block="nether:netherrack"},
-- Floor 3
{pos={x=0,y=2,z=0}, block="nether:netherrack"},
{pos={x=0,y=2,z=1}, block="nether:netherrack"},
{pos={x=0,y=2,z=2}, block="nether:netherrack"},
{pos={x=0,y=2,z=3}, block="nether:netherrack"},
{pos={x=0,y=2,z=4}, block="nether:netherrack"},
{pos={x=0,y=2,z=5}, block="nether:netherrack"},
{pos={x=1,y=2,z=5}, block="nether:netherrack"},
{pos={x=2,y=2,z=5}, block="nether:netherrack"},
{pos={x=3,y=2,z=5}, block="nether:netherrack"},
{pos={x=4,y=2,z=5}, block="nether:netherrack"},
{pos={x=5,y=2,z=5}, block="nether:netherrack"},
{pos={x=0,y=2,z=6}, block="nether:netherrack"},
{pos={x=1,y=2,z=6}, block="nether:netherrack"},
{pos={x=2,y=2,z=6}, block="nether:netherrack"},
{pos={x=3,y=2,z=6}, block="nether:netherrack"},
{pos={x=4,y=2,z=6}, block="nether:netherrack"},
{pos={x=5,y=2,z=6}, block="nether:netherrack"},
{pos={x=5,y=2,z=4}, block="nether:netherrack"},
{pos={x=5,y=2,z=3}, block="nether:netherrack"},
{pos={x=5,y=2,z=2}, block="nether:netherrack"},
{pos={x=5,y=2,z=1}, block="nether:netherrack"},
{pos={x=5,y=2,z=0}, block="nether:netherrack"},
{pos={x=4,y=2,z=0}, block="nether:netherrack"},
{pos={x=3,y=2,z=2}, block="nether:netherrack"},
{pos={x=2,y=2,z=2}, block="nether:netherrack"},
{pos={x=1,y=2,z=0}, block="nether:netherrack"},
{pos={x=1,y=2,z=1}, block="nether:netherrack"},
{pos={x=4,y=2,z=1}, block="nether:netherrack"},
{pos={x=1,y=2,z=2}, block="nether:netherrack"},
{pos={x=4,y=2,z=2}, block="nether:netherrack"},
-- Floor 4
{pos={x=0,y=3,z=0}, block="nether:netherrack"},
{pos={x=0,y=3,z=1}, block="nether:netherrack"},
{pos={x=0,y=3,z=2}, block="nether:netherrack"},
{pos={x=0,y=3,z=3}, block="nether:netherrack"},
{pos={x=0,y=3,z=4}, block="nether:netherrack"},
{pos={x=0,y=3,z=5}, block="nether:netherrack"},
{pos={x=1,y=3,z=5}, block="nether:netherrack"},
{pos={x=2,y=3,z=5}, block="nether:netherrack"},
{pos={x=3,y=3,z=5}, block="nether:netherrack"},
{pos={x=4,y=3,z=5}, block="nether:netherrack"},
{pos={x=5,y=3,z=5}, block="nether:netherrack"},
{pos={x=0,y=3,z=6}, block="nether:netherrack"},
{pos={x=1,y=3,z=6}, block="nether:netherrack"},
{pos={x=2,y=3,z=6}, block="nether:netherrack"},
{pos={x=3,y=3,z=6}, block="nether:netherrack"},
{pos={x=4,y=3,z=6}, block="nether:netherrack"},
{pos={x=5,y=3,z=6}, block="nether:netherrack"},
{pos={x=5,y=3,z=4}, block="nether:netherrack"},
{pos={x=5,y=3,z=3}, block="nether:netherrack"},
{pos={x=5,y=3,z=2}, block="nether:netherrack"},
{pos={x=5,y=3,z=1}, block="nether:netherrack"},
{pos={x=5,y=3,z=0}, block="nether:netherrack"},
{pos={x=4,y=3,z=0}, block="nether:netherrack"},
{pos={x=3,y=3,z=3}, block="nether:netherrack"},
{pos={x=2,y=3,z=3}, block="nether:netherrack"},
{pos={x=1,y=3,z=0}, block="nether:netherrack"},
{pos={x=1,y=3,z=1}, block="nether:netherrack"},
{pos={x=4,y=3,z=1}, block="nether:netherrack"},
{pos={x=1,y=3,z=2}, block="nether:netherrack"},
{pos={x=4,y=3,z=2}, block="nether:netherrack"},
{pos={x=1,y=3,z=3}, block="nether:netherrack"},
{pos={x=4,y=3,z=3}, block="nether:netherrack"},
{pos={x=1,y=3,z=4}, block="nether:netherrack"},
{pos={x=4,y=3,z=4}, block="nether:netherrack"},
{pos={x=2,y=3,z=4}, block="nether:netherrack"},
{pos={x=2,y=3,z=5}, block="nether:netherrack"},
{pos={x=3,y=3,z=4}, block="nether:netherrack"},
{pos={x=3,y=3,z=5}, block="nether:netherrack"},
-- Floor 5
{pos={x=2,y=4,z=4}, block="nether:netherrack"},
{pos={x=2,y=4,z=5}, block="nether:netherrack"},
{pos={x=3,y=4,z=4}, block="nether:netherrack"},
{pos={x=3,y=4,z=5}, block="nether:netherrack"},
{pos={x=2,y=4,z=6}, block="nether:netherrack"},
{pos={x=3,y=4,z=6}, block="nether:netherrack"},
-- Torches on floor 5
{pos={x=0,y=4,z=4}, block="nether:nether_torch_bottom"},
{pos={x=1,y=4,z=4}, block="nether:nether_torch_bottom"},
{pos={x=0,y=4,z=5}, block="nether:nether_torch_bottom"},
{pos={x=1,y=4,z=5}, block="nether:nether_torch_bottom"},
{pos={x=4,y=4,z=4}, block="nether:nether_torch_bottom"},
{pos={x=5,y=4,z=4}, block="nether:nether_torch_bottom"},
{pos={x=4,y=4,z=5}, block="nether:nether_torch_bottom"},
{pos={x=5,y=4,z=5}, block="nether:nether_torch_bottom"},
{pos={x=0,y=4,z=0}, block="nether:nether_torch_bottom"},
{pos={x=1,y=4,z=0}, block="nether:nether_torch_bottom"},
{pos={x=0,y=4,z=1}, block="nether:nether_torch_bottom"},
{pos={x=1,y=4,z=1}, block="nether:nether_torch_bottom"},
{pos={x=4,y=4,z=0}, block="nether:nether_torch_bottom"},
{pos={x=5,y=4,z=0}, block="nether:nether_torch_bottom"},
{pos={x=4,y=4,z=1}, block="nether:nether_torch_bottom"},
{pos={x=5,y=4,z=1}, block="nether:nether_torch_bottom"},
{pos={x=0,y=4,z=2}, block="nether:nether_torch_bottom"},
{pos={x=1,y=4,z=2}, block="nether:nether_torch_bottom"},
{pos={x=0,y=4,z=3}, block="nether:nether_torch_bottom"},
{pos={x=1,y=4,z=3}, block="nether:nether_torch_bottom"},
{pos={x=4,y=4,z=2}, block="nether:nether_torch_bottom"},
{pos={x=5,y=4,z=2}, block="nether:nether_torch_bottom"},
{pos={x=4,y=4,z=3}, block="nether:nether_torch_bottom"},
{pos={x=5,y=4,z=3}, block="nether:nether_torch_bottom"},
{pos={x=4,y=4,z=6}, block="nether:nether_torch_bottom"},
{pos={x=5,y=4,z=6}, block="nether:nether_torch_bottom"},
-- Floor 6
{pos={x=2,y=5,z=6}, block="nether:netherrack"},
{pos={x=3,y=5,z=6}, block="nether:netherrack"},
-- Floor 7
{pos={x=2,y=6,z=6}, block="nether:netherrack"},
{pos={x=3,y=6,z=6}, block="nether:netherrack"},

15
nether/.luacheckrc Normal file
View File

@ -0,0 +1,15 @@
read_globals = {
-- Defined by Minetest
"minetest", "vector", "PseudoRandom", "VoxelArea", "ItemStack", "dump",
"string",
-- Mods
"default", "stairs", "creative"
}
globals = {"nether"}
ignore = {
"212",
-- Unused argument
"411", "421", "422", "423", "431", "432",
-- Shadowing
}

View File

@ -197,7 +197,7 @@ minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv
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})
minetest.sound_play("default_wood_footstep", {pos=player:get_pos(), gain=0.25})
sound_allowed = false
minetest.after(0, function()
sound_allowed = true
@ -214,7 +214,7 @@ minetest.register_craft({
minetest.register_craft({
type = "cooking",
output = "default:coal",
output = "default:coal_lump",
recipe = "nether:tree",
})

View File

@ -1,6 +0,0 @@
default
glow
riesenpilz
stairs
fence_registration?
watershed?

View File

@ -1,5 +1,5 @@
-- minetest time speed
local time_speed = tonumber(minetest.setting_get("time_speed"))
local time_speed = tonumber(minetest.settings:get("time_speed"))
if not time_speed then
time_speed = 1
else
@ -250,14 +250,14 @@ 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)
meta:set_float("timedif", timediff-times)
for i = 1,times do
for _ = 1,times do
for _,name in pairs({
"fuel_totaltime",
"fuel_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)
@ -292,13 +292,13 @@ minetest.register_abm({
inv:add_item("dst", cooked.item)
-- take stuff from "src" list
inv:set_stack("src", 1, aftercooked.items[1])
else
--~ 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)
@ -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

@ -3,15 +3,15 @@ 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},
description = "Mushrooms",
{"text", "Nether mushrooms can be found on the nether's ground and\n"..
"on netherrack soil, it can be dug by hand."},
{"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:"},
{"text", "If you drop it without holding 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},
{"y", 0.1},
{"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"..
@ -27,81 +27,92 @@ local guide_infos = {
{"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},
description = "Tools",
{"text", "You can craft 5 kinds of tools in the nether,\n"..
"which (except the mushroom pick) require sticks to be crafted:"},
{"image", {1, 1, "nether_pick_mushroom.png"}},
{"text", "strength: 1\n"..
{"y", 0.1},
{"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"..
{"y", 0.1},
{"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_axe_netherrack.png", 1.5}},
{"image", {1, 1, "nether_shovel_netherrack.png", 3}},
{"image", {1, 1, "nether_sword_netherrack.png", 4.5}},
{"image", {1, 1, "nether_pick_netherrack.png"}},
{"text", "strength: 3\n"..
{"y", 0.1},
{"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_axe_netherrack_blue.png", 1.5}},
{"image", {1, 1, "nether_shovel_netherrack_blue.png", 3}},
{"image", {1, 1, "nether_sword_netherrack_blue.png", 4.5}},
{"image", {1, 1, "nether_pick_netherrack_blue.png"}},
{"text", "strength: 3\n"..
{"y", 0.1},
{"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_axe_white.png", 1.5}},
{"image", {1, 1, "nether_shovel_white.png", 3}},
{"image", {1, 1, "nether_sword_white.png", 4.5}},
{"image", {1, 1, "nether_pick_white.png"}},
{"text", "strength: 3\n"..
{"y", 0.1},
{"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:"},
description = "Blood structures",
{"text", "You can find blood structures on the ground and\n"..
"dig their nodes even with the bare hand."},
{"y", 0.5},
{"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"),
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_blood_stem_top.png",
"nether_blood_stem.png", "nether_blood_stem.png")}},
{"y", 0.1},
{"text", "Blood stem, blood, blood head and nether fruit"},
{"y", 0.1},
{"text", "You can craft 4 blood wood with the stem :"},
{"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."},
{"y", 0.1},
{"text", "The 4 blood nodes can be cooked and, except\n"..
"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},
description = "Fruits",
{"text", "You can find the nether fruits on blood structures\n"..
"and dig them even with the bare hand."},
{"image", {1, 1, "nether_fruit.png"}},
{"text", "You can eat it to get a bit blood because of its acid effect:"},
{"text", "Eating it will make you lose life but\n"..
"it might feed you and give you blood :"},
{"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."},
{"text", "If you eat it at the right place inside a portal,\n"..
"you will 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:"},
{"text", "If you drop it without holding the fast key,\n"..
"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},
{"text", "Craft a fruit leave block out of 9 fruit leaves\n"..
"The fruit can be used to craft a nether pearl."},
{"image", {1, 1, cube("nether_fruit_leaves.png")}},
{"text", "fruit leaves block"},
{"y", 0.2},
{"text", "A fruit leaves block"},
},
{
description = "cooking",
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},
"They can be found at pyramid like constructions and require at least\n"..
"a strength 1 nether pick to be dug.\n"..
"To craft the furnace, use the netherrack bricks like cobble:"},
{"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")}},
@ -113,41 +124,47 @@ local guide_infos = {
{"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}},
{"text", "Some nether items can be cooked:"},
{"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"),
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},
{"y", 1.2},
{"text", "Some cooked blood stem, cooked blood,\n"..
"cooked blood head and cooked blood wood,"},
{"image", {1, 1, "nether_hotbed.png", 0.3}},
{"image", {1, 1, "nether_pearl.png", 2}},
{"y", 1},
{"text", "cooked extracted blood and nether pearl"},
{"y", 1.2},
{"text", "Some cooked extracted blood and a nether pearl"},
},
{
description = "extractor",
description = "Extractors",
{"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}},
{"text", "Here you can see its craft recipe:"},
{"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_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"..
{"text", "Extract blood from the blood nodes you get from the blood structures.\n"..
"You can also get blood with a nether fruit."},
{"y", 0.2},
{"text", "So you can use it:\n"..
@ -169,127 +186,187 @@ local guide_infos = {
{"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."},
{"text", "The empty blood stem can be crafted into empty nether wood,\n"..
"which can be crafted into nether sticks."},
},
{
description = "ores",
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},
{"text", "The red netherrack is generated like stone.\n"..
"The black netherrack is generated like gravel.\n"..
"Both require at least a strength 2 nether pick to be dug."},
{"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},
{"text", "The blue netherrack is generated like diamond ore.\n"..
"The siwtonic ore is generated like mese blocks.\n"..
"Both require at least a strength 3 nether pick to be dug."},
{"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"..
{"y", 0.2},
{"text", "Glow stone can be used for lighting.\n"..
"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."},
"Dig tiled netherrack with at least a level 2 pickaxe."},
},
{
description = "vines",
{"text", "The nether vines can be fed with blood.\n"..
"They can be dug by hand and drop nether children."},
description = "Vines",
{"text", "Feed nether vines with blood.\n"..
"Dig them with anything."},
{"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."},
{"text", "Grow nether child by placing\n"..
"placing it to a dark place onto a\n"..
"blood structure head node."},
{"image", {1, 1, "nether_sapling.png"}},
{"y", -0.11},
{"y", -0.10},
{"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:"},
description = "Pearls",
{"text", "The nether pearl can be used to teleport by throwing it.\n"..
"Here is how to get one :"},
{"y", 0.2},
{"text", "First of all craft 2 mushroom heads and 1 nether fruit\n"..
"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:"},
{"text", "Put the result into the furnace\n"..
"to cook it into 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},
description = "Bricks",
{"text", "Craft bricks out of red,\n"..
"black and blue netherrack."},
{"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.4},
{"text", "Dig them with at least a level 1 pickaxe."},
{"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",
description = "Portals",
{"text", "Here you can find out how to built the nether portal."},
{"y", 0.4},
{"y", 0.3},
{"text", "A nether portal requires following nodes:"},
{"y", 0.05},
{"text", "21 empty nether wooden planks\n"..
{"text", "25 empty nether wooden planks\n"..
"16 black netherrack\n"..
"12 blue netherrack bricks\n"..
"12 black netherrack\n"..
"8 red netherrack\n"..
"8 cooked nether wood\n"..
"8 cooked nether blood\n"..
"4 nether fruits\n"..
"2 siwtonic blocks"},
{"y", 0.2},
{"text", "It should look approximately like this one:"},
{"image", {5.625, 6, "nether_teleporter.png", 0, -1.5}},
{"y", 5.5},
{"text", "You can activate it by standing in the middle on a siwtonic block and eating a nether fruit.\n"..
"Don't forget to take enough stuff with you to be able to build a portal back."},
{"text", "Activate it by standing in the middle,\n"..
"on the siwtonic block and eating a nether fruit.\n"..
"Take enough stuff with you to build a portal when you'll come back."},
},
{
description = "nether forest",
{"text", "The nether forest is generated in caves above the usual nether."},
description = "Forests",
{"text", "The nether forest is generated in caves,\n"..
"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},
{"text", "Use the nether forest grass to get paper.\n"..
"Craft paper out of the dried grass."},
{"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},
{"text", "Nether trunks can be found at nether trees.\n"..
"Craft nether wood out of nether trunk."},
{"image", {1, 1, "nether_glowflower.png"}},
{"text", "Currently this flower can be used for lighting and decoration."},
{"y", 0.2},
{"text", "Use it for lighting and decoration."},
},
}
-- the size of guide pages
local guide_size = {x=15, y=10, cx=0.1, cy=-0.2}
local guide_size = {x=40, y=10, cx=0.2, cy=0.2}
-- informations about settings and ...
local formspec_offset = {x=0.25, y=0.55}
local formspec_offset = {x=0.25, y=0.50}
local font_size
if minetest.is_singleplayer() then
font_size = tonumber(minetest.setting_get("font_size")) or 13
font_size = tonumber(minetest.settings: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
guide_size.fx = math.floor((40*(guide_size.cx+formspec_offset.x))*font_size)
guide_size.fy = font_size/40
-- 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:]",
contents = "size[3.6,"..(#guide_infos)-2 ..";]label["..guide_size.cx+0.7 ..","..guide_size.cy+0.2 ..";Contents:]",
}
-- change the infos to formspecs
for n,data in ipairs(guide_infos) do
local html_text = ""
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
html_text = html_text .. content .. "\n"
local tab = minetest.wrap_text(content, guide_size.fx, true)
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.."]"
html_text = html_text ..
("<img name=%s width=%g height=%g>\n"):format(
texture_name, w, h)
y = y+h
else
px = guide_size.cx+px
py = py or 0
html_text = html_text ..
("<img name=%s width=%g height=%g>\n"):format(
texture_name, w, h)
--~ 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 = ("formspec_version[4]size[%g,%g;]hypertext[0,0;%g,%g;html;%s]button[%g,%g;1,2;quit;Back]"
):format(
x * 1.8, y + 1,
x * 1.8, y,
minetest.formspec_escape(html_text),
0.5 * x - 0.5, y)
guide_forms[n] = {data.description, form}
end
print(dump(guide_forms))
--[[
for n,data in ipairs(guide_infos) do
local form = ""
local y = 0
@ -301,10 +378,10 @@ for n,data in ipairs(guide_infos) do
elseif typ == "x" then
x = math.max(x, content)
elseif typ == "text" then
local tab = minetest.splittext(content, guide_size.fx)
local tab = minetest.wrap_text(content, guide_size.fx, true)
local l = guide_size.cx
for _,str in ipairs(tab) do
form = form.."label["..guide_size.cx..","..guide_size.cy+y..";"..str.."]"
form = form.."label["..guide_size.cx ..","..guide_size.cy+y..";"..str.."]"
y = y+guide_size.fy
l = math.max(l, #str)
end
@ -323,9 +400,10 @@ for n,data in ipairs(guide_infos) do
end
end
end
form = "size["..x..","..y+1 ..";]"..form.."button["..x/2-0.5 ..","..y ..";1,2;quit;back]"
form = "size["..x*1.8 ..","..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
@ -333,11 +411,12 @@ for n,i in ipairs(guide_forms) do
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.."]"
local desc = i[1]
local s = #desc * 1.3 / font_size + 1.5
guide_forms.contents = guide_forms.contents ..
"button[" .. guide_size.cx * 12 / s - 0.5 .. "," ..
guide_size.cy + y / 1.3 .. ";" .. s .. ",1;name;" .. desc .. "]"
end
-- shows the contents of the formspec
@ -372,8 +451,10 @@ minetest.register_chatcommand("nether_help", {
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.")
if player:get_pos().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...")

View File

@ -11,7 +11,7 @@
-- godkiller447 (ideas)
-- If I didn't list you, please let me know!
local load_time_start = os.clock()
local load_time_start = minetest.get_us_time()
if not rawget(_G, "nether") then
nether = {}
@ -19,15 +19,6 @@ end
--== EDITABLE OPTIONS ==--
--says some information.
nether.info = true
-- tell everyone about the generation
nether.inform_all = minetest.is_singleplayer()
--1:<a bit of information> 2:<acceptable amount of information> 3:<lots of text>
nether.max_spam = 2
-- Depth of the nether
local nether_middle = -20000
@ -52,8 +43,8 @@ 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
local abm_tree_interval = 864
local abm_tree_chance = 100
-- height of the nether generation's end
nether.start = f_h_max+100
@ -62,7 +53,7 @@ nether.start = f_h_max+100
local NETHER_HEIGHT = 30
-- Maximum amount of randomness in the map generation
NETHER_RANDOM = 2
local NETHER_RANDOM = 2
-- Frequency of Glowstone on the "roof" of the Nether (higher is less frequent)
local GLOWSTONE_FREQ_ROOF = 500
@ -83,63 +74,60 @@ local NETHER_SHROOM_FREQ = 100
--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)
-- Start position for the Throne of Hades (y is relative to the bottom of the
-- nether)
--HADES_THRONE_STARTPOS = {x=0, y=1, z=0}
-- Spawn pos for when the nether hasn't been loaded yet (i.e. no portal in the nether) (y is relative to the bottom of the nether)
-- Spawn pos for when the nether hasn't been loaded yet (i.e. no portal in the
-- nether) (y is relative to the bottom of the nether)
--NETHER_SPAWNPOS = {x=0, y=5, z=0}
-- Structure of the nether portal (all is relative to the nether portal creator block)
-- Structure of the nether portal (all is relative to the nether portal creator
-- block)
--== END OF EDITABLE OPTIONS ==--
if nether.info then
local path = minetest.get_modpath"nether"
dofile(path .. "/settings.lua")
local nether_weird_noise = dofile(path .. "/weird_mapgen_noise.lua")
dofile(path .. "/items.lua")
--dofile(path .. "/furnace.lua")
dofile(path .. "/pearl.lua")
if nether.log_level >= 1 then
function nether:inform(msg, spam, t)
if spam <= self.max_spam then
if spam <= self.log_level then
local info
if t then
info = string.format("[nether] "..msg.." after ca. %.2fs", os.clock() - t)
info = "[nether] " .. msg .. (" after ca. %.3g s"):format(
(minetest.get_us_time() - t) / 1000000)
else
info = "[nether] "..msg
info = "[nether] " .. msg
end
print(info)
if self.inform_all then
if self.log_to_chat then
minetest.chat_send_all(info)
end
end
end
else
function nether:inform()
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
-- Weierstrass function stuff from https://github.com/slemonide/gen
local SIZE = 1000
local ssize = math.ceil(math.abs(SIZE))
local function do_ws_func(depth, a, x)
local n = x/(16*SIZE)
local n = math.pi * x / (16 * SIZE)
local y = 0
for k=1,depth do
y = y + math.sin(math.pi * k^a * n)/(k^a)
y = y + math.sin(k^a * n) / k^a
end
return SIZE*y/math.pi
return SIZE * y / math.pi
end
local chunksize = minetest.setting_get("chunksize") or 5
local chunksize = minetest.settings:get"chunksize" or 5
local ws_lists = {}
local function get_ws_list(a,x)
ws_lists[a] = ws_lists[a] or {}
@ -158,10 +146,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
@ -179,42 +163,25 @@ end
local function set_vm_data(manip, nodes, pos, t1, name, generated)
manip:set_data(nodes)
manip:write_to_map()
local spam = 2
if generated then
spam = 3
end
nether:inform(name.." grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", spam, t1)
if not generated then
local t1 = os.clock()
manip:update_map()
nether:inform("map updated", spam, t1)
end
end
local function fix_light(minp, maxp)
local manip = minetest.get_voxel_manip()
local emerged_pos1, emerged_pos2 = manip:read_from_map(minp, maxp)
area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
nodes = manip:get_data()
manip:set_data(nodes)
manip:write_to_map()
manip:update_map()
manip:write_to_map(not generated)
nether:inform(name.." grew at " .. minetest.pos_to_string(pos),
generated and 3 or 2, t1)
end
-- Generated variables
local NETHER_BOTTOM = (nether_middle - NETHER_HEIGHT)
nether.buildings = NETHER_BOTTOM+12
local NETHER_ROOF_ABS = (nether_middle - NETHER_RANDOM)
--~ 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}
--HADES_THRONE_STARTPOS_ABS = {x=HADES_THRONE_STARTPOS.x, y=(NETHER_BOTTOM +
--HADES_THRONE_STARTPOS.y), z=HADES_THRONE_STARTPOS.z}
--LAVA_Y = (NETHER_BOTTOM + LAVA_HEIGHT)
--HADES_THRONE_ABS = {}
--HADES_THRONE_ENDPOS_ABS = {}
--HADES_THRONE_GENERATED = minetest.get_worldpath() .. "/netherhadesthrone.txt"
--NETHER_SPAWNPOS_ABS = {x=NETHER_SPAWNPOS.x, y=(NETHER_BOTTOM + NETHER_SPAWNPOS.y), z=NETHER_SPAWNPOS.z}
--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
@ -237,7 +204,7 @@ for i,v in ipairs(HADES_THRONE_ABS) do
end
HADES_THRONE_ENDPOS_ABS = {x=htx, y=hty, z=htz}]]
local c
local c, nether_tree_nodes
local function define_contents()
c = {
ignore = minetest.get_content_id("ignore"),
@ -248,7 +215,8 @@ local function define_contents()
diamond = minetest.get_content_id("default:stone_with_diamond"),
mese = minetest.get_content_id("default:mese"),
glowstone = minetest.get_content_id("glow:stone"), --https://github.com/Zeg9/minetest-glow
--https://github.com/Zeg9/minetest-glow
glowstone = minetest.get_content_id("glow:stone"),
nether_shroom = minetest.get_content_id("riesenpilz:nether_shroom"),
@ -278,6 +246,12 @@ local function define_contents()
nether_dirt_top = minetest.get_content_id("nether:dirt_top"),
nether_dirt_bottom = minetest.get_content_id("nether:dirt_bottom"),
}
local trn = {c.nether_tree, c.nether_tree_corner, c.nether_leaves,
c.nether_fruit}
nether_tree_nodes = {}
for i = 1,#trn do
nether_tree_nodes[trn[i]] = true
end
end
local pr, contents_defined
@ -304,13 +278,14 @@ end
local f_perlins = {}
--local perlin1 = minetest.get_perlin(13,3, 0.5, 50) --Get map specific perlin
-- abs(v) < 1-(persistance^octaves))/(1-persistance) = amp
--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 = {
{
{ -- amp 1.75
seed = 13,
octaves = 3,
persist = 0.5,
@ -318,7 +293,7 @@ local perlins = {
scale = 1,
offset = 0,
},
{
{-- amp 1.75
seed = 133,
octaves = 3,
persist = 0.5,
@ -326,7 +301,7 @@ local perlins = {
scale = 1,
offset = 0,
},
{
{-- amp 1.75
seed = 112,
octaves = 3,
persist = 0.5,
@ -342,7 +317,7 @@ local perlins = {
scale = 1,
offset = 0,
},]]
forest_top = {
forest_top = {-- amp 2.44
seed = 21,
octaves = 3,
persist = 0.8,
@ -352,18 +327,26 @@ local perlins = {
},
}
local info = true
-- buffers, see https://forum.minetest.net/viewtopic.php?f=18&t=16043
local pelin_maps
local pmap1 = {}
local pmap2 = {}
local pmap3 = {}
local pmap_f_top = {}
local data = {}
local structures_enabled = true
local vine_maxlength = math.floor(NETHER_HEIGHT/4+0.5)
-- Create the Nether
minetest.register_on_generated(function(minp, maxp, seed)
if not (maxp.y >= NETHER_BOTTOM-100 and minp.y <= nether.start) then --avoid big map generation
--avoid big map generation
if not (maxp.y >= NETHER_BOTTOM-100 and minp.y <= nether.start) then
return
end
local addpos = {}
local t1 = os.clock()
nether:inform("generates at: x=["..minp.x.."; "..maxp.x.."]; y=["..minp.y.."; "..maxp.y.."]; z=["..minp.z.."; "..maxp.z.."]", 2)
local t1 = minetest.get_us_time()
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()
@ -378,31 +361,41 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local data = vm:get_data()
vm:get_data(data)
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
pr = PseudoRandom(seed+33)
local tab,num = {},1
local trees,num_trees = {},1
--local perlin1 = minetest.get_perlin(13,3, 0.5, 50) --Get map specific perlin
--local perlin1 = minetest.get_perlin(13,3, 0.5, 50)
--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 side_length = maxp.x - minp.x + 1
local map_lengths_xyz = {x=side_length, y=side_length, z=side_length}
local pmap1 = minetest.get_perlin_map(perlins[1], map_lengths_xyz):get2dMap_flat({x=minp.x, y=minp.z})
local pmap2 = minetest.get_perlin_map(perlins[2], map_lengths_xyz):get2dMap_flat({x=minp.x, y=minp.z})
local pmap3 = minetest.get_perlin_map(perlins[3], map_lengths_xyz):get2dMap_flat({x=minp.x, y=minp.z})
if not pelin_maps then
pelin_maps = {
a = minetest.get_perlin_map(perlins[1], map_lengths_xyz),
b = minetest.get_perlin_map(perlins[2], map_lengths_xyz),
c = minetest.get_perlin_map(perlins[3], map_lengths_xyz),
forest_top = minetest.get_perlin_map(perlins.forest_top,
map_lengths_xyz),
}
end
pelin_maps.a:get_2d_map_flat({x=minp.x, y=minp.z}, pmap1)
pelin_maps.b:get_2d_map_flat({x=minp.x, y=minp.z}, pmap2)
pelin_maps.c:get_2d_map_flat({x=minp.x, y=minp.z}, pmap3)
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({x=minp.x, y=minp.z})
local perlin_f_bottom, pmap_f_top, strassx, strassz
--local pmap_f_bottom = minetest.get_perlin_map(perlins.forest_bottom,
-- map_lengths_xyz):get_2d_map_flat({x=minp.x, y=minp.z})
local perlin_f_bottom, strassx, strassz
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({x=minp.x, y=minp.z})
pelin_maps.forest_top:get_2d_map_flat({x=minp.x, y=minp.z}, pmap_f_top)
strassx = get_ws_list(2, minp.x)
strassz = get_ws_list(2, minp.z)
end
@ -410,7 +403,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
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)
tab2 = nether_weird_noise({x=minp.x, y=nether.buildings-79, z=minp.z},
pymg, 200, 8, 10, side_length-1)
end
local count = 0
@ -456,17 +450,18 @@ minetest.register_on_generated(function(minp, maxp, seed)
py_h_g = nether.buildings-7
end
local vi = area:index(x, minp.y, z)
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
for _ = 1,side_length do
data[vi] = c.netherrack_brick
vi = vi + area.ystride
end
else
for y=minp.y, maxp.y do
local p_addpos = area:index(x, y, z)
data[p_addpos] = c.lava
for _ = 1,side_length do
data[vi] = c.lava
vi = vi + area.ystride
end
end
else
@ -478,15 +473,19 @@ minetest.register_on_generated(function(minp, maxp, seed)
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 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)
f_perlins[pstr] = math.floor(f_h_min + (math.abs(
perlin_f_bottom:get_2d{x=p.x, y=p.z} + 1))
* f_yscale_bottom + 0.5)
end
local top_noise = pmap_f_top[count]+1
if top_noise < 0 then
top_noise = -top_noise/10
--nether:inform("ERROR: (perlin noise) "..pmap_f_top[count].." is not inside [-1; 1]", 1)
--nether:inform("ERROR: (perlin noise) "..
-- pmap_f_top[count].." is not inside [-1; 1]", 1)
end
f_top = math.floor(f_h_max - top_noise*f_yscale_top + 0.5)
f_bottom = f_perlins[pstr]+pr:next(0,f_bottom_scale-1)
@ -495,78 +494,74 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
for y=minp.y, maxp.y do
local p_addpos = area:index(x, y, z)
local d_p_addp = data[p_addpos]
local d_p_addp = data[vi]
--if py_h >= maxp.y-4 then
if y <= py_h
and noisp then
if noisp == 1 then
data[p_addpos] = c.netherrack_brick
data[vi] = c.netherrack_brick
elseif noisp == 2 then
if y == py_h then
data[p_addpos] = c.netherrack_brick
data[vi] = c.netherrack_brick
elseif y == py_h_g
and pr:next(1,3) <= 2 then
data[p_addpos] = c.netherrack
data[vi] = c.netherrack
elseif y <= py_h_g then
data[p_addpos] = c.lava
data[vi] = c.lava
else
data[p_addpos] = c.air
data[vi] = 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
data[vi] = c.nether_dirt_top
elseif is_forest
and y < f_bottom
and y >= f_h_dirt then
data[p_addpos] = c.nether_dirt
data[vi] = c.nether_dirt
elseif is_forest
and y == f_h_dirt-1 then
data[p_addpos] = c.nether_dirt_bottom
data[vi] = 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
data[vi] = c.nether_shroom
elseif pr:next(1,glowflower_rarity) == 1 then
data[p_addpos] = c.glowflower
data[vi] = c.glowflower
elseif pr:next(1,grass_rarity) == 1 then
data[p_addpos] = c.nether_grass[pr:next(1,3)]
data[vi] = c.nether_grass[pr:next(1,3)]
else
data[p_addpos] = c.air
data[vi] = 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
if not nether_tree_nodes[d_p_addp] then
data[vi] = c.air
end
elseif is_forest
and y == f_top then
local sel = math.floor(strassx[x]+strassz[z]+0.5)%10
if sel <= 5 then
data[p_addpos] = return_nether_ore(d_p_addp, true)
data[vi] = return_nether_ore(d_p_addp, true)
elseif sel == 6 then
data[p_addpos] = c.netherrack_black
data[vi] = c.netherrack_black
elseif sel == 7 then
data[p_addpos] = c.glowstone
data[vi] = c.glowstone
else
data[p_addpos] = c.air
data[vi] = c.air
end
elseif y <= NETHER_BOTTOM then
if y <= bottom then
data[p_addpos] = return_nether_ore(d_p_addp, true)
data[vi] = return_nether_ore(d_p_addp, true)
else
data[p_addpos] = c.lava
data[vi] = c.lava
end
elseif r_structure == 1
and y == bottom then
@ -574,26 +569,27 @@ minetest.register_on_generated(function(minp, maxp, seed)
num = num+1
elseif y <= bottom then
if pr:next(1,LAVA_FREQ) == 1 then
data[p_addpos] = c.lava
data[vi] = c.lava
else
data[p_addpos] = return_nether_ore(d_p_addp, false)
data[vi] = 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
data[vi] = c.nether_shroom
elseif (y == top and r_glowstone == 1) then
data[p_addpos] = c.glowstone
data[vi] = c.glowstone
elseif y >= top then
data[p_addpos] = return_nether_ore(d_p_addp, true)
data[vi] = 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
data[vi] = c.nether_vine
else
data[p_addpos] = c.air
data[vi] = c.air
end
end
vi = vi + area.ystride
end
end
end
@ -602,37 +598,42 @@ minetest.register_on_generated(function(minp, maxp, seed)
-- vm:set_lighting(12)
-- vm:calc_lighting()
-- vm:update_liquids()
vm:write_to_map()
vm:write_to_map(false)
nether:inform("nodes set", 2, t1)
local t2 = os.clock()
local t2 = minetest.get_us_time()
local tr_bl_cnt = 0
if structures_enabled then --Trees:
for _,v in ipairs(tab) do
nether.grow_netherstructure(v, true)
if structures_enabled then -- Blood netherstructures
tr_bl_cnt = #tab
for i = 1,tr_bl_cnt do
nether.grow_netherstructure(tab[i], true)
end
end
if forest_possible then --Trees:
for _,v in ipairs(trees) do
nether.grow_tree(v, true)
if forest_possible then -- Forest trees
tr_bl_cnt = tr_bl_cnt + #trees
for i = 1,#trees do
nether.grow_tree(trees[i], true)
end
end
nether:inform("trees set", 2, t2)
if tr_bl_cnt > 0 then
nether:inform(tr_bl_cnt .. " trees and blood structures set", 2, t2)
end
t2 = os.clock()
fix_light(minp, maxp)
t2 = minetest.get_us_time()
minetest.fix_light(minp, maxp)
nether:inform("map updated", 2, t2)
nether:inform("light fixed", 2, t2)
nether:inform("done", 1, t1)
end)
function nether.grow_netherstructure(pos, generated)
local t1 = os.clock()
local t1 = minetest.get_us_time()
if not contents_defined then
define_contents()
@ -649,8 +650,10 @@ function nether.grow_netherstructure(pos, generated)
local area = r_area(manip, 2, height, pos)
local nodes = manip:get_data()
for i = 0, height-1 do
nodes[area:index(pos.x, pos.y+i, pos.z)] = c.blood_stem
local vi = area:indexp(pos)
for _ = 0, height-1 do
nodes[vi] = c.blood_stem
vi = vi + area.ystride
end
for i = -1,1 do
@ -689,6 +692,9 @@ function nether.grow_netherstructure(pos, generated)
end
local poshash = minetest.hash_node_position
local pos_from_hash = minetest.get_position_from_hash
local function soft_node(id)
return id == c.air or id == c.ignore
end
@ -698,7 +704,6 @@ local function update_minmax(min, max, p)
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 = {}
@ -726,7 +731,7 @@ 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()
local t1 = minetest.get_us_time()
if not contents_defined then
define_contents()
@ -769,18 +774,20 @@ function nether.grow_tree(pos, generated)
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]
trunks[poshash{x=x, y=p.y, z=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]
trunk_corners[poshash(p)] = 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
p.y = p.y + i
trunks[poshash(p)] = true
p.y = p.y - i
end
p.y = p.y+h
--n = #todo+1 -- causes small trees
--n = #todo+1 -- caused small trees
todo[#todo+1] = p
end
if p.y > pos.y+h_trunk_max then
@ -793,13 +800,23 @@ function nether.grow_tree(pos, generated)
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
local ps = {}
local trunk_count = 0
for i,par2 in pairs(trunks) do
local pos = pos_from_hash(i)
update_minmax(min, max, pos)
local z,y,x = pos.z, pos.y, pos.x
trunk_count = trunk_count+1
ps[trunk_count] = {z,y,x, par2}
end
for _,d in pairs(ps) do
if d[4] == true then
d[4] = nil
end
table.insert(trunk_ps, p)
trunk_ps[#trunk_ps+1] = d
local pz, py, px = unpack(d)
count = count+1
if count > leaf_thickness then
count = 0
@ -807,18 +824,22 @@ function nether.grow_tree(pos, generated)
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
local distq = x*x+y*y+z*z
if distq ~= 0
and math.random(1, math.sqrt(distq)) == 1 then
local x = x+px
local y = y+py
local z = z+pz
local vi = poshash{x=x, y=y, z=z}
if not trunks[vi] then
if fruit_chance
and math.random(1, fruit_rarity) == 1
and math.random(1, fruit_chance) == 1 then
fruits[pstr] = true
fruits[vi] = true
else
leaves[pstr] = true
leaves[vi] = true
end
update_minmax(min, max, {x=x, z=z})
end
end
end
@ -827,37 +848,12 @@ function nether.grow_tree(pos, generated)
end
end
local leaf_ps = {}
for n,_ in pairs(leaves) do
local p = {}
p.x, p.y, p.z = unpack(string.split(n, " "))
table.insert(leaf_ps, p)
min, max = update_minmax(min, max, p)
end
for n,_ in pairs(trunks) do
local p = {}
p.x, _, p.z = unpack(string.split(n, " "))
min, max = update_minmax(min, max, p)
end
--ps = nil
--collectgarbage()
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)
-- param2 explicitly set 0 due to possibly previous leaves node
trunk_ps[#trunk_ps+1] = {pos.z, pos.y+i, pos.x, 0}
end
local manip = minetest.get_voxel_manip()
@ -866,8 +862,8 @@ function nether.grow_tree(pos, generated)
local nodes = manip:get_data()
local param2s = manip:get_param2_data()
for _,p in pairs(leaf_ps) do
p = area:indexp(p)
for i in pairs(leaves) do
local p = area:indexp(pos_from_hash(i))
if soft_node(nodes[p]) then
nodes[p] = c.nether_leaves
param2s[p] = math.random(0,179)
@ -875,43 +871,35 @@ function nether.grow_tree(pos, generated)
end
end
for _,p in pairs(fruit_ps) do
p = area:indexp(p)
for i in pairs(fruits) do
local p = area:indexp(pos_from_hash(i))
if soft_node(nodes[p]) then
nodes[p] = c.nether_apple
end
end
for _,p in pairs(trunk_ps) do
local par = p.par
p = area:indexp(p)
for i = 1,#trunk_ps do
local p = trunk_ps[i]
local par = p[4]
p = area:index(p[3], p[2], p[1])
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
for i,par2 in pairs(trunk_corners) do
local vi = area:indexp(pos_from_hash(i))
nodes[vi] = c.nether_tree_corner
param2s[vi] = par2
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
manip:write_to_map(not generated)
nether:inform("a nether tree with " .. trunk_count ..
" branch trunk nodes grew at " .. minetest.pos_to_string(pos),
generated and 3 or 2, t1)
end
@ -935,12 +923,13 @@ minetest.register_abm({
minetest.register_abm({
nodenames = {"nether:tree_sapling"},
neighbors = {"group:nether_dirt"},
interval = 864,
chance = 100,
interval = abm_tree_interval,
chance = abm_tree_chance,
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]
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
@ -961,13 +950,15 @@ minetest.register_abm({
return
end
pos.y = pos.y+1
if (minetest.get_node_light(pos) or 16) > 7 then --mushrooms grow at dark places
--mushrooms grow at dark places
if (minetest.get_node_light(pos) or 16) > 7 then
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})
minetest.set_node(pos,
{name="nether:netherrack_soil", param2=par2-1})
end
end
})
@ -981,6 +972,10 @@ local function grass_allowed(pos)
return 0
end
local data = minetest.registered_nodes[nd]
if not data then
-- unknown node
return false
end
local drawtype = data.drawtype
if drawtype
and drawtype ~= "normal"
@ -1027,16 +1022,17 @@ minetest.register_abm({
})
minetest.register_privilege("nether", "Allows sending players to nether and extracting them")
minetest.register_privilege("nether",
"Allows sending players to nether and extracting them")
dofile(path.."/crafting.lua")
dofile(path.."/portal.lua")
dofile(path.."/guide.lua")
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
local time = (minetest.get_us_time() - load_time_start) / 1000000
local msg = ("[nether] loaded after ca. %g seconds."):format(time)
if time > 0.01 then
print(msg)
else
minetest.log("info", msg)

View File

@ -35,11 +35,19 @@ local function add_fence(name)
end
--]]
local creative_installed = minetest.global_exists("creative")
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 creative_installed
and creative.is_enabled_for(player:get_player_name()) then
return true
end
local tool = player:get_wielded_item():get_name()
tool = minetest.registered_tools[tool] or tool == ""
and minetest.registered_items[tool]
if not tool
or not tool.tool_capabilities then
return false
@ -204,7 +212,8 @@ add_more_nodes("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"},
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(),
})
@ -212,7 +221,8 @@ add_more_nodes("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"},
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,
@ -224,7 +234,8 @@ add_more_nodes("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"},
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(),
})
@ -233,7 +244,8 @@ add_more_nodes("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"},
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(),
})
@ -241,7 +253,8 @@ add_more_nodes("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"},
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,
@ -253,7 +266,8 @@ add_more_nodes("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"},
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(),
})
@ -345,7 +359,10 @@ minetest.override_item("riesenpilz:nether_shroom", {
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"},
tiles = {"nether_fruit_top.png", "nether_fruit_bottom.png",
"nether_fruit.png", "nether_fruit.png^[transformFX",
"nether_fruit.png^[transformFX", "nether_fruit.png"},
use_texture_alpha = "opaque",
node_box = {
type = "fixed",
fixed = {
@ -373,7 +390,7 @@ minetest.register_node("nether:apple", {
return
end
itemstack:take_item()
if nether_port(user, vector.round(user:getpos())) then
if nether.teleport_player(user) then
return itemstack
end
local amount = math.random(4, 6)
@ -500,8 +517,10 @@ minetest.register_node("nether:tree", {
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"},
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},
@ -522,7 +541,7 @@ minetest.register_node("nether:leaves", {
description = "Nether Leaves",
drawtype = "plantlike",
waving = 1,
visual_scale = math.sqrt(math.sqrt(2)),
visual_scale = math.sqrt(2) + 0.01,
tiles = {"nether_leaves.png"},
inventory_image = "nether_leaves.png",
wield_image = "nether_leaves.png",
@ -623,7 +642,7 @@ minetest.register_node("nether:portal", {
light_source = 12,
paramtype = "light",
sunlight_propagates = true,
use_texture_alpha = true,
use_texture_alpha = "blend",
walkable = false,
pointable = false,
buildable_to = false,
@ -1001,3 +1020,11 @@ minetest.register_tool("nether:sword_white", {
damage_groups = {fleshy=11},
},
})
-- override creative hand
if minetest.settings:get_bool("creative_mode") then
local capas = minetest.registered_items[""].tool_capabilities
capas.groupcaps.nether = capas.groupcaps.cracky
minetest.override_item("", {tool_capabilities = capas})
end

3
nether/mod.conf Normal file
View File

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

View File

@ -1,22 +1,14 @@
local function table_contains(t, v)
for _,i in pairs(t) do
if v == i then
return true
end
end
return false
end
local creative = minetest.setting_getbool("creative_mode")
local function throw_pearl(item, player)
local playerpos = player:getpos()
local playerpos = player:get_pos()
playerpos.y = playerpos.y+1.625
local obj = minetest.add_entity(playerpos, "nether:pearl_entity")
local dir = player:get_look_dir()
obj:setvelocity(vector.multiply(dir, 30))
obj:setacceleration({x=dir.x*-3, y=-dir.y^8*80-10, z=dir.z*-3})
obj:get_luaentity().player = player:get_player_name()
if not creative then
local pname = player:get_player_name()
obj:get_luaentity().player = pname
if not minetest.is_creative_enabled(pname) then
item:take_item()
return item
end
@ -107,7 +99,7 @@ minetest.register_entity("nether:pearl_entity", {
self.player = tmp.player
end,
get_staticdata = function(self)
--forceload(vector.round(self.object:getpos()))
--forceload(vector.round(self.object:get_pos()))
return minetest.serialize({
player = self.player,
})
@ -129,7 +121,7 @@ minetest.register_entity("nether:pearl_entity", {
return
end
local pos = self.object:getpos()
local pos = self.object:get_pos()
local rpos = vector.round(pos)
local lastpos = self.lastpos
if not lastpos then

View File

@ -2,8 +2,7 @@
-- kills the player if he uses PilzAdam portal
local portal_target = nether.buildings+1
local nether_prisons = minetest.setting_getbool("enable_damage")
local obsidian_portal_kills = nether_prisons and true
local damage_enabled = minetest.settings:get_bool"enable_damage"
local mclike_portal = false
local abm_allowed
@ -11,40 +10,39 @@ 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 save_path = minetest.get_worldpath() .. "/nether_players"
local players_in_nether = {}
-- only get info from file if nether prisons
if nether_prisons then
local file = io.open(minetest.get_worldpath()..'/nether_players', "r")
-- Load the list of players which are trapped in the nether
-- (or would be trapped if nether.trap_players was true)
do
local file = io.open(save_path, "r")
if file then
local contents = file:read('*all')
local contents = file:read"*all"
io.close(file)
if contents then
players_in_nether = string.split(contents, " ")
local playernames = string.split(contents, " ")
for i = 1,#playernames do
players_in_nether[playernames[i]] = true
end
end
end
end
local function save_nether_players()
local output = ''
for _,name in ipairs(players_in_nether) do
output = output..name..' '
local playernames,n = {},1
for name in pairs(players_in_nether) do
playernames[n] = name
n = n+1
end
local f = io.open(minetest.get_worldpath()..'/nether_players', "w")
f:write(output)
local f = io.open(save_path, "w")
assert(f, "Could not open nether_players file for writing.")
f:write(table.concat(playernames, " "))
io.close(f)
end
local update_background
if nether_prisons then
if nether.trap_players then
function update_background(player, down)
if down then
player:set_sky({r=15, g=0, b=0}, "plain")
@ -58,80 +56,76 @@ end
-- returns nodename if area is generated, else calls generation function
local function generated_or_generate(pos)
local name = minetest.get_node(pos).name
if name ~= "ignore" then
return name
local node = minetest.get_node_or_nil(pos)
if node then
return node.name
end
minetest.get_voxel_manip():read_from_map(pos, pos)
name = minetest.get_node_or_nil(pos)
if not name then
node = minetest.get_node_or_nil(pos)
if not node then
minetest.emerge_area(vector.subtract(pos, 80), vector.add(pos, 80))
return false
end
return name.name
return node.name
end
-- where the player appears after dying
local function get_player_died_target(player)
local target = vector.add(player:getpos(), {x=math.random(-100,100), y=0, z=math.random(-100,100)})
local target = vector.add(player:get_pos(),
{x=math.random(-100,100), y=0, z=math.random(-100,100)})
target.y = portal_target + math.random(4)
return target
end
-- used for obsidian portal
local function obsidian_teleport(player, pname)
minetest.chat_send_player(pname, "For any reason you arrived here. Type /nether_help to find out things like craft recipes.")
if obsidian_portal_kills then
local function obsidian_teleport(player, pname, target)
minetest.chat_send_player(pname, "For any reason you arrived here. Type " ..
"/nether_help to find out things like craft recipes.")
players_in_nether[pname] = true
save_nether_players()
update_background(player, true)
if target then
player:set_pos(target)
else
player:set_hp(0)
return true
end
if not mclike_portal then
local target = vector.round(get_player_died_target(player))
if generated_or_generate(target) then
player:moveto(target)
return true
end
end
return false
end
-- teleports players to nether or helps it
local function player_to_nether(player, safe)
local function player_to_nether(player, pos)
local pname = player:get_player_name()
if table.icontains(players_in_nether, pname) then
players_in_nether[pname] = true
save_nether_players()
update_background(player, true)
if pos then
player:set_pos(pos)
return
end
players_in_nether[#players_in_nether+1] = 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.")
minetest.chat_send_player(pname, "For any reason you arrived here. " ..
"Type /nether_help to find out things like craft recipes.")
if nether.trap_players then
player:set_hp(0)
if not nether_prisons then
player:moveto(get_player_died_target(player))
end
end
update_background(player, true)
if not damage_enabled or not nether.trap_players then
player:set_pos(get_player_died_target(player))
end
end
local function player_from_nether(player)
local function player_from_nether(player, pos)
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
if players_in_nether[pname] then
players_in_nether[pname] = nil
save_nether_players()
end
update_background(player)
update_background(player, false)
player:set_pos(pos)
end
local function player_exists(name)
for _,player in pairs(minetest.get_connected_players()) do
if player:get_player_name() == name then
local players = minetest.get_connected_players()
for i = 1,#players do
if players[i]:get_player_name() == name then
return true
end
end
@ -144,7 +138,8 @@ minetest.register_chatcommand("to_hell", {
description = "Send someone to hell",
func = function(name, pname)
if not minetest.check_player_privs(name, {nether=true}) then
return false, "You need the nether priv to execute this chatcommand."
return false,
"You need the nether privilege to execute this chatcommand."
end
if not player_exists(pname) then
pname = name
@ -164,7 +159,8 @@ minetest.register_chatcommand("from_hell", {
description = "Extract from hell",
func = function(name, pname)
if not minetest.check_player_privs(name, {nether=true}) then
return false, "You need the nether priv to execute this chatcommand."
return false,
"You need the nether priv to execute this chatcommand."
end
if not player_exists(pname) then
pname = name
@ -174,23 +170,23 @@ minetest.register_chatcommand("from_hell", {
return false, "Something went wrong."
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})
local pos = player:get_pos()
player_from_nether(player, {x=pos.x, y=100, z=pos.z})
return true, pname.." is now out of the nether."
end
})
if nether_prisons then
-- Disallow teleportation and change spawn positions if the nether traps players
if nether.trap_players then
-- randomly set player position when he/she dies in nether
minetest.register_on_respawnplayer(function(player)
local pname = player:get_player_name()
if not table.icontains(players_in_nether, pname) then
if not players_in_nether[pname] then
return
end
local target = get_player_died_target(player)
player:moveto(target)
player:set_pos(target)
minetest.after(0, function(pname, target)
-- fixes respawn bug
local player = minetest.get_player_by_name(pname)
@ -201,65 +197,73 @@ if nether_prisons then
return true
end)
-- function for teleporting players where they belong to
local function update_players()
for _,player in pairs(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")]]
-- override set_pos etc. to disallow player teleportion by e.g. travelnet
local function can_teleport(player, pos)
if not player:is_player() then
-- the same metatable is used for entities
return true
end
local pname = player:get_player_name()
local in_nether = players_in_nether[pname] == true
-- test if the target is valid
if pos.y < nether.start then
if in_nether then
return true
end
elseif not in_nether then
return true
end
end
-- fix wrong player positions
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)
-- set background when player joins
minetest.register_on_joinplayer(function(player)
minetest.after(0, function(player)
if player:getpos().y < nether.start then
-- test if the current position is valid
local current_pos = player:get_pos()
local now_in_nether = current_pos.y < nether.start
if now_in_nether ~= in_nether then
if in_nether then
minetest.log("action", "Player \"" .. pname ..
"\" has to be in the nether, teleporting it!")
update_background(player, true)
current_pos.y = portal_target
player:set_pos(current_pos)
else
minetest.log("action", "Player \"" .. pname ..
"\" must not be in the nether, teleporting it!")
update_background(player, false)
current_pos.y = 20
player:set_pos(current_pos)
end
end, player)
end)
else
-- test if player is in nether when he/she joins
return false
end
minetest.chat_send_player(pname,
"You can not simply teleport to or from the nether!")
minetest.log("action", "Player \"" .. pname ..
"\" attempted to teleport from or to the nether, ignoring.")
return false
end
local methods = {"set_pos", "move_to", "setpos", "moveto"}
local metatable_overridden
minetest.register_on_joinplayer(function(player)
minetest.after(0, function(player)
if player:getpos().y < nether.start then
if not table.icontains(players_in_nether, pname) then
players_in_nether[#players_in_nether+1] = pname
end
return
end
for i,name in pairs(players_in_nether) do
if name == pname then
players_in_nether[i] = nil
return
-- set the background when the player joins
if player:get_pos().y < nether.start then
update_background(player, true)
end
-- overide set_pos etc. if not yet done
if metatable_overridden then
return
end
metatable_overridden = true
local mt = getmetatable(player)
for i = 1,#methods do
local methodname = methods[i]
local origfunc = mt[methodname]
mt[methodname] = function(...)
if can_teleport(...) then
origfunc(...)
end
end
end, player)
end
end)
end
@ -295,29 +299,36 @@ local particledef = {
-- teleports player to neter (obsidian portal)
local function obsi_teleport_player(player, pos, target)
local pname = player:get_player_name()
if table.icontains(players_in_nether, pname) then
if players_in_nether[pname] then
return
end
local objpos = player:getpos()
local objpos = player:get_pos()
objpos.y = objpos.y+0.1 -- Fix some glitches at -8000
if minetest.get_node(vector.round(objpos)).name ~= "nether:portal" then
return
end
if not obsidian_teleport(player, pname) then
local has_teleported
if damage_enabled then
obsidian_teleport(player, pname)
has_teleported = true
elseif not mclike_portal then
local target = vector.round(get_player_died_target(player))
if generated_or_generate(target) then
obsidian_teleport(player, pname, target)
has_teleported = true
end
end
if not has_teleported then
-- e.g. ungenerated area
return
end
players_in_nether[#players_in_nether+1] = pname
save_nether_players()
update_background(player, true)
remove_portal_essence(pos)
minetest.sound_play("nether_portal_usual", {to_player=pname, gain=1})
--obj:setpos(target)
end
-- abm for particles of the obsidian portal essence and for teleporting
@ -332,7 +343,8 @@ minetest.register_abm({
end
particledef.minpos = {x=pos.x-0.25, y=pos.y-0.5, z=pos.z-0.25}
particledef.maxpos = {x=pos.x+0.25, y=pos.y+0.34, z=pos.z+0.25}
particledef.texture = "nether_portal_particle.png^[transform"..math.random(0,7)
particledef.texture = "nether_portal_particle.png^[transform" ..
math.random(0, 7)
minetest.add_particlespawner(particledef)
for _,obj in pairs(minetest.get_objects_inside_radius(pos, 1)) do
if obj:is_player() then
@ -465,7 +477,7 @@ local function make_portal(pos)
for d=0,3 do
for y=p1.y,p2.y do
local p = {}
local p
if param2 == 0 then
p = {x=p1.x+d, y=y, z=p1.z}
else
@ -544,14 +556,12 @@ minetest.after(0.1, function()
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
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.settings:get_bool("creative_mode") then
stack:take_item()
end
end
@ -563,8 +573,7 @@ end)
-- a not filled square
vector.square = vector.square or
function(r)
local function vector_square(r)
local tab, n = {}, 1
for i = -r+1, r do
for j = -1, 1, 2 do
@ -577,21 +586,20 @@ function(r)
return tab
end
-- detects if it's a portal
local function netherport(pos)
local function is_netherportal(pos)
local x, y, z = pos.x, pos.y, pos.z
for _,i in pairs({-1, 3}) do
if minetest.get_node({x=x, y=y+i, z=z}).name ~= "nether:white" then
return
end
end
for _,sn in pairs(vector.square(1)) do
for _,sn in pairs(vector_square(1)) do
if minetest.get_node({x=x+sn[1], y=y-1, z=z+sn[2]}).name ~= "nether:netherrack"
or minetest.get_node({x=x+sn[1], y=y+3, z=z+sn[2]}).name ~= "nether:blood_cooked" then
return
end
end
for _,sn in pairs(vector.square(2)) do
for _,sn in pairs(vector_square(2)) do
if minetest.get_node({x=x+sn[1], y=y-1, z=z+sn[2]}).name ~= "nether:netherrack_black"
or minetest.get_node({x=x+sn[1], y=y+3, z=z+sn[2]}).name ~= "nether:wood_empty" then
return
@ -634,22 +642,26 @@ local function set_portal(t, z,x, y)
t[z][x] = y
end
local function get_player_nodepos(player)
local pos = player:get_pos()
pos.y = pos.y + player:get_properties().collisionbox[2] + 0.5
return vector.round(pos)
end
-- used when a player eats that fruit in a portal
function nether_port(player, pos)
if not player
or not pos
or not pos.x then
minetest.log("error", "[nether] nether_port: something failed.")
function nether.teleport_player(player)
if not player then
minetest.log("error", "[nether] Missing player.")
return
end
if not netherport(pos) then
local pos = get_player_nodepos(player)
if not is_netherportal(pos) then
return
end
minetest.sound_play("nether_teleporter", {pos=pos})
local meta = minetest.get_meta({x=pos.x, y=pos.y-1, z=pos.z})
if pos.y < nether.start then
set_portal(known_portals_d, pos.z,pos.x, pos.y)
player_from_nether(player)
local my = tonumber(meta:get_string("y"))
local y = get_portal(known_portals_u, pos.z,pos.x)
@ -660,9 +672,9 @@ function nether_port(player, pos)
else
y = my or 100
end
pos.y = y
pos.y = y - 0.3
player:moveto(pos)
player_from_nether(player, pos)
else
set_portal(known_portals_u, pos.z,pos.x, pos.y)
@ -675,10 +687,9 @@ function nether_port(player, pos)
else
y = my or portal_target+math.random(4)
end
pos.y = y
pos.y = y - 0.3
player:moveto(pos)
player_to_nether(player, true)
player_to_nether(player, pos)
end
minetest.sound_play("nether_teleporter", {pos=pos})
return true

23
nether/settings.lua Normal file
View File

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

19
nether/settingtypes.txt Normal file
View File

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

View File

@ -5,7 +5,7 @@ end
local r_chs = {}
function nether_weird_noise(minp, fct, s, seed, range, scale)
local 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
@ -86,3 +86,5 @@ minetest.register_node("ac:wmg", {
end
end,
})]]
return nether_weird_noise