Post your modding questions here

afeys
Member
 
Posts: 17
Joined: Thu Mar 26, 2015 08:55

Re: Post your modding questions here

by afeys » Thu Nov 05, 2015 09:43

paramat wrote:afeys and others, the new feature will soon be added https://github.com/minetest/minetest/pull/3339
"This commit adds a new API function minetest.place_schematic_on_vmanip()"


Brilliant !
Thanks
 

User avatar
Ferk
Member
 
Posts: 330
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: Post your modding questions here

by Ferk » Thu Nov 05, 2015 11:25

That minetest.place_schematic_on_vmanip() looks nice.
Specially combined with control of the chunksize from lua (which I think it's also a feature in next version), I'll check it out this weekend to generate Wuzzy Tutorial world in chunks. Also it could be useful for Dungeontest as well.

Btw, is a version string exposed anywhere in the api to know what minetest version the server runs? it looks like it's available for the clients but not for the server.
It would be nice to have the version so the mod can exit gracefully if the engine is too old for it to run. But yeah just "nice-to-have", not very important.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

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

Re: Post your modding questions here

by paramat » Fri Nov 06, 2015 07:24

minetest.place_schematic_on_vmanip() can be used with either the 'mapgen object voxelmanip' or the 'non mapgen object voxelmanip'. Use the function immediately after 'set data' and before any of: 'set lighting', 'calc lighting', 'write to map'.
 

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 » Fri Nov 06, 2015 07:50

Ferk wrote:Btw, is a version string exposed anywhere in the api to know what minetest version the server runs? it looks like it's available for the clients but not for the server.
It would be nice to have the version so the mod can exit gracefully if the engine is too old for it to run. But yeah just "nice-to-have", not very important.


It's not possible to get a version string in order to stop abuse like this. Version strings are for informational use,not for checking for features. Check that the function exists instead by doing

if minetest.func then

Note no brackets or colon.
 

User avatar
Ferk
Member
 
Posts: 330
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: Post your modding questions here

by Ferk » Fri Nov 06, 2015 08:51

@rubenwardy good point. I was doing already something like that when using minetest.wallmounted_to_dir(), only available in latest git.

Though being able to enforce a chunksize in minetest.set_mapgen_params is not that easy to check for, but I guess it's not a big deal, if I just want to throw an error checking for the other function would suffice.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

User avatar
Ferk
Member
 
Posts: 330
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: Post your modding questions here

by Ferk » Sat Nov 07, 2015 14:52

I was experimenting with the minetest.place_schematic_on_vmanip to place the tutorial world schematics within a singlenode mapgen. Works fine. I'm doing vmanip:calc_lighting() and vmanip:write_to_map() right after the schematics are placed and it works well.

However, I don't think the lighting is completely correct. It seems to render as if it was nighttime all the time, even though the sun should be right up, the sky turns gray when I'm not looking directly into it. I guess the engine seems to think I'm in an underground even though the Tutorial world map is completely exposed (the player spawn is enclosed though, not sure if that's relevant).

Any ideas?
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

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

Re: Post your modding questions here

by paramat » Sun Nov 08, 2015 01:19

When the chunk above has not been generated yet, lighting is assumed from whether y is above or below water_level, so set water_level = -31000 in mapgen params, also set the flag 'nolight' to avoid an unnecessary 2nd lighting calculation before schematics are placed.
See new vm docs https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L2814
 

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 » Sun Nov 08, 2015 01:36

Is there a way to change the inventory slots in formspec like you can with buttons?
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
Ferk
Member
 
Posts: 330
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: Post your modding questions here

by Ferk » Sun Nov 08, 2015 11:42

paramat wrote:When the chunk above has not been generated yet, lighting is assumed from whether y is above or below water_level

Thanks for the explanation! I did some tests flying around generating higher chunks and what you said seems to be the reason. After flying above and placing the schematic a second time the nodes get properly lighted up.

However, setting water_level = -31000 using minetest.set_mapgen_params didn't have any effect:
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_mapgen_init(function(mgparams)
   minetest.set_mapgen_params({mgname="singlenode", water_level = -31000, flags = "nolight" })
end)

Do I need to do something else for the light to be calculated right?

if I run minetest.emerge_area to load the chunk above before loading the schematic it works, from a chatcommand. But it won't work in register_on_generated, since I guess the voxelmanip area is already loaded by the time I can add the chunks above to the queue. Also running the emerge slows things down a bit.


Thanks for that as well, the lua_api.txt file is pretty awesome. Much better than the outdated dev wiki.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

User avatar
jp
Member
 
Posts: 705
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith

Re: Post your modding questions here

by jp » Sun Nov 08, 2015 17:16

Don wrote:Is there a way to change the inventory slots in formspec like you can with buttons?

You don't really change a slot, but an item stack.

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
<some meta getter>:set_stack(<list>, <index>, <itemstack>)
 

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 » Sun Nov 08, 2015 19:05

jp wrote:
Don wrote:Is there a way to change the inventory slots in formspec like you can with buttons?

You don't really change a slot, but an item stack.

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
<some meta getter>:set_stack(<list>, <index>, <itemstack>)

I was referring to visual size. Length and width. They are 1x1 and I would like to make them 0.5x0.5.
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
jp
Member
 
Posts: 705
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith

Re: Post your modding questions here

by jp » Sun Nov 08, 2015 19:18

No it's not possible and hardcoded to fit the fixed size of an inventory item.
 

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 » Sun Nov 08, 2015 19:24

jp wrote:No it's not possible and hardcoded to fit the fixed size of an inventory item.

That is what I thought. Thanks.
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
 

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

Re: Post your modding questions here

