[Mod] Bridge Tool [bridgetool] -- for easy bridge building

Kilarin
Member
 
Posts: 712
Joined: Mon Mar 10, 2014 00:36

[Mod] Bridge Tool [bridgetool] -- for easy bridge building

by Kilarin » Sun Apr 20, 2014 23:24

Bridge Tool Version 2.2
This mod adds a new "bridge tool" that makes placing stone (or glass, earth, or any material) while building a bridge in no-fly mode easy.

The bridge tool has 3 modes that can be switched by left clicking with the tool.
And you can switch the WIDTH of the path built by holding down the SNEAK key and left clicking.
Image
The inventory image changes with the mode indicates exactly how the bridge tool builds in that mode. For width of 2 and 3 you will note either 2 or 3 little blue squares appear below the main image to let you know what the width is.

On a right click, the bridge tool will attempt to use whatever material is in the inventory slot directly to the right of the bridge tool to build in the direction indicated by the mode

In mode 1 it will build FORWARD in a straight line:
Image
This saves you a lot of time pressing the sneak button and leaning over the edge so you can click on the outward face of the node. Please note that the bridge tool can build out in any of the 4 directions depending on what way you are facing when you right click.

In mode 2 the bridge tool builds DOWN diagonally:
Image
This is perhaps the most important function of the bridge tool because what seems like it should be simple, building down from a bridge you are standing on, is virtually impossible without this tool.

In mode 3 the bridge tool builds UP diagonally:
Image
This is not hard to do without the tool, but using the tool saves you several steps.

And when you select a width of 2 or 3 by holding down the sneak button and left clicking the tool will build a path of that width:
Image
Image

If the bridge tool can not build where you asked it to, or if it runs out of material in the stack to the right of the tool, it will notify you of the problem via chat message.

The bridge tool is crafted using 3 steel ingots in a v shape, and one mese crystal:
Code: Select all
steel ingot,                     ,steel ingot
           ,    steel ingot      ,
           ,mese crystal fragment,

Image
The inventory image will switch from the tool itself to the mode image the first time you left click with the tool.

The bridge tool automatically orients stairs in the proper direction. When building a 3 node wide stair, the tool will ensure that all stairs point the correct direction. And when building forward, the tool will orient the stair downward.

And the bridge tool is now configured to wear out. If you wish to implement this feature edit the init.lua and change the value of WEAR_PER_USE from 0 to whatever you wish. (Max wear is 65535 and wear will be applied for each node of width of the path you are building)

Video:
Excalibur Zero created a video demonstrating this mod:
https://www.youtube.com/watch?v=j2E9ojtyitc

Author: Kilarin (Donald Hines)

Credits:
My son helped me with some ideas for this mod. I got a lot of code examples from the screwdriver mod in minetest_game by RealBadAngel, Maciej Kasatkin. I also copied and modified the screwdriver's mode number images for use in the bridge tool inventory images.
Topywo suggested adding wear, correcting down stair orientation, and using not_in_creative_inventory. Sokomine suggested adding width so that you could build 2 or 3 wide.

Dependencies:
soft depends on default, but without default you have no recipe.

Incompatibilities:
Problems have been reported when using this mod with inventory tweak

License:
code CC0, textures CC BY-SA 3.0

github source:
https://github.com/Kilarin/bridgetool

Download:
https://github.com/Kilarin/bridgetool/archive/master.zip

To install:
Simply unzip the file into your mods folder, then rename the resulting folder from bridgetool-master to bridgetool
OR, simply install it directly from minetest using the online mod repository.

Mod Database:
If you use this mod, please consider reviewing it on the MineTest Mod Database.
https://forum.minetest.net/mmdb/mod/bridgetool/

Changelog
--Version 2.2
Added new global enable_chat_warn at top of init.lua that can be set to NO if you don't want bridgetool warning messages to appear in chat.
Removed dependency upon default. Put the recipie inside an if checking for default so that in the unlikely case someone is running this without default, they still could. they would just have to use /giveme or creative mode to get the tools
Corrected two undeclared globals to locals.
Renamed the git repository to bridgetool-master to be in line with other mods.

--Version 2.1
Corrected fact that 3 wide stairs would sometimes orient the 3rd stair the wrong way
Modified stair orientation when using mode 1(forward) so that the stair will face down (since the only reason you would use the "forward" option with this tool and a staircase is to begin a down stair.)

---Version 2.0
Added width of 2 or 3
corrected down stair orientation
added not_in_creative_inventory=1 to all of the "mode" versions of the tool
added wear option

---Version 1.0
Initial release
Last edited by Kilarin on Tue Dec 30, 2014 16:48, edited 6 times in total.
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Sokomine » Sun Apr 20, 2014 23:37

At first I thought "oh, another bridge tool". I did an auto-building bridge as one of my first mods - only to discover a day or so later that it had been done already by someone else before that, But your mod is diffrent. Perhaps it ought to be called...path tool or something like that.

The images of the actual "bridge" beeing built are not very favorable - they show too much cobble. People sometimes tend to pile that up and do not remove those piles...so I'm always a bit suspicious about cobble showing up. However, your mod might also be very useful for somethinig even more: Building roofs. I always find it annoying and usually use my replacer mod in order to copy the orientation of the stairs. With your tool, creating roofs might be a lot easier.

It could also be very helpful to build roads to help people explore a server. For such situations, adding blocks to the side of the road automaticly could help. Roads are commonly 2 or 3 blocks wide.
 

Kilarin
Member
 
Posts: 712
Joined: Mon Mar 10, 2014 00:36

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Kilarin » Sun Apr 20, 2014 23:45

Sokomine wrote:At first I thought "oh, another bridge tool"

I wouldn't be surprised if someone has done a mod that works very similar to this one, it is a pretty simple idea. But I didn't find one on my initial search and figured that building this would be good practice.

Sokomine wrote:The images of the actual "bridge" beeing built are not very favorable - they show too much cobble.

Will build with anything, of course, so I can change the images.

Sokomine wrote:However, your mod might also be very useful for somethinig even more: Building roofs.

Yep, it could be used in a lot of different kinds of building projects.

Sokomine wrote:It could also be very helpful to build roads to help people explore a server. For such situations, adding blocks to the side of the road automaticly could help. Roads are commonly 2 or 3 blocks wide.

That's an interesting idea. Would be pretty easy to code, just need to decide whether it should be a separate tool or how best to control the width.
 

User avatar
Evergreen
Member
 
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Evergreen » Mon Apr 21, 2014 00:48

Nice idea! I don't know how many times I've had to bridge down and have to pillar up to make a stair downwards.
 

User avatar
Krock
Developer
 
Posts: 4148
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Krock » Mon Apr 21, 2014 07:00

Well, It's a nice tool. With this way, it's possible to make a stairway to heaven. Or simple: nerdpoles in a diagonal scale.
 

User avatar
Topywo
Member
 
Posts: 1720
Joined: Fri May 18, 2012 20:27

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Topywo » Mon Apr 21, 2014 08:56

Krock wrote:a stairway to heaven


That came up in my mind too.

I tried the mod. It works very well (although I needed some time to get used to choose the tool instead of the blocks to place the blocks).

Three (minor) suggestions:
- For the three bridgetool_modes you could use groups = {not_in_creative_inventory=1}
- For survival adding 'wear' would be an option
- Is it possible (without going through too much trouble) to make stairs going downwards get the right placement angle?

This mod is a real addition for minetest.
 

Kilarin
Member
 
Posts: 712
Joined: Mon Mar 10, 2014 00:36

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Kilarin » Mon Apr 21, 2014 14:25

