From 52630eb85abec28e84436585cc0f59d74c3a95da Mon Sep 17 00:00:00 2001 From: Vanic Date: Sat, 10 Jan 2026 12:04:25 +0300 Subject: [PATCH] Add test map image parsing --- mods/CORE/MapGen/src/MapGen.lua | 1 + .../mapGenerator/src/asyncInit.lua | 2 ++ .../mapGenerator/src/mapGenerator.lua | 32 ++++++++++++++---- .../mapGenerator/textures/maps/map.ff | Bin 2000016 -> 0 bytes 4 files changed, 29 insertions(+), 6 deletions(-) delete mode 100644 mods/ENVIRONMENT/mapGenerator/textures/maps/map.ff diff --git a/mods/CORE/MapGen/src/MapGen.lua b/mods/CORE/MapGen/src/MapGen.lua index 4ba93ca..ef13178 100644 --- a/mods/CORE/MapGen/src/MapGen.lua +++ b/mods/CORE/MapGen/src/MapGen.lua @@ -244,6 +244,7 @@ function MapGen:register2DPeaksFromFile(layerName, map, zeroPos,peakColors) local modPath = core.get_modpath(core.get_current_modname()) local peaks = Api.ff2luat(modPath .. '/textures/maps/' .. map) local mapSize = peaks.size + peaks.size = nil print(dump(peaks)) for color, peaksPos in pairs(peaks) do diff --git a/mods/ENVIRONMENT/mapGenerator/src/asyncInit.lua b/mods/ENVIRONMENT/mapGenerator/src/asyncInit.lua index 71f6d26..bafa56b 100644 --- a/mods/ENVIRONMENT/mapGenerator/src/asyncInit.lua +++ b/mods/ENVIRONMENT/mapGenerator/src/asyncInit.lua @@ -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') diff --git a/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua b/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua index 763b5eb..82a9ec9 100644 --- a/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua +++ b/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua @@ -61,7 +61,7 @@ local land1 = { } local land2 = { - offset = 20, + offset = 10, scale = 5, spread = {x = 30, y = 30, z = 30}, seed = 47, @@ -133,22 +133,42 @@ mapGenerator:register2DPeaks('midgard', v(200, 0, 100), v(-300, 0, -200), })--]] - +--[[ mapGenerator:register2DPeaksFromFile('midgard', 'map.ff', {x=250, y=250}, { - ['#396fffff'] = {noise = { + ['#396FFFFF'] = {noise = { landscapeNoise = land1, tempNoise = climat2, humidityNoise = climat2, } }, - ['3fff26ff'] = {noise = { + ['#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, @@ -163,7 +183,7 @@ mapGenerator:registerCavern('midgard', 'cavern1', { persistence = 0.5, lacunarity = 2.0 }, -}) +})--]] -- --- Biomes --- diff --git a/mods/ENVIRONMENT/mapGenerator/textures/maps/map.ff b/mods/ENVIRONMENT/mapGenerator/textures/maps/map.ff deleted file mode 100644 index 01cc1d90a33705406b2393c11eaedef692e0f2ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2000016 zcmeI*QEJ>U6a~<9F5~+V!!2DuI1YL#sLm+fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCIBSkjpl%WHz5! z=i}?Lepo;F!~qU)fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCH;LP{(i6O5L1S zpR?y@J+q#1jsqOv00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$;HnPfvb7k;RiD4-&42#uKL4q2R?k{gTLnkANarl4sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14m^_swMC?^w|c9$&(vFa zl~;MSZgGGE9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14shT(9dO^L=bW3q znVWUjy2}9$aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103MMo(|-) zwHSw7$<>~@k|%kRC$4gU103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3>aGK68Kr9N+*4IKTl8aNs!|@O!eJb8h-(Zq{Av zE(bWk0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z;K1Gv)E1Gt^SbwW_4#T>kKfKOEoy2ROh14sd`29N@q$2XfiQ zJDc@HPxRzgPvk>BUy9D*Y1J&o4@^#b$|mL-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WFt-D_Y%RuNPIJwvj;W+> zE^;|nF3rO{?CZG90S<70103K02ROh14sd`29N+*4IKTl8a9}+L{Jc=F^?JQtTd(z6 zul1S(9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29GJm@+9FcdM}5@CGyABA@^@zb_$PnzXCK4? z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aA1E2ykA7G^lJZJS+Dd;uk?xo9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCFnfkjvI$9Ok>`e9hHdt>1j(00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$UI@fcw&N zjcZ(6%{9-5Yh2?R2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%hm6%M#hhg^L{u6QL^ za%JDb0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29C*xu+9Fby zBRP63M|+*WT(*%&dED!K`aE;w+8oTmewFJS-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sc*T2V5_qmwGv0FRhn)sh4`m0S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%hmnFFr>;{+!-@tG6;ofDkk1P3_40S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WaHIpSXOXuf^Ts!MlQ;Vu4sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4?r|WOt;IOxM}F?fkKD+O-0+hF9N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G;J`c%)E1HYJYNqV_`nB!-ss|k400%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2RN{*19iN6B6ag!b-tdL^~?IjHx6)s103K02ROh14sd`29N+*4IB>oLUWe5~Jv_gM z)