Post your modding questions here

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Fri Mar 13, 2015 23:38

12Me21 wrote:How do you use default.generate_ore and minetest.register_ore?
specifically, how do you convert code for default.generate_ore to minetest.register_ore?

http://dev.minetest.net/register_ore
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
Rui
Member
 
Posts: 255
Joined: Wed Oct 01, 2014 12:59
GitHub: Rui-Minetest

[DELETED]

by Rui » Sat Mar 14, 2015 11:07

[DELETED]
Last edited by Rui on Fri Nov 04, 2016 12:49, edited 2 times in total.
 

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

Re: Post your modding questions here

by Hybrid Dog » Sat Mar 14, 2015 15:07

Rui 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
minetest.register_abm({
   nodenames = {"default:furnace_active"},
   interval = 1,
   chance = 2,
   action = function(pos, node)
      local frontpos = vector.subtract(pos, minetest.facedir_to_dir(node.param2))
      minetest.add_particlespawner({
         amount = 6,
         time = 4,
         minpos = frontpos,
         maxpos = frontpos,
         minvel = {x=0, y=0, z=0},
         maxvel = {x=0, y=0.6, z=0},
         minacc = {x=0,y=0,z=0},
         maxacc = {x=0,y=0,z=0},
         minexptime = 0.1,
         maxexptime = 0.5,
         minsize = 2,
         maxsize = 2.5,
         collisiondetection = false,
         vertical = true,
         texture = "default_furnace_particle.png"
         })
   end
})

if your problem is finding the place between the furnace and the position in front of it, you only would need to halve the vector you get with minetest.facedir_to_dir:
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_abm({
   nodenames = {"default:furnace_active"},
   interval = 1,
   chance = 2,
   action = function(pos, node)
      local frontpos = vector.subtract(pos, vector.multiply(minetest.facedir_to_dir(node.param2), 0.5))
      minetest.add_particlespawner({
         amount = 6,
         time = 4,
         minpos = frontpos,
         maxpos = frontpos,
         minvel = {x=0, y=0, z=0},
         maxvel = {x=0, y=0.6, z=0},
         minacc = {x=0,y=0,z=0},
         maxacc = {x=0,y=0,z=0},
         minexptime = 0.1,
         maxexptime = 0.5,
         minsize = 2,
         maxsize = 2.5,
         collisiondetection = false,
         vertical = true,
         texture = "default_furnace_particle.png"
         })
   end
})

BTW: to make not every particle look equal, you can use the "transform" texture modifier https://github.com/HybridDog/nuke/blob/ ... t.lua#L798

l like furnace particles.
 

User avatar
Rui
Member
 
Posts: 255
Joined: Wed Oct 01, 2014 12:59
GitHub: Rui-Minetest

[DELETED]

by Rui » Sat Mar 14, 2015 22:13

[DELETED]
Last edited by Rui on Fri Nov 04, 2016 12:49, edited 2 times in total.
 

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

Re: Post your modding questions here

by Hybrid Dog » Sun Mar 15, 2015 10:36

Rui wrote:@Hybrid Dog
Thank you!
However, would not be able to change the height and horizontal?

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_abm({
   nodenames = {"default:furnace_active"},
   interval = 1,
   chance = 2,
   action = function(pos, node)
      local fdir = minetest.facedir_to_dir(node.param2)
      local minp = {x=pos.x-fdir.x*0.51, y=pos.y-5/16, z=pos.z-fdir.z*0.51}
      local maxp = vector.new(minp)
      maxp.y = maxp.y+3/16
      if fdir.x == 0 then
         minp.x = minp.x-0.4
         maxp.x = maxp.x+0.4
      elseif fdir.z == 0 then
         minp.z = minp.z-0.4
         maxp.z = maxp.z+0.4
      end
      minetest.add_particlespawner({
         amount = 6,
         time = 4,
         minpos = minp,
         maxpos = maxp,
         minvel = {x=0, y=0, z=0},
         maxvel = {x=0, y=0.6, z=0},
         minacc = {x=-0.2,y=0,z=-0.2},
         maxacc = {x=0.2,y=0,z=0.2},
         minexptime = 0.1,
         maxexptime = 0.6,
         minsize = 1.5,
         maxsize = 2.5,
         collisiondetection = false,
         vertical = true,
         texture = "default_furnace_particle.png^[transform"..math.random(0,7)
      })
   end
})
 

User avatar
Rui
Member
 
