Post your modding questions here

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

Re: Post your modding questions here

by burli » Sat Mar 04, 2017 16:40

Is it possible to make such a leaf shape? It is a normal leaf node with an oversized plantlike inside

Image
Attachments
Bildschirmfoto vom 2017-03-04 17-37-26.jpg
Bildschirmfoto vom 2017-03-04 17-37-26.jpg (176.16 KiB) Viewed 8775 times
 

User avatar
yzelast
Member
 
Posts: 43
Joined: Sun Oct 02, 2016 01:18
GitHub: yzelast
In-game: yzelast

Re: Post your modding questions here

by yzelast » Sat Mar 04, 2017 18:04

burli wrote:Is it possible to make such a leaf shape? It is a normal leaf node with an oversized plantlike inside

Image


The nodebox trees have similar leaves, you could take a look on it.
https://forum.minetest.net/viewtopic.php?f=9&t=16292
Have a free time? So check it out my mods: Real Trees and Wood Plus
 

User avatar
D00Med
Member
 
Posts: 712
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med

Re: Post your modding questions here

by D00Med » Mon Mar 06, 2017 07:11

Would it be possible to make a copy of the mapgen at a different height without an expensive function?
(I already tried just copying dirt with grass using register_on_generated but it was really slow)
Look! I have a signature :]
My subgame: https://forum.minetest.net/viewtopic.php?f=15&t=14051#p207242
dmobs2 is coming...
 

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

Re: Post your modding questions here

by burli » Mon Mar 06, 2017 07:24

You mean a copy of the generated map? How far you will copy? Inside a chunk
 

User avatar
D00Med
Member
 
Posts: 712
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med

Re: Post your modding questions here

by D00Med » Mon Mar 06, 2017 07:25

Yeah. Everything
Look! I have a signature :]
My subgame: https://forum.minetest.net/viewtopic.php?f=15&t=14051#p207242
dmobs2 is coming...
 

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

Re: Post your modding questions here

by burli » Mon Mar 06, 2017 07:32

Should be fast if you use VoxelManip
 

User avatar
D00Med
Member
 
Posts: 712
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med

Re: Post your modding questions here

by D00Med » Mon Mar 06, 2017 07:51

Ok...I should probably learn how then...
Look! I have a signature :]
My subgame: https://forum.minetest.net/viewtopic.php?f=15&t=14051#p207242
dmobs2 is coming...
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Mon Mar 06, 2017 08:12

D00Med wrote:I already tried just copying dirt with grass using register_on_generated but it was really slow

D00Med wrote:Ok...I should probably learn how then...

Maybe you should post the actual code to see if somebody can suggest improvements?
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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

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

Re: Post your modding questions here

by sofar » Tue Mar 07, 2017 05:20

Hybrid Dog wrote:Does node metadata become compressed?


I'm fairly sure everything on the map is compressed, including entity data as well.
 

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

Re: Post your modding questions here

by burli » Tue Mar 07, 2017 12:57

I know that nodes have a on_rightclick callback, but I can't find something similar for tools. Is it possible to call a callback function if I make a rightclick with a tool? For example if I want to make different actions with the same tool?
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Post your modding questions here

by rubenwardy » Tue Mar 07, 2017 13:19

It's on place
 

User avatar
DS-minetest
Member
 
Posts: 707
Joined: Thu Jun 19, 2014 19:49
GitHub: DS-Minetest
In-game: DS

Re: Post your modding questions here

by DS-minetest » Tue Mar 07, 2017 13:36

It's
on_place = function(itemstack, placer, pointed_thing)
and
on_secondary_use = function(itemstack, user, pointed_thing).
on_place is called when you make rightclick on a node with the item,
on_secondary_use is called when you make rightclick with the item without pointing on any node.
These are not only for tools, I think, they are for every item (craftitem, node, tool).
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

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

Re: Post your modding questions here

by burli » Tue Mar 07, 2017 13:56

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
 

EdShouldBeInBed
Member
 
Posts: 36
Joined: Sun Feb 22, 2015 16:03
In-game: EdShdBInBed

Aliasing Nodes

by EdShouldBeInBed » Tue Mar 07, 2017 15:29

Question/ Issue: If I use minetest.register_alias to replace one mods version of a node with another, will the first mod recognize the replacement node for crafting? Where should I put such alias statements?

Reason: In my personal minetest game, I have both Dark Ages and Technic installed. I want to use DA's version of Marble and a few other nodes over technic's in the worldgen, but only if Technic will recognize DA's version for crafting. This applies to other nodes/ ores like rubies (I currently have two versions).

More Info(optional): I'm also wondering where I should put this, in a /mygametweaks folder under the game's mod folder? If I do, do I have to fully define it as a mod with a depends.txt and all?
I'm a writer who tinkers with code on occasion. I play minetest when insomnia makes the writing hard.
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: Post your modding questions here

by TumeniNodes » Wed Mar 08, 2017 03:36

