Page 89 of 169

Re: Post your modding questions here

Posted: Fri Sep 25, 2015 22:24
by Ferk
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.

Re: Post your modding questions here

Posted: Sat Sep 26, 2015 11:34
by Ben
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!

Re: Post your modding questions here

Posted: Tue Sep 29, 2015 17:16
by Don
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

Re: Post your modding questions here

Posted: Wed Sep 30, 2015 14:14
by Nathan.S
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.

Re: Post your modding questions here

Posted: Wed Sep 30, 2015 14:51
by Hybrid Dog
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

Re: Post your modding questions here

Posted: Wed Sep 30, 2015 14:52
by Don
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.

Re: Post your modding questions here

Posted: Wed Sep 30, 2015 14:52
by Don
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.

Re: Post your modding questions here

Posted: Wed Sep 30, 2015 14:55
by Hybrid Dog
Is it possible to change the light at a specific place (e.g. using vmanip) that it looks like a shadow?

Re: Post your modding questions here

Posted: Wed Sep 30, 2015 16:10
by kaadmy
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 :(

Re: Post your modding questions here

Posted: Wed Sep 30, 2015 16:15
by Hybrid Dog
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

Re: Post your modding questions here

Posted: Wed Sep 30, 2015 21:01
by Don
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)

Re: Post your modding questions here

Posted: Wed Sep 30, 2015 22:51
by Nathan.S
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.

Re: Post your modding questions here

Posted: Wed Sep 30, 2015 23:03
by DoyleChris
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.

Re: Post your modding questions here

Posted: Thu Oct 01, 2015 12:47
by Don
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.

Re: Post your modding questions here

Posted: Thu Oct 01, 2015 17:33
by bark
EDIT: Posted in the wrong place.

Re: Post your modding questions here

Posted: Fri Oct 02, 2015 01:22
by eduardomezencio
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?

Re: Post your modding questions here

Posted: Fri Oct 02, 2015 08:19
by Ferk
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.

Re: Post your modding questions here

Posted: Fri Oct 02, 2015 11:22
by eduardomezencio
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.

Re: Post your modding questions here

Posted: Fri Oct 02, 2015 11:28
by Ferk
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.

Re: Post your modding questions here

Posted: Fri Oct 02, 2015 15:32
by eduardomezencio
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.

Re: Post your modding questions here

Posted: Fri Oct 02, 2015 18:57
by Ferk
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.

Re: Post your modding questions here

Posted: Sat Oct 03, 2015 01:31
by eduardomezencio
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.

Re: Post your modding questions here

Posted: Sat Oct 03, 2015 12:09
by rubenwardy
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.

Re: Post your modding questions here

Posted: Sat Oct 03, 2015 17:01
by eduardomezencio
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.

Re: Post your modding questions here

Posted: Sat Oct 03, 2015 17:18
by eduardomezencio
And it didn't work. You can get chunksize with get_mapgen_params() but you can't change it with set_mapgen_params().