[Mod] Hexagonal* Prisms [hex]

Post Reply
Schnux
New member
Posts: 7
Joined: Thu Oct 11, 2018 21:53
GitHub: Schnux2

[Mod] Hexagonal* Prisms [hex]

by Schnux » Post

I once read in the Minetest modding book that before releasing a mod, one should think about whether it is useful. This mod isn't.
But it is fun to play with it.


* Technically, they are not hexagonal, but dodecagonal, but I still prefer this name because it just sounds better and seems easier to imagine.

Since I am totally new to this forum, I may introduce myself, but there is not very much to say. As you will see when you read further, my largest motivation for playing Minetest is that I have way too much free time. I am an unskilled programmer and a horrible texture designer. English is not my mother tongue, please correct me if I make mistakes.

Presenting...

hex (version 0.1)! (Imagine a dramatic fanfare here.)

Image

description.txt says "This mod adds prisms with a hexagonal base area which behave similar to nodes." And that's it, basically.
I got a bit bored by all those cubes, so I added prisms. They are entities, technically, and "similar to nodes" is an exaggeration (no ABMs, no VoxelManip, no digging animation), but you can build houses out of them - if Minetest doesn't decide that there are too much entities in some area and removes all of them.
This mod adds a simple API described in api.txt for adding your own prisms and already registers two prisms: Basalt and a Basalt slab.

License:
The parts of the code which were written by me, Schnux: LGPL 2.1.
I copied and adjusted some lines from the "carts" and "stairs" mod from Minetest Game, this is documented in the readme.
Media, all by myself: CC BY-SA 3.0.

How to install:
Download and decompress the folder which is attached to this post, if necessary, rename it to "hex" (that is how it should already be called), and put it into the "mods" subfolder of your Minetest folder. (If you only want this to be used in a single world, place the folder in worldmods/ in your world directory.)
For further information or help see http://wiki.minetest.com/wiki/Installing_Mods.

Dependencies:
None.

Download:
https://github.com/Schnux2/hex/archive/master.zip or the attachment below

View Source:
https://github.com/Schnux2/hex

If you encounter any problem or need help, just write something into this forum topic or write an e-mail to schnux@gmx.de.

(Edit 1: Added screenshot
Edit 2: added Github and another download link
Edit 3: solved the error reported by DS-minetest below and updated the attachments)
Attachments
hex.zip
(790.64 KiB) Downloaded 47 times
small_screenshot.png
small_screenshot.png (218.31 KiB) Viewed 600 times
Last edited by Schnux on Sat Oct 13, 2018 21:40, edited 3 times in total.

User avatar
Andrey01
Member
Posts: 2577
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: [Mod] Hexagonal* Prisms [hex]

by Andrey01 » Post

Screens please?

Schnux
New member
Posts: 7
Joined: Thu Oct 11, 2018 21:53
GitHub: Schnux2

Re: [Mod] Hexagonal* Prisms [hex]

by Schnux » Post

Of course.

Schnux
New member
Posts: 7
Joined: Thu Oct 11, 2018 21:53
GitHub: Schnux2

Re: [Mod] Hexagonal* Prisms [hex]

by Schnux » Post

Update: Github link added for those who just want to look at the source code.

User avatar
Desour
Member
Posts: 1473
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [Mod] Hexagonal* Prisms [hex]

by Desour » Post

You can do this with nodes. Just use the mesh drawtype here and add the name of your model here. Don't forget to set paramtype to "light".
Oh, and there's already a vector.round in minetest builtin, you don't need to add it yourself.
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

Schnux
New member
Posts: 7
Joined: Thu Oct 11, 2018 21:53
GitHub: Schnux2

Re: [Mod] Hexagonal* Prisms [hex]

by Schnux » Post

No! Please just download the mod, then you will see the difference to normal nodes. The point of this mod is that their positions do not have to be on whole-integer coordinates (are they called like that?), but you can build structures like this:
Spoiler
Image
If they would have to have integer coordinates, the best result of an attempt to build an almost hexagonal* shape out of small hexagonal* meshes I could imagine would be this:
Spoiler
Image
By the way, with only-integer coordinates (normal nodes), not even such a simple shape would be possible (with prisms of a reasonable size):
Spoiler
Image
The prisms have to have non-integer coordinates to form such a shape.
(The distance from the middle point of one prism to the middle point of the next prism in x-direction (left/right on the picture) is not the width of a node, but (square_root(3)) /2 (≈0.866) times the width of a node.)

As far as I know, all this is not possible with nodes - please correct me if I am wrong!

My own hex.vector_round is also different to the builtin vector.round because it rounds the x- and z-coordinates to integers and integers+0.5 instead of only to integers, but it isn't even actually used.
Attachments
screenshot_20181013_230604.png
screenshot_20181013_230604.png (54.2 KiB) Viewed 600 times
screenshot_20181013_230306.png
screenshot_20181013_230306.png (143.82 KiB) Viewed 600 times
screenshot_20181013_223931.png
screenshot_20181013_223931.png (134.81 KiB) Viewed 600 times

User avatar
Desour
Member
Posts: 1473
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [Mod] Hexagonal* Prisms [hex]

by Desour » Post

Oh, ok.
Doesn't dofiling "\\test.lua" cause a crash for you? It has to be "/test.lua" (or DIR_DELIM.."test.lua").
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

Schnux
New member
Posts: 7
Joined: Thu Oct 11, 2018 21:53
GitHub: Schnux2

Re: [Mod] Hexagonal* Prisms [hex]

by Schnux » Post

No, it doesn't cause a crash (I still play on Minetest 0.4.16, may this be the reason?).
I still changed it because it works in my Minetest version also with DIR_DELIM and if it crashed yours, that's definitely a thing to fix.

User avatar
maxx
Member
Posts: 44
Joined: Thu Feb 15, 2018 15:24
GitHub: maxhipp
In-game: maxx or max
Location: Germany | Bavaria

Re: [Mod] Hexagonal* Prisms [hex]

by maxx » Post

NICE!
Stay safe! | Don't forget the planet

Schnux
New member
Posts: 7
Joined: Thu Oct 11, 2018 21:53
GitHub: Schnux2

Re: [Mod] Hexagonal* Prisms [hex]

by Schnux » Post

Just as an example what is possible to build with this (in case anyone is interested...):
Some kind of a dark tower, maybe the fortress of an evil overlord, maybe the temple of an ancient civilisation, worshipping their god of fire...
(This could definitely have been built better, it is just an advertisement.)
Spoiler
Image
Spoiler
Image
But larger buildings like this one are very instable. After exiting the game and re-eentering, it looked like this:
Spoiler
Image
I do not have any idea why Minetest removed exactly those prisms and let others be. Probably it is possible to have more entities inside one mapblock with the setting "max_objects_per_block", but why were they so randomly removed?
Attachments
screenshot_20181030_170637.png
screenshot_20181030_170637.png (297.08 KiB) Viewed 600 times
screenshot_20181030_163413.png
screenshot_20181030_163413.png (219.13 KiB) Viewed 600 times
screenshot_20181030_164137.png
screenshot_20181030_164137.png (128.89 KiB) Viewed 600 times

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests