Finish decorations
							parent
							
								
									18fecc7eae
								
							
						
					
					
						commit
						b1dbac00d3
					
				
							
								
								
									
										201
									
								
								init.lua
								
								
								
								
							
							
						
						
									
										201
									
								
								init.lua
								
								
								
								
							|  | @ -321,7 +321,7 @@ function internal.clean_deco_def(def) | |||
|     place("height", "number", 1) | ||||
|     place("place_offset_y", "number", 0) | ||||
|     place("replacements", "table", {}) | ||||
|     place("flags", "string", "") | ||||
|     place("flags", "string", "place_center_x,place_center_z") | ||||
|     place("rotation", "string", "0") | ||||
| 
 | ||||
|     d.height     = math.max(d.height    ,  0) | ||||
|  | @ -575,6 +575,11 @@ function internal.flat_from_node_types(bools, minp, maxp) | |||
|                 return nt.floor_deco | ||||
|             end | ||||
| 
 | ||||
|             if bools:get_index(i + bools.up) == false then | ||||
|                 -- Block is near the ceiling | ||||
|                 return nt.ceiling_deco | ||||
|             end | ||||
| 
 | ||||
|             return nt.air | ||||
|         else | ||||
|             -- NOT PART OF CAVE | ||||
|  | @ -745,8 +750,12 @@ function internal.generate_caves(data, minp, maxp) | |||
|                 place(def.node_wall) | ||||
|             elseif nt == internal.node_types.ceiling then | ||||
|                 place(def.node_roof) | ||||
|             elseif nt == internal.node_types.floor_deco then | ||||
|             elseif nt == internal.node_types.floor_deco or nt == internal.node_types.ceiling_deco then | ||||
|                 local schem_placed = false | ||||
|                 local appropriate_place = "floor" | ||||
|                 if nt == internal.node_types.ceiling_deco then | ||||
|                     appropriate_place = "ceiling" | ||||
|                 end | ||||
| 
 | ||||
|                 if not schem_placed then | ||||
|                     -- Prevent decorations from spawning in the air | ||||
|  | @ -757,7 +766,7 @@ function internal.generate_caves(data, minp, maxp) | |||
| 
 | ||||
|                 if not schem_placed then | ||||
|                     for _, deco in ipairs(noordstar_caves.registered_decorations) do | ||||
|                         if deco.place_on ~= "floor" then | ||||
|                         if deco.place_on ~= appropriate_place then | ||||
|                         elseif math.random() > deco.fill_ratio then | ||||
|                         elseif not internal.is_deco_biome(deco, def.name) then | ||||
|                         else | ||||
|  | @ -769,7 +778,12 @@ function internal.generate_caves(data, minp, maxp) | |||
|                 end | ||||
| 
 | ||||
