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 Sep 25, 2015 00:40

It is saying that it is placing a node but when I check the location there is nothing there.

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
2015-09-24 17:33:06: ACTION[Emerge-0]: Placing node at 1962,-4,-2100
action   Placing node at 1962,-4,-2100
2015-09-24 17:33:06: ACTION[Emerge-0]: Placing node at 1784,10,-2053
action   Placing node at 1784,10,-2053
2015-09-24 17:33:12: ACTION[Emerge-0]: Placing node at 1742,-4,-2197
action   Placing node at 1742,-4,-2197
2015-09-24 17:33:14: ACTION[Emerge-0]: Placing node at 1944,0,-2207
action   Placing node at 1944,0,-2207
2015-09-24 17:33:22: ACTION[Emerge-0]: Placing node at 1754,7,-2368
action   Placing node at 1754,7,-2368
2015-09-24 17:33:24: ACTION[Emerge-0]: Placing node at 1956,15,-2390
action   Placing node at 1956,15,-2390
2015-09-24 17:33:38: ACTION[Emerge-0]: Placing node at 1676,12,-2353
action   Placing node at 1676,12,-2353
2015-09-24 17:33:39: ACTION[Emerge-0]: Placing node at 1699,-7,-2582
action   Placing node at 1699,-7,-2582
2015-09-24 17:33:40: ACTION[Emerge-0]: Placing node at 1767,12,-2590
action   Placing node at 1767,12,-2590
2015-09-24 17:33:49: ACTION[Emerge-0]: Placing node at 1696,48,-2726
action   Placing node at 1696,48,-2726
2015-09-24 17:33:50: ACTION[Emerge-0]: Placing node at 1765,48,-2748
action   Placing node at 1765,48,-2748
2015-09-24 17:33:54: ACTION[Emerge-0]: Placing node at 1540,17,-2518
action   Placing node at 1540,17,-2518
2015-09-24 17:33:56: ACTION[Emerge-0]: Placing node at 1564,5,-2709
action   Placing node at 1564,5,-2709
2015-09-24 17:35:46: ACTION[Emerge-0]: Placing node at 1329,9,-2690
action   Placing node at 1329,9,-2690
2015-09-24 17:35:56: ACTION[Emerge-0]: Placing node at 1362,19,-2533
action   Placing node at 1362,19,-2533
2015-09-24 17:36:00: ACTION[Emerge-0]: Placing node at 1241,4,-2549
action   Placing node at 1241,4,-2549
2015-09-24 17:36:01: ACTION[Emerge-0]: Placing node at 1212,-2,-2748
action   Placing node at 1212,-2,-2748
2015-09-24 17:36:39: ACTION[Emerge-0]: Placing node at 1402,-4,-2839
action   Placing node at 1402,-4,-2839
2015-09-24 17:36:40: ACTION[Emerge-0]: Placing node at 1185,-19,-2882
action   Placing node at 1185,-19,-2882
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 » Fri Sep 25, 2015 01:00

Don wrote:It is saying that it is placing a node but when I check the location there is nothing there.

Strange. The minetes.log line is right before setting The "vd[va:indexp(item_pos)]" value, right? The node should be there then if you do vm:set_data and vm:write_to_map.. And your Y coordinates look reasonable, not sure why mines are so off.
Perhaps my underground mapgen messes up The heightmap calculation?
{ ☠ 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 » Fri Sep 25, 2015 02:11

I had the minetest.log in a different spot. I moved it but got the same result. I can give myself the node and place it in the world. I have an abm running to place a schematic when it finds the node. When I place the node the schematic is placed. I am watching the terminal and seeing the node being placed like the code says above but I can not find any. I have checked it with mapgen v6 and v7. Both were new maps with no other mods running. I am not getting any errors in debug.
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 » Fri Sep 25, 2015 12:59

Ben wrote:
Hybrid Dog wrote:as far as l know the client needs to load the chunk, not the server
there's a function to forceload a chunk: [url]dev.minetest.net/minetest.forceload_block[/url]


Thanks, and sorry for the late reply, but forceload is a mechanism to keep a block loaded "forever", right? So that's not what I'm looking for. Thanks, though!

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).
 

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

Re: Post your modding questions here

by Hybrid Dog » Fri Sep 25, 2015 13:03

Ferk wrote:
Don wrote:It is saying that it is placing a node but when I check the location there is nothing there.

Strange. The minetes.log line is right before setting The "vd[va:indexp(item_pos)]" value, right? The node should be there then if you do vm:set_data and vm:write_to_map.. And your Y coordinates look reasonable, not sure why mines are so off.
Perhaps my underground mapgen messes up The heightmap calculation?

maybe you somewhere didn't round the position before using it for the area index
 

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

Re: Post your modding questions here

by Ferk » Fri Sep 25, 2015 13:45

Hybrid Dog wrote:maybe you somewhere didn't round the position before using it for the area index

You mean for my case or for Don's?

In my case, even though I use an area index for checking the heighmap (not for placing the node itself, since I'm not using voxelmanip), I've even tried printing straight "minetest.get_mapgen_object("heightmap")[1]" in the on_generated and even that returns -31000. It's not just that the Y coordinate is a bit off, it's in the complete lower limit of the map because I can't get the height.

Maybe it's because my "flat" flag is on? I think I have it enabled, but I didn't see much difference anyway so I thought it wasn't really taking effect.

In Don's case, he's printing out the item_pos values before using them and they all seem to be integers.
Last edited by Ferk on Fri Sep 25, 2015 14:09, edited 1 time in total.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

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

Re: Post your modding questions here

by Hybrid Dog » Fri Sep 25, 2015 14:08

you use mgv6, don't you?
 

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

Re: Post your modding questions here

by Ferk » Fri Sep 25, 2015 14:11

Hybrid Dog wrote:you use mgv6, don't you?

I don't recall if I was using mgv6 or mgv7.. but definitely not singlenode.

I will try to check it further later when I reach home.
{ ☠ 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 » Fri Sep 25, 2015 18:11

Ok, I just made a very simple mod called "heighmaptest" with only 5 lines in its init.lua:

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_generated(function(minp, maxp, seed)
   if minp.y > -5 and maxp.y < 200 then
       minetest.log("action"," heighmap 1 : " .. minetest.get_mapgen_object("heightmap")[1]);
   end      
end)


I always get "heighmap 1 : -31000" as output. Even in a completely vanilla Minetest with no other mods and no minetest.conf, just using default mapgen v6. What am I doing wrong?

EDIT: Ok, after some more testing I'm starting to understand....

The heighmap only takes into account the nodes of the currently loading chunk. This means that if your whole chunk is in the underground the heigh is just gonna be the heigh of the top of the chunk (not the surface of the world), and if your chunk happens to be somewhere in the air above the land where there are no blocks, the heigh is -31000 because it would be the same as a singlenode map for that chunk.

This means the heighmap is actually quite an unreliable way to find out where's the surface. The center of a mountain could be reported to be the height if you are unlucky enough to have checked an area of the chunk that is right behind the mountain. You would have no way to know if that heigh is actually the surface or not unless you check the chunk above to see if it's maybe all air or it's a mountain.

So what's the right way to place something in the surface then?

Maybe I will place the node at y == 5 and let the ABM that spawns the entrance carve its way up and/or down before placing the schematic. I have to add a ladder anyway.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

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

Re: Post your modding questions here

by paramat » Fri Sep 25, 2015 19:26

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 minp.y > -5 and maxp.y < 200 then

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).
 

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

Re: Post your modding questions here

by Ferk » Fri Sep 25, 2015 22:24

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: 157
Joined: Tue Mar 31, 2015 20:09

Re: Post your modding questions here

by Ben » Sat Sep 26, 2015 11:34

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: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Tue Sep 29, 2015 17:16

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.

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_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: 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 Sep 30, 2015 14:14

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.
 

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

Re: Post your modding questions here

by Hybrid Dog » Wed Sep 30, 2015 14:51

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: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Wed Sep 30, 2015 14:52

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: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Wed Sep 30, 2015 14:52

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
 

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

Re: Post your modding questions here

by Hybrid Dog » Wed Sep 30, 2015 14:55

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: 627
Joined: Thu Aug 27, 2015 23:07
GitHub: kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD

Re: Post your modding questions here

by kaadmy » Wed Sep 30, 2015 16:10

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.
 

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

Re: Post your modding questions here

by Hybrid Dog » Wed Sep 30, 2015 16:15

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: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Wed Sep 30, 2015 21:01

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?

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
      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: 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 Sep 30, 2015 22:51

Don you might try looking at this code. https://github.com/minetest-australopithecus/minetest-australopithecus-voice/blob/master/mods/voice/voice.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.
 

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

Re: Post your modding questions here

by DoyleChris » Wed Sep 30, 2015 23:03

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: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Thu Oct 01, 2015 12:47

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 » Thu Oct 01, 2015 17:33

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 » Fri Oct 02, 2015 01:22

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: 330
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: Post your modding questions here

by Ferk » Fri Oct 02, 2015 08:19

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 » Fri Oct 02, 2015 11:22

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: 330
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: Post your modding questions here

by Ferk » Fri Oct 02, 2015 11:28

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 » Fri Oct 02, 2015 15:32

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.
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 6 guests

cron