Post your modding questions here

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:48

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

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

by Hybrid Dog » Wed Mar 08, 2017 11:32

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

Re:

by TumeniNodes » Wed Mar 08, 2017 11:44

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)
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 19:37

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

Re: Post your modding questions here

by TumeniNodes » Wed Mar 08, 2017 19:45

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.
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 21:56

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

Re: Post your modding questions here

by TumeniNodes » Wed Mar 08, 2017 22:37

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

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Wed Mar 08, 2017 22:41

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

Re: Post your modding questions here

by TumeniNodes » Wed Mar 08, 2017 22:55

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

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Thu Mar 09, 2017 09:37

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
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 » Thu Mar 09, 2017 20:21

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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

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

Re: Post your modding questions here

by D00Med » Thu Mar 09, 2017 20:32

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

User avatar
GreenDimond
Member
 
Posts: 460
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: Post your modding questions here

by GreenDimond » Fri Mar 10, 2017 23:46

How do I set the size of space between slots when defining an inventory list?
I am Green. I tend to binge-post. "All of this over a 16x16 representation of a cartoon cat ?!?! what has this world come to..." -TenPlus1, 2017.
Diz mah mods! :D ↑ github.com/minetest/minetest_game/issues/1647#issuecomment-288134572 ↑
Sand Plus - Tac Nayn - Waffles - Coming Soon: Caverealms Plus
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Sat Mar 11, 2017 08:10

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

Re: Post your modding questions here

by burli » Sat Mar 11, 2017 08:30

Thx kaeza, that helps a lot
 

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

Re: Post your modding questions here

by burli » Sat Mar 11, 2017 13:20

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

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

Re: Post your modding questions here

by burli » Sat Mar 11, 2017 14:46

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

Meanwhile I got this, but I still don't understand uses.

For example: a wooden shovel has uses = 10, but I can dig 31 sand nodes, a stone shovel has uses = 20, but I can dig 61 sand, a mese shovel has also uses = 20, but I can dig nearly 550 sand

How so? Maybe I didn't understand Uses

How is leveldiff calculated? The diff between what?

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
Table of resulting digging times:

    crumbly        0     1     2     3     4  <- level
         ->  0     -     -     -     -     -
             1  0.80  1.60  1.60     -     -
             2  0.60  1.20  1.20     -     -
             3  0.40  0.80  0.80     -     -

    level diff:    2     1     0    -1    -2


I assume "crumbly" is the level of the crumbly group of the node, e.g. crumbly = 3 for sand. But what is meant with "level"?
 

User avatar
cx384
Member
 
Posts: 249
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: Post your modding questions here

by cx384 » Sat Mar 11, 2017 15:13

Is there a way to copy a file without using os.execute()?
Can your read this?
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Sat Mar 11, 2017 21:23

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
local file=io.open("source.txt", "r")
local target=io.open("target.txt", "w")
target:write(file:read("*a"))
file:close()
target:close()

works with security as long as copied file is in mod or world directory
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Sat Mar 11, 2017 21:32

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

Meanwhile I got this, but I still don't understand uses.

For example: a wooden shovel has uses = 10, but I can dig 31 sand nodes, a stone shovel has uses = 20, but I can dig 61 sand, a mese shovel has also uses = 20, but I can dig nearly 550 sand

How so? Maybe I didn't understand Uses

How is leveldiff calculated? The diff between what?

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
Table of resulting digging times:

    crumbly        0     1     2     3     4  <- level
         ->  0     -     -     -     -     -
             1  0.80  1.60  1.60     -     -
             2  0.60  1.20  1.20     -     -
             3  0.40  0.80  0.80     -     -

    level diff:    2     1     0    -1    -2


I assume "crumbly" is the level of the crumbly group of the node, e.g. crumbly = 3 for sand. But what is meant with "level"?

The leveldiff is the difference between the node's "level" group (not the crumbly rating) and the tool's "maxlevel" for the digging group (here crumbly)
Sand is level 0, wooden shovel has maxlevel 1, so leveldiff is 1-> 10*3^1=30 uses
Mese shovel has maxlevel 3, leveldiff 3 -> 20*3^3=20*27=540
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

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

Re: Post your modding questions here

by burli » Sat Mar 11, 2017 21:45

orwell wrote:The leveldiff is the difference between the node's "level" group (not the crumbly rating) and the tool's "maxlevel" for the digging group (here crumbly)
Sand is level 0, wooden shovel has maxlevel 1, so leveldiff is 1-> 10*3^1=30 uses
Mese shovel has maxlevel 3, leveldiff 3 -> 20*3^3=20*27=540


Thank you. Meanwhile I got this myself, but only because I assumed that the default level is 0. Takes a while to find that out. Didn't found any hint in the doc what's the default value if no level is given
 

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

Re: Post your modding questions here

by burli » Sun Mar 12, 2017 08:44

How can I update param2 of a node? Currently I replace the node with set_node() and the new param2 value, but I hope there is a faster way
 

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 » Sun Mar 12, 2017 08:45