Posts: 255
Joined: Wed Oct 01, 2014 12:59
GitHub: Rui-Minetest

[DELETED]

by Rui » Sun Mar 15, 2015 11:10

[DELETED]
Last edited by Rui on Fri Nov 04, 2016 12:50, edited 2 times in total.
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Mon Mar 16, 2015 02:31

How do you check if an itemstack is in a group?
I have this and want it to check the group instead
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
if itemstack:get_name()== "default:leaves" then
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Post your modding questions here

by TenPlus1 » Mon Mar 16, 2015 08:46

Don: change default:leaves to group:leaves
 

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

RE: How do you check if an itemstack is in a group?

by rubenwardy » Mon Mar 16, 2015 08:58

Do 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
-- Get real name if it is an alias (eg "leaves" -> "default:leaves")
local name = minetest.registered_aliases[itemstack:get_name()]
if not name then
    name = itemstack:get_name()]
end

-- Check group
local item = minetest.registered_items[name]
if item and item.groups and item.groups["leaves"] then
    -- success
end


Untested. WTFPL or CC0
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Mon Mar 16, 2015 12:33

CompassGPS, and the compass mods it was built upon, give the player a compass who's image changes to point in the direction of the place they are looking for. The only way to do this is to actually have a series of compass items and change which one the player is holding to the one that has an image pointing in the right direction. Clumsy, but it works.

Sometime after I wrote the compassgps mod, one of the minetest updates changed functionality so that if you are wielding the compass when the image changes, the hand holding the compass BOBS. I can understand why this happens, because technically you are wielding a new item. But in this case, it's not supposed to LOOK like you are wielding a new item. It's supposed to look like the compass is pointing in a different direction.

Nathan Salapat has done a nice youtube review of CompassGPS that shows the very annoying pumping behavior:
https://www.youtube.com/watch?v=ow4qGGiYN3s

Does anyone know how I can turn the wield item change hand bob OFF when the compassgps is in the players hand? I've tried multiple times to eliminate this, but every time I do a set_stack to the compassgps while its being weilded, the hand does the annoying fist pump.
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: RE: How do you check if an itemstack is in a group?

by Don » Mon Mar 16, 2015 13:23

rubenwardy wrote:Do 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
-- Get real name if it is an alias (eg "leaves" -> "default:leaves")
local name = minetest.registered_aliases[itemstack:get_name()]
if not name then
    name = itemstack:get_name()]
end

-- Check group
local item = minetest.registered_items[name]
if item and item.groups and item.groups["leaves"] then
    -- success
end


Untested. WTFPL or CC0

Worked like a charm. Thank you very much.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

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

Re: Post your modding questions here

by Hybrid Dog » Mon Mar 16, 2015 17:25

Rui wrote:By the way, do I should merge this to minetest_game?

yes, please
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Tue Mar 17, 2015 15:10

Is there a way to have a craft item display the tooltip(description) without having the craftitem in the inventory?
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Tue Mar 17, 2015 16:27

my old carts fork https://github.com/Kilarin/carts
https://forum.minetest.net/viewtopic.php?f=11&t=2451&start=450#p140035
USED to have an option to keep the player facing the direction the cart was going. But now when I hit set_look_yaw(setyaw) it seems to do NOTHING. no error, but also the players yaw does not change.

Anyone have any clue what has changed and what I need to do to get this working again?

Thanks!
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Post your modding questions here

by Nathan.S » Tue Mar 17, 2015 16:34

Is there a way to set the length of time required for a cooking recipe? I've looked on the wiki and at the default mod and can't find anything. I want to make a canteen that lets you purify water, but to do that you need to cook it and I want it to take longer than cooking other things.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
12Me21
Member
 
Posts: 826
Joined: Tue Mar 05, 2013 00:36

Re: Post your modding questions here

by 12Me21 » Tue Mar 17, 2015 16:39

Nathan.S wrote:Is there a way to set the length of time required for a cooking recipe? I've looked on the wiki and at the default mod and can't find anything. I want to make a canteen that lets you purify water, but to do that you need to cook it and I want it to take longer than cooking other things.


I'm pretty sure there is, because I know obsidian shards take longer to cook. let me check...

ok, you have to do:
cooktime = #
http://dev.minetest.net/minetest.register_craft
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Post your modding questions here

by Nathan.S » Tue Mar 17, 2015 16:41

