Post your modding questions here

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: Post your modding questions here

by Byakuren » Post

It appears to go 4.5 beyond, but that would just make it worse (more unwalkable space).
Every time a mod API is left undocumented, a koala dies.

User avatar
burli
Member
Posts: 1643
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Post

sofar wrote:
burli wrote:Is it possible to make such a leaf shape? It is a normal leaf node with an oversized plantlike inside
make a mesh node (and yes, this is entirely reasonable geometry)
I'm using the mesh node from the nodebox trees mod. Works fine. I still have a little flicker and waving doesn't work

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Post your modding questions here

by sofar » Post

burli wrote:I'm using the mesh node from the nodebox trees mod. Works fine. I still have a little flicker and waving doesn't work
waving should not be enabled for most mesh nodes.

The flicker happens because you likely have multiple surfaces exactly in the same place. Try offsetting them by a small (0.001) value or rotating by 1 degree

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: Post your modding questions here

by TumeniNodes » Post

sofar wrote:A more reliable method would be voxelmanip and do multiple nodes.
Hmmm, I have not ventured into using voxelmanip yet. I'd be interested to take a look at it, could you point me in the right direction so I don't have to hunt it down? :P

Do you think this method may work? Or, is this a lost cause for now?
Byakuren wrote:There is a collision box (though only on the lowered bridge), I think Minetest just doesn't detect collisions that far.
The reason the collision box is only on the lowered bridge, is because I was focusing on getting it to work on that first.

I made a portcullis using the same code (somewhat), and when it is down, there is only a small space on each end which is passable...
But it really doesn't pose a big issue with that object.

And thank you both for looking at this and the suggestions.

edit: I found the info for voxelmanip but there's a slight problem...
Image
Attachments
Danger Will Robinson Danger.png
Danger Will Robinson Danger.png (133.04 KiB) Viewed 566 times
A Wonderful World

User avatar
burli
Member
Posts: 1643
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Post

TumeniNodes wrote:
sofar wrote:A more reliable method would be voxelmanip and do multiple nodes.
Hmmm, I have not ventured into using voxelmanip yet. I'd be interested to take a look at it, could you point me in the right direction so I don't have to hunt it down? :P
You can take a look at this. It is a simple example that replaces air with glass.

Code: Select all

minetest.register_on_generated(function(minp, maxp)
	local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
	local a = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
	local data = vm:get_data()
	local c_air = minetest.get_content_id("air")
	local c_ignore = minetest.get_content_id("ignore")
	local c_glass = minetest.get_content_id("default:glass")
	local csize = vector.add(vector.subtract(maxp, minp), 1)
	for z = minp.z, maxp.z do
	for y = minp.y, maxp.y do
	for x = minp.x, maxp.x do
		local vi = a:index(x, y, z)

		if data[vi] == c_air or data[vi] == c_ignore then
			data[vi] = c_glass
		end
	end
	end
	end

	vm:set_data(data)
	vm:write_to_map()
end)

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: Post your modding questions here

by TumeniNodes » Post

burli wrote:
TumeniNodes wrote:
sofar wrote:A more reliable method would be voxelmanip and do multiple nodes.
Hmmm, I have not ventured into using voxelmanip yet. I'd be interested to take a look at it, could you point me in the right direction so I don't have to hunt it down? :P
You can take a look at this. It is a simple example that replaces air with glass.

Code: Select all

minetest.register_on_generated(function(minp, maxp)
	local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
	local a = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
	local data = vm:get_data()
	local c_air = minetest.get_content_id("air")
	local c_ignore = minetest.get_content_id("ignore")
	local c_glass = minetest.get_content_id("default:glass")
	local csize = vector.add(vector.subtract(maxp, minp), 1)
	for z = minp.z, maxp.z do
	for y = minp.y, maxp.y do
	for x = minp.x, maxp.x do
		local vi = a:index(x, y, z)

		if data[vi] == c_air or data[vi] == c_ignore then
			data[vi] = c_glass
		end
	end
	end
	end

	vm:set_data(data)
	vm:write_to_map()
end)
Thank you very much burli.

Well, looks like I'm going back to school again :P
I keep thinking "maybe I should stop experimenting... it keeps getting me into trouble...."

Then I think "Nah... it's too much fun" : /

Though, I think some of us have an odd idea of "fun" :D
A Wonderful World

User avatar
burli
Member
Posts: 1643
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Post

you can also look in trees.lua. The old trees use Voxelmanip. Just look into default.grow_tree()

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: Post your modding questions here

by TumeniNodes » Post

burli wrote:you can also look in trees.lua. The old trees use Voxelmanip. Just look into default.grow_tree()
but, is voxelmanip particularly reserved for generated map features then?
can it be applied to an object which will open and close?

I'm just gonna go read the info... see how confused I can make myself :D
A Wonderful World

User avatar
burli
Member
Posts: 1643
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Post

TumeniNodes wrote: can it be applied to an object which will open and close?
Not sure what you mean. Any example?

The idea of VoxelManip is, that you can get a part of the map (a chunk or a part of the chunk) as array. You can change the data in this array and write it back. But the chunk has to be generated first and the area has to be inside the chunk plus the surrounding shell of 16 nodes (emin, emax)

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: Post your modding questions here

by TumeniNodes » Post

burli wrote:
TumeniNodes wrote: can it be applied to an object which will open and close?
Not sure what you mean. Any example?

The idea of VoxelManip is, that you can get a part of the map (a chunk or a part of the chunk) as array. You can change the data in this array and write it back. But the chunk has to be generated first and the area has to be inside the chunk plus the surrounding shell of 16 nodes (emin, emax)
This is why, I have a sneaking suspicion... the voxelmanip is not going to work for a drawbridge?
Is it not reserved for generated map objects?
I need sleep, I'll check here in the morn
A Wonderful World

User avatar
Hybrid Dog
Member
Posts: 2828
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

by Hybrid Dog » Post

vmanip isn't reserved for mapgen, but if you use it for mapgen you need to consider the differences of usage, see http://dev.minetest.net/vmanip

By the way, there's a PR about increasing the collision check range https://github.com/minetest/minetest/pull/5335

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re:

by TumeniNodes » Post

Hybrid Dog wrote:vmanip isn't reserved for mapgen, but if you use it for mapgen you need to consider the differences of usage, see http://dev.minetest.net/vmanip

By the way, there's a PR about increasing the collision check range https://github.com/minetest/minetest/pull/5335
Sweet....
and, thank you. Yeh, I wasn't sure because I saw "mapgen", and "generated" upon first 4 second glance, and judging by burli's posts... I jumped to conclusions :P

edit: just read through real quick.
I agree with sofar and paramats suggestions of finding another means to use multiple nodes (i.e. voxelmanip).

And paramat mentioned focusing more toward the node collision box code (which makes better sense, since that would not impact the load on resources for the end user)
A Wonderful World

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Post your modding questions here

by sofar » Post

I'd look at the TNT mod - it uses a vmanip to create the crater, and does so outside of mapgen domain.

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: Post your modding questions here

by TumeniNodes » Post

sofar wrote:I'd look at the TNT mod - it uses a vmanip to create the crater, and does so outside of mapgen domain.
cool, thank you sofar

I'll look at it now... I could use something to get me away from posting on the forums for a bit :P

edit: so..., "if" I manage to wrap my inefficient brain around voxelmanip... would it make sense for me to apply it only to the lowered bridge?
If I am able to make just that walkable... I'll be one happy duck.
A Wonderful World

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Post your modding questions here

by sofar » Post

TumeniNodes wrote:so..., "if" I manage to wrap my inefficient brain around voxelmanip... would it make sense for me to apply it only to the lowered bridge?
If I am able to make just that walkable... I'll be one happy duck.
Well, what I would do is:

1. make everything just 1x1x1 nodes so the whole collision box problem goes away
2. use a vmanip to make the door open/close node changes all at once

I assume your "open" door is a bunch of laying-down-looking nodes, and your "closed" door is a bunch of upright-looking nodes.

So the vmanip would be used to both switch from open to close, and from close to open. You'd use one vmanip to rapidly replace the /closed/ nodes with air, and put down the /open/ nodes, and vice versa.

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: Post your modding questions here

by TumeniNodes » Post

sofar wrote:Well, what I would do is:

1. make everything just 1x1x1 nodes so the whole collision box problem goes away
2. use a vmanip to make the door open/close node changes all at once

I assume your "open" door is a bunch of laying-down-looking nodes, and your "closed" door is a bunch of upright-looking nodes.

