[Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

Post Reply
User avatar
Nigel
Member
Posts: 29
Joined: Fri May 03, 2019 09:08
GitHub: nyje
IRC: Nigel
In-game: Nigel
Location: Corinth, Greece

[Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by Nigel » Post

Symmetool Mirror
(c)2019 Nigel Garnett

A building tool for MineTest which places multiple blocks based on the current mode of its marker's symmetry settings.

Description & caveats:
It is designed to speed up building structures which have mirror symmetry in one, two or all three dimensions. It does this by mirroring nodes placed or dug with the tool in the X, Y & Z directions across a 'virtual mirror' which is marked by the tool placed 'in world'.

It can be used in creative mode, or in survival. For survival mode it soft depends on default for its crafting recipe:

Code: Select all

    "default:glass"        "default:steel_ingot"      "default:glass"
    "default:steel_ingot"  "default:meselamp"         "default:steel_ingot"
    "default:glass"        "default:steel_ingot"      "default:glass"
In survival mode, the materials the tool tries to use for building must be available in your main inventory somewhere.[/b]

It has only been tested on desktop but only uses the left/right mouse buttons, so should work fine on phones/tablets. In this case I believe "double tap"="right click" (how you place stuff) and "long tap"="left click" (how you dig stuff), although this is entirely untested ;-)

Testing has shown that protection mods are respected, the mod ***should*** be safe to use on multiplayer servers.

Basics:
Place the symmetry tool as you would any normal block. This creates the marker which will act as the mirror across which nodes will be mirrored.

At this stage (or any time the tool is not 'loaded' (see below)) the controls do the following:
  • Left clicking the node will remove it (or it can be dug as normal whilst holding almost any other node).
  • Right clicking on the node will cycle through the symmetry modes, which are shown visually, and in the in game chat. After ten seconds, the visual markers will disappear, but the node's infotext will indicate the mirroring mode.
  • Left clicking another node will load that node into the tool, and from now on right clicking will build with that node.
  • Right clicking another node will move the mirror node to the clicked position (you can only have one mirror node in world at any time).
From now on, until the tool is unloaded:
  • Right Click will place the loaded node in the world, and will also place a node on the opposite side of the mirror node, the same distance as you are from the mirror for every axis you have chosen.
  • Left Click will dig the node you are pointing at, and also dig the node in the mirrored positions for each axis.
  • Left clicking the sky (or nothing) will unload the tool so you can choose another node to build with.
Protection is respected for each individual node placement or removal, so the tool should be safe for multiplayer use.

Happy building ;-)


Screenshot & Video:
Image

Simple example build on YouTube

Dependencies:
It soft depends on minetest_game's default, but ONLY to provide the crafting recipe and to check for survival mode. It should operate without issue on any creative server.

License:
MIT


Downloads & source code:

Symmetool on Github

Symmetool on ContentDB

Or as a good old fashioned zip file:
symmetool-1.6.zip
v1.6 Ready for action version
(11.81 KiB) Downloaded 60 times
Last edited by Nigel on Thu Nov 28, 2019 10:44, edited 11 times in total.
My Published Mods: Visual Bots | Symmetool Mirror

User avatar
Nigel
Member
Posts: 29
Joined: Fri May 03, 2019 09:08
GitHub: nyje
IRC: Nigel
In-game: Nigel
Location: Corinth, Greece

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by Nigel » Post

Ok, Here is a really quick and simple example video showing the Symmetool in use, making a small building which is symmetrical accross the X & Z axes. (link goes to my new youtube minetest channel)

It is also live on our server "A D V E N T U R E T I M E" which needs a password to enter.
Look the server up on the serverlist & read the information to get the password.
My Published Mods: Visual Bots | Symmetool Mirror

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by texmex » Post

This is brilliant!

User avatar
Nigel
Member
Posts: 29
Joined: Fri May 03, 2019 09:08
GitHub: nyje
IRC: Nigel
In-game: Nigel
Location: Corinth, Greece

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by Nigel » Post

Thanks ;-)

I got fed up repeating myself on castle & tower builds...
My Published Mods: Visual Bots | Symmetool Mirror

User avatar
Melkor
Member
Posts: 372
Joined: Sat Sep 24, 2011 01:03
Location: Underground

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by Melkor » Post

this is truly a really, really, good tool, thanks for sharing!

User avatar
BuckarooBanzay
Member
Posts: 437
Joined: Tue Apr 24, 2018 05:58
GitHub: BuckarooBanzay
IRC: BuckarooBanzai
In-game: BuckarooBanzai

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by BuckarooBanzay » Post

Oooh, this is an awesome idea! :O
¯\_(ツ)_/¯ Not active here anymore, contact me on the minetest discord, irc, lemmy or github (for programming issues)

User avatar
Nigel
Member
Posts: 29
Joined: Fri May 03, 2019 09:08
GitHub: nyje
IRC: Nigel
In-game: Nigel
Location: Corinth, Greece

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by Nigel » Post

@Melkor & @BuckarooBanzay

Thanks guys, and you're welcome. The praise & thanks means a lot coming from such talented modders ;-)

Several of my previous servers would not have been the same without your smart mods...
My Published Mods: Visual Bots | Symmetool Mirror

User avatar
rubenwardy
Moderator
Posts: 6977
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by rubenwardy » Post

This is pretty cool. Do you plan to make it consume nodes and have a craft recipe so it can be used in creative?
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

CalebJ
Member
Posts: 407
Joined: Sat Dec 29, 2018 19:21
GitHub: KaylebJay
IRC: KaylebJay
In-game: CalebJ
Location: Tunnelers' Abyss

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by CalebJ » Post

Mmmm... very interesting. Great work!!

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Symmetool Mirror - Build helper [symmetool]

by texmex » Post

rubenwardy wrote:This is pretty cool. Do you plan to make it consume nodes and have a craft recipe so it can be used in creative?
You mean survival?

User avatar
Nigel
Member
Posts: 29
Joined: Fri May 03, 2019 09:08
GitHub: nyje
IRC: Nigel
In-game: Nigel
Location: Corinth, Greece

Re: [Mod] Symmetool Mirror - Build helper [v1.5][symmetool]

by Nigel » Post

@rubenwardy: thanks. I did not have plans to add survival mode, but have now done so.

@CalebJ: Thanks a lot for the kind words...

@texmex: I assumed he did ;-)

@all: NEW VERSION AVAILABLE - v1.5

The mod should now work in Survival or Creative mode.
see the1st post for github link, or grab it from ContentDB.

Happy Building ;-)
My Published Mods: Visual Bots | Symmetool Mirror

User avatar
Nigel
Member
Posts: 29
Joined: Fri May 03, 2019 09:08
GitHub: nyje
IRC: Nigel
In-game: Nigel
Location: Corinth, Greece

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by Nigel » Post

New release v1.6
  • Improved handling of resources in survival mode
  • further checks to respect protection; all operations will succeed in protected areas, but nothing will be dug or placed.
  • code refactoring in main functions to squash those pesky bugs.
Please refer to the 1st post for download options.

I am now not aware of any outstanding bugs in the mod, so please, if you find any problems with the code, go here to report them.

If you have any suggestions, comments or feature requests, feel free to post them here.

Happy Building ;-)
My Published Mods: Visual Bots | Symmetool Mirror

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by texmex » Post

As a simplification, would it be possible to have a placement of the symmetry node as the only requirement for mirroring? What I mean is that, technically, if a node is placed within a radius of the center symmetry node then it is automatically mirrored in the directions , without the need to also wield it at all. Modes can be toggled on the center node directly.

User avatar
Codesound
Member
Posts: 365
Joined: Thu Jun 09, 2016 14:56

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by Codesound » Post

+1

Thanks for this useful idea!!! Amazing!!! And also for your videotutorial.... many mods would need these videos to illustrate their use!

Thanks again....

User avatar
Nigel
Member
Posts: 29
Joined: Fri May 03, 2019 09:08
GitHub: nyje
IRC: Nigel
In-game: Nigel
Location: Corinth, Greece

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by Nigel » Post

@codesound: thanks for the complementary remarks.As to the video, I was just worried people wouldn't understand what on earth this mod was for from my bad descriptions ;-)

@texmex: possible? yes of course... anything is possible ;-) However I'm unlikely to go that way unless someone gives me a brilliant & efficient method to do so...

All the ways I could think of doing it without a handler tool ended up way too inefficient, as I would basically have to watch the on_place of EVERY node (messy) or use a global callback or timer to keep an eye on the whole area for new blocks (inefficient).

Hence we have the placer tool (which was inspired by the build helpers on the fantastic 'Inside the Box' server by Nore and Sofar).

