Post your modding questions here

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Sun Jul 20, 2014 09:26

Mitroman wrote:Hi. I wanted to have the Itemstack of the wielded item of the player. But here is the problem:
There is a function (player:get_wielded_item() ) that should return the Itemstack, but it returns userdata and I have no idea how to change / use it into an itemstack. Thanks :).

Itemstacks ARE userdata objects. Userdata objects can have methods associated with them. Try some of the Itemstack methods (e.g. player:get_wielded_item():get_name()) on the returned userdata object and you should get what you expect from an Itemstack.
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Sun Jul 20, 2014 09:29

paramat wrote:Thanks everyone.
srifqi wrote:How to create my own map gen?

See this thread https://forum.minetest.net/viewtopic.php?f=18&t=6396
I also have a few simplified lua mapgens meant to help people learn the methods, the most useful one is here https://forum.minetest.net/viewtopic.php?f=11&t=8628

Here's a little more about mapgens: Development Wiki Modding FAQ: How Do I Generate a Custom Map?
 

UtahTeapot
New member
 
Posts: 1
Joined: Wed Jul 09, 2014 17:37
In-game: UtahTeapot

Re: Post your modding questions here

by UtahTeapot » Tue Jul 22, 2014 17:48

Title: How can I change the default font?
I've saw people change their default font, i wanna do it myself!

OffT: Hi! I'm new here!
 

User avatar
kidmondo
Member
 
Posts: 130
Joined: Sun May 11, 2014 07:56
IRC: kidmondo
In-game: kidmondo

Re: Post your modding questions here

by kidmondo » Tue Jul 22, 2014 20:35

Would someone be able to make a minetest version of Flan's WW2 mod?
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: Post your modding questions here

by philipbenr » Wed Jul 23, 2014 00:16

I just replaced the font files in the fonts folder and renamed them to liberationsans.ttf and whatever. Just replace them is what I'd suggest.
 

User avatar
Calinou
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

Re: Post your modding questions here

by Calinou » Wed Jul 23, 2014 08:34

UtahTeapot wrote:Title: How can I change the default font?
I've saw people change their default font, i wanna do it myself!

OffT: Hi! I'm new here!


This has nothing to do with modding, but put this in minetest.conf and replace the font path with something else (or nothing if you have no font around, to use the default one):

This changes font settings which work only with Freetype-enabled builds, not with bitmap fonts.

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
font_path = /usr/share/fonts/truetype/droid/DroidSans.ttf
font_size = 18
font_shadow_alpha = 255
mono_font_size = 16
fallback_font_size = 18
fallback_font_shadow_alpha = 255
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Post your modding questions here

by Krock » Wed Jul 23, 2014 08:54

UtahTeapot wrote:Title: How can I change the default font?
I've saw people change their default font, i wanna do it myself!

OffT: Hi! I'm new here!

Addition for builds without freetype:
https://github.com/minetest/minetest/bl ... s.cpp#L181

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
font_path = fonts/fontlucida.png
mono_font_path = fonts/fontdejavusansmono.png
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
Mitroman
Member
 
Posts: 62
Joined: Thu Apr 03, 2014 19:47
GitHub: Mitroman
In-game: Mitroman15

Re: Post your modding questions here

by Mitroman » Sun Jul 27, 2014 15:01

Itemstacks ARE userdata objects. Userdata objects can have methods associated with them. Try some of the Itemstack methods (e.g. player:get_wielded_item():get_name()) on the returned userdata object and you should get what you expect from an Itemstack.[/quote]
Thanks. =)
 

TeTpaAka
Member
 
Posts: 131
Joined: Sat Dec 28, 2013 21:54

Re: Post your modding questions here

by TeTpaAka » Mon Jul 28, 2014 18:29

I have a question: When there are multiple minetest.register_on_generated() calls, which one is called first?
I mean, by combining multiple mods with map-manipulating calls, which mod sees the changes of the others?
 

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 » Mon Jul 28, 2014 19:01

It is a FIFO* stack. The first minetest.register_on_generated() call is run first, and then the second is etc.

This means mods see the changes of the mods loaded before it. Use depends.txt to force a mod to load before your mod.

* - First In First Out.
 

User avatar
Esteban
Member
 
Posts: 872
Joined: Sun Sep 08, 2013 13:26
GitHub: Esteban-
IRC: Esteban
In-game: Esteban

Re: Post your modding questions here

by Esteban » Wed Jul 30, 2014 19:58

I am trying to finish an NPC, my question is how I can make that when you left-click the NPC it disappear and give me its spawner back? Here is the code:

+ Spoiler
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: Post your modding questions here

by philipbenr » Wed Jul 30, 2014 23:00

Topic: How to generate trees normally
--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
Reason: I want to make a forest with birch trees/ oak trees
--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
More info: I looked into farming_plus, and I saw that I could easily make saplings grow, and that I had no problem with that. But then I thought 'If I have saplings of birch or oak trees, then I will need a good birch/oak forest.' So, I need to be able to generate forests, thickets, and the like, mainly because I think the mod (for a subgame) I am making will not look good. Anybody able to explain how to do so? I can use a simple bit of code to get trees to spawn randomly, but that isn't good enough...

[Edit] I looked at plants_lib documentation, and it was rather complicated and helped my mind swim even more.
 

User avatar
HeroOfTheWinds
Member
 
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero

Re: Post your modding questions here

by HeroOfTheWinds » Thu Jul 31, 2014 00:21

There are a few ways to go about this, and since mgv7 is not stable at the minute, I'll take the more catch-all approach. Lua Voxel Manipulator is the short answer. There are two ways to make forests via LVM:
1. Have it spawn special saplings that grow via abm 1 second after chunk gen, by placing premade schematics of the trees (save them with WorldEdit).
2. Have it use functions to procedurally generate the trees.

That there is the heart of it. You will also need to implement a simple for loop to search for the ground level at any given area, and see if it is of suitable material (e.g. default:dirt_with_grass). A small example could be like 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
--make variables to condense the edges of the generated chunk
local x0 = minp.x
local x1 = maxp.x
local y0 = minp.y
local y1 = maxp.y
local z0 = minp.z
local z1 = maxp.z

--loop through the x and z planes first
for x = x0, x1 do
    for z = z0, z1 do
        --loop from the top to the bottom, and stop when the node isn't ground.
        for y = y1, y0, -1 do
            local vi = area:get_data(x,y,z)
            if data[vi] ~= c_air then
                --grab the index of y+1, place your tree generator or else call your function to gen the tree.  break afterward.
            end
        end
    end
end


Just a very rough idea. I left out the bits about initializing the LVM and closing it down, look at either paramat or my own mods to get an idea how to start and stop them.
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: Post your modding questions here

by philipbenr » Thu Jul 31, 2014 00:38

Thanks. Will do.

I do wish mgv7 was stable and complete... :/ Oh well. c55 will work at his own pace.
 

User avatar
HeroOfTheWinds
Member
 
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero

Re: Post your modding questions here

by HeroOfTheWinds » Thu Jul 31, 2014 00:50

philipbenr wrote:Thanks. Will do.

I do wish mgv7 was stable and complete... :/ Oh well. c55 will work at his own pace.

Happy to help. :)

So do I.... Also, it's hmmm's jurisdiction, I believe, not c55's.
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: Post your modding questions here

by philipbenr » Thu Jul 31, 2014 01:39

@ HeroOfTheWinds: I heard that it was c55 (I think from paramat...). It may be both.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: Post your modding questions here

by paramat » Thu Jul 31, 2014 14:30

Mgv7 is entirely hmmmm / kwolekr's work. He was recently trying to rewrite it but is frustrated with the difficult progress so is taking a break from mapgen (i can confirm it drives you crazy very quickly, it's common to waste 2 days of full time work adjusting parameters, generating huge amounts of terrain and not getting anywhere), he's also going through 'real life' stuff too like illness. So don't expect anything soon. Celeron55 wants to work on the 3D noise mgv5 of MT 0.3.0 and re-introduce that into Minetest.
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: Post your modding questions here

by philipbenr » Thu Jul 31, 2014 19:34

Okay... Kinda confused, I heard that c55 was doing work on something, but I wasn't sure what...
 

User avatar
addi
Member
 
Posts: 605
Joined: Thu Sep 20, 2012 03:16

How does the Lua Table formspec works?

by addi » Fri Aug 01, 2014 06:31

How does the Lua Table formspec works?

How can i send that formspec to a player?
minetest.show_formspec(playername, formname, formspec)
seems not to work, it requires a string not a table?
 

User avatar
Bas080
Member
 
Posts: 398
Joined: Mon May 21, 2012 15:54
GitHub: bas080
IRC: bas080
In-game: bas080

Re: Post your modding questions here

by Bas080 » Fri Aug 01, 2014 12:29