|                 if not schem_placed then | ||||
|                     place(def.node_dust or "air") | ||||
|                     local n = "air" | ||||
|                     if nt == internal.node_types.floor_deco then | ||||
|                         n = def.node_dust or n | ||||
|                     end | ||||
|                     place(n) | ||||
|                     schem_placed = true | ||||
|                 end | ||||
|             else | ||||
|                 error( | ||||
|  | @ -913,16 +927,42 @@ end | |||
| -- Place all schematic decorations into the world | ||||
| function internal.place_schematic_decorations(vmanip, schems) | ||||
|     for _, schem in ipairs(schems) do | ||||
|         local pos  = schem.pos | ||||
|         local pos  = { | ||||
|             x = schem.pos.x, | ||||
|             y = schem.pos.y + schem.deco.place_offset_y, | ||||
|             z = schem.pos.z, | ||||
|         } | ||||
|         local deco = schem.deco | ||||
| 
 | ||||
|         if deco.deco_type ~= "schematic" then | ||||
|         else | ||||
|             minetest.place_schematic_on_vmanip( | ||||
|                 vmanip, pos, | ||||
|                 deco.schematic, deco.rotation, deco.replacement, | ||||
|                 true, deco.flags | ||||
|             ) | ||||
|             if deco.place_on == "floor" then | ||||
|                 minetest.place_schematic_on_vmanip( | ||||
|                     vmanip, pos, | ||||
|                     deco.schematic, deco.rotation, deco.replacement, | ||||
|                     true, deco.flags | ||||
|                 ) | ||||
|             elseif deco.place_on == "ceiling" then | ||||
|                 local h = deco.schematic | ||||
| 
 | ||||
|                 if type(deco.schematic) == "string" then | ||||
|                     h = minetest.read_schematic(h, {}) | ||||
| 
 | ||||
|                     if type(h) == "nil" then | ||||
|                         error("Could not find schematic! Perhaps it the filename is incorrect?") | ||||
|                     end | ||||
|                 end | ||||
| 
 | ||||
|                 h = h.size.y | ||||
| 
 | ||||
|                 minetest.place_schematic_on_vmanip( | ||||
|                     vmanip, { x = pos.x, y = pos.y - h + 1, z = pos.z }, | ||||
|                     deco.schematic, deco.rotation, deco.replacement, | ||||
|                     true, deco.flags | ||||
|                 ) | ||||
|             else | ||||
|                 error("Unknown place_on value `" .. deco.place_on .. "`") | ||||
|             end | ||||
|         end | ||||
|     end | ||||
| end | ||||
|  | @ -931,7 +971,11 @@ end | |||
| function internal.place_simple_decorations(flat, schems) | ||||
|     for _, schem in ipairs(schems) do | ||||
|         if schem.deco.deco_type == "simple" then | ||||
|             local pos  = schem.pos | ||||
|             local pos  = { | ||||
|                 x = schem.pos.x, | ||||
|                 y = schem.pos.y + schem.deco.place_offset_y, | ||||
|                 z = schem.pos.z, | ||||
|             } | ||||
|             local deco = schem.deco | ||||
|              | ||||
|             local i = flat:pos_to_index(pos) | ||||
|  | @ -1243,84 +1287,104 @@ noordstar_caves.register_shape({ | |||
|     connectivity_point = 10, | ||||
|     verticality_point = 40, | ||||
| }) | ||||
| -- noordstar_caves.register_shape({ | ||||
| --     name = "noordstar_caves:cliffs", | ||||
| noordstar_caves.register_shape({ | ||||
|     name = "noordstar_caves:cliffs", | ||||
|      | ||||
| --     noise_params = { | ||||
| --         offset = 0.4, | ||||
| --         scale = 0.5, | ||||
| --         spread = { x = 20, y = 100, z = 20 }, | ||||
| --         seed = 97354, | ||||
| --         octaves = 4, | ||||
| --         persistence = 0.6, | ||||
| --         lacunarity = 2.0, | ||||
| --         flags = "" | ||||
| --     }, | ||||
|     noise_params = { | ||||
|         offset = 0.4, | ||||
|         scale = 0.5, | ||||
|         spread = { x = 20, y = 100, z = 20 }, | ||||
|         seed = 97354, | ||||
|         octaves = 4, | ||||
|         persistence = 0.6, | ||||
|         lacunarity = 2.0, | ||||
|         flags = "" | ||||
|     }, | ||||
| 
 | ||||
| --     func = function(pos, n) | ||||
| --         return n | ||||
| --     end, | ||||
|     func = function(pos, n) | ||||
|         return n | ||||
|     end, | ||||
| 
 | ||||
| --     connectivity_point = 30, | ||||
| --     verticality_point = 80, | ||||
| -- }) | ||||
| -- noordstar_caves.register_shape({ | ||||
| --     name = "noordstar_caves:donuts", | ||||
|     connectivity_point = 30, | ||||
|     verticality_point = 80, | ||||
| }) | ||||
| noordstar_caves.register_shape({ | ||||
|     name = "noordstar_caves:donuts", | ||||
|      | ||||
| --     noise_params = { | ||||
| --         offset = 0.0, | ||||
| --         scale = 1.0, | ||||
| --         spread = { x = 30, y = 30, z = 30 }, | ||||
| --         seed = 3934, | ||||
| --         octaves = 1, | ||||
| --         persistence = 0.6, | ||||
| --         lacunarity = 2.0, | ||||
| --         flags = "eased" | ||||
| --     }, | ||||
|     noise_params = { | ||||
|         offset = 0.0, | ||||
|         scale = 1.0, | ||||
|         spread = { x = 30, y = 30, z = 30 }, | ||||
|         seed = 3934, | ||||
|         octaves = 1, | ||||
|         persistence = 0.6, | ||||
|         lacunarity = 2.0, | ||||
|         flags = "eased" | ||||
|     }, | ||||
| 
 | ||||
| --     func = function(pos, n) | ||||
| --         return 1 - 2 * math.abs(n)^0.5 | ||||
| --     end, | ||||
|     func = function(pos, n) | ||||
|         return 1 - 2 * math.abs(n)^0.5 | ||||
|     end, | ||||
| 
 | ||||
| --     connectivity_point = 50, | ||||
| --     verticality_point = 40, | ||||
| -- }) | ||||
| -- noordstar_caves.register_shape({ | ||||
| --     name = "noordstar_caves:wall", | ||||
|     connectivity_point = 50, | ||||
|     verticality_point = 40, | ||||
| }) | ||||
| noordstar_caves.register_shape({ | ||||
|     name = "noordstar_caves:wall", | ||||
| 
 | ||||
| --     func = function(pos, n) | ||||
| --         return -0.5 | ||||
| --     end, | ||||
|     func = function(pos, n) | ||||
|         return -0.5 | ||||
|     end, | ||||
| 
 | ||||
| --     connectivity_point = 0, | ||||
| --     verticality_point = 0, | ||||
| -- }) | ||||
|     connectivity_point = 0, | ||||
|     verticality_point = 0, | ||||
| }) | ||||
| 
 | ||||
| -- noordstar_caves.set_world_depth(-60) | ||||
| -- noordstar_caves.cave_vastness = function(pos) return math.abs(pos.y - 60) / 120 end | ||||
| 
 | ||||
| noordstar_caves.register_biome({ | ||||
|     name = "test", | ||||
|     name = "nc:glowing_floor", | ||||
|     node_floor = "mcl_core:crying_obsidian", | ||||
|     node_wall = "mcl_core:sand", | ||||
|     node_roof = "mcl_ocean:sea_lantern", | ||||
|     node_dust = "mcl_core:snow", | ||||
|     heat_point = 80, | ||||
|     humidity_point = 80, | ||||
|     heat_point = 20, | ||||
|     humidity_point = 0, | ||||
| }) | ||||
| noordstar_caves.register_biome({ | ||||
|     name = "test2", | ||||
|     name = "nc:crazy_glowin_walls", | ||||
|     node_floor = "mcl_amethyst:amethyst_block", | ||||
|     node_wall = "mcl_crimson:shroomlight", | ||||
|     node_roof = "mcl_colorblocks:glazed_terracotta_silver", | ||||
|     heat_point = 100, | ||||
|     humidity_point = 0, | ||||
| }) | ||||
| noordstar_caves.register_biome({ | ||||
|     name = "nc:regular", | ||||
|     heat_point = 50, | ||||
|     humidity_point = 50, | ||||
| }) | ||||
| noordstar_caves.register_biome({ | ||||
|     name = "nc:cold", | ||||
|     node_dust = "mcl_core:snow", | ||||
|     node_roof = "mcl_core:ice", | ||||
|     heat_point = 10, | ||||
|     humidity_point = 100, | ||||
| }) | ||||
| noordstar_caves.register_biome({ | ||||
|     name = "nc:grass", | ||||
|     node_floor = "mcl_core:dirt_with_grass", | ||||
|     heat_point = 50, | ||||
|     humidity_point = 70, | ||||
| }) | ||||
| noordstar_caves.register_biome({ | ||||
|     name = "nc:dangerous_lava", | ||||
|     node_floor = "mcl_core:lava_source", | ||||
|     y_max = -40, | ||||
|     heat_point = 100, | ||||
|     humidity_point = 100, | ||||
| }) | ||||
| -- noordstar_caves.register_biome({ | ||||
| --     name = "test3", | ||||
| --     heat_point = 50, | ||||
| --     humidity_point = 50, | ||||
| -- }) | ||||
| 
 | ||||
| noordstar_caves.register_decoration({ | ||||
|     deco_type = "simple", | ||||
|  | @ -1329,21 +1393,22 @@ noordstar_caves.register_decoration({ | |||
|     decoration = "mcl_core:cactus", | ||||
|     height = 3, | ||||
|     height_max = 8, | ||||
|     biomes = { "test" }, | ||||
|     biomes = { "nc:glowing_floor" }, | ||||
| }) | ||||
| noordstar_caves.register_decoration({ | ||||
|     deco_type = "simple", | ||||
|     place_on = "floor", | ||||
|     place_on = "ceiling", | ||||
|     fill_ratio = 0.1, | ||||
|     decoration = "mcl_ocean:sea_lantern", | ||||
|     height = 1, | ||||
|     height_max = 4, | ||||
|     biomes = { "test2" }, | ||||
|     biomes = { "nc:crazy_glowin_walls" }, | ||||
|     place_offset_y = -3, | ||||
| }) | ||||
| noordstar_caves.register_decoration({ | ||||
|     deco_type = "schematic", | ||||
|     place_on = "floor", | ||||
|     fill_ratio = 0.005, | ||||
|     fill_ratio = 0.001, | ||||
|     schematic = squeak, | ||||
|     rotation = "random", | ||||
|     -- place_offset_y = 5, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue