From f4793ac9dbc0956e922125cfaf798a8f8dd6ca6e Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sat, 21 Sep 2024 21:08:25 +0300 Subject: [PATCH] advanced structures test --- res/generators/default.files/tower.vox | Bin 0 -> 343 bytes res/generators/default.files/tree0.vox | Bin 16479 -> 262 bytes res/generators/default.lua | 19 +++++++++++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 res/generators/default.files/tower.vox diff --git a/res/generators/default.files/tower.vox b/res/generators/default.files/tower.vox new file mode 100644 index 0000000000000000000000000000000000000000..c992fe45175e0c29a4ced15147f0b5aff93f0957 GIT binary patch literal 343 zcmb2|=3oE==C?N-^9~sZv_34n|?@&A1Ozx7YfRsEaV z_sg;Q&wT!${dXdf<+s(_Q*YO_XoSXgpGcE9yzAw$UmvS4nHjD*UVG=Nzy0QY)wQ>`{@yqB fMlIXQKd0<}Pn9_&u{%-w-bwMoD2=8V919Wm_WiT#wZ+HOh*UhTJFc5~}N#ddhH{OUh;L1CZs#z4P zfd;C0^`{jS1UF`a@#p2CErrfBgnlV8tEEUEPQHy|o#3k(Hz_^_0A-MW;CGRKpd9TE zOIuI=fpnVujkRVtr}oHGKe=2rJv8;AtOYc*-)*Vv*at^S{g{8_+|xbmT@ShSNE?HG z9)J|@kbmvFbFCk#`Oj7V>Ny0oO77ott{eyI08imfUU*@Vt7>ZYsyhMRRA{o)wHwwhk=T3`3W!?8Jgv2He!-gmJH2XRLJ M0gAB5;$J`j0G3IA9smFU literal 16479 zcmeI)K?;IE6vpvq)52)eMY@2iZW3m*kgNd(i%#D>V#tjPXCfs3NTlR@e1`O!LkY5rq-==?&TU(A&;5J2D~5V9AO-%uO!pVA|yHq0WWHuT^ffu#zB9LMBH zYc&6vF;V{khGWN!ujeebZmH*+c_T0sNX^eM!^6H)*He#U>Uivr00Q3;AiLjjqzeKF zAbi&RzYq{`mnrU8J{dSG$|P-Bex`DtI>l diff --git a/res/generators/default.lua b/res/generators/default.lua index 254820cd..cb6be030 100644 --- a/res/generators/default.lua +++ b/res/generators/default.lua @@ -57,7 +57,7 @@ biomes = { function load_structures() local structures = {} - local names = {"tree0"} + local names = {"tree0", "tower"} for i, name in ipairs(names) do local filename = "core:default.files/"..name debug.log("loading structure "..filename) @@ -69,11 +69,22 @@ end function place_structures(x, z, w, d, seed) local placements = {} local hmap = generate_heightmap(x, z, w, d, seed) - for i=0,math.floor(math.random()*3)+5 do + for i=0,math.floor(math.random()*3) do local px = math.random() * w local pz = math.random() * d local py = hmap:at(px, pz) * 256 + if py <= sea_level then + goto continue + end table.insert(placements, {0, {px-8, py, pz-8}}) + ::continue:: + end + + if math.random() < 0.03 then + local px = math.random() * w + local pz = math.random() * d + local py = hmap:at(px, pz) * 256 + table.insert(placements, {1, {px-8, py, pz-8}}) end return placements end @@ -125,10 +136,10 @@ end local function _generate_biome_parameters(x, y, w, h, seed, s) local tempmap = Heightmap(w, h) tempmap.noiseSeed = seed + 5324 - tempmap:noise({x, y}, 0.4*s, 4) + tempmap:noise({x, y}, 0.04*s, 4) local hummap = Heightmap(w, h) hummap.noiseSeed = seed + 953 - hummap:noise({x, y}, 0.16*s, 4) + hummap:noise({x, y}, 0.016*s, 4) tempmap:pow(2) hummap:pow(2) return tempmap, hummap