Updated mmgen_simple to use the new callback parameters and the

content id cache
This commit is contained in:
evrooije 2018-07-22 18:34:44 +02:00
parent 3464b6ec5d
commit 9c5dc8eec4
1 changed files with 4 additions and 12 deletions

View File

@ -1,25 +1,17 @@
mmgen_simple = {} mmgen_simple = {}
function mmgen_simple.generate(current_layer, minp, maxp, offset_minp, offset_maxp, content_id) function mmgen_simple.generate(current_layer, vm, area, vm_data, minp, maxp, offset_minp, offset_maxp, nodetype)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
local vm_data = vm:get_data()
local c_ground local c_ground
if content_id then if nodetype then
c_ground = minetest.get_content_id(content_id) c_ground = multi_map.node[nodetype]
else else
c_ground = multi_map.c_stone c_ground = multi_map.node["default:stone"]
end end
if offset_minp.y >= 0 then if offset_minp.y >= 0 then
multi_map.generate_singlenode_chunk(minp, maxp, area, vm_data, multi_map.c_air) multi_map.generate_singlenode_chunk(minp, maxp, area, vm_data, multi_map.c_air)
vm:set_lighting({day=15, night=0})
else else
multi_map.generate_singlenode_chunk(minp, maxp, area, vm_data, c_ground) multi_map.generate_singlenode_chunk(minp, maxp, area, vm_data, c_ground)
end end
vm:set_data(vm_data)
vm:calc_lighting(false)
vm:write_to_map(false)
end end