So the vmanip would be used to both switch from open to close, and from close to open. You'd use one vmanip to rapidly replace the /closed/ nodes with air, and put down the /open/ nodes, and vice versa.
okie dokie
thank you
A Wonderful World

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: Post your modding questions here

by orwell » Post

@TumeniNodes, I just overflew your code, but did you set walkable=true for the upper node? I think not...
If a node is not walkable, nothing will collide with it, independent of if a collision box is set.
EDIT: probably not of interest for the problem (raised drawbridge...), but indeed, it's not walkable, so you can walk through!
----
I need help regarding models:
I know that minetest supports multiple textures for an object. I have a Blender object that has 2 material slots with materials in it, and different faces assigned to these materials. Because this single blender files contains many objects (it is the file with the different rail variants for my advtrains mod) I export single objects by selecting "Export selected only" while exporting.
Then, in LUA, I have a node with tiles={"texture1.png", "texture2.png"}, and want all faces assigned to the first material slot of the blender object to use texture1.png, and all other use texture2.png
What do I have to do that minetest recognizes both materials? For me, the first texture gets applied for all faces of the mesh.
Is multiple material textures even implemented for nodes?
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: Post your modding questions here

by TumeniNodes » Post

orwell wrote:@TumeniNodes, I just overflew your code, but did you set walkable=true for the upper node? I think not...
If a node is not walkable, nothing will collide with it, independent of if a collision box is set.
I did have walkable = true in there before. I remember it was you who suggested I try it. : )
The problem is, the object is too large for what the collision code in MT handles.

I had thought about trying to see if using a schematic might work but, sofar has suggested I apply voxelmanip.
Not really confident I will be able to work it out but, I'll try.

I know your question is not directed toward me but,

Nathan S is the Blender guru here but... did you set those 2 textures to the materials in Blender?
If not, you need to do that.
Even though you set each face with a material, you still need to go in and assign a texture to each as well, set the normals, and adjust the textures to each face / assign each texture to each material.
And your drawtype should be "mesh" not node

If I read the question correctly, these are the steps you are missing
Nathan also made some vid tutorials on this very recently, checking the out might help : )
A Wonderful World

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: Post your modding questions here

by orwell » Post

What I've tried now:
- Copy the required object to a new blender file
- add 2 materials into two slots and assign the right materials to faces
- selected a dummy color grid and a dummy uv grid as textures, one for each material slot
- assigned the texture to the faces by selecting the uvs and swapping the image
Still, it does not work.
EDIT:Also tried OBJ instead of B3D. When exporting to OBJ, a .mtl file is created that holds both materials (so this should work)
EDIT2: also doesn't work when using an entity instead of a node.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: Post your modding questions here

by kaeza » Post

burli wrote:A, ok, it's a little bit confusing that a rightclick callback is sometimes called on_rightclick and sometimes on_place. Doc could be more clear at this point
When you interact (in this case, right click) with a node, there are two items involved: the wielded item, and the node you're pointing at. Note that the hand is also considered an item by the engine.

The `on_place` callback is called for the wielded item. The `on_rightclick` callback is called for the pointed node. There's a difference between the two, and what you should override or otherwise implement depends on the use case.

BTW, this is also the same for `on_punch`/`on_use` pair of callbacks.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
D00Med
Member
Posts: 949
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med
Location: Australia...somewhere

Re: Post your modding questions here

by D00Med » Post

Is there a way to make a particular biome flat in v7 mapgen? or valleys?
Look! I have a signature :]
My subgame: viewtopic.php?f=15&t=14051#p207242

User avatar
GreenXenith
Member
Posts: 1356
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
Location: UTC-8:00
Contact:

Re: Post your modding questions here

by GreenXenith » Post

How do I set the size of space between slots when defining an inventory list?
YouTube | Mods | Patreon | Minetest Discord @greenxenith

You should not be able to read this message.

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: Post your modding questions here

by orwell » Post

You can't, except by defining every single slot as separate list[] element, which is overkill
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
burli
Member
Posts: 1643
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Post

Thx kaeza, that helps a lot

User avatar
burli
Member
Posts: 1643
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Post

How can I add wear to an item if it is used with the right mouse button?

Locked

Who is online

Users browsing this forum: No registered users and 5 guests