Post your modding questions here

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Post your modding questions here

by TenPlus1 » Mon Sep 21, 2015 11:04

Whoops! wrong thread...
Last edited by TenPlus1 on Mon Sep 21, 2015 13:29, edited 1 time in total.
 

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 » Mon Sep 21, 2015 12:19

TenPlus1 wrote:Could you please move my "Lucky Block" mod to MOD Releases :) Thanks...

viewtopic.php?f=9&t=13284

...and also my Pie mod also...

viewtopic.php?f=9&t=13285

Wrong place.
https://forum.minetest.net/viewtopic.php?f=11&t=10418
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
Sane
Member
 
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Mapgen function called more than once.

by Sane » Mon Sep 21, 2015 15:21

Hi there,

I have noticed that the function registered with minetest.register_on_generated gets called more than once. That seems a bit odd to me.

If that behaviour is intended,
what is the differnce between the calls?
which call is the one that counts? (Most probably the last one, but who knows for sure?)
are earlier calls missing information somehow? If so what is missing?
Isn't it a waste of processing time to have map sections generated several times?

To reproduce run a new minimal word with the following test code:
+ minetest/games/minimal/mods/test/init.lua
Trying to stay me.
 

User avatar
Sane
Member
 
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Re: Mapgen function called more than once.

by Sane » Mon Sep 21, 2015 15:57

Sane wrote:...
I have noticed that the function registered with minetest.register_on_generated gets called more than once. That seems a bit odd to me.
...


Nevermind, just found the solution. That thing bugged me for some days now and as it seems actually posting the question seems to have triggered someting ...

The soulution is that I've set num_emerge_threads = 4 in minetest,conf. Leaving this at 1 solves the issue.
Trying to stay me.
 

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 » Mon Sep 21, 2015 18:10

I want to place a block every 1000 nodes square. It should be somewhat random. I do not want it to be exactly 1000.
The node will be placed in water on mapgen at surface height.

I am not great with mapgen and was wondering what the best way to do this is?
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
Sane
Member
 
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Re: Post your modding questions here

by Sane » Mon Sep 21, 2015 18:13

Don wrote:I want to place a block every 1000 nodes square. It should be somewhat random. I do not want it to be exactly 1000.
The node will be placed in water on mapgen at surface height.

I am not great with mapgen and was wondering what the best way to do this is?


Will this be a new world or an exisiting one?
Trying to stay me.
 

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 » Mon Sep 21, 2015 18:16

New world
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
Sane
Member
 
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Re: Post your modding questions here

by Sane » Mon Sep 21, 2015 18:44

Don wrote:New world

ArguablySane has posted a solution:
viewtopic.php?f=3&t=13132&p=191868#p189480
Trying to stay me.
 

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 » Mon Sep 21, 2015 19:17

Sane wrote:
Don wrote:New world

ArguablySane has posted a solution:
viewtopic.php?f=3&t=13132&p=191868#p189480

Thanks. I will try to modify it to make it work. Do you know if this works with all mapgens or just v5 and v7?
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
Sane
Member
 
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Re: Post your modding questions here

by Sane » Tue Sep 22, 2015 09:33

Don wrote:
Sane wrote:
Don wrote:New world

ArguablySane has posted a solution:
viewtopic.php?f=3&t=13132&p=191868#p189480

Thanks. I will try to modify it to make it work. Do you know if this works with all mapgens or just v5 and v7?


No I don't. But singlenode does not work, the hightmap is always empty.

As I already was fiddeling with mapgen and hightmaps ...
I've patched up a thingy that places a node on the surface, at a random position in the mg block that contains a grid point defined by cell_size. If the mg block is not within y > -200 and < 200 then the node will be placed completely random.
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
--[[
Node placer - Places a node on the surface, at a random position in the mg block that contains a grid point defined by cell_size

published under Creative Commons CC0 license.
--]]

-- cell_size  must be bigger then mg block size (80) to work.
local cell_size = 150
local item_id = minetest.get_content_id("default:steelblock")