Topywo wrote:(although I needed some time to get used to choose the tool instead of the blocks to place the blocks

Yep, that takes some getting used to.

Topywo wrote:For the three bridgetool_modes you could use groups = {not_in_creative_inventory=1}

Pardon my extreme ignorance, but I don't quite understand what you mean here.

Topywo wrote:For survival adding 'wear' would be an option

I didn't put wear on the tool because I was thinking that normally PLACING blocks is not something that cost you wear. But you are absolutely right, it should at least be an option that can be easily turned off or on in the init.lua. I'll set it up that way, and set the default whichever way most people think it should be.

Topywo wrote:Is it possible (without going through too much trouble) to make stairs going downwards get the right placement angle?

I never even tested with stairs. That is a good point. I'll see if I can make that work.

Thanks for trying the mod, and thanks for the suggestions!
 

User avatar
Topywo
Member
 
Posts: 1720
Joined: Fri May 18, 2012 20:27

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Topywo » Mon Apr 21, 2014 19:21

You're welcome!

Kilarin wrote:
Topywo wrote:For the three bridgetool_modes you could use groups = {not_in_creative_inventory=1}

Pardon my extreme ignorance, but I don't quite understand what you mean here.


My fault, I wasn't clear. By adding "not_in_creative_inventory=1" in the description of the 3 different bridgetool modes, they don't appear in the creative inventory.

Example:
Code: Select all
for i = 1, 3 do
  minetest.register_tool("bridgetool:bridge_tool"..i, {
    description = "Bridge Tool mode "..i,
    inventory_image = "bridgetool_m"..i..".png",
    wield_image = "bridgetool_wield.png^[transformR90",
   groups = {not_in_creative_inventory=1},
    on_place = bridgetool_place,
    on_use = bridgetool_switchmode
  })
end
 

Kilarin
Member
 
Posts: 712
Joined: Mon Mar 10, 2014 00:36

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Kilarin » Mon Apr 21, 2014 19:27

Topywo wrote:By adding "not_in_creative_inventory=1" in the description of the 3 different bridgetool modes, they don't appear in the creative inventory.

Oh, DUH! That makes sense! Will fix.
 

User avatar
ak399g
Member
 
Posts: 160
Joined: Tue Jul 30, 2013 02:36
In-game: SAFR

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by ak399g » Mon Apr 21, 2014 21:16

Haven't tried yet but intend to. This looks so incredibly useful! I've been needing this for a while.
 

Kilarin
Member
 
Posts: 712
Joined: Mon Mar 10, 2014 00:36

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Kilarin » Tue Apr 22, 2014 03:59

Version 2.0 is now available.
Changes:
You can now build a path 2 or 3 nodes wide with the bridge tool. Change the tools width by holding down the sneak key and left clicking.

Down stairs should orient correctly when placed with the build tool. Be aware that if you are building a path 3 wide, the third stair will sometimes rotate in the wrong direction. I think I know how to fix that and will get it into a future update.

The tools for the different modes and widths all specify not_in_creative_inventory=1 now.

The bridge tool can now be configured to wear out if you wish. Just edit the init.lua and change the WEAR_PER_USE constant from 0 to whatever value you wish.

And I updated the screen shots in the main post. I swear it takes me longer to cobble together some screen shots than to write the code. As is obvious from my 2 mods so far, graphics are NOT my strong point. :)

Thank you to everyone who's tried the mod, and especially thanks to those offering advice and suggestions. I'm brand new to Lua scripting and minetest, so any further advice or critiques of the code are most welcome.
 

User avatar
Topywo
Member
 
Posts: 1720
Joined: Fri May 18, 2012 20:27

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Topywo » Tue Apr 22, 2014 09:36

Kilarin wrote:I swear it takes me longer to cobble together some screen shots than to write the code.


Just wait until you start to make more crafting recipes and want to show them ;-)

Building a stair downwards and broader blocks work fine, thanks. I hope you solve the right placement of stairs, but even without that this mod is already very good. I expect it to appear on at least a few servers.

P.s. I don't know if it's obligated, but you could put your license also in your readme.txt.
 

User avatar
Excalibur Zero
Member
 
Posts: 142
Joined: Tue Apr 02, 2013 19:45
Location: United States
GitHub: ExcaliburZero
 

Kilarin
Member
 
Posts: 712
Joined: Mon Mar 10, 2014 00:36

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Kilarin » Tue Apr 22, 2014 23:10

Topywo wrote:P.s. I don't know if it's obligated, but you could put your license also in your readme.txt.

The license IS in the readme, do I need to pull it out of the paragraph it is in and make it more obvious?

Excalibur Zero wrote:I put together this video on it

Thank you very much! I linked to your video in the main description above.

VERSION 2.1 is loaded above now.

This fixes the stair orientation glitch. The problem was that stairs always orient facing UP from the player. But when building 3 wide, sometimes the third stair was far enough to the side that it would turn sideways. The tool now ensures that all stairs face the same direction no matter what the width. I also made forward stairs orient downward since the only reason to ever place a stair in forward mode is the beginning of a downward stair case.

