Page 1 of 2

[Mod] Tunnelmaker [2.0] [tunnelmaker]

Posted: Mon May 21, 2018 18:08
by kestral
A Minetest Mod to easily create arbitrarily curved tunnels, pathways, and bridges.

With the official release of Minetest 5.0, Tunnelmaker 2.0 is being released, with many new and improved features.

However, note that this version of tunnelmaker only supports Minetest 5.0+. For old versions of Minetest, use the 'legacy' branch on github, or the following zip file: ...


  • Create tunnels, paths, and bridges in all sixteen possible advtrains track directions with one click.
  • Also digs up or down in the eight possible advtrains slope track directions.
  • Improved support for advtrains mod with gravel embankment, arched and optionally lined tunnels, and two widths of bridges.
  • New support for bike mod with two widths of cobblestone pathways and bridges, along with unlined tunnels.
  • New support for general excavation with unlined and lined tunnels.
  • New User Options menu to change modes and other options.
  • Reference nodes added to help digging and laying advtrains track—now easily removed when done.
  • Glass enclosure added when in water to create water tunnels.
  • Requires "tunneling" privilege, and checks protections before digging.
  • No longer has a crafting recipe, so needs to be given to player.
  • Works in both creative and survival modes, but tunneling does not place any nodes into user's inventory.
  • Minetest.conf support for several global options. See settingtypes.txt for details.
  • New support for client-side translation files. Currently only have Russian and my attempt at a French translation. Other languages will be gratefully accepted. Reference template file is available in locale directory.
New bike path mode, using optional angledstairs mod for improved diagonal slopes:

Controls (Reverted back to classic controls.)
  • Left-click: Super dig one node. One click digs any node (non-repeating) and places it in player's inventory. However, it can't be used to pick up dropped items.
  • Shift-left-click: Bring up new User Options menu (see below).
  • Right-click: Dig tunnel in direction player pointed. Note that this won't place any of the dug nodes in player's inventory.
  • Shift-right-click: Cycle through vertical digging modes, up, down, and horizontal.

User Options menu
  • Digging mode Select one of the three digging modes: General purpose, Advanced trains, or Bike paths.
  • Wide paths / lined tunnels Select between narrow and wide paths, and whether tunnels are lined with stone or not.
  • Continuous up/down digging Don't reset up/down after each dig.
  • Clear tree cover Remove all plant material above dig up to 30 nodes above ground. CPU intensive, so shuts off after two minutes.
  • Remove reference nodes Easily remove reference nodes by walking over them. Also shuts off after two minutes.
  • Lock desert mode to: either "Desert" or "Non-desert" Option only available when "add_desert_material = true" has been added to minetest.conf. Overrides use of desert materials in desert biomes. Useful for transition regions.
All possible inventory icons:

License: CC0
Dependencies: default
Code and documentation:
Download: ...

I would also like to thank Mikola, who provided many of the ideas (along with code) that helped to make this release possible.

Re: Tunnelmaker

Posted: Mon May 21, 2018 20:33
by orwell
Hey, that looks cool!
May I link this in my mod's topic?
I haven't tried it yet, but looking at the screenshot, I see a problem. You just dig away nodes, but do not stabilize the tunnel walls and ceiling, so gravel might fall down on the tracks.
However, this definitely has potential!

Re: Tunnelmaker

Posted: Tue May 22, 2018 21:25
by kestral
Yes, please link in your mod topic. Thanks.

I also thought about the problem you brought up, which gave me some ideas to improve my code. Now I check the ceiling for blocks that can fall, before I dig, and convert them to cobblestone. Also while debugging this, it pointed out another issue I had with tunneling through blocks that can fall, which I also fixed.

Thanks for the comments. I've had a lot of fun with the advtrains mod.

Re: Tunnelmaker

Posted: Wed May 23, 2018 04:38
by Cage
I really like this mod. Been wanting a mod that would do this although I was using DigAll to do the same thing. Now with this mod it makes it easy to dig tunnels. Only problem I found is that it doesn't play nice with DigAll. Seems to be a conflict between the two. So I just disable one or the other depending on my needs.

Re: Tunnelmaker

Posted: Thu May 24, 2018 18:01
by kestral
Glad you liked it. I updated the mod so it now works with digall. I changed the digging function from dig_node to node_dig, based on checking which function matyilona200 used for the tunneltest mod. Thanks matyilona200! However, make sure that digall is disactivated before tunneling, or you'll create quite a mess.

