Mapgen map from image (#3)

* Mapgen: add peaks register from image

* Fixed unsigned int bytes to number conversion

* Fixed uintb2num func for normal conversion...

* Add test map image parsing

---------

Co-authored-by: ssdaniel24 <bo7oaonteg2m@mail.ru>
This commit is contained in:
Van
2026-01-10 12:05:33 +03:00
committed by GitHub
parent 395f45aeb9
commit 0ff45e4da1
6 changed files with 162 additions and 6 deletions

View File

@@ -37,6 +37,8 @@ dofile(core.get_modpath('smc__api__table')..'/init.lua')
-- TODO: пока что закоментировано, поскольку вызывает ошибку из-за global_step
-- Api loader
-- dofile(core.get_modpath('smc__api__api_loader')..'/init.lua')
Api = {}
dofile(core.get_modpath('smc__api__api_loader')..'/src/Api/ff2lua.lua')
---@type MapGen
local mapGenerator = dofile(core.get_modpath('smc__core__map_generator')..'/src/mapGenerator.lua')

View File

@@ -61,7 +61,7 @@ local land1 = {
}
local land2 = {
offset = 20,
offset = 10,
scale = 5,
spread = {x = 30, y = 30, z = 30},
seed = 47,
@@ -101,7 +101,7 @@ local climat0 = {
}
local v = vector.new
--[[
mapGenerator:register2DPeaks('midgard',
{
landscapeNoise = land1,
@@ -132,8 +132,43 @@ mapGenerator:register2DPeaks('midgard',
},{
v(200, 0, 100),
v(-300, 0, -200),
})
})--]]
--[[
mapGenerator:register2DPeaksFromFile('midgard', 'map.ff', {x=250, y=250}, {
['#396FFFFF'] = {noise = {
landscapeNoise = land1,
tempNoise = climat2,
humidityNoise = climat2,
}
},
['#3FFF26FF'] = {noise = {
landscapeNoise = land2,
tempNoise = climat2,
humidityNoise = climat2,
}
}
})--]]
local N = 32
for x = -10, 10 do
for z = - 10, 10 do
local land
if math.random(0,1) == 0 then
land = land1
else
land = land2
end
print(x)
mapGenerator:register2DPeak('midgard', vector.new(x*N, 0, z*N), {
landscapeNoise = land,
tempNoise = climat2,
humidityNoise = climat2,
})
end
end
--[[
mapGenerator:registerCavern('midgard', 'cavern1', {
minY = -48,
maxY = 0,
@@ -148,7 +183,7 @@ mapGenerator:registerCavern('midgard', 'cavern1', {
persistence = 0.5,
lacunarity = 2.0
},
})
})--]]
-- --- Biomes ---