Thank you everyone for your help and suggestions. As I've said before, any suggestions or critique is most welcome.
 

Sokomine
Member
 
Posts: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Sokomine » Wed Apr 23, 2014 02:32

Kilarin wrote:And I updated the screen shots in the main post. I swear it takes me longer to cobble together some screen shots than to write the code. As is obvious from my 2 mods so far, graphics are NOT my strong point. :)

Oh yes, I know that problem :-/ And the worst thing is that image hosters I kept using kept disappearing, so most of my mod topics are now without pictures, and I need to re-upload them. Hope to find that time soon.

Thanks for the nice tool!
 

User avatar
ak399g
Member
 
Posts: 160
Joined: Tue Jul 30, 2013 02:36
In-game: SAFR
 

Kilarin
Member
 
Posts: 712
Joined: Mon Mar 10, 2014 00:36

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Kilarin » Wed Apr 23, 2014 12:01

Thank you Sokomine! I think your suggestion for building a path 2 or 3 wide is a great improvement!

ak399g wrote:IS this compatible with node/area protection mods?

I THINK so. Since I use minetest.item_place and minetest.dig_node, both of which include logic that checks minetest.is_protected. Although the minetest.dig_node check is redundant in this case because I only dig a node after I've successfully placed it.

I don't check for protection before swapping the orientation of the stairs, but I don't think that should matter since I use item_place to PUT the stairs there in the first place. So if the node was protected, it would never have been able to place the stairs in the first place.

So I think this is compatible with area protection, but if I'm missing any steps I needed to do, PLEASE let me know!


<note:> For anyone who is wondering, "Why on earth is a tool that only builds using dig_node???" The reason is that I had trouble with minetest.item_place refusing to build diagonally from air. It appeared to need another node in place to attach the new node to. So both the up and the down modes first place a node forward, then switch pointed.under to that forward node and pointed.above to either below(mode 2) or above(mode 3) that node and then use item_place to place the diagonal node. And after the diagonal node that we wanted is placed, I use dig_node to remove the unwanted extra forward node (which automatically places it back in in your inventory)
 

User avatar
Topywo
Member
 
Posts: 1720
Joined: Fri May 18, 2012 20:27

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Topywo » Wed Apr 23, 2014 13:20

Kilarin wrote:
Topywo wrote:P.s. I don't know if it's obligated, but you could put your license also in your readme.txt.

The license IS in the readme, do I need to pull it out of the paragraph it is in and make it more obvious?


No, not for me at least. My mistake, using leafpad and not scrolling to the right.

Kilarin wrote:This fixes the stair orientation glitch.


Works perfectly pleasant now!
 

User avatar
Calinou
Moderator
 
Posts: 3145
Joined: Mon Aug 01, 2011 14:26
Location: Troyes, France
GitHub: Calinou
IRC: Calinou
In-game: Calinou

