Force minetest to load an area

npx
Member
 
Posts: 165
Joined: Thu Apr 09, 2015 21:17
In-game: npx

Force minetest to load an area

by npx » Tue Oct 18, 2016 21:26

We are working on a new dimension for our mod nssm and we would like to add some schematics to it. The problem is I don't understand how to force minetest to load an area that is really far from the player.

I tried to reproduce the code that Pilzadam used for his nether mod, but there are some differences in our methods. (I need to place some schematics while Pilzadam builds his portal directly using lua code).

Anyways he uses two functions:
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.get_voxel_manip():read_from_map(pos, pos)
minetest.emerge_area(vector.subtract(pos, 80), vector.add(pos, 80))


I can't understand the differences between these two function (I read the wiki for them). The first doesn't work for me and it gives me this error:
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/mods/nssb/mapgen.lua:792: attempt to index a nil value

I can't understand which is the nil value because the variable "pos" does exist and it is set.

The second function seems to work because it doesn't give any error and after it I can add the schematic, but when I teleport to the place where I have added the schematic the world isn't loaded and when finally it gets loaded the schematic is there but some of its block have not been correctly placed.

Can someone help me?
Thank You
 

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

Re: Force minetest to load an area

by paramat » Tue Oct 18, 2016 22:42

PilzAdam's nether mod now uses a schematic for the portal, i coded it. See that for an example.
Make sure you have 'force place' set to true in 'place schematic', or, per-node force place for each solid node in the schematic.
Also, every solid node in the schematic must have 'is ground content = false' to avoid being removed by overgenerating caves. For example natural materials like stone can be removed. So create mod duplicate nodes that have ground content = false.
 

npx
Member
 
Posts: 165
Joined: Thu Apr 09, 2015 21:17
In-game: npx

Re: Force minetest to load an area

by npx » Sat Oct 22, 2016 21:29

Thank You for your help.
I will study your version of the nether mod!
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 5 guests

cron