minetest.register_on_generated(function(minp, maxp, seed)
   -- If the next_hotspot is not within this mg block then exit
   local next_hotspot = {
      x = math.ceil(minp.x / cell_size) * cell_size,
      y = math.ceil(minp.y / cell_size) * cell_size,
      z = math.ceil(minp.z / cell_size) * cell_size
   }
   if next_hotspot.x > maxp.x or
      next_hotspot.y > maxp.y or
      next_hotspot.z > maxp.z then return end
   
   -- Place the object somewhere in this block

   local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
   local va = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
   local vd = vm:get_data()
   
   local r = PcgRandom(seed) -- this ensures that you get the same results each time you generate the world anew.
   local item_pos = {
      x = r:next(minp.x, maxp.x),
      y = r:next(minp.y, maxp.y),
      z = r:next(minp.z, maxp.z),
   }

   -- This is to optimize, because getting the height map is expensive
   if minp.y > -200 and maxp.y < 200 then
      local hm = minetest.get_mapgen_object("heightmap")
      local hz = (item_pos.z - minp.z) * 80
      local hx = (item_pos.x - minp.x) % 80
      local height = hm[1 + hx + hz]
      item_pos.y = height + 1
   end

   vd[va:indexp(item_pos)] = item_id

   --
   vm:set_data(vd)
   --vm:calc_lighting()
   --vm:update_liquids()
   vm:write_to_map()
   --vm:update_map()
   --
end)
Trying to stay me.
 

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 23, 2015 00:04

@Sane - Thanks. I got busy with something else and haven't tried yet. Will do it tomorrow.

I have another issue though. I have a mts schematic that contains a node with a formspec. When the schematic is placed the node does not have the formspec. I created another block and then used an abm to place the one with the formspec. This seems to work fine.
My question is, is that the best way to do it or is there a better 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
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 23, 2015 00:30

Don wrote:I have another issue though. I have a mts schematic that contains a node with a formspec. When the schematic is placed the node does not have the formspec. I created another block and then used an abm to place the one with the formspec. This seems to work fine.
My question is, is that the best way to do it or is there a better way?

That's how I do it, I couldn't find a better solution.
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 23, 2015 15:05

kaadmy wrote:
Don wrote:I have another issue though. I have a mts schematic that contains a node with a formspec. When the schematic is placed the node does not have the formspec. I created another block and then used an abm to place the one with the formspec. This seems to work fine.
My question is, is that the best way to do it or is there a better way?

That's how I do it, I couldn't find a better solution.

There's another way: you could execute the function which usually becomes executed after the node appears (http://dev.minetest.net/minetest.regist ... _construct)
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 on_construct = minetest.registered_nodes[name].on_construct
if on_construct then
on_construct(pos)
end

You would need to loop through the positions where the schematic added nodes.
 

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

Re: Post your modding questions here

by Ferk » Wed Sep 23, 2015 22:23

-Deleted-

Yep, I didn't read properly. Sorry.
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

User avatar
GunshipPenguin
Member
 
Posts: 94
Joined: Tue Jan 28, 2014 00:38
GitHub: GunshipPenguin
IRC: GunshipPenguin
In-game: GunshipPenguin

Re: Post your modding questions here

by GunshipPenguin » Thu Sep 24, 2015 05:41

I'm having some trouble with the Voxel Manipulator.

Basically, I want the mapgen to generate nodes up to a certain point, then just have all nodes generated past that point filled with an invisible undiggable block. I'm using the following code:

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 SIZE = 200;

minetest.register_node("limit:limit_node", {
   diggable = false,
   sunlight_propagates = true,
   drawtype = "airlike",
})

minetest.register_on_generated(function(minp, maxp, seed)
   local c_limit = minetest.get_content_id("limit:limit_node")
   local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
   local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
   local data = vm:get_data(minp, maxp)
   
   for i in area:iterp(minp, maxp) do
      local currPos = area:position(i)
      if math.abs(currPos["x"]) > SIZE/2 or
            math.abs(currPos["y"]) > SIZE/2 or
            math.abs(currPos["z"]) > SIZE/2 then
         data[i] = c_limit;
      end
   end
   vm:set_data(data)
   vm:write_to_map(data)
end)


In the code above, If the x, y or z coordinate of any generated block is > 100, it will be replaced with the node "limit:limit_node" which is simply an undiggable, invisible node. This code does work, but I find that certian nodes are not replaced by limit:limit_node like I want them to be. Here's are 2 screenshots of what I'm talking about:

+ Spoiler


As you can see in the screenshots, the map stops when x, y or z > 100 except for a few scattered unreplaced nodes. The unreplaced nodes seem to usually be liquids, dungeons and a few dirt or dirt_with_grass nodes.

I'm experiencing this using minetest 0.4.13 stable with the latest minetest_game.

Can anybody tell me why these nodes are not being replaced? Many thanks in advance.

Also, I understand that I could use map_generation_limit in minetest.conf for this, but it doesn’t exactly work with what I'm ultimately trying to do.
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Post your modding questions here

by rubenwardy » Thu Sep 24, 2015 15:23

This is, afaik, due to overgeneration, which causes the c++ mapgen to override your blocks. Paramat is the one to talk to about this.
 

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

Re: Post your modding questions here

by Hybrid Dog » Thu Sep 24, 2015 16:54

rubenwardy wrote:This is, afaik, due to overgeneration, which causes the c++ mapgen to override your blocks. Paramat is the one to talk to about this.

ls overgeneration also the reason for usual trees in the meow heaven?
Image
Attachments
nhvbugtree.png
nhvbugtree.png (303.34 KiB) Viewed 1417 times
 

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

Re: Post your modding questions here

by paramat » Thu Sep 24, 2015 18:01

Hybrid Dog yes probably.

All core mapgens work on the 80^3 node mapchunk plus a 16 node deep shell that extends into / overlaps neighbouring mapchunks. Dungeons, large caves and mgv6 dirt/grass all 'overgenerate' into the shell sometimes.

In your code emin emax are the shell limits, minp maxp are the mapchunk limits try:

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 data = vm:get_data(emin, emax)
   
   for i in area:iterp(emin, emax) do


It might help.
 

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

Re: Post your modding questions here

by Hybrid Dog » Thu Sep 24, 2015 18:13

paramat wrote:Hybrid Dog yes probably.

All core mapgens work on the 80^3 node mapchunk plus a 16 node deep shell that extends into / overlaps neighbouring mapchunks. Dungeons, large caves and mgv6 dirt/grass all 'overgenerate' into the shell sometimes.

In your code emin emax are the shell limits, minp maxp are the mapchunk limits try:

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 data = vm:get_data(emin, emax)
   
   for i in area:iterp(emin, emax) do


It might help.

it would cause unnecessary lag, l guess, the map would become generated more than one time at the same place
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: Post your modding questions here

by Ben » Thu Sep 24, 2015 18:18

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!
 

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

Re: Post your modding questions here

by Ferk » Thu Sep 24, 2015 20:42

Sane wrote:
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
--[[
Node placer - Places a node on the surface, at a random position in the mg block that contains a grid point defined by cell_size

published under Creative Commons CC0 license.
--]]

-- cell_size  must be bigger then mg block size (80) to work.
local cell_size = 150
local item_id = minetest.get_content_id("default:steelblock")

minetest.register_on_generated(function(minp, maxp, seed)
   -- If the next_hotspot is not within this mg block then exit
   local next_hotspot = {
      x = math.ceil(minp.x / cell_size) * cell_size,
      y = math.ceil(minp.y / cell_size) * cell_size,
      z = math.ceil(minp.z / cell_size) * cell_size
   }
   if next_hotspot.x > maxp.x or
      next_hotspot.y > maxp.y or
      next_hotspot.z > maxp.z then return end
   
   -- Place the object somewhere in this block

   local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
   local va = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
   local vd = vm:get_data()
   
   local r = PcgRandom(seed) -- this ensures that you get the same results each time you generate the world anew.
   local item_pos = {
      x = r:next(minp.x, maxp.x),
      y = r:next(minp.y, maxp.y),
      z = r:next(minp.z, maxp.z),
   }

   -- This is to optimize, because getting the height map is expensive
   if minp.y > -200 and maxp.y < 200 then
      local hm = minetest.get_mapgen_object("heightmap")
      local hz = (item_pos.z - minp.z) * 80
      local hx = (item_pos.x - minp.x) % 80
      local height = hm[1 + hx + hz]
      item_pos.y = height + 1
   end

   vd[va:indexp(item_pos)] = item_id

   --
   vm:set_data(vd)
   --vm:calc_lighting()
   --vm:update_liquids()
   vm:write_to_map()
   --vm:update_map()
   --
end)


