Post your modding questions here

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

Re: Post your modding questions here

by Ferk » Post

paramat wrote:minp.y of the surface mapchunk is -32, so this code only acts on empty mapchunks, mgv6 doesn't rise above the surface mapchunk (-32 to 47).
Perhaps just ignore any heightmap value of y = 47 as that is usually inside a mountain (not in mgv6 though because of the above fact).
Thanks! that makes sense.

I changed the dungeon maze to generate from -35 downwards and I had no problems anymore. I'll limit the generation of the entrances to the chunks in the ground level only (from -32 to 47).

Entrances will sometimes generate inside of mountains, but I think I prefer to leave it like that rather than prevent the entrance from getting generated at all.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }

User avatar
Ben
Member
Posts: 160
Joined: Tue Mar 31, 2015 20:09

Re: Post your modding questions here

by Ben » Post

Hybrid Dog wrote: there's a better way
https://github.com/minetest/minetest/co ... t-13428878
obviously calling the vmanip:read_from_map(minp,maxp) makes minetest. Get node work in those chunk(s).
Wow, thanks, "emerging" the area sounds exactly like what I wanted! I'ma go test for minetest.emerge_area(), and use it if present. I won't be relying on the result, anyway (it's very legit for the area to not be emerged yet / be unloaded again by the time I do my checks). Thanks!

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

Re: Post your modding questions here

by Don » Post

I am trying to figure out item_drop. I am not sure if it is the right function to use.
I am trying to make it so when you punch a node the node stays but an item is placed into the players inventory.

Code: Select all

on_punch = function(pos, node, puncher, pointed_thing)
		minetest.item_drop("default:cobble 1", puncher, pos)
end
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: 1147
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: Post your modding questions here

by Nathan.S » Post

I use minetest.add_item(pos, 'mod:thing') which works just fine, I think this may be an area where multiple functions can accomplish the same thing.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
Hybrid Dog
Member
Posts: 2828
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

Don wrote:[…] when you punch a node the node stays but an item is placed into the players inventory.
just get the inventory of the puncher
https://github.com/HybridDog/treecapita ... t.lua#L262
and add an item there
https://github.com/HybridDog/treecapita ... ua#L72-L77

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

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

Re: Post your modding questions here

by Don » Post

Nathan.S wrote:I use minetest.add_item(pos, 'mod:thing') which works just fine, I think this may be an area where multiple functions can accomplish the same thing.
Thanks. I will do it that way.
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
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Post

Hybrid Dog wrote:
Don wrote:[…] when you punch a node the node stays but an item is placed into the players inventory.
just get the inventory of the puncher
https://github.com/HybridDog/treecapita ... t.lua#L262
and add an item there
https://github.com/HybridDog/treecapita ... ua#L72-L77
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

User avatar
Hybrid Dog
Member
Posts: 2828
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

Is it possible to change the light at a specific place (e.g. using vmanip) that it looks like a shadow?

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
kaadmy
Member
Posts: 706
Joined: Thu Aug 27, 2015 23:07
GitHub: kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD

Re: Post your modding questions here

by kaadmy » Post

Hybrid Dog wrote:Is it possible to change the light at a specific place (e.g. using vmanip) that it looks like a shadow?
Hmm, interesting...
If you used worldedit and fixed light, the shadows would be removed, though :(
Never paint white stripes on roads near Zebra crossings.

Pixture

User avatar
Hybrid Dog
Member
Posts: 2828
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: Post your modding questions here

by Hybrid Dog » Post

kaadmy wrote:
Hybrid Dog wrote:Is it possible to change the light at a specific place (e.g. using vmanip) that it looks like a shadow?
Hmm, interesting...
If you used worldedit and fixed light, the shadows would be removed, though :(
that wouldn't be a problem, shadows need to get recalculated often and l don't use the fixlight command

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

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

Re: Post your modding questions here

by Don » Post

I want to get_objects_inside_radius to find players. Then I want it to get the player names and make them strings.
Using the example from the wiki how would I change it so I can send a chat message to people within a set radius?

Code: Select all

		local all_objects = minetest.get_objects_inside_radius({x=0, y=0, z=0}, 10)
		local players = {}
		local _,obj
		for _,obj in ipairs(all_objects) do
			if obj:is_player() then
				table.insert(players, obj)
			end
		end
		minetest.chat_send_player(players, name.." placed a "..descr)
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: 1147
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: Post your modding questions here

by Nathan.S » Post

Don you might try looking at this code. https://github.com/minetest-australopit ... e.lua#L321 I won't do anything for bystanders that aren't playing the game, but might that might not be a problem. I can't imagine there would be too many people interested in watching but not playing.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

DoyleChris
Member
Posts: 265
Joined: Sat Jul 25, 2015 19:54
In-game: DoyleChris

Re: Post your modding questions here

by DoyleChris » Post

I am trying to figure out how to make the Nuke Mod 1.6 drop lumps when detonated. I have been comparing the code to the TNT mod and trying to figure out what to add from the TNT mod to the Nuke Mod to make it work.

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

Re: Post your modding questions here

by Don » Post

DoyleChris wrote:I am trying to figure out how to make the Nuke Mod 1.6 drop lumps when detonated. I have been comparing the code to the TNT mod and trying to figure out what to add from the TNT mod to the Nuke Mod to make it work.
You would use item_drop. Make a list of items that you want it to drop either by get_objects_inside_radius or making your own list.
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

bark
Member
Posts: 35
Joined: Thu Sep 24, 2015 13:25
In-game: bark

Re: Post your modding questions here

by bark » Post

EDIT: Posted in the wrong place.
Last edited by bark on Fri Oct 02, 2015 08:15, edited 1 time in total.

User avatar
eduardomezencio
Member
Posts: 73
Joined: Tue Sep 08, 2015 17:48
GitHub: eduardomezencio

Re: Post your modding questions here

by eduardomezencio » Post

Games can have a minetest.conf file that will override some settings, right? (I never found this in the documentation, but I found a minetest.conf file in a lot of games)

Can a mod do the same?

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

Re: Post your modding questions here

by Ferk » Post

eduardomezencio wrote:Games can have a minetest.conf file that will override some settings, right? (I never found this in the documentation, but I found a minetest.conf file in a lot of games)

Can a mod do the same?
Maybe it would work to use minetest.setting_set (http://dev.minetest.net/minetest.setting_set).
But would this override the global settings for the user? I hope it only affects the minetest.conf of the world, the documentation doesn't explain.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }

User avatar
eduardomezencio
Member
Posts: 73
Joined: Tue Sep 08, 2015 17:48
GitHub: eduardomezencio

Re: Post your modding questions here

by eduardomezencio » Post

Ferk wrote:Maybe it would work to use minetest.setting_set (http://dev.minetest.net/minetest.setting_set).
This would help, but only if it could be executed before anything is loaded. That's because the thing I want to change is the chunk size, to optimize my mapgen. Changing it after the world starts generating would not help.

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

Re: Post your modding questions here

by Ferk » Post

eduardomezencio wrote:This would help, but only if it could be executed before anything is loaded. That's because the thing I want to change is the chunk size, to optimize my mapgen. Changing it after the world starts generating would not help.
I guess if you put it directly in the init.lua of your mod it should be effective as soon as the mods get loaded (which I believe precedes mapgen).

Or maybe it also works if you add it as a handler for mapgen init: http://dev.minetest.net/minetest.regist ... apgen_init

But I don't know for sure what's the right way.. can someone else answer? I would also be interested.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }

User avatar
eduardomezencio
Member
Posts: 73
Joined: Tue Sep 08, 2015 17:48
GitHub: eduardomezencio

Re: Post your modding questions here

by eduardomezencio » Post

Ferk wrote:I guess if you put it directly in the init.lua of your mod it should be effective as soon as the mods get loaded (which I believe precedes mapgen).
I don't know if this is the right thing, but it kinda 'feels like' the right thing. I'll test it soon.

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

Re: Post your modding questions here

by Ferk » Post

I also have a question: how come there's a "minetest.dir_to_wallmounted" but not a "minetest.wallmounted_to_dir"?

I'm implementing some rotation logic and I need to be able to convert the values to vector, transform them and convert them back. I can do this with facedir nodes but not wallmounted.

EDIT: Not sure if there's some other way to convert wallmounted to dir right now, but I opened a pull request to add that function to the engine.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }

User avatar
eduardomezencio
Member
Posts: 73
Joined: Tue Sep 08, 2015 17:48
GitHub: eduardomezencio

Re: Post your modding questions here

by eduardomezencio » Post

Ferk wrote:Maybe it would work to use minetest.setting_set (http://dev.minetest.net/minetest.setting_set).
I tested it, and it's not the solution. First problem is that it changes the user setting in his minetest.conf file, so it may cause problems with his other worlds. Second that just putting it in init.lua does not make the setting change before mapgen starts. Only after closing and opening the world again it starts to work.

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: Post your modding questions here

by rubenwardy » Post

minetest.set_mapgen_params(MapgenParams) may be the solution

https://github.com/minetest/minetest/bl ... .txt#L2007

you can set seed, flags, water level and mgname.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
eduardomezencio
Member
Posts: 73
Joined: Tue Sep 08, 2015 17:48
GitHub: eduardomezencio

Re: Post your modding questions here

by eduardomezencio » Post

rubenwardy wrote:minetest.set_mapgen_params(MapgenParams) may be the solution

https://github.com/minetest/minetest/bl ... .txt#L2007

you can set seed, flags, water level and mgname.
Thank you very much for your answer. This seems to be the solution, but the information in the wiki contradicts it. First, chunksize is not listed as a possible value for mapgen_params here: http://dev.minetest.net/minetest.set_mapgen_params

Second, this page http://dev.minetest.net/Mapgen_Parameters says the following about chunksize:
http://dev.minetest.net/Mapgen_Parameters wrote:This parameter cannot be modified through the Lua API.
I'll test your suggestion. I hope it works, but then it will mean that the wiki definitely needs some fixing.

User avatar
eduardomezencio
Member
Posts: 73
Joined: Tue Sep 08, 2015 17:48
GitHub: eduardomezencio

Re: Post your modding questions here

by eduardomezencio » Post

And it didn't work. You can get chunksize with get_mapgen_params() but you can't change it with set_mapgen_params().

Locked

Who is online

Users browsing this forum: No registered users and 3 guests