Nevermind I just found it here: http://rubenwardy.com/minetest_modding_ ... ft-cooking
You are correct 12Me12 that's exactly how it works, I guess there must be some default set, because I didn't see an example of this in any of the default cooking recipes.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Fri Mar 20, 2015 14:55

I am trying to add groups to a table. I can't seem to make it work.
if I put "{cracky=2}" into the table it won't read it.
If I leave the { and } out of the table and do groups = { tablegroup } it fails to load script.

Can you add groups to a table?

Edit - I solved it. I put in "" in the table. I took them out and it works.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

48inches
New member
 
Posts: 3
Joined: Sun Mar 22, 2015 23:20

Re: Post your modding questions here

by 48inches » Mon Mar 23, 2015 02:56

What I want to do is make a growing ivy mod, I have an abm that gradually stacks ivy nodes but the ivy node is always in the same rotation. How do I rotate the ivy node so it is against a nearby node or at least in the same rotation as the ivy below it?

O, and hello.
 

User avatar
12Me21
Member
 
Posts: 826
Joined: Tue Mar 05, 2013 00:36

Re: Post your modding questions here

by 12Me21 » Mon Mar 23, 2015 12:52

48inches wrote:What I want to do is make a growing ivy mod, I have an abm that gradually stacks ivy nodes but the ivy node is always in the same rotation. How do I rotate the ivy node so it is against a nearby node or at least in the same rotation as the ivy below it?

O, and hello.


Can I see the code?
 

48inches
New member
 
Posts: 3
Joined: Sun Mar 22, 2015 23:20

Re: Post your modding questions here

by 48inches » Tue Mar 24, 2015 19:06

Can I see the code?

Here's the abm for the ivy.
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_abm({
   nodenames = {"garden:ivygrow"},
   interval = 10,
   chance = 4,
   action = function(pos, node, active_object_count, active_object_count_wider)
   local x = pos.x
   local y = pos.y
   local z = pos.z
   local pos_y = {x=x,y=y+1,z=z}
   local pos = {x=x,y=y,z=z}
   
   if minetest.get_node(pos_y).name == "air" then
      minetest.set_node(pos_y, {name="garden:ivygrow"})
      minetest.set_node(pos, {name="garden:ivy"})
      end
   end
})

If you need my attempt at rotating the node, I don't have it I deleted it in frustration. I will post it when I rewrite it.
I am a noob at this so thanks.
 

User avatar
12Me21
Member
 
Posts: 826
Joined: Tue Mar 05, 2013 00:36

Re: Post your modding questions here

by 12Me21 » Wed Mar 25, 2015 00:38

48inches wrote:
Can I see the code?

Here's the abm for the ivy.
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_abm({
   nodenames = {"garden:ivygrow"},
   interval = 10,
   chance = 4,
   action = function(pos, node, active_object_count, active_object_count_wider)
   local x = pos.x
   local y = pos.y
   local z = pos.z
   local pos_y = {x=x,y=y+1,z=z}
   local pos = {x=x,y=y,z=z}
   
   if minetest.get_node(pos_y).name == "air" then
      minetest.set_node(pos_y, {name="garden:ivygrow"})
      minetest.set_node(pos, {name="garden:ivy"})
      end
   end
})

If you need my attempt at rotating the node, I don't have it I deleted it in frustration. I will post it when I rewrite it.
I am a noob at this so thanks.



try 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
minetest.register_abm({
   nodenames = {"garden:ivygrow"},
   interval = 1,
   chance = 1,
   action = function(pos, node)
   local x = pos.x
   local y = pos.y
   local z = pos.z
   local pos_y = {x=x,y=y+1,z=z}
   local node = minetest.get_node(pos)
   if minetest.get_node(pos_y).name == "air" then
      minetest.set_node(pos_y, {name = "garden:ivygrow", param2=node.param2})
      minetest.set_node(pos, {name = "garden:ivy", param2=node.param2})
      end
   end
})

you have to keep the param2 (rotation) of the nodes.
 

48inches
New member
 
Posts: 3
Joined: Sun Mar 22, 2015 23:20

Re: Post your modding questions here

by 48inches » Wed Mar 25, 2015 02:58

try 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
minetest.register_abm({
   nodenames = {"garden:ivygrow"},
   interval = 1,
   chance = 1,
   action = function(pos, node)
   local x = pos.x
   local y = pos.y
   local z = pos.z
   local pos_y = {x=x,y=y+1,z=z}
   local node = minetest.get_node(pos)
   if minetest.get_node(pos_y).name == "air" then
      minetest.set_node(pos_y, {name = "garden:ivygrow", param2=node.param2})
      minetest.set_node(pos, {name = "garden:ivy", param2=node.param2})
      end
   end
})


