get_voxel_manip and ignore
get_voxel_manip and ignore
I'm trying to make my beanstalk generate when the admin plants a magic bean
What I need to do is use get_voxel_manip and generate the beanstalk in already generated chunks, working my way up until I reach the level where chunks have NOT been generated yet. Then I want to let the regular on_generated function do the rest.
So I do a: vm = minetest.get_voxel_manip() and emin, emax = vm:read_from_map(minp, maxp),
then I start working my way up y. Eventually I get to height y=128, and there, the data[vi] switches from 126 (air) to 127 (ignore), so I'm assuming that area has not been generated yet.
but I am not getting the behavior I expected. if I load and generate up to 127 and stop, nothing from 128 up to 200 generates. on_generated takes over at node 201 and the beanstalk IS generated normally from there up.
if I stop generating much lower than 127 (say at 79), still nothing generates until node 201
if I try to generate past 127, it faithfully generates the beanstalk up to 127, but from 128 up to 201, no nodes placed actually appear on the map.
I am obviously NOT dealing with the vm correctly when it hits ignore. What is the proper method of handling this? Should I be force loading chunks?
Thank you.
What I need to do is use get_voxel_manip and generate the beanstalk in already generated chunks, working my way up until I reach the level where chunks have NOT been generated yet. Then I want to let the regular on_generated function do the rest.
So I do a: vm = minetest.get_voxel_manip() and emin, emax = vm:read_from_map(minp, maxp),
then I start working my way up y. Eventually I get to height y=128, and there, the data[vi] switches from 126 (air) to 127 (ignore), so I'm assuming that area has not been generated yet.
but I am not getting the behavior I expected. if I load and generate up to 127 and stop, nothing from 128 up to 200 generates. on_generated takes over at node 201 and the beanstalk IS generated normally from there up.
if I stop generating much lower than 127 (say at 79), still nothing generates until node 201
if I try to generate past 127, it faithfully generates the beanstalk up to 127, but from 128 up to 201, no nodes placed actually appear on the map.
I am obviously NOT dealing with the vm correctly when it hits ignore. What is the proper method of handling this? Should I be force loading chunks?
Thank you.
-
- Member
- Posts: 4276
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
Re: get_voxel_manip and ignore
I'm not sure if this will help you (or even covers the problem). When mapchunks are generated, they're generated with an outer shell one mapblock (16 nodes) wide. If the mapchunk at the other side of that shell block hasn't been generated yet, the shell will be filled with ignore nodes. Caves may "wander" into the shell and place air blocks into that ignore space wherever there'll be a cave later on.
Perhaps it might help you to place at least one beanstalk node into the ignore-filled shell.
Perhaps it might help you to place at least one beanstalk node into the ignore-filled shell.
A list of my mods can be found here.
Re: get_voxel_manip and ignore
Thank you for the info Sokomine.
tried writing over by one, same results.Sokomine wrote: Perhaps it might help you to place at least one beanstalk node into the ignore-filled shell.
-
- Member
- Posts: 1118
- Joined: Mon Dec 29, 2014 08:07
- Location: USA
Re: get_voxel_manip and ignore
Correct me if I am wrong, but I think the voxel_manip is on available during on_generated calls.
Re: get_voxel_manip and ignore
minetest.get_mapgen_object() during mapgen onlyShadMOrdere wrote:Correct me if I am wrong, but I think the voxel_manip is on available during on_generated calls.
minetest.get_voxel_manip() after mapgen.
Which I'm doing, but I seem to be running into some blocks that can not be updated with get_voxel_manip after mapgen, and do not get automatically updated during mapgen with get_mapgen_object.
-
- Member
- Posts: 4276
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
Re: get_voxel_manip and ignore
After I've aktually seen the beanstalks: Just use minetest.register_on_generated, do know where a beanstalk will be without having to rely on the ground beeing generated, and always put the beanstalk into the mapchunk and the outer shell. Then you ought to be fine.
A list of my mods can be found here.
Re: get_voxel_manip and ignore
Pretty much how its being done. Its just that I'm trying to add new functionality. A magic bean that an admin can place wherever they want, and a new beanstalk will be added at that position. Handy when someone wants a beanstalk at spawn, etc.Sokomine wrote:Just use minetest.register_on_generated, do know where a beanstalk will be without having to rely on the ground beeing generated, and always put the beanstalk into the mapchunk and the outer shell. Then you ought to be fine
I THOUGHT it would be pretty simple. But I'm stuck. My code should just generate until it hits an ungenerated block, then let the on_generated function take over. But there are (in some places) blocks full of ignore that can not be written over with voxel_manip, and don't generate with on_generate and mapgen_object.
SO, I've pushed a new beanstalk branch "magicbeans" https://github.com/Kilarin/beanstalk/tree/magicbeans
And a corresponding "magicbeans" branch to fractured: https://github.com/Kilarin/fractured/tree/magicbeans
It has the new magic beancode, and a bunch of (slow) debugging statements in the log.
to test, install fractured from the magicbeans branch (or beanstalks in your own game from the magicbeans branch), start a new game then:
/grant singleplayer all
/giveme beanstalk:magic_bean
and place the magic bean on the ground.
If you do this in fractured in the spawn blast area, you will see the beanstalk immediately grow up to y=127, then a gap, then the autogeneration takes over at y=200. But looking in debug, you will see the logging statements indicating that the code is writing to the voxelmanip for y>127 y<200, but changes aren't being saved on those blocks.
If you run around placing magic_beans at other spots, sometimes there will be no gap, sometimes there will. Its always blocks full of ignore.
Any minetest genius who can figure out what is wrong will officially be my favorite person for the entire week. :)
-
- Member
- Posts: 4276
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
Re: get_voxel_manip and ignore
Maybe that's related to the general problem with spawning large schematics. We had some similar errors there recently as well. AFAIK no solution has been found yet.
As to your beans...they're supposed to grow. If someone places one, chunks above may have already generated. Maybe you need to change it so that it starts growing when the topmost nodes get hit by an abm. Players actually climbing up would then let the beanstalk slowly grow.
As to your beans...they're supposed to grow. If someone places one, chunks above may have already generated. Maybe you need to change it so that it starts growing when the topmost nodes get hit by an abm. Players actually climbing up would then let the beanstalk slowly grow.
A list of my mods can be found here.
-
- Member
- Posts: 1118
- Joined: Mon Dec 29, 2014 08:07
- Location: USA
Re: get_voxel_manip and ignore
Yes, I was going to suggest the same thing as Sokomine.
This thread, viewtopic.php?f=6&t=22136 may offer further insight.
Also, while minetest.get_voxel_manip() might work after mapgen, it still may have limitations as to where it can be used. Try an LVM.
This thread, viewtopic.php?f=6&t=22136 may offer further insight.
Also, while minetest.get_voxel_manip() might work after mapgen, it still may have limitations as to where it can be used. Try an LVM.
Re: get_voxel_manip and ignore
thank you for the links and advice! I will look into it.
-
- Member
- Posts: 1118
- Joined: Mon Dec 29, 2014 08:07
- Location: USA
Re: get_voxel_manip and ignore
Kilarin,
You might also investigate magma_conduits mod.
On a side, I'm wondering if there might be a specific issue where, as Sokomine suggested, you are able to write to the edge of adjacent blocks, if they are ungenerated, but if they are already generated, there may be an issue doing this. Just a thought.
Also, are you writing the generated beanstalk directly in the voxel_manip, or do you generate (a) schematic(s) and place the generated schematics? If you are generating and writing directly, try the alternate, where you instead write to a schematic, and then place schematics in the "generated" areas while doing what already works for the ungenerated areas?
You might also investigate magma_conduits mod.
On a side, I'm wondering if there might be a specific issue where, as Sokomine suggested, you are able to write to the edge of adjacent blocks, if they are ungenerated, but if they are already generated, there may be an issue doing this. Just a thought.
Also, are you writing the generated beanstalk directly in the voxel_manip, or do you generate (a) schematic(s) and place the generated schematics? If you are generating and writing directly, try the alternate, where you instead write to a schematic, and then place schematics in the "generated" areas while doing what already works for the ungenerated areas?
-
- Member
- Posts: 4276
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
Re: get_voxel_manip and ignore
I usually had better results with writing directly into the VoxelManip. Trying to place schematics using the engine didn't work the way I needed it the last time I tried. My skyplatform mod uses place_schematic, and that has those issues with spawning large schematics (doesn't operate in on_generated; just spawns them later on). Thus, writing directly to the VoxelManip may be safest.
A list of my mods can be found here.
Re: get_voxel_manip and ignore
Yes, no schematics involved in the beanstalks. May have to test using a schematic, but that would be a pretty major rewrite.ShadMOrdre wrote: writing the generated beanstalk directly in the voxel_manip
I'm a bit confused by this, since my understand was that get_voxel_manip returns an LVM (Lua Voxel Manipulator)ShadMOrdre wrote:while minetest.get_voxel_manip() might work after mapgen, it still may have limitations as to where it can be used. Try an LVM
In "realms" I had to modify my code to add schematics to a table, instead of adding them directly to the lvm during generation, and then add them all at the end when the lvm was being saved because minetest.place_schematic writes to the map, not the vm area, and place_schematic_vmanip does nothing if you are writing to the area, it has to be run after 'set data' and before any of: 'set lighting', 'calc lighting', 'write to map'Sokomine wrote:Trying to place schematics using the engine didn't work the way I needed it the last time I tried.
Who is online
Users browsing this forum: Google [Bot] and 6 guests