Re: [mod] Bridge Tool (makes building bridges easy) [bridget

by Calinou » Mon May 05, 2014 09:07

Fun fact: a while ago (2 to 3 years ago), a C++ patch proposed such a thing but it was rejected (I don't remember the reason, but maybe you can find it in the IRC logs, probably in #minetest-dev).
 

User avatar
mimilus
Member
 
Posts: 75
Joined: Thu Mar 06, 2014 09:08
Location: France
GitHub: mimilus
IRC: Mimilus
 

Kilarin
Member
 
Posts: 712
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Bridge Tool [bridgetool] -- for easy bridge buildi

by Kilarin » Mon May 05, 2014 17:52

Calinou wrote:Fun fact: a while ago (2 to 3 years ago), a C++ patch proposed such a thing but it was rejected

I'm confused. Why would you build something like this into the engine? Tools are built in lua for minetest. Or am I misunderstanding you?

Mimilus wrote:I like it :)

I'm glad you are finding it useful! I find am using it all the time when building now.
 

Kilarin
Member
 
Posts: 712
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Bridge Tool [bridgetool] -- for easy bridge buildi

by Kilarin » Wed Jun 11, 2014 04:24

BridgeTool is now correctly uploaded to the minetest mod database. https://forum.minetest.net/mmdb/mod/bridgetool/

This should make it easy to install directly from MineTest. If you use it and like it (or not), please feel free to rate/review it there.
 

User avatar
Wuzzy
Member
 
Posts: 3243
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Bridge Tool [bridgetool] -- for easy bridge buildi

by Wuzzy » Thu Jun 12, 2014 14:27

Great tool! It is really useful to build floating islands and stuff, as the sneaking way is just annoying. I was honestly looking for a mod like this. Thanks!

There are just two minor downsides, without thse this mod would be perfect for me:
  • It depends on default. If I see correctly, this is only because of the crafting recipe. In that case, you can make the dependency optional easily by enclosing the crafting recipe registration function in “if minetest.get_modpath("default") ~= nil then --[[ code goes here ]] end” and changing depends.txt to “default?”.
  • The chat is cluttered when something went wrong. I don’t like it to abuse the chat for gameplay things and I think this is an ugly solution. May I suggest to use sound effects (to the player) instead?
 

Kilarin
Member
 
Posts: 712
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Bridge Tool [bridgetool] -- for easy bridge buildi

by Kilarin » Fri Jun 13, 2014 01:15

Wuzzy wrote:Great tool!

I'm glad you are finding it useful!

Wuzzy wrote:It depends on default. If I see correctly, this is only because of the crafting recipe. In that case, you can make the dependency optional easily by enclosing the crafting recipe registration function in “if minetest.get_modpath("default") ~= nil then --[[ code goes here ]] end” and changing depends.txt to “default?”.

Please pardon my ignorance and educate me further, because I obviously need it. I thought that EVERYTHING depended on default. If I define the recipe only if default exists, then how will anyone craft the item? Do you mean they would be able to use it in creative mode without default?

Wuzzy wrote: I don’t like it to abuse the chat for gameplay things and I think this is an ugly solution

I LIKE using chat, because I can give more information that way. I'm afraid a lot of players might not have much information on how the item works, and while a beep might just leave them confused, with a chat message I can make it clear to them exactly what is wrong and what they need to do to fix it. I'm a programmer. I LOVE long, extensive, and detailed error messages. :)

However, when I was working on it I figured there might very well be people who didn't like all the chat messages, and that I ought to put a flag at the top of the init.lua that would allow the user (or server admin) to turn them off. Should have done it, will do it now.

Also, I think using sounds to indicate problems is certainly a great idea. I've never played with sound, but my son was messing with an example the other day. I'll add that in.
 

User avatar
Wuzzy
Member
 
Posts: 3243
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Bridge Tool [bridgetool] -- for easy bridge buildi

by Wuzzy » Fri Jun 13, 2014 04:19

Kilarin wrote:Please pardon my ignorance and educate me further, because I obviously need it. I thought that EVERYTHING depended on default. If I define the recipe only if default exists, then how will anyone craft the item? Do you mean they would be able to use it in creative mode without default?

First: The default mod is not a mandatory dependency. It is perfectly possible to write mods which do not depend on default. The default mod does not define so much stuff actually. It defines a most (not all!) the nodes and items you find in the community wiki, crafting recipes, a lot of ABMs (like leaf decay), the player model and a tiny part of the GUI (heart image, bubble image, stuff like that). But it is not everything in minetest_game, that’s what the other mods are for.

Of course the recipe itself needs default, because the components come from default. However, as I said, the mod would be is still usable without any recipe. Of course you can’t craft the item without a crafting recipe. But you already said it can be useful in some creative mode. The commands /give and /giveme are always available, regardless of any mod. Apart from that, other mods may introduce other ways to obtain any item, even inside the gameplay. Think of trading mods or stuff like that. Even crazier, other mods may depend on your mod and create their own crafting recipe. OK this is a bad example.
Now consider some server uses a different game than minetest_game. Then the default mod is not present and is would practically not be possible to activate it. Thus, no bridge tool for any game except minetest_game (and maybe minetest_game clones). But if default is present, it is safe to add the crafting recipe, because: why not? xD. That’s why I am arguing for an optional dependency.
The bridge tool is useful on its own, especially for creative servers.




Adding a flag may be a good idea, I suggest to set it to off just for release versions.
Oh, before I forget: I am okay with the very first bridge tool message. I think this is neccessary, especially if this mod is used on random servers with random players around.
 

Next

Return to Mod Releases



Who is online

Users browsing this forum: Mikola and 12 guests