I am of course open to any ideas anyone may have as to how it could be done, as it would be nice, and simpler. You are of course welcome to try to get it to work yourself ;o)
Last edited by Nigel on Tue Nov 26, 2019 20:15, edited 1 time in total.
My Published Mods: Visual Bots | Symmetool Mirror

User avatar
BuckarooBanzay
Member
Posts: 437
Joined: Tue Apr 24, 2018 05:58
GitHub: BuckarooBanzay
IRC: BuckarooBanzai
In-game: BuckarooBanzai

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by BuckarooBanzay » Post

Nigel wrote: All the ways I could think of doing it without a handler tool ended up way too inefficient, as I would basically have to watch the on_place of EVERY node (messy) or use a global callback or timer to keep an eye on the whole area for new blocks (inefficient).
There is

Code: Select all

minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing))
Reference: https://github.com/minetest/minetest/bl ... .txt#L4094

It is not recommended to use it, but it fits the exact use case... ¯\_(ツ)_/¯
¯\_(ツ)_/¯ Not active here anymore, contact me on the minetest discord, irc, lemmy or github (for programming issues)

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by texmex » Post

Why is it recommended against? It’s a good method imo.

User avatar
rubenwardy
Moderator
Posts: 6977
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by rubenwardy » Post

It's better to use register_on_placenode if you want to be alerted to the placement of any node. The bigger problem is finding whether the node is placed in a symmetric region, but I'd avoid premature optimisation and just do a simple node search to begin with
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by texmex » Post

How about storing the position of symmetry nodes is mod storage as soon as they’re placed? By doing so the first step in the added register_on_placenode logic would cost near nothing (checking for the existance of any placed symmetry node at all). If there’s a known node’s pos stored, then check whether the newly placed normal node is in range of a symmetry node. If so, mirror it.

But yes, rubenwardy’s idea is a good first step!

User avatar
rubenwardy
Moderator
Posts: 6977
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by rubenwardy » Post

texmex wrote:How about storing the position of symmetry nodes is mod storage as soon as they’re placed?
On large servers, this could cause a large linear search. And it's a pain to keep updated. It's worth doing something simple and using the profiler to check the mod's performance impact.

get_node is slow mostly because of the time it takes to go between C++ and Lua. Using a single function like get_node_near or get_node_in_area will not have this issue
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
Nigel
Member
Posts: 29
Joined: Fri May 03, 2019 09:08
GitHub: nyje
IRC: Nigel
In-game: Nigel
Location: Corinth, Greece

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by Nigel » Post

@BuckarooBanzay:
indeed, it's the perfect use case, but as rubenwardy notes, on a server even an N style problem gets slow, fast. But you know that and I'm sure there was a /s missing from your comment ;-) Oh no, wait, nothing was missing ;-)

@rubenwardy & @texmex
Indeed, I had considered most of these points, but BOY, thanks for the input. I was gonna have a limited set of 'symmetricable' nodes in a lookup table or tree, but thought better of it in the end, and decided the open endedness and speed (excepting my poor quality code) of the tool based solution was the best bet.. especially considering the HUGE number of registered nodes on my current live server, I didn't want to slow down building operations in general for a specific use tool.

As an aside, we just had several players building with it simultaneously on ADVENTURETIME with no issue at all, and my VPS is rather under-powered right now due to lack of funds...

@rubenwardy:
I get the hint, and I agree, the code needs much optimization at this point, It was a proof of concept. I can reduce MANY of the expensive calls or remove them altogether. Thanks for the input, your code and your explanations in the modding book has been a big part how I could make this mod in the first place ;-)
My Published Mods: Visual Bots | Symmetool Mirror

User avatar
Codesound
Member
Posts: 365
Joined: Thu Jun 09, 2016 14:56

Re: [Mod] Symmetool Mirror - Build helper [v1.6][symmetool]

by Codesound » Post

Hi,
using this beautiful tool, Minetest 5.5 crashes when I place it on the snow layer (not on the snow cube, but on the one that has settled on top); it's possible to fix?

Code: Select all

AsyncErr: Lua: Runtime error from mod '' in callback item_OnPlace(): Invalid position (expected table got nil).
stack traceback:
  [C]: in function 'get_meta'
  /home/kernel00/.minetest/mods/symmetool/init.lua:171: in function 'inform_state'
  /home/kernel00/.minetest/mods/symmetool/init.lua:261: in function 'after_place_node'
  /usr/share/minetest/builtin/game/item.lua:414: in function </usr/share/minetest/builtin/game/item.lua:293>

thanks again

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 11 guests