mirror of
				https://github.com/mt-mods/biome_lib.git
				synced 2025-11-04 06:45:29 +01:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			2021-04-20
			...
			9dd5228218
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					9dd5228218 | 
							
								
								
									
										0
									
								
								depends.txt
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								depends.txt
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										30
									
								
								init.lua
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										30
									
								
								init.lua
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							@@ -44,7 +44,7 @@ local DEBUG = false --... except if you want to spam the console with debugging
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function biome_lib:dbg(msg)
 | 
					function biome_lib:dbg(msg)
 | 
				
			||||||
	if DEBUG then
 | 
						if DEBUG then
 | 
				
			||||||
		print("[Plantlife] "..msg)
 | 
							minetest.log("info", "[Plantlife] "..msg)
 | 
				
			||||||
		minetest.log("verbose", "[Plantlife] "..msg)
 | 
							minetest.log("verbose", "[Plantlife] "..msg)
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
@@ -142,7 +142,7 @@ function biome_lib:register_generate_plant(biomedef, nodes_or_function_or_model)
 | 
				
			|||||||
		biome_lib:dbg("Warning: Registered function call using deprecated string method: "..dump(nodes_or_function_or_model))
 | 
							biome_lib:dbg("Warning: Registered function call using deprecated string method: "..dump(nodes_or_function_or_model))
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if biomedef.check_air == false then 
 | 
						if biomedef.check_air == false then
 | 
				
			||||||
		biome_lib:dbg("Register no-air-check mapgen hook: "..dump(nodes_or_function_or_model))
 | 
							biome_lib:dbg("Register no-air-check mapgen hook: "..dump(nodes_or_function_or_model))
 | 
				
			||||||
		biome_lib.actionslist_no_aircheck[#biome_lib.actionslist_no_aircheck + 1] = { biomedef, nodes_or_function_or_model }
 | 
							biome_lib.actionslist_no_aircheck[#biome_lib.actionslist_no_aircheck + 1] = { biomedef, nodes_or_function_or_model }
 | 
				
			||||||
		local s = biomedef.surface
 | 
							local s = biomedef.surface
 | 
				
			||||||
@@ -218,7 +218,7 @@ function biome_lib:populate_surfaces(biome, nodes_or_function_or_model, snodes,
 | 
				
			|||||||
			else
 | 
								else
 | 
				
			||||||
				if string.find(biome_surfaces_string, "group:") then
 | 
									if string.find(biome_surfaces_string, "group:") then
 | 
				
			||||||
					for j = 1, #biome.surface do
 | 
										for j = 1, #biome.surface do
 | 
				
			||||||
						if string.find(biome.surface[j], "^group:") 
 | 
											if string.find(biome.surface[j], "^group:")
 | 
				
			||||||
						  and minetest.get_item_group(dest_node.name, biome.surface[j]) then
 | 
											  and minetest.get_item_group(dest_node.name, biome.surface[j]) then
 | 
				
			||||||
							surface_ok = true
 | 
												surface_ok = true
 | 
				
			||||||
							break
 | 
												break
 | 
				
			||||||
@@ -289,7 +289,7 @@ function biome_lib:populate_surfaces(biome, nodes_or_function_or_model, snodes,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
					if objtype == "table" then
 | 
										if objtype == "table" then
 | 
				
			||||||
						if nodes_or_function_or_model.axiom then
 | 
											if nodes_or_function_or_model.axiom then
 | 
				
			||||||
							biome_lib:generate_tree(pos, nodes_or_function_or_model)
 | 
												biome_lib:generate_tree(p_top, nodes_or_function_or_model)
 | 
				
			||||||
							spawned = true
 | 
												spawned = true
 | 
				
			||||||
						else
 | 
											else
 | 
				
			||||||
							local fdir = nil
 | 
												local fdir = nil
 | 
				
			||||||
@@ -448,8 +448,8 @@ end)
 | 
				
			|||||||
-- to prevent unpopulated map areas
 | 
					-- to prevent unpopulated map areas
 | 
				
			||||||
 | 
					
 | 
				
			||||||
minetest.register_on_shutdown(function()
 | 
					minetest.register_on_shutdown(function()
 | 
				
			||||||
	print("[biome_lib] Stand by, playing out the rest of the aircheck mapblock log")
 | 
						minetest.log("action", "[biome_lib] Stand by, playing out the rest of the aircheck mapblock log")
 | 
				
			||||||
	print("(there are "..#biome_lib.blocklist_aircheck.." entries)...")
 | 
						minetest.log("action", "(there are "..#biome_lib.blocklist_aircheck.." entries)...")
 | 
				
			||||||
	while true do
 | 
						while true do
 | 
				
			||||||
		biome_lib:generate_block_with_air_checking(0.1)
 | 
							biome_lib:generate_block_with_air_checking(0.1)
 | 
				
			||||||
		if #biome_lib.blocklist_aircheck == 0 then return end
 | 
							if #biome_lib.blocklist_aircheck == 0 then return end
 | 
				
			||||||
@@ -457,8 +457,8 @@ minetest.register_on_shutdown(function()
 | 
				
			|||||||
end)
 | 
					end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
minetest.register_on_shutdown(function()
 | 
					minetest.register_on_shutdown(function()
 | 
				
			||||||
	print("[biome_lib] Stand by, playing out the rest of the no-aircheck mapblock log")
 | 
						minetest.log("action", "[biome_lib] Stand by, playing out the rest of the no-aircheck mapblock log")
 | 
				
			||||||
	print("(there are "..#biome_lib.blocklist_aircheck.." entries)...")
 | 
						minetest.log("action", "(there are "..#biome_lib.blocklist_aircheck.." entries)...")
 | 
				
			||||||
	while true do
 | 
						while true do
 | 
				
			||||||
		biome_lib:generate_block_no_aircheck(0.1)
 | 
							biome_lib:generate_block_no_aircheck(0.1)
 | 
				
			||||||
		if #biome_lib.blocklist_no_aircheck == 0 then return end
 | 
							if #biome_lib.blocklist_no_aircheck == 0 then return end
 | 
				
			||||||
@@ -497,13 +497,13 @@ function biome_lib:spawn_on_surfaces(sd,sp,sr,sc,ss,sa)
 | 
				
			|||||||
		chance = biome.spawn_chance,
 | 
							chance = biome.spawn_chance,
 | 
				
			||||||
		neighbors = biome.neighbors,
 | 
							neighbors = biome.neighbors,
 | 
				
			||||||
		action = function(pos, node, active_object_count, active_object_count_wider)
 | 
							action = function(pos, node, active_object_count, active_object_count_wider)
 | 
				
			||||||
			local p_top = { x = pos.x, y = pos.y + 1, z = pos.z }	
 | 
								local p_top = { x = pos.x, y = pos.y + 1, z = pos.z }
 | 
				
			||||||
			local n_top = minetest.get_node(p_top)
 | 
								local n_top = minetest.get_node(p_top)
 | 
				
			||||||
			local perlin_fertile_area = minetest.get_perlin(biome.seed_diff, perlin_octaves, perlin_persistence, perlin_scale)
 | 
								local perlin_fertile_area = minetest.get_perlin(biome.seed_diff, perlin_octaves, perlin_persistence, perlin_scale)
 | 
				
			||||||
			local noise1 = perlin_fertile_area:get2d({x=p_top.x, y=p_top.z})
 | 
								local noise1 = perlin_fertile_area:get2d({x=p_top.x, y=p_top.z})
 | 
				
			||||||
			local noise2 = biome_lib.perlin_temperature:get2d({x=p_top.x, y=p_top.z})
 | 
								local noise2 = biome_lib.perlin_temperature:get2d({x=p_top.x, y=p_top.z})
 | 
				
			||||||
			local noise3 = biome_lib.perlin_humidity:get2d({x=p_top.x+150, y=p_top.z+50})
 | 
								local noise3 = biome_lib.perlin_humidity:get2d({x=p_top.x+150, y=p_top.z+50})
 | 
				
			||||||
			if noise1 > biome.plantlife_limit 
 | 
								if noise1 > biome.plantlife_limit
 | 
				
			||||||
			  and noise2 <= biome.temp_min
 | 
								  and noise2 <= biome.temp_min
 | 
				
			||||||
			  and noise2 >= biome.temp_max
 | 
								  and noise2 >= biome.temp_max
 | 
				
			||||||
			  and noise3 <= biome.humidity_min
 | 
								  and noise3 <= biome.humidity_min
 | 
				
			||||||
@@ -546,7 +546,7 @@ function biome_lib:spawn_on_surfaces(sd,sp,sr,sc,ss,sa)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
							elseif biome.spawn_on_side then
 | 
												elseif biome.spawn_on_side then
 | 
				
			||||||
								local onside = biome_lib:find_open_side(pos)
 | 
													local onside = biome_lib:find_open_side(pos)
 | 
				
			||||||
								if onside then 
 | 
													if onside then
 | 
				
			||||||
									minetest.set_node(onside.newpos, { name = plant_to_spawn, param2 = onside.facedir })
 | 
														minetest.set_node(onside.newpos, { name = plant_to_spawn, param2 = onside.facedir })
 | 
				
			||||||
								end
 | 
													end
 | 
				
			||||||
							elseif biome.spawn_on_bottom then
 | 
												elseif biome.spawn_on_bottom then
 | 
				
			||||||
@@ -652,7 +652,7 @@ function biome_lib:find_adjacent_wall(pos, verticals, randomflag)
 | 
				
			|||||||
	local verts = dump(verticals)
 | 
						local verts = dump(verticals)
 | 
				
			||||||
	if randomflag then
 | 
						if randomflag then
 | 
				
			||||||
		local walltab = {}
 | 
							local walltab = {}
 | 
				
			||||||
		
 | 
					
 | 
				
			||||||
		if string.find(verts, minetest.get_node({ x=pos.x-1, y=pos.y, z=pos.z   }).name) then walltab[#walltab + 1] = 3 end
 | 
							if string.find(verts, minetest.get_node({ x=pos.x-1, y=pos.y, z=pos.z   }).name) then walltab[#walltab + 1] = 3 end
 | 
				
			||||||
		if string.find(verts, minetest.get_node({ x=pos.x+1, y=pos.y, z=pos.z   }).name) then walltab[#walltab + 1] = 2 end
 | 
							if string.find(verts, minetest.get_node({ x=pos.x+1, y=pos.y, z=pos.z   }).name) then walltab[#walltab + 1] = 2 end
 | 
				
			||||||
		if string.find(verts, minetest.get_node({ x=pos.x  , y=pos.y, z=pos.z-1 }).name) then walltab[#walltab + 1] = 5 end
 | 
							if string.find(verts, minetest.get_node({ x=pos.x  , y=pos.y, z=pos.z-1 }).name) then walltab[#walltab + 1] = 5 end
 | 
				
			||||||
@@ -728,10 +728,10 @@ function biome_lib:get_nodedef_field(nodename, fieldname)
 | 
				
			|||||||
	return minetest.registered_nodes[nodename][fieldname]
 | 
						return minetest.registered_nodes[nodename][fieldname]
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print("[Biome Lib] Loaded")
 | 
					minetest.log("action", "[Biome Lib] Loaded")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
minetest.after(0, function()
 | 
					minetest.after(0, function()
 | 
				
			||||||
	print("[Biome Lib] Registered a total of "..(#biome_lib.surfaceslist_aircheck)+(#biome_lib.surfaceslist_no_aircheck).." surface types to be evaluated, spread")
 | 
						minetest.log("action", "[Biome Lib] Registered a total of "..(#biome_lib.surfaceslist_aircheck)+(#biome_lib.surfaceslist_no_aircheck).." surface types to be evaluated, spread")
 | 
				
			||||||
	print("[Biome Lib] across "..#biome_lib.actionslist_aircheck.." actions with air-checking and "..#biome_lib.actionslist_no_aircheck.." actions without.")
 | 
						minetest.log("action", "[Biome Lib] across "..#biome_lib.actionslist_aircheck.." actions with air-checking and "..#biome_lib.actionslist_no_aircheck.." actions without.")
 | 
				
			||||||
end)
 | 
					end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										0
									
								
								locale/de.txt
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								locale/de.txt
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										0
									
								
								locale/fr.txt
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								locale/fr.txt
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										0
									
								
								locale/template.txt
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								locale/template.txt
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										0
									
								
								locale/tr.txt
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								locale/tr.txt
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
		Reference in New Issue
	
	Block a user