you have to keep the param2 (rotation) of the nodes.

Thank you 12Me21 that worked well.
 

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

Re: Post your modding questions here

by Hybrid Dog » Wed Mar 25, 2015 13:52

48inches wrote:
Can I see the code?

Here's the abm for the ivy.
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_abm({
   nodenames = {"garden:ivygrow"},
   interval = 10,
   chance = 4,
   action = function(pos, node, active_object_count, active_object_count_wider)
   local x = pos.x
   local y = pos.y
   local z = pos.z
   local pos_y = {x=x,y=y+1,z=z}
   local pos = {x=x,y=y,z=z}
   
   if minetest.get_node(pos_y).name == "air" then
      minetest.set_node(pos_y, {name="garden:ivygrow"})
      minetest.set_node(pos, {name="garden:ivy"})
      end
   end
})

If you need my attempt at rotating the node, I don't have it I deleted it in frustration. I will post it when I rewrite it.
I am a noob at this so thanks.

this could work, too:
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_abm({
   nodenames = {"garden:ivygrow"},
   interval = 10,
   chance = 4,
   action = function(pos, node)
      pos.y = pos.y+1
      if minetest.get_node(pos).name == "air" then
         minetest.set_node(pos, node)
         pos.y = pos.y-1
         node.name = "garden:ivy"
         minetest.set_node(pos, node)
      end
   end
})
 

ryvnf
New member
 
Posts: 2
Joined: Sun Mar 22, 2015 17:03
GitHub: ryvnf
IRC: ryvnf
In-game: ryvnf

What does `settexturemod('^[brighten')` do?

by ryvnf » Thu Mar 26, 2015 13:52

Hello, I am currently learning the modding API by hacking other peoples mods. I was hacking the Nuke mod written by sfan5 when I came across a strange line that I cannot find much information about.

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
self.object:settexturemod('^[brighten')


I know that it makes the texture of the entity brighter but I cannot really figure out how it does that. Can you please explain what it does or point me to some documentation about it? I have been searching for documentation on the web and on this forum but I was not able to find any.

Thank you for your time and attention! :)
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: What does `settexturemod('^[brighten')` do?

by Don » Thu Mar 26, 2015 14:13

ryvnf wrote:Hello, I am currently learning the modding API by hacking other peoples mods. I was hacking the Nuke mod written by sfan5 when I came across a strange line that I cannot find much information about.

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
self.object:settexturemod('^[brighten')


I know that it makes the texture of the entity brighter but I cannot really figure out how it does that. Can you please explain what it does or point me to some documentation about it? I have been searching for documentation on the web and on this forum but I was not able to find any.

Thank you for your time and attention! :)

http://dev.minetest.net/texture
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

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

Re: What does `settexturemod('^[brighten')` do?

by Hybrid Dog » Thu Mar 26, 2015 14:20

Don wrote:
ryvnf wrote:Hello, I am currently learning the modding API by hacking other peoples mods. I was hacking the Nuke mod written by sfan5 when I came across a strange line that I cannot find much information about.

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
self.object:settexturemod('^[brighten')


I know that it makes the texture of the entity brighter but I cannot really figure out how it does that. Can you please explain what it does or point me to some documentation about it? I have been searching for documentation on the web and on this forum but I was not able to find any.

Thank you for your time and attention! :)

http://dev.minetest.net/texture

and how does settexturemod work?
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Post your modding questions here

by Nathan.S » Sat Mar 28, 2015 22:17

I think this is possible, but I could be wrong.
I want to have a cooking recipe, for oysters and mussels, that when cooked yields meat and shells. I thought I'd seen this done before, but can't remember what mod was doing it, it was giving other objects back, a bucket I think.
Any help would be appreciated.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Sat Mar 28, 2015 22:35

Nathan.S wrote:I think this is possible, but I could be wrong.
I want to have a cooking recipe, for oysters and mussels, that when cooked yields meat and shells. I thought I'd seen this done before, but can't remember what mod was doing it, it was giving other objects back, a bucket I think.
Any help would be appreciated.


If you look at what I did for the sponge it should help.

viewtopic.php?f=9&t=11539
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Post your modding questions here

by Nathan.S » Sun Mar 29, 2015 01:31

Thank you very much Don, I think I can use that and get what I want.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 38 guests

cron