Besides working with digall, this change also means that when tunneling, this mod will now pull in one copy of each type of block dug into the inventory, but only if it's not already there. It still digs if the inventory is full, but no blocks are collected. It also works the same for 0.4.16 and 0.5.0-dev—no more raining blocks in 0.5.0-dev.

Re: Tunnelmaker

Posted: Fri May 25, 2018 20:27
by orwell
How does it behave with protection?

Re: Tunnelmaker

Posted: Sat May 26, 2018 02:05
by kestral
Yes, I test for minetest.is_protected before executing node_dig and set_node functions, but to be honest, I haven't tested these protection features for a while.

Re: Tunnelmaker

Posted: Mon Jun 18, 2018 03:19
by kestral
I've added a new feature to tunnelmaker. I started updating the code to deal with the possibility of accidentally tunneling into water. Some of the digging patterns ended up being different, but when there is no water, the tunnel will end up almost exactly the same as before. (There are a couple of one-block fixes for slight imperfections in my older design.)

When there is water near the tunnel, I put a glass wall around the tunnel anywhere it's boundary is touching the water. I also replace any water within the tunnel with air, and put a temporary glass endcap at the end of the tunnel to keep water out during the tunneling process.

What this means is that it is now possible to effectively dig tunnels through water. Now you can easily run trains to your underwater sea bases.


Re: Tunnelmaker

Posted: Mon Jun 18, 2018 06:19
by Cage
kestral I am really liking this mod. By the way I found that is plays nice with DigAll and haven't had to disable DigAll. Just have to be careful not to use the sneak key when using Tunnelmaker. I have found many uses for this mod other then just digging tunnels. Thank you for all your hard work on this mod.

Re: Tunnelmaker

Posted: Thu Jun 21, 2018 21:13
by kestral
I've added a couple of new features to tunnelmaker. Since the original purpose of this mod was to make it easier to lay advtrains track, I thought that it would be good if it played more nicely with already placed advtrains track.
  • It will no longer dig dtrack nodes. (Previously all dtrack nodes within the digging window were removed.)
  • If a dtrack node is selected, a y-offset of -1 is applied before calling the dig function. This will keep the digging at ground level. (Previously it would dig 1 node above the ground, and place fill around the track.)
This should hopefully make it more useful for laying advtrains track, but shouldn't have any impact on non-train related usages.

Re: Tunnelmaker

Posted: Mon Jun 25, 2018 09:14
by orwell
You should probably check for the group 'advtrains_track' instead of hardcoding nodes

Re: Tunnelmaker

Posted: Wed Jun 27, 2018 03:56
by kestral
I updated the code to test for: 'minetest.registered_nodes[name].groups.advtrains_track == 1'.

While testing I discovered one exception: one can't use tunnelmaker directly on ATC track. That particular track overrides tunnelmaker's right click. It's still recognized as advtrains_track though, so it won't be deleted when tunnelmaker digs over it.

Re: Tunnelmaker

Posted: Wed Jun 27, 2018 07:13
by hajo
kestral wrote:new feature .. tunneling into water.
Does that feature handle other liquids too, such as lava and acid ?

Re: Tunnelmaker

Posted: Wed Jun 27, 2018 08:19
by orwell
kestral wrote:I updated the code to test for: 'minetest.registered_nodes[name].groups.advtrains_track == 1'.

While testing I discovered one exception: one can't use tunnelmaker directly on ATC track. That particular track overrides tunnelmaker's right click. It's still recognized as advtrains_track though, so it won't be deleted when tunnelmaker digs over it.
Try holding the Sneak key while clicking, it should work then

Re: [Mod] Tunnelmaker [tunnelmaker]

Posted: Fri Jul 20, 2018 18:47
by kestral
I updated first post to reflect the capabilities of the latest version of Tunnelmaker.
  • Added ability to dig up and dig down to support advtrains slope tracks.
  • Removed ability to dig tunnels through water.
This also makes it much easier to build simple stone bridges with the default fill feature. Before to make a bridge go down, one had to fly below the bridge to place an appropriate reference node. Now one just has to use the sneak key while right-clicking to set the digging mode to Down.

For these changes, I had to learn about using global variables in mods, and detecting keyboard input.

Hopefully my use of the sneak key won't interfere with too many other uses. Right now what I see is:
  • Can't set digging mode while flying — I don't see this as a problem.
  • Overrides digall use of sneak key when digging tunnels — This is probably for the better.
  • Can't use sneak key to override advanced trains ATC track's use of sneak key — It should be very rare to want to dig tunnel on one of these tracks.