This is the code for a drawbridge I was working on a while back...
Never did figure out why I can't walk it?

I can walk along the center for about 2 nodes then... woosh, fall through.

What am I doing wrong? (I should be able to figure this out by now but.... : / )
I just tried again today, but only for about 5 minutes and said "screw it", maybe someone else will see what I did wrong, right off the bat... :P

I also have an obj model but, it works this way... well, visually anyway

Any help will be greatly appreciated... ten-Q

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_node("castle_features:drawbridge_raised", {
   description = "Drawbridge Raised",
   drawtype = "nodebox",
   tiles = {"bridge_timber.png"},
   paramtype = "light",
   paramtype2 = "facedir",
   node_box = {
      type = "fixed",
      fixed = {
         {-2.5, 0.25, 0.25, 2.5, 5.3125, 0.5},
      },
   },
   sounds = default.node_sound_wood_defaults(),
   groups = {choppy=2, wood=1,oddly_breakable_by_hand=3,flammable=3},
   on_rightclick = function(pos, node, puncher)
      minetest.swap_node(pos, {name = "castle_features:drawbridge_lowered", param2 = node.param2})
   end,   
})

minetest.register_node("castle_features:drawbridge_lowered", {
   description = "Drawbridge Lowered",
   drawtype = "nodebox",
   tiles = {"bridge_timber.png"},
   paramtype = "light",
   paramtype2 = "facedir",
   walkable = true,
   node_box = {
      type = "fixed",
      fixed = {
         {-2.5, 0.25, -4.5, 2.5, 0.5, 0.5},
      },
   },
   collision_box = {
      type = "fixed",
      fixed = {
         {-2.5, 0.25, -4.5, 2.5, 0.5, 0.5},
      },
   },
   groups = {choppy=2,wood=1,oddly_breakable_by_hand=3,flammable=3},
   sounds = default.node_sound_wood_defaults(),
   
   on_rightclick = function(pos, node, puncher)
      minetest.swap_node(pos, {name = "castle_features:drawbridge_raised", param2 = node.param2})
   end,
   drop = "castle_features:drawbridge_raised",
})
Flick?... Flick who?
 

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

Re: Post your modding questions here

by sofar » Wed Mar 08, 2017 04:47

TumeniNodes wrote:This is the code for a drawbridge I was working on a while back...
Never did figure out why I can't walk it?


Add a collision box.
 

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

Re: Post your modding questions here

by sofar » Wed Mar 08, 2017 05:35

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)
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: Post your modding questions here

by Byakuren » Wed Mar 08, 2017 05:38

sofar wrote:
TumeniNodes wrote:This is the code for a drawbridge I was working on a while back...
Never did figure out why I can't walk it?


Add a collision box.

There is a collision box (though only on the lowered bridge), I think Minetest just doesn't detect collisions that far.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Wed Mar 08, 2017 05:46

Byakuren wrote:There is a collision box (though only on the lowered bridge), I think Minetest just doesn't detect collisions that far.

Indeed, Minetest has serious bugs with collision boxes >1 node in size.
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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

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

Re: Post your modding questions here

by sofar » Wed Mar 08, 2017 05:51

kaeza wrote:
Byakuren wrote:There is a collision box (though only on the lowered bridge), I think Minetest just doesn't detect collisions that far.

Indeed, Minetest has serious bugs with collision boxes >1 node in size.


Actually, you can go 1 beyond the node itself. This node goes 2.0 beyond it, so the last 1.0 will be buggy.
 

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

Re: Post your modding questions here

by sofar » Wed Mar 08, 2017 05:51

Byakuren wrote:
sofar wrote:
TumeniNodes wrote:This is the code for a drawbridge I was working on a while back...
Never did figure out why I can't walk it?


Add a collision box.

There is a collision box (though only on the lowered bridge), I think Minetest just doesn't detect collisions that far.


A more reliable method would be voxelmanip and do multiple nodes.
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: Post your modding questions here

by Byakuren » Wed Mar 08, 2017 06:14

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: 1313
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Wed Mar 08, 2017 06:31

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
Member
 
Posts: 781
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Post your modding questions here

by sofar » Wed Mar 08, 2017 06:38

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: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: Post your modding questions here

by TumeniNodes » Wed Mar 08, 2017 08:44

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 8776 times
Flick?... Flick who?
 

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

Re: Post your modding questions here

by burli » Wed Mar 08, 2017 08:55

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.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: Post your modding questions here

by TumeniNodes » Wed Mar 08, 2017 09:04

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.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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
Flick?... Flick who?
 

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

Re: Post your modding questions here

by burli » Wed Mar 08, 2017 09:10

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

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: Post your modding questions here

by TumeniNodes » Wed Mar 08, 2017 09:24

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
Flick?... Flick who?
 

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

Re: Post your modding questions here

by burli » Wed Mar 08, 2017 09:36

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)
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 8 guests

cron