Im looking to place a sign from inside "minetest.register_on_generated(..." larger snippet below
I can place sand using: ...minetest.get_content_id("default:sand")...
but signs using:...minetest.get_content_id("default:sign")...
don't show. There arn't any error warnings afaik, Do I need other attributes, is the name wrong, I have no clue
I also want to add some text. The idea is I want to check some values calculated in the script from inside the game at multiple positions for debugging purposes. other suggestions are very welcome.
Cheers, Smitje
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.register_on_generated(function(minp, maxp, seed)
if minp.y < YMIN or maxp.y > YMAX then
return -- The chunk is outside the set height band (YMIN YMAX)
end
local t1 = os.clock()
local x1 = maxp.x
local y1 = maxp.y
local z1 = maxp.z
local x0 = minp.x
local y0 = minp.y
local z0 = minp.z
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
local data = vm:get_data()
local c_testmarker = minetest.get_content_id("citygen:testmarker")
local chunck_name = tostring(x0)..","..tostring(z0)
print(chunck_name)
print("block "..x0.." "..y0.." "..z0.." # "..x1.." "..y1.." "..z1.." ")
--
print("seed ")
print(citygen_get_vseed(x0, z0))
-- create seed markers
hmap = minetest.get_mapgen_object("heightmap")
if citygen.known_chuncks[chunck_name]["status"] == "hasseed" then
local ch_seedx, ch_seedz = citygen_get_vseed(x0, z0)
local h02 = citygen_get_h(ch_seedx, ch_seedz, x0, z0)
if h02 <= y1 and h02 >= y0 then
for k = 1, 4 do
local vi = area:index(ch_seedx, h02+k, ch_seedz)
data[vi] = c_testmarker
end
local vi = area:index(ch_seedx, h02+5, ch_seedz)
data[vi] = minetest.get_content_id("default:sign")
--print(dump(minetest.get_content_id("default:sand")))
end
end
-- end of the citygen stuff ------------
vm:set_data(data)
vm:set_lighting({day=0, night=0})
vm:calc_lighting()
vm:write_to_map(data)
local chugent = math.ceil((os.clock() - t1) * 1000)
print ("[hfind] "..chugent.." ms\n")