addi, that's because the formspec is defined with a string. The api documentation helped me. Also looking at mods that alter the player formspec should give you the solution.

https://github.com/minetest/minetest/bl ... i.txt#L922
 

User avatar
addi
Member
 
Posts: 605
Joined: Thu Sep 20, 2012 03:16

Re: Post your modding questions here

by addi » Fri Aug 01, 2014 12:33

Bas080 wrote:addi, that's because the formspec is defined with a string. The api documentation helped me. Also looking at mods that alter the player formspec should give you the solution.

https://github.com/minetest/minetest/bl ... i.txt#L922

yes i know, but what is about this: http://dev.minetest.net/Lua_Table_Formspec
i thougt its new, but it seems not so. :-(
 

drkwv
Member
 
Posts: 67
Joined: Thu Jun 28, 2012 13:48

Re: Post your modding questions here

by drkwv » Fri Aug 08, 2014 06:42

Is it possible to get particle collision coordinates? What does playername parameter for minetest.add_particle is used for?
 

User avatar
durtective6
Member
 
Posts: 167
Joined: Sun Aug 12, 2012 14:19
In-game: derplez

Re: Post your modding questions here

by durtective6 » Fri Aug 08, 2014 10:34

Hello, I've been trying to make some tools in a mod I am making but I am having trouble making two of them. How would I make it so a pickaxe drops the smelted product of whatever it digs? Also how would I make it so when a ore is dug by a certain pickaxe it drops a different item (e.g. gold ore--> gold shards/pieces etc)? Thanks
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

Re: Post your modding questions here

by Casimir » Fri Aug 08, 2014 10:40

drkwv wrote:Is it possible to get particle collision coordinates?

No, But you can use entities instead. See PilzAdams throwing mod.

drkwv wrote:What does playername parameter for minetest.add_particle is used for?

Particles are only shown to that player.
 

drkwv
Member
 
Posts: 67
Joined: Thu Jun 28, 2012 13:48

Re: Post your modding questions here

by drkwv » Fri Aug 08, 2014 12:06

How do I capture mouse right click on nothing with node or craftitem?
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Post your modding questions here

by Krock » Fri Aug 08, 2014 12:11

drkwv wrote:How do I capture mouse right click on nothing with node or craftitem?

Items:
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
    on_place = func(itemstack, placer, pointed_thing),
    ^ Shall place item and return the leftover itemstack
    ^ default: minetest.item_place

https://github.com/minetest/minetest/bl ... 2338-L2340

Nodes:
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
    after_place_node = func(pos, placer, itemstack, pointed_thing),
    ^ Called after constructing node when node was placed using
      minetest.item_place_node / minetest.place_node
    ^ If return true no item is taken from itemstack
    ^ default: nil

https://github.com/minetest/minetest/bl ... 2436-L2440
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

drkwv
Member
 
Posts: 67
Joined: Thu Jun 28, 2012 13:48

Re: Post your modding questions here

by drkwv » Fri Aug 08, 2014 12:55

Krock wrote:on_place, after_place_node

Both don't work when I click on nothing (on air).
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Post your modding questions here

by Krock » Fri Aug 08, 2014 13:00

drkwv wrote:
Krock wrote:on_place, after_place_node

Both don't work when I click on nothing (on air).

Well then, for nodes:
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
    on_rightclick = func(pos, node, clicker, itemstack, pointed_thing),
    ^ default: nil
    ^ if defined, itemstack will hold clicker's wielded item
    ^ Shall return the leftover itemstack
    ^ Note: pointed_thing can be nil, if a mod calls this function

https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L2453-L2457

Haven't found anything about craftitems on_rightclick.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

Re: Post your modding questions here

by Casimir » Fri Aug 08, 2014 13:07

Do you mean you want to create a node/item/tool that you hold in the hand and when pointing onto the sky and right click a function should be executed?
Then it would be something like 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
on_place = function(itemstack, user, pointed_thing)
   if pointed_thing then return end
   print("Oh, see those clouds!")
end,
 

drkwv
Member
 
Posts: 67
Joined: Thu Jun 28, 2012 13:48

Re: Post your modding questions here

by drkwv » Fri Aug 08, 2014 13:14

Krock wrote:on_rightclick

On_rightclick is used when I right clicking on the placed node by hand. Tested it too.
Casimir wrote:Do you mean you want to create a node/item/tool that you hold in the hand and when pointing onto the sky and right click a function should be executed?

Yes, this is correct. But on_place is triggered only when I right click not on air.
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 16 guests

cron