by paramat » Sun Nov 08, 2015 23:16

Ferk, does it work without the nolight flag?

minetest.set_mapgen_params({mgname="singlenode", water_level = -31000 })

I discovered that when you use 'nolight' it's essential to run the vm in every mapchunk (whether you are placing schematics or not) because it now contains the only lighting calculation.

Another thing: without the 'nolight' flag, you need to use 'vm set lighting (day=0 night=0)' immediately before 'vm calc lighting()' so that light from the first lighting calculation doesn't interfere with the second lighting calculation.

If you're adding schematics 'on generated' make sure to use the 'mapgen object vm'.
 

User avatar
Ferk
Member
 
Posts: 330
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: Post your modding questions here

by Ferk » Mon Nov 09, 2015 01:01

@paramat no, without nolight it's still like before. Also vm:set_lighting({day=0,night=0}) doesn't make any noticeable difference.

I'm using minetest.get_mapgen_object("voxelmanip").
You can find the code here: https://github.com/Ferk/minetest_tutori ... n.lua#L395
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

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

Re: Post your modding questions here

by paramat » Mon Nov 09, 2015 06:32

Try removing the 'vm update map' here https://github.com/Ferk/minetest_tutorial/blob/master/mods/tutorial/mapgen.lua#L428
'vm update map' is only used with the non-mapgen-object voxelmanip.
 

User avatar
LionsDen
Member
 
Posts: 525
Joined: Thu Jun 06, 2013 03:19

Re: Post your modding questions here

by LionsDen » Mon Nov 09, 2015 18:46

jp wrote:No it's not possible and hardcoded to fit the fixed size of an inventory item.


If I remember correctly, Unified Inventory showed small icons of the inventory icons in the arrangement of available items. I haven't played recently so maybe it changed but if it hasn't, that would be a good place to look to see how it is done.
 

User avatar
Ferk
Member
 
Posts: 330
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: Post your modding questions here

by Ferk » Mon Nov 09, 2015 19:09

@paramat Thanks again.
However that also didn't have much effect. I'm clueless on what could be the reason.
+ Spoiler


@LionsDen
I think unified inventory makes the slots transparent (by setting alpha color 00000000) and then uses drawings in the formspec background to make custom slots. I'm not sure if they make them smaller or if it's just to change the visual style of the slot.
But I don't think they make the items themselves small. That would also look strange since the item would have to pop out with its original size when you drag it.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

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 Nov 09, 2015 20:43

The small icons in unified iventory are image buttons. They can be resized no problem.
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
Ferk
Member
 
Posts: 330
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: Post your modding questions here

by Ferk » Tue Nov 10, 2015 10:50

EDIT: Ugh.. sorry for this post, false alarm.. too bad I can't delete the comment
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

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 Nov 10, 2015 19:11

I must have been away for too long, did something change where the print command doesn't print things to the debug anymore? is this an option I can turn back on, I need that to figure out what is going on with my mod.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

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 Nov 10, 2015 21:59

What version of Minetest are you using? Latest dev?
 

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 Nov 10, 2015 23:05

ya, I use the daily PPA
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

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

Re: Post your modding questions here

by paramat » Wed Nov 11, 2015 02:17

Yes debug behaviour and settings changed, see .conf, perhaps try higher settings.
 

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 » Wed Nov 11, 2015 16:38

I'll check into that, thanks.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
GunshipPenguin
Member
 
Posts: 94
Joined: Tue Jan 28, 2014 00:38
GitHub: GunshipPenguin
IRC: GunshipPenguin
In-game: GunshipPenguin

Re: Post your modding questions here

by GunshipPenguin » Sun Nov 15, 2015 00:20

Is there a way to get minetest.find_nodes_in_area_under_air() to return an array of the positions of all nodes under air, rather than just the nodes or groups specified in the nodenames argument?
 

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 » Sun Nov 15, 2015 00:30

GunshipPenguin wrote:Is there a way to get minetest.find_nodes_in_area_under_air() to return an array of the positions of all nodes under air, rather than just the nodes or groups specified in the nodenames argument?

find_nodes_in_area_under_air returns positions.
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
qwertymine3
Member
 
Posts: 194
Joined: Wed Jun 03, 2015 14:33
GitHub: Qwertymine
In-game: qwertymine3

Re: Post your modding questions here

by qwertymine3 » Sun Nov 15, 2015 00:53

GunshipPenguin as far as I know, no - but a list of the basic node groups will pick-up almost all nodes.
Avatar by :devnko-ennekappao:
 

User avatar
mahmutelmas06
Member
 
Posts: 355
Joined: Mon Mar 02, 2015 13:10
GitHub: mahmutelmas06
IRC: mahmutelmas06
In-game: masum

Re: Post your modding questions here

by mahmutelmas06 » Mon Nov 16, 2015 22:01

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
fruits = {
   orange = "farming_plus:orange",
   apple = "default:apple",
   meat = "mobs:meat",
           }



this is what i do to use a fruit group in my mod.
I want to use simple Orange for craft recipe but what i want is registering all oranges from other mods as "Orange"

How can i do that
i tried for exp.

orange= {"farming:orange", "farming_plus:orange", "farming_redo:orange"}, but it didnt work.
My Mods:

Beverage
 

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 Nov 16, 2015 23:30

If you're willing to use the food mod (you can just install the library bit of it "food", you don't need to install the food that comes with it, "food_basic")

https://github.com/rubenwardy/food/blob ... rt.lua#L20
https://github.com/rubenwardy/food/blob ... ua#L19-L64

If you're not willing to, the just reinplement the function linked to by the second link. (If you just copy and paste, then you need to follow the GPL license.)
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

cron