artifact_one/mods/artifact_world/mapgen.lua
2025-11-29 17:45:59 -05:00

24 lines
731 B
Lua

local vm_data = {}
local c_air = minetest.get_content_id("air")
local c_stone = minetest.get_content_id("artifact:stone")
-- Singlenode, but the single node is stone.
-- (Note that this is just the base mapgen; the world itself will
-- be loaded from a schematic on init.)
minetest.register_on_generated(function(vm, minp, maxp)
local min, max = vm:get_emerged_area()
local va = VoxelArea(min, max)
vm:get_data(vm_data)
-- If we load a giant schematic initially, the parts outside view range get eaten by mapgen.
-- for i in va:iterp(minp, maxp) do
-- if vm_data[i] == c_air then
-- vm_data[i] = c_stone
-- end
-- end
vm:set_data(vm_data)
vm:calc_lighting()
end)