I haven't tested your code, but since you are calculating next_hotspot in all 3 dimensions, wouldn't a new block be created in the same area in the surface when a chunk gets generated further down close to the hotspot below?

I know you have checks to avoid placing it in the surface if it's below -200 and above 200 but with a cell_size of 150 you still can have 2 hotspots in there.

Also, if it's below -200 or above 200, it would place the node in a random location, even if it's in the sky or underground, no?
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

User avatar
Sane
Member
 
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Re: Post your modding questions here

by Sane » Thu Sep 24, 2015 21:01

GunshipPenguin wrote:This code does work, but I find that certian nodes are not replaced by limit:limit_node like I want them to be.

Maybe those nodes where generated after your mod already ran. Do you have default in your depends.txt.
Trying to stay me.
 

User avatar
Sane
Member
 
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Re: Post your modding questions here

by Sane » Thu Sep 24, 2015 21:17

Ferk wrote:I haven't tested your code, but since you are calculating next_hotspot in all 3 dimensions, wouldn't a new block be created in the same area in the surface when a chunk gets generated further down close to the hotspot below?

The hotspot is a single coordinate so it can only be in one mapgen block.

Ferk wrote:I know you have checks to avoid placing it in the surface if it's below -200 and above 200 ...

No, the purpose of of the checks is to avoid getting the hightmap unnecessarily. Just a performance thing.

Ferk wrote:Also, if it's below -200 or above 200, it would place the node in a random location, even if it's in the sky or underground, no?

Yes this is what it does.
Trying to stay me.
 

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

Re: Post your modding questions here

by Ferk » Thu Sep 24, 2015 21:29

Sane wrote:The hotspot is a single coordinate so it can only be in one mapgen block.

Yes, but after each hotspot is found, a node is placed at the surface (using the heightmap) whenever the chunk that is getting generated is between -200 and 200 (the node in the surface might not be part of the chunk generated).

If this is the case then it's possible for 2 nodes to be placed at heightmap level next to each other, even though the goal was to have them separated by 150 nodes. The hotspots might be separated by that much (in the Y axis), but not the nodes you are placing.

I think it would be better to calculate 2D hotspots(only X and Z coordinates) and then after getting the heightmap check that the node is within the chunk that you are generating before placing it. That way you ensure you only place one node once on each X-Z division and only at surface level.

Sane wrote:No, the purpose of of the checks is to avoid getting the hightmap unnecessarily. Just a performance thing.

