Still struggling with rivers, they are painful when you don;t particularly want them to be placed to randomly.
Hopefully quick question - On generation I perform some cleanup on my river so it doesn't spill over the edges etc (codes not complete yet but close). However I can find any block thats more negative than the current block I'm replacing usually for reference. However I can't see a way of finding a block more positive before the whole on_generated has run.
At the moment what I'm trying to do is backwards replace a node as I have some basic mirroring going on so if for example I need to remove block x=1 y=1 z=1 and assuming river bed is currently centered on 0 I know I also need to remove x=1 y=1 z=-2. Currently I tried doing this using minetest.set_node({x=x, y=y, z=z-2}, {name="default:sand"}). I attempt to do this while currently setting the data object for x=1 y=1 z=1. So this very fragmented block of code below:
Code: Select all
data[a:index(x, y, z)] = c_ice -- expanded that for clarity
minetest.set_node({x=x, y=y, z=z-2}, {name="default:sand"})
essentially backwards overwriting the required block while setting the current block...except it dosent work. I think this is because the voxelmanip doesn't update until the end and update the whole so essentially my "node" dosen;t yet truly exist until the chunk is updated. So is there an easy way to essentially go back and replace a specific node when the chunk is mid generation?
I do have a workaround store the x,y,z for the required nodes in a table then after chunk generation ends then call set node and run it across all coords in the table...This just seems more untidy to me, but maybe it is the best way.
Appreciate the help and advice, I'm very close to having a river I'm happy with just trying to iron out some noise overlay issues.