Re: [Mod] Tunnelmaker [tunnelmaker]

Posted: Thu Oct 18, 2018 21:28
by kestral
I would like to thank Richard Jeffries for his video review of tunnelmaker. It's located at:

I've watched several other of his minetest videos and they're very good. I've got many more on my list of ones I want to watch. Check them out.

As to tunnelmaker, I've added a few configuration variables to allow the user to enable or disable various features. Some of these might be useful for people who use tunnelmaker without advtrains. Using the default values shouldn't give any significant changes from before.

The biggest option is that tunneling through water can now be enabled again. I added back and improved the code to put in the glass enclosure around the tunnel.

The others give the ability to disable the placement of the cobblestone reference nodes; disable placing torches, or adjust their spacing; and enable the ability to dig up or down continuously without having the mode reset each time.

These configuration variables can be changed by editing tunnelmaker's init.lua, near the top of the file.

Re: [Mod] Tunnelmaker [tunnelmaker]

Posted: Sat Dec 15, 2018 15:04
by Mikola
Do you plan in the near future to make changes in fashion?
Do you have a desire to consider Pull Requests if it appears?

Re: [Mod] Tunnelmaker [tunnelmaker]

Posted: Sun Dec 16, 2018 23:43
by Theone10
i thank i can have some fun with this

Re: [Mod] Tunnelmaker [tunnelmaker]

Posted: Sun Dec 16, 2018 23:45
by kestral
Mikola, I'm not sure what you mean by changes in fashion.

I cannot change the width of the tunnels without starting the code over again, but I realized that I could change the height, and make the "arches" optional. The code now has new config variables to set both of these, which I have checked in.

I will consider other changes, but my first priority is to support laying advtrains track, while keeping the operation of this mod as simple as possible. There are plenty of other tunneling mods that have more features, but are much more complex to use.

Re: [Mod] Tunnelmaker [tunnelmaker]

Posted: Sat Dec 29, 2018 19:04
by Mikola
kestral, I redid this mod for myself and added some useful features. ... ster-1.X.X
You can read and express your opinion: whether you want to deal with it or not.

At the moment, the and LICENSE.txt has not been corrected.
There is a problem with licenses.
I used part of the code from the mod Xray viewtopic.php?id=3191. This mod uses a GPLv3 license and when using this mod, the final project must also use a GPLv3 license.

Re: [Mod] Tunnelmaker [tunnelmaker]

Posted: Sun Dec 30, 2018 00:14
by kestral
Mikola, I've downloaded your version and have started to look at it, but wow, you've really done a lot.

I'm definitely going to take a close look at all your changes, but it's going to take some time.

Re: [Mod] Tunnelmaker [tunnelmaker]

Posted: Sun Dec 30, 2018 09:41
by Mikola
I believe that the next step is to learn how to store the values of variables individually for each user in players.sqlite. This will allow you to quickly change the modes of operation of the mod and will remove the need to restart the server when changing the values of variables. Perhaps this should be done after the release minetest 5.0.

I hope that in the future it will be possible to make game trains from this mod, capable of creating embankments and bridges, creating tunnels and laying the railway.

Re: [Mod] Tunnelmaker [tunnelmaker]

Posted: Thu Jan 03, 2019 20:35
by kestral
Mikola, I've incorporated your version with changes in the experimental branch of my github repo. Take a look and see what you think, but note that it's still a work in progress.

For others, know that tunnelmaker 2.0 is in the works, with many new features on the way. Stay tuned for more news.

Re: [Mod] Tunnelmaker [tunnelmaker]

Posted: Tue Jan 29, 2019 03:08
by kestral
Tunnelmaker 2.0 Beta, has now been merged into master branch.

Details moved to first post.

Re: [Mod] Tunnelmaker [tunnelmaker]

Posted: Wed Jan 30, 2019 18:24
by Mikola
kestral, I am glad that my work and ideas were useful to you.
I am also glad that you managed to realize saving the tunnelmaker settings separately for each player using the invocation of the settings menu. This will greatly facilitate teamwork.

Are you planning major changes in the branch "beta" in the near future?

Is planned to be used Version 2.0 only with minetest 5.0 and higher?
What do you think about adding localization for players from different countries? I added the ability to translate and translate into Russian for Version 2.0-beta-7 - 2019-01-26 with the new function minetest.get_translator(), but it will only work with minetest 5.0 and higher.
If you are interested in it, I will add a Pull request.