I know, the fact that this also limits the amount of nodes that get placed in the surface is just an after-effect. Perhaps because you added this it's less noticeable, since only 2 nodes would be created on each 150x150 area in the surface. But still there's a chance they would be next to each other (also, even though the area is 150 the randomness in the X and Z axis when placing the node is limited to the currently generating chunk, which might not be that big).
{ ☠ 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 » Thu Sep 24, 2015 22:06

I just tested it and it does place 2 nodes close together. I found 3 within a 50 node radius.
The question is how to fix this. I need the nodes to be seperated. If they are close then it will cause an issue with what they do.
Thanks for all your help on this!
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
Sane
Member
 
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Re: Post your modding questions here

by Sane » Thu Sep 24, 2015 22:21

Ferk wrote:
Sane wrote:The hotspot is a single coordinate so it can only be in one mapgen block.

Yes, but after each hotspot is found, a node is placed at the surface (using the heightmap) whenever the chunk that is getting generated is between -200 and 200 (the node in the surface might not be part of the chunk generated).

If this is the case then it's possible for 2 nodes to be placed at heightmap level next to each other, even though the goal was to have them separated by 150 nodes. The hotspots might be separated by that much, but not the nodes you are placing.

That's right.

The code is a reply to Don, who wanted to place a node at a 1000 nodes spacing. The intend of the source is to give an general impression on how to go about to solve a thing like that. It is not thought to be the solution.

Thank you for your interest. Feel free to optimize and extend the code to a working condition.
Trying to stay me.
 

User avatar
Sane
Member
 
Posts: 103
Joined: Tue Jun 17, 2014 09:31
GitHub: mt-sane
In-game: Sane

Re: Post your modding questions here

by Sane » Thu Sep 24, 2015 22:31

Don wrote:I just tested it and it does place 2 nodes close together. I found 3 within a 50 node radius.

That's odd. That should not be possible.
Could you send the coordinates and the grid size you test with?

Don wrote:The question is how to fix this. I need the nodes to be seperated. If they are close then it will cause an issue with what they do.

The code places the node within a mapgen block. That is a 80x80x80 volume. So if you stay with a 1000er spacing you should be safe,

Don wrote:Thanks for all your help on this!

You are very welcome.
Trying to stay me.
 

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

Re: Post your modding questions here

by Ferk » Thu Sep 24, 2015 23:19

Sane wrote:The code is a reply to Don, who wanted to place a node at a 1000 nodes spacing. The intend of the source is to give an general impression on how to go about to solve a thing like that. It is not thought to be the solution.

Yes, I know. And thanks for that, I'm interested as well because something like this would also be useful for my project. I would like to place an entrance to an underground dungeon in the surface in specific X,Z positions at fixed distances.

This is what I'm doing in my register_on_generated for that:

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 > dungeon_rooms.origin.y) then

        -- avoid the calculation when too high up
        if (minp.y > 200) then return end

        local cell_size = {
            x = dungeon_rooms.stairs_distance * dungeon_rooms.room_area.x,
            z = dungeon_rooms.stairs_distance * dungeon_rooms.room_area.z,
        }

        local next_entrance = {
            x = maxp.x - (maxp.x % cell_size.x),
            z = maxp.z - (maxp.z % cell_size.z),
        }

        if (minp.x < next_entrance.x) and (minp.z < next_entrance.z) then

            -- Put the entrance spawner on ground level
            local hm = minetest.get_mapgen_object("heightmap")
            local hz = (next_entrance.z - minp.z) * 80
            local hx = (next_entrance.x - minp.x) % 80
            next_entrance.y = hm[1 + hx + hz]

            -- But only if it's in the generating chunk
            if (next_entrance.y < maxp.y) and (next_entrance.y > minp.y) then
                 minetest.set_node(next_entrance, minetest.get_content_id("dungeon_rooms:entrance_spawner"))
            end
        end
else
   [......]
end


However, for some reason my heighmap is always -31000, for every value of the array... I'm not sure why that's happening.
{ ☠ 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 » Thu Sep 24, 2015 23:34

I screwed up. I commented out the part of my code. I still had nodes spawning.
I have just your code running now. I have been looking for around a half hour and can not find one. I will let you know if I do find one. I have to make supper now. I will get back to it this evening.
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 » Thu Sep 24, 2015 23:42

Don wrote:I have been looking for around a half hour and can not find one.

Can you print out the value of your coordinates, or at least the item_pos.y after the heighmap calculation?

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.log("action","Placing node at " .. item_pos.x .. ",".. item_pos.y .. ",".. item_pos.z)

Perhaps, like me, your heightmap returns -31000.

I can't find proper documentation regarding minetest.get_mapgen_object("heightmap").

Also, how sure can we be that a chunk is gonna be 80x80? there's a "chunksize" configuration option in minetest.conf. Potentially, a mapgen relying on a hardcoded 80x80 chunk size could be messed up if people changed their settings. Maybe we should use "(maxp.x - minp.x)"
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 5 guests

cron