burli wrote:How can I update param2 of a node? Currently I replace the node with set_node() and the new param2 value, but I hope there is a faster way


swapnode(pos, {name = node.name, param2 = newparam2})

no faster way than that.
 

User avatar
cx384
Member
 
Posts: 249
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: Post your modding questions here

by cx384 » Sun Mar 12, 2017 11:34

orwell wrote:
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
local file=io.open("source.txt", "r")
local target=io.open("target.txt", "w")
target:write(file:read("*a"))
file:close()
target:close()

works with security as long as copied file is in mod or world directory

Thank you orwell, but the file is in the /.minetest/textures directory (texture packs) (and it is a .png file).
Anyway I have to change the secure.trusted_mods setting.
But I cant use minetest.setting_set("secure.trusted_mods", "modname") right?
Can your read this?
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Sun Mar 12, 2017 18:31

Of course not. You need to instruct the user to add this mod to trusted_mods.
After a private conversation with NathanS, I got my blender issue fixed. Thanks Nathan
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Sun Mar 12, 2017 18:33

burli wrote:
orwell wrote:The leveldiff is the difference between the node's "level" group (not the crumbly rating) and the tool's "maxlevel" for the digging group (here crumbly)
Sand is level 0, wooden shovel has maxlevel 1, so leveldiff is 1-> 10*3^1=30 uses
Mese shovel has maxlevel 3, leveldiff 3 -> 20*3^3=20*27=540


Thank you. Meanwhile I got this myself, but only because I assumed that the default level is 0. Takes a while to find that out. Didn't found any hint in the doc what's the default value if no level is given

If a group is not given, it's rating defaults to 0. So...
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

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 » Thu Mar 16, 2017 02:28

cx384 wrote:Thank you orwell, but the file is in the /.minetest/textures directory (texture packs) (and it is a .png file).

You can't do that. Mods (currently) run only on the server. Texture packs are on the client.

Can you specify what you're actually trying to do?

cx384 wrote:Anyway I have to change the secure.trusted_mods setting.
But I cant use minetest.setting_set("secure.trusted_mods", "modname") right?

Of course not. What is the point of having a secure environment if mods can disable or otherwise mess with it?
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
 

Muuus
New member
 
Posts: 2
Joined: Thu Jan 19, 2017 18:37
In-game: Muuus

Re: Post your modding questions here

by Muuus » Thu Mar 16, 2017 10:06

Hi, I'm searching a way to allow the player to place a specific item ONLY into a specific node inventory. Meaning, I have my ModdedItem_A and I want the player to be able to place it only into ModdedNode_B's inventory, but not into any other inventory, like chest's, or other modded node's inventory. Is there any easy way to do that ?
 

User avatar
cx384
Member
 
Posts: 249
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: Post your modding questions here

by cx384 » Thu Mar 16, 2017 14:07

kaeza wrote:Can you specify what you're actually trying to do?

I'm making a mod which copies textures from the texturepacks folder into the mod textures folder, because I want to register nodes with this textures.
This is my code for this:
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
local path_mod = minetest.get_modpath("ntm_texture_packs")
local path_minetest = string.sub(path_mod,1,string.find(path_mod,"/mods/"))
local path_mod_textures = path_mod.."/textures/"

local insecure_environment = minetest.request_insecure_environment()

if not insecure_environment then
   error("You have too add the ntm_texture_packs mod to the secure.trusted_mods setting if you want to use it.")
end

local function file_exists(name)
   setfenv(1, insecure_environment)
   local f=io.open(name,"r")
   if f~=nil then io.close(f) return true else return false end
end

local function copy_and_rename_texture(texture_pack, texture)
      setfenv(1, insecure_environment)
      local file=io.open(path_minetest.."textures/"..texture_pack.."/"..texture, "r")
      local target=io.open(path_mod_textures..texture, "w")
      target:write(file:read("*a"))
      file:close()
      target:close()
      os.rename (path_mod_textures..texture, path_mod_textures..texture_pack.."_"..texture)
end

local function get_and_check_texture(texture_pack, texture)
   if not file_exists(path_mod_textures..texture_pack..texture) then
      if file_exists(path_minetest.."textures/"..texture_pack.."/"..texture) then         
         copy_and_rename_texture(texture_pack, texture)
      else
         return false
      end   
   end
   return true
end
Can your read this?
 

Nyarg
Member
 
Posts: 144
Joined: Sun May 15, 2016 04:32

Re: Post your modding questions here

by Nyarg » Thu Mar 16, 2017 16:51

500000 nodes = 30 FPS
10500 entities = 3 FPS

W.T.H. is does exactly MT render or engine when draw simple node Versus simplest entity ?
entity simple single side plate (without any material assigned in blender)

the entity
+ Spoiler
the plate.x
+ Spoiler
I am a noob. still yet. Not so noob ) [vml] WIP
"My english isn't well" I know. I'm sorry )
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 9 guests

cron