minetest.register_on_generated()?

User avatar
0gb.us
Member
 
Posts: 841
Joined: Sun Sep 16, 2012 01:55

minetest.register_on_generated()?

by 0gb.us » Sat Feb 16, 2013 00:28

To better understand minetest.register_on_generated(), I added this code to my game:

minetest.register_on_generated(function(minp, maxp, seed)
local debug = "minp="..(minetest.pos_to_string(minp))..", maxp="..(minetest.pos_to_string(maxp))..", seed="..seed
print(debug)
minetest.chat_send_all(debug)
end)


The output was quite strange though.

minp=(0,0,0), maxp=(15,15,15), seed=0
minp=(0,0,0), maxp=(15,15,15), seed=0
minp=(0,0,0), maxp=(15,15,15), seed=0
minp=(-30832,-112,30768), maxp=(-30753,-33,30847), seed=782612992
minp=(-30832,-112,30848), maxp=(-30753,-33,30927), seed=3833351712
minp=(-30832,48,30768), maxp=(-30753,127,30847), seed=789352672
minp=(0,0,0), maxp=(15,15,15), seed=0
minp=(0,0,0), maxp=(15,15,15), seed=0
minp=(0,0,0), maxp=(15,15,15), seed=0
minp=(0,0,0), maxp=(15,15,15), seed=0
minp=(0,0,0), maxp=(15,15,15), seed=0
minp=(0,0,0), maxp=(15,15,15), seed=0
minp=(0,0,0), maxp=(15,15,15), seed=0
minp=(0,0,0), maxp=(15,15,15), seed=0
minp=(-30832,-32,30688), maxp=(-30753,47,30767), seed=2030211408
minp=(0,0,0), maxp=(15,15,15), seed=0
minp=(-30912,-32,30688), maxp=(-30833,47,30767), seed=2030209568
minp=(0,0,0), maxp=(15,15,15), seed=0
minp=(0,0,0), maxp=(15,15,15), seed=0
minp=(-30832,48,30688), maxp=(-30753,127,30767), seed=2033581248
minp=(-30832,-112,30688), maxp=(-30753,-33,30767), seed=2026841568


The seed keeps changing, which I imagine is because the seed used by the function is some permutation to the coordinates and the world seed or something. But almost every line is "minp=(0,0,0), maxp=(15,15,15), seed=0" (My exert doesn't show that, but about 90% of the time, that's the line that is displayed.) Is there some reason why it keeps trying to edit the center map chunk? I'm at the edge of the world (to insure new chunks are generated) and the most common coordinates are still positioned in the spawn area.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sat Feb 16, 2013 15:13

The seed param is the blockseed, so its different for each block.
 

User avatar
0gb.us
Member
 
Posts: 841
Joined: Sun Sep 16, 2012 01:55

by 0gb.us » Sat Feb 16, 2013 15:20

Okay. I figured something like that. But why does it keep trying to generate the map chunk at the very center of the map when I am steps away from the very edge of the map? "minp=(0,0,0), maxp=(15,15,15)"
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sat Feb 16, 2013 15:38

 

User avatar
0gb.us
Member
 
Posts: 841
Joined: Sun Sep 16, 2012 01:55

by 0gb.us » Mon Feb 18, 2013 12:01

So it's an edge of the map issue. Thanks! I just tested a bit closer in, and I was able to get better test data.
 

User avatar
0gb.us
Member
 
Posts: 841
Joined: Sun Sep 16, 2012 01:55

by 0gb.us » Mon Feb 18, 2013 22:02

Apparently, the map generator tries to regenerate the map chunk in the center when it would normally generate nodes beyond the edge of the game.

Hmmm. I wonder if the center chunk would be regenerated if a player stood there to keep it loaded while another player stood at the edge .... I'll have to test that. My guess it that the C++ mapgen won't replace the center chunk, but the Lua scrtpts are clearly being used. So if someone build a stone structure there for example, it may end up with ore in it.

EDIT: My hunch was right. There are no signs of C++ mapgen regenerating the center chunk, but coal ore pops up in the stone I left there. No iron ore though, with my seed. With a different seed, iron may appear as well. Or if it is a desert, it may respawn cactus and dry shrubs.
Last edited by 0gb.us on Mon Feb 18, 2013 22:18, edited 1 time in total.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Feb 19, 2013 14:55

0gb.us wrote:Apparently, the map generator tries to regenerate the map chunk in the center when it would normally generate nodes beyond the edge of the game.

Hmmm. I wonder if the center chunk would be regenerated if a player stood there to keep it loaded while another player stood at the edge .... I'll have to test that. My guess it that the C++ mapgen won't replace the center chunk, but the Lua scrtpts are clearly being used. So if someone build a stone structure there for example, it may end up with ore in it.

EDIT: My hunch was right. There are no signs of C++ mapgen regenerating the center chunk, but coal ore pops up in the stone I left there. No iron ore though, with my seed. With a different seed, iron may appear as well. Or if it is a desert, it may respawn cactus and dry shrubs.

Thats because the Lua API call ignores the no_op flag.
http://irc.minetest.ru/minetest-dev/2013-02-16#i_2875750
 

User avatar
Chinchow
Member
 
Posts: 683
Joined: Tue Sep 18, 2012 21:37

by Chinchow » Tue Feb 19, 2013 22:15

So possibly renewable coal?
Sometimes, it's harder to think up a mod than it is to create it.
Mods: Orichalcum Stonebricks Extra Chests
 

User avatar
0gb.us
Member
 
Posts: 841
Joined: Sun Sep 16, 2012 01:55

by 0gb.us » Tue Feb 19, 2013 22:27

PilzAdam wrote:Thats because the Lua API call ignores the no_op flag.
http://irc.minetest.ru/minetest-dev/2013-02-16#i_2875750


That's very interesting. Though this is nowhere near being worthy of being on the priority list yet, I wonder if there's a way to fix it in the distant future. Maybe after I find the time to learn C++ ....

Chinchow wrote:So possibly renewable coal?


Not truly renewable, at least not until stone is renewable. This just converts some of the stone to coal.
 

rarkenin
Member
 
Posts: 668
Joined: Tue Nov 20, 2012 20:48

by rarkenin » Wed Feb 20, 2013 13:09

0gb.us wrote:
PilzAdam wrote:Thats because the Lua API call ignores the no_op flag.
http://irc.minetest.ru/minetest-dev/2013-02-16#i_2875750


That's very interesting. Though this is nowhere near being worthy of being on the priority list yet, I wonder if there's a way to fix it in the distant future. Maybe after I find the time to learn C++ ....

Chinchow wrote:So possibly renewable coal?


Not truly renewable, at least not until stone is renewable. This just converts some of the stone to coal.


Actually, if done correctly, you would be able to use renewable wood to smelt cobble to stone, place it, and trigger the bug. Then again, that would require cobble generators.
Last edited by rarkenin on Wed Feb 20, 2013 13:10, edited 1 time in total.
Admin pro tempore on 0gb.us:30000. Ask me if you have a problem, or just want help.
This is a signature virus. Add me to your signature so that I can multiply.
Now working on my own clone, Mosstest.
I guess I'm back for some time.
 

User avatar
0gb.us
Member
 
Posts: 841
Joined: Sun Sep 16, 2012 01:55

by 0gb.us » Wed Feb 20, 2013 21:42

rarkenin wrote:Actually, if done correctly, you would be able to use renewable wood to smelt cobble to stone, place it, and trigger the bug. Then again, that would require cobble generators.


Yes, I understand that. You know I only smelt using renewable fuels. But stone/cobble are not renewable.
 

User avatar
shadowwraith
Member
 
Posts: 63
Joined: Fri Feb 15, 2013 23:27

by shadowwraith » Sun Feb 24, 2013 04:59

What about charcoal

In minecraft you could smelt wood, using wood sticks as a fuel to make charcoal which can thenn be used if there is no coal available.

Since trees can be replanted it is therefore a renewable fuel.

just a thought :)
"Spill some blood for me dear Brother" Vicente Valtiare, Oblivion

Currently using Minetest 0.4.7 Ubuntu Daily Build on Ubuntustudio 13.10 Saucy Salamander 64bit (based on Ubuntu 13:10)
Trolls will be shot on sight!!!
 

User avatar
0gb.us
Member
 
Posts: 841
Joined: Sun Sep 16, 2012 01:55

by 0gb.us » Sun Feb 24, 2013 06:11

shadowwraith wrote:What about charcoal

In minecraft you could smelt wood, using wood sticks as a fuel to make charcoal which can thenn be used if there is no coal available.

Since trees can be replanted it is therefore a renewable fuel.

just a thought :)


Renewable fuel, and more importantly (as trees are ALREADY renewable fuel), renewable torches.

In Minetest, you used to be able to smelt wood to get coal, but that was removed. Since it already existed but was removed, it's likely we won't get it back.
 

deivan
Member
 
Posts: 452
Joined: Fri Feb 15, 2013 10:16

by deivan » Wed Mar 06, 2013 12:46

About stones, after corrected the mod "lava cooling" is possible construct a stone factory. I have one in my game. :)
 


Return to Minetest General

Who is online

Users browsing this forum: No registered users and 10 guests