Updated mmgen_simple to use the new callback parameters and the
content id cache
This commit is contained in:
parent
3464b6ec5d
commit
9c5dc8eec4
|
@ -1,25 +1,17 @@
|
|||
mmgen_simple = {}
|
||||
|
||||
function mmgen_simple.generate(current_layer, minp, maxp, offset_minp, offset_maxp, content_id)
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
|
||||
local vm_data = vm:get_data()
|
||||
|
||||
function mmgen_simple.generate(current_layer, vm, area, vm_data, minp, maxp, offset_minp, offset_maxp, nodetype)
|
||||
local c_ground
|
||||
if content_id then
|
||||
c_ground = minetest.get_content_id(content_id)
|
||||
if nodetype then
|
||||
c_ground = multi_map.node[nodetype]
|
||||
else
|
||||
c_ground = multi_map.c_stone
|
||||
c_ground = multi_map.node["default:stone"]
|
||||
end
|
||||
|
||||
if offset_minp.y >= 0 then
|
||||
multi_map.generate_singlenode_chunk(minp, maxp, area, vm_data, multi_map.c_air)
|
||||
vm:set_lighting({day=15, night=0})
|
||||
else
|
||||
multi_map.generate_singlenode_chunk(minp, maxp, area, vm_data, c_ground)
|
||||
end
|
||||
|
||||
vm:set_data(vm_data)
|
||||
vm:calc_lighting(false)
|
||||
vm:write_to_map(false)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue