Compare commits
	
		
			155 Commits
		
	
	
		
			0.4.dev-20
			...
			0.4.6
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | c43718a434 | ||
|  | 3db7bafb39 | ||
|  | d8c6a4f2ea | ||
|  | d2550ab761 | ||
|  | 7e843c92a6 | ||
|  | d6ec56811b | ||
|  | c809fc9655 | ||
|  | b4e9ef269b | ||
|  | 4e20ed6153 | ||
|  | 79856c914d | ||
|  | 648a11263b | ||
|  | 467e2029e2 | ||
|  | 3a617bcb6e | ||
|  | d5c373e290 | ||
|  | 4c5cb106c3 | ||
|  | 9ff8f8038e | ||
|  | a4426e4bd4 | ||
|  | e82c122822 | ||
|  | e43573b46b | ||
|  | 2f91ec0f73 | ||
|  | 57980cb49d | ||
|  | 034010a371 | ||
|  | 4b9914fdcb | ||
|  | 0d924e7e4d | ||
|  | 90aaa1fb62 | ||
|  | 6c70e0295a | ||
|  | 230747c748 | ||
|  | 86cff038a4 | ||
|  | 0823f16acb | ||
|  | e1d17b1747 | ||
|  | 2817db19d4 | ||
|  | 716397819d | ||
|  | 67fa74ac01 | ||
|  | d5cc51a396 | ||
|  | cd604fa9c8 | ||
|  | 686c0d087c | ||
|  | c27afe7ee8 | ||
|  | 9e23e9ecbf | ||
|  | 97db50a2fe | ||
|  | a0ba7cf973 | ||
|  | c1b1f2aa49 | ||
|  | 0beabfc755 | ||
|  | 5fa8852115 | ||
|  | 0eb46a01ff | ||
|  | de8726a9f7 | ||
|  | 33ec25caed | ||
|  | deb39ddcd4 | ||
|  | 2d1e7463d3 | ||
|  | 7505fbce51 | ||
|  | 9232734a48 | ||
|  | 1bf62bbad4 | ||
|  | 95cbfc50d8 | ||
|  | 61e60724f6 | ||
|  | 8c977451a8 | ||
|  | 73d078fd27 | ||
|  | 0636d574af | ||
|  | c4f2bee9a6 | ||
|  | 4763fa635a | ||
|  | 3928eccf74 | ||
|  | 5311c6ec96 | ||
|  | 91937acf76 | ||
|  | e7b4b2ba57 | ||
|  | 89fb5aed7f | ||
|  | df54836ea0 | ||
|  | f2a67871d2 | ||
|  | c3eaa9cd64 | ||
|  | d39044a2a7 | ||
|  | 8a6b2df6b1 | ||
|  | bed848f68a | ||
|  | 24939c299b | ||
|  | 24d8d79ea1 | ||
|  | cb4bfa51a1 | ||
|  | 7a01de2f36 | ||
|  | c7a4a68d28 | ||
|  | 91da5d1308 | ||
|  | 39e4bf0346 | ||
|  | dce87664d2 | ||
|  | b97400d71d | ||
|  | abaf4c5121 | ||
|  | 609646b9b5 | ||
|  | 04d40a5ce4 | ||
|  | 24781813fa | ||
|  | 0057a87b99 | ||
|  | dfa0f096ce | ||
|  | e9ad8d06c8 | ||
|  | 0495f9e209 | ||
|  | 2ff55cf6cc | ||
|  | d0638d7284 | ||
|  | 6687b5504d | ||
|  | c455ba9b68 | ||
|  | 165da9348a | ||
|  | fb8144f703 | ||
|  | df2fdba2b4 | ||
|  | 3a7cbfc531 | ||
|  | 2768d4974b | ||
|  | d317d7b80b | ||
|  | 91ee23d61b | ||
|  | df3a694099 | ||
|  | d75b39683a | ||
|  | 68020d2e93 | ||
|  | f1a447d1fe | ||
|  | 30d582296b | ||
|  | 36c17b04fe | ||
|  | ff9e2a75ee | ||
|  | 5497db98de | ||
|  | 4a68126a2b | ||
|  | 5ce918059d | ||
|  | e0fe1a08c5 | ||
|  | 25a6cd866b | ||
|  | 0ed7ccfc1f | ||
|  | e5502c9415 | ||
|  | e5e62f9085 | ||
|  | a8a204ae39 | ||
|  | a399f648e7 | ||
|  | 87a1e37d34 | ||
|  | 6ad1d56b3d | ||
|  | d3d3e76447 | ||
|  | 794c68b32b | ||
|  | 0722c8064b | ||
|  | d98eab6a84 | ||
|  | 61a9bb2b47 | ||
|  | 32ee20ebe7 | ||
|  | 937ec64ee6 | ||
|  | 7db7ea543f | ||
|  | 319ac40fa5 | ||
|  | cd4e86773f | ||
|  | 8643caac3c | ||
|  | 81afea1c00 | ||
|  | a29819ebee | ||
|  | 6de625c67f | ||
|  | e550a0e26f | ||
|  | 8739c4e737 | ||
|  | 3ea6096a7a | ||
|  | f2916c0a31 | ||
|  | c7b624d67c | ||
|  | 6ba4f01d0b | ||
|  | a9da19c590 | ||
|  | b1dcbe72aa | ||
|  | 8c8b4b005e | ||
|  | 537344bc62 | ||
|  | 274f280e10 | ||
|  | 3c8d4879a1 | ||
|  | d05002ecc0 | ||
|  | d817c9babe | ||
|  | 4e996ffa35 | ||
|  | 1dd62938c1 | ||
|  | 9a624d85d0 | ||
|  | a93527dfb6 | ||
|  | fcaacdb4ad | ||
|  | dd9b33db67 | ||
|  | 894f98d878 | ||
|  | 3a1a7d511d | ||
|  | 53e9b0e107 | ||
|  | 216227bac3 | ||
|  | 1a62348e44 | 
							
								
								
									
										12
									
								
								README.txt
									
									
									
									
									
								
							
							
						
						| @@ -6,7 +6,7 @@ To build the wholeness of the Minetest project, insert this repository as | ||||
| in the Minetest Engine. | ||||
|  | ||||
| The Minetest Engine can be found in: | ||||
|   https://github.com/celeron55/minetest/ | ||||
|   https://github.com/minetest/minetest/ | ||||
|  | ||||
| Compatibility | ||||
| -------------- | ||||
| @@ -17,7 +17,7 @@ Additionally, when the minetest engine is tagged to be a certain version (eg. | ||||
| 0.4.dev-20120326), minetest_game is tagged with the version too. | ||||
|  | ||||
| When stable releases are made, minetest_game is packaged and made available in | ||||
|   https://github.com/celeron55/minetest_game/downloads | ||||
|   http://minetest.net/download.php | ||||
| and in case the repository has grown too much, it may be reset. In that sense, | ||||
| this is not a "real" git repository. (Package maintainers please note!) | ||||
|  | ||||
| @@ -27,16 +27,16 @@ Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com> | ||||
| See README.txt in each mod directory for information about other authors. | ||||
|  | ||||
| This program is free software; you can redistribute it and/or modify | ||||
| it under the terms of the GNU General Public License as published by | ||||
| the Free Software Foundation; either version 2 of the License, or | ||||
| it under the terms of the GNU Lesser General Public License as published by | ||||
| the Free Software Foundation; either version 2.1 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| This program is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| GNU General Public License for more details. | ||||
| GNU Lesser General Public License for more details. | ||||
|  | ||||
| You should have received a copy of the GNU General Public License along | ||||
| You should have received a copy of the GNU Lesser General Public License along | ||||
| with this program; if not, write to the Free Software Foundation, Inc., | ||||
| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||||
|  | ||||
|   | ||||
| @@ -1,2 +1,2 @@ | ||||
| name = Minetest | ||||
|  | ||||
| common_mods = default, bucket, creative, doors, dye, fire, stairs, vessels, wool | ||||
|   | ||||
| @@ -1,26 +0,0 @@ | ||||
| Minetest 0.4 mod: bucket | ||||
| ========================= | ||||
|  | ||||
| License of source code: | ||||
| ----------------------- | ||||
| Copyright (C) 2011-2012 Kahrl <kahrl@gmx.net> | ||||
| Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com> | ||||
|  | ||||
| This program is free software; you can redistribute it and/or modify | ||||
| it under the terms of the GNU General Public License as published by | ||||
| the Free Software Foundation; either version 2 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| http://www.gnu.org/licenses/gpl-2.0.html | ||||
|  | ||||
| License of media (textures and sounds) | ||||
| -------------------------------------- | ||||
| Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)                                  | ||||
| http://creativecommons.org/licenses/by-sa/3.0/ | ||||
|  | ||||
| Authors of media files | ||||
| ----------------------- | ||||
| Everything not listed in here: | ||||
| Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com> | ||||
|  | ||||
|  | ||||
| @@ -1,2 +0,0 @@ | ||||
| default | ||||
|  | ||||
| @@ -1,95 +0,0 @@ | ||||
| -- Minetest 0.4 mod: bucket | ||||
| -- See README.txt for licensing and other information. | ||||
|  | ||||
| minetest.register_alias("bucket", "bucket:bucket_empty") | ||||
| minetest.register_alias("bucket_water", "bucket:bucket_water") | ||||
| minetest.register_alias("bucket_lava", "bucket:bucket_lava") | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 	output = 'bucket:bucket_empty 1', | ||||
| 	recipe = { | ||||
| 		{'default:steel_ingot', '', 'default:steel_ingot'}, | ||||
| 		{'', 'default:steel_ingot', ''}, | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| bucket = {} | ||||
| bucket.liquids = {} | ||||
|  | ||||
| -- Register a new liquid | ||||
| --   source = name of the source node | ||||
| --   flowing = name of the flowing node | ||||
| --   itemname = name of the new bucket item (or nil if liquid is not takeable) | ||||
| --   inventory_image = texture of the new bucket item (ignored if itemname == nil) | ||||
| -- This function can be called from any mod (that depends on bucket). | ||||
| function bucket.register_liquid(source, flowing, itemname, inventory_image) | ||||
| 	bucket.liquids[source] = { | ||||
| 		source = source, | ||||
| 		flowing = flowing, | ||||
| 		itemname = itemname, | ||||
| 	} | ||||
| 	bucket.liquids[flowing] = bucket.liquids[source] | ||||
|  | ||||
| 	if itemname ~= nil then | ||||
| 		minetest.register_craftitem(itemname, { | ||||
| 			inventory_image = inventory_image, | ||||
| 			stack_max = 1, | ||||
| 			liquids_pointable = true, | ||||
| 			on_use = function(itemstack, user, pointed_thing) | ||||
| 				-- Must be pointing to node | ||||
| 				if pointed_thing.type ~= "node" then | ||||
| 					return | ||||
| 				end | ||||
| 				-- Check if pointing to a liquid | ||||
| 				n = minetest.env:get_node(pointed_thing.under) | ||||
| 				if bucket.liquids[n.name] == nil then | ||||
| 					-- Not a liquid | ||||
| 					minetest.env:add_node(pointed_thing.above, {name=source}) | ||||
| 				elseif n.name ~= source then | ||||
| 					-- It's a liquid | ||||
| 					minetest.env:add_node(pointed_thing.under, {name=source}) | ||||
| 				end | ||||
| 				return {name="bucket:bucket_empty"} | ||||
| 			end | ||||
| 		}) | ||||
| 	end | ||||
| end | ||||
|  | ||||
| minetest.register_craftitem("bucket:bucket_empty", { | ||||
| 	inventory_image = "bucket.png", | ||||
| 	stack_max = 1, | ||||
| 	liquids_pointable = true, | ||||
| 	on_use = function(itemstack, user, pointed_thing) | ||||
| 		-- Must be pointing to node | ||||
| 		if pointed_thing.type ~= "node" then | ||||
| 			return | ||||
| 		end | ||||
| 		-- Check if pointing to a liquid source | ||||
| 		n = minetest.env:get_node(pointed_thing.under) | ||||
| 		liquiddef = bucket.liquids[n.name] | ||||
| 		if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then | ||||
| 			minetest.env:add_node(pointed_thing.under, {name="air"}) | ||||
| 			return {name=liquiddef.itemname} | ||||
| 		end | ||||
| 	end, | ||||
| }) | ||||
|  | ||||
| bucket.register_liquid( | ||||
| 	"default:water_source", | ||||
| 	"default:water_flowing", | ||||
| 	"bucket:bucket_water", | ||||
| 	"bucket_water.png" | ||||
| ) | ||||
|  | ||||
| bucket.register_liquid( | ||||
| 	"default:lava_source", | ||||
| 	"default:lava_flowing", | ||||
| 	"bucket:bucket_lava", | ||||
| 	"bucket_lava.png" | ||||
| ) | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 	type = "fuel", | ||||
| 	recipe = "default:bucket_lava", | ||||
| 	burntime = 60, | ||||
| }) | ||||
| Before Width: | Height: | Size: 329 B | 
| Before Width: | Height: | Size: 363 B | 
| Before Width: | Height: | Size: 369 B | 
| @@ -1,64 +0,0 @@ | ||||
| Minetest 0.4 mod: default | ||||
| ========================== | ||||
|  | ||||
| License of source code: | ||||
| ----------------------- | ||||
| Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com> | ||||
|  | ||||
| This program is free software; you can redistribute it and/or modify | ||||
| it under the terms of the GNU General Public License as published by | ||||
| the Free Software Foundation; either version 2 of the License, or | ||||
| (at your option) any later version. | ||||
|  | ||||
| http://www.gnu.org/licenses/gpl-2.0.html | ||||
|  | ||||
| License of media (textures and sounds) | ||||
| -------------------------------------- | ||||
| Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)                                  | ||||
| http://creativecommons.org/licenses/by-sa/3.0/ | ||||
|  | ||||
| Authors of media files | ||||
| ----------------------- | ||||
| Everything not listed in here: | ||||
| Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com> | ||||
|  | ||||
| Originating from work by kddekadenz/Dogers: | ||||
|   default_grass_footstep.{1,2,3}.ogg | ||||
|   default_dig_crumbly.{1,2}.ogg | ||||
|  | ||||
| Cisoun's WTFPL texture pack: | ||||
|   default_chest_front.png | ||||
|   default_chest_lock.png | ||||
|   default_chest_side.png | ||||
|   default_chest_top.png | ||||
|   default_cobble.png | ||||
|   default_dirt.png | ||||
|   default_grass.png | ||||
|   default_grass_side.png | ||||
|   default_jungletree.png | ||||
|   default_jungletree_top.png | ||||
|   default_lava.png | ||||
|   default_leaves.png | ||||
|   default_mossycobble.png | ||||
|   default_sand.png | ||||
|   default_sapling.png | ||||
|   default_sign_wall.png | ||||
|   default_stone.png | ||||
|   default_tool_mesepick.png | ||||
|   default_tool_steelpick.png | ||||
|   default_tool_steelshovel.png | ||||
|   default_tool_steelsword.png | ||||
|   default_tool_stonepick.png | ||||
|   default_tool_stoneshovel.png | ||||
|   default_tool_woodpick.png | ||||
|   default_tool_woodshovel.png | ||||
|   default_tree.png | ||||
|   default_tree_top.png | ||||
|   default_water.png | ||||
|  | ||||
| Originating from G4JC's Almost MC Texture Pack: | ||||
|   default_wood.png | ||||
|   default_torch.png | ||||
|   default_torch_on_ceiling.png | ||||
|   default_torch_on_floor.png | ||||
|    | ||||
| @@ -1,92 +0,0 @@ | ||||
| -- minetest/default/leafdecay.lua | ||||
|  | ||||
| -- To enable leaf decay for a node, add it to the "leafdecay" group. | ||||
| -- | ||||
| -- The rating of the group determines how far from a node in the group "tree" | ||||
| -- the node can be without decaying. | ||||
| -- | ||||
| -- If param2 of the node is ~= 0, the node will always be preserved. Thus, if | ||||
| -- the player places a node of that kind, you will want to set param2=1 or so. | ||||
|  | ||||
| default.leafdecay_trunk_cache = {} | ||||
| default.leafdecay_enable_cache = true | ||||
| -- Spread the load of finding trunks | ||||
| default.leafdecay_trunk_find_allow_accumulator = 0 | ||||
|  | ||||
| minetest.register_globalstep(function(dtime) | ||||
| 	local finds_per_second = 5000 | ||||
| 	default.leafdecay_trunk_find_allow_accumulator = | ||||
| 			math.floor(dtime * finds_per_second) | ||||
| end) | ||||
|  | ||||
| minetest.register_abm({ | ||||
| 	nodenames = {"group:leafdecay"}, | ||||
| 	neighbors = {"air", "group:liquid"}, | ||||
| 	-- A low interval and a high inverse chance spreads the load | ||||
| 	interval = 2, | ||||
| 	chance = 5, | ||||
|  | ||||
| 	action = function(p0, node, _, _) | ||||
| 		--print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")") | ||||
| 		local do_preserve = false | ||||
| 		local d = minetest.registered_nodes[node.name].groups.leafdecay | ||||
| 		if not d or d == 0 then | ||||
| 			--print("not groups.leafdecay") | ||||
| 			return | ||||
| 		end | ||||
| 		local n0 = minetest.env:get_node(p0) | ||||
| 		if n0.param2 ~= 0 then | ||||
| 			--print("param2 ~= 0") | ||||
| 			return | ||||
| 		end | ||||
| 		local p0_hash = nil | ||||
| 		if default.leafdecay_enable_cache then | ||||
| 			p0_hash = minetest.hash_node_position(p0) | ||||
| 			local trunkp = default.leafdecay_trunk_cache[p0_hash] | ||||
| 			if trunkp then | ||||
| 				local n = minetest.env:get_node(trunkp) | ||||
| 				local reg = minetest.registered_nodes[n.name] | ||||
| 				-- Assume ignore is a trunk, to make the thing work at the border of the active area | ||||
| 				if n.name == "ignore" or (reg.groups.tree and reg.groups.tree ~= 0) then | ||||
| 					--print("cached trunk still exists") | ||||
| 					return | ||||
| 				end | ||||
| 				--print("cached trunk is invalid") | ||||
| 				-- Cache is invalid | ||||
| 				table.remove(default.leafdecay_trunk_cache, p0_hash) | ||||
| 			end | ||||
| 		end | ||||
| 		if default.leafdecay_trunk_find_allow_accumulator <= 0 then | ||||
| 			return | ||||
| 		end | ||||
| 		default.leafdecay_trunk_find_allow_accumulator = | ||||
| 				default.leafdecay_trunk_find_allow_accumulator - 1 | ||||
| 		-- Assume ignore is a trunk, to make the thing work at the border of the active area | ||||
| 		local p1 = minetest.env:find_node_near(p0, d, {"ignore", "group:tree"}) | ||||
| 		if p1 then | ||||
| 			do_preserve = true | ||||
| 			if default.leafdecay_enable_cache then | ||||
| 				--print("caching trunk") | ||||
| 				-- Cache the trunk | ||||
| 				default.leafdecay_trunk_cache[p0_hash] = p1 | ||||
| 			end | ||||
| 		end | ||||
| 		if not do_preserve then | ||||
| 			-- Drop stuff other than the node itself | ||||
| 			itemstacks = minetest.get_node_drops(n0.name) | ||||
| 			for _, itemname in ipairs(itemstacks) do | ||||
| 				if itemname ~= n0.name then | ||||
| 					local p_drop = { | ||||
| 						x = p0.x - 0.5 + math.random(), | ||||
| 						y = p0.y - 0.5 + math.random(), | ||||
| 						z = p0.z - 0.5 + math.random(), | ||||
| 					} | ||||
| 					minetest.env:add_item(p_drop, itemname) | ||||
| 				end | ||||
| 			end | ||||
| 			-- Remove node | ||||
| 			minetest.env:remove_node(p0) | ||||
| 		end | ||||
| 	end | ||||
| }) | ||||
|  | ||||
| @@ -1,221 +0,0 @@ | ||||
| -- minetest/default/mapgen.lua | ||||
|  | ||||
| -- | ||||
| -- Aliases for map generator outputs | ||||
| -- | ||||
|  | ||||
| minetest.register_alias("mapgen_air", "air") | ||||
| minetest.register_alias("mapgen_stone", "default:stone") | ||||
| minetest.register_alias("mapgen_tree", "default:tree") | ||||
| minetest.register_alias("mapgen_leaves", "default:leaves") | ||||
| minetest.register_alias("mapgen_apple", "default:apple") | ||||
| minetest.register_alias("mapgen_water_source", "default:water_source") | ||||
| minetest.register_alias("mapgen_dirt", "default:dirt") | ||||
| minetest.register_alias("mapgen_sand", "default:sand") | ||||
| minetest.register_alias("mapgen_gravel", "default:gravel") | ||||
| minetest.register_alias("mapgen_clay", "default:clay") | ||||
| minetest.register_alias("mapgen_lava_source", "default:lava_source") | ||||
| minetest.register_alias("mapgen_cobble", "default:cobble") | ||||
| minetest.register_alias("mapgen_mossycobble", "default:mossycobble") | ||||
| minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass") | ||||
| minetest.register_alias("mapgen_junglegrass", "default:junglegrass") | ||||
| minetest.register_alias("mapgen_stone_with_coal", "default:stone_with_coal") | ||||
| minetest.register_alias("mapgen_stone_with_iron", "default:stone_with_iron") | ||||
| minetest.register_alias("mapgen_mese", "default:mese") | ||||
| minetest.register_alias("mapgen_desert_sand", "default:desert_sand") | ||||
| minetest.register_alias("mapgen_desert_stone", "default:desert_stone") | ||||
|  | ||||
| -- | ||||
| -- Ore generation | ||||
| -- | ||||
|  | ||||
| local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, ore_per_chunk, height_min, height_max) | ||||
| 	if maxp.y < height_min or minp.y > height_max then | ||||
| 		return | ||||
| 	end | ||||
| 	local y_min = math.max(minp.y, height_min) | ||||
| 	local y_max = math.min(maxp.y, height_max) | ||||
| 	local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) | ||||
| 	local pr = PseudoRandom(seed) | ||||
| 	local num_chunks = math.floor(chunks_per_volume * volume) | ||||
| 	local chunk_size = 3 | ||||
| 	if ore_per_chunk <= 4 then | ||||
| 		chunk_size = 2 | ||||
| 	end | ||||
| 	local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk) | ||||
| 	--print("generate_ore num_chunks: "..dump(num_chunks)) | ||||
| 	for i=1,num_chunks do | ||||
| 		local y0 = pr:next(y_min, y_max-chunk_size+1) | ||||
| 		if y0 >= height_min and y0 <= height_max then | ||||
| 			local x0 = pr:next(minp.x, maxp.x-chunk_size+1) | ||||
| 			local z0 = pr:next(minp.z, maxp.z-chunk_size+1) | ||||
| 			local p0 = {x=x0, y=y0, z=z0} | ||||
| 			for x1=0,chunk_size-1 do | ||||
| 			for y1=0,chunk_size-1 do | ||||
| 			for z1=0,chunk_size-1 do | ||||
| 				if pr:next(1,inverse_chance) == 1 then | ||||
| 					local x2 = x0+x1 | ||||
| 					local y2 = y0+y1 | ||||
| 					local z2 = z0+z1 | ||||
| 					local p2 = {x=x2, y=y2, z=z2} | ||||
| 					if minetest.env:get_node(p2).name == wherein then | ||||
| 						minetest.env:set_node(p2, {name=name}) | ||||
| 					end | ||||
| 				end | ||||
| 			end | ||||
| 			end | ||||
| 			end | ||||
| 		end | ||||
| 	end | ||||
| 	--print("generate_ore done") | ||||
| end | ||||
|  | ||||
| function default.make_papyrus(pos, size) | ||||
| 	for y=0,size-1 do | ||||
| 		local p = {x=pos.x, y=pos.y+y, z=pos.z} | ||||
| 		minetest.env:set_node(p, {name="default:papyrus"}) | ||||
| 	end | ||||
| end | ||||
|  | ||||
| function default.make_cactus(pos, size) | ||||
| 	for y=0,size-1 do | ||||
| 		local p = {x=pos.x, y=pos.y+y, z=pos.z} | ||||
| 		minetest.env:set_node(p, {name="default:cactus"}) | ||||
| 	end | ||||
| end | ||||
|  | ||||
| minetest.register_on_generated(function(minp, maxp, seed) | ||||
| 	generate_ore("default:stone_with_coal", "default:stone", minp, maxp, seed,   1/8/8/8,    5, -31000,  64) | ||||
| 	generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+1, 1/16/16/16, 5,   -5,   7) | ||||
| 	generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+2, 1/12/12/12, 5, -16,   -5) | ||||
| 	generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+3, 1/9/9/9,    5, -31000, -17) | ||||
| 	if maxp.y >= 2 and minp.y <= 0 then | ||||
| 		-- Generate clay | ||||
| 		-- Assume X and Z lengths are equal | ||||
| 		local divlen = 4 | ||||
| 		local divs = (maxp.x-minp.x)/divlen+1; | ||||
| 		for divx=0+1,divs-1-1 do | ||||
| 		for divz=0+1,divs-1-1 do | ||||
| 			local cx = minp.x + math.floor((divx+0.5)*divlen) | ||||
| 			local cz = minp.z + math.floor((divz+0.5)*divlen) | ||||
| 			if minetest.env:get_node({x=cx,y=1,z=cz}).name == "default:water_source" and | ||||
| 					minetest.env:get_node({x=cx,y=0,z=cz}).name == "default:sand" then | ||||
| 				local is_shallow = true | ||||
| 				local num_water_around = 0 | ||||
| 				if minetest.env:get_node({x=cx-divlen*2,y=1,z=cz+0}).name == "default:water_source" then | ||||
| 					num_water_around = num_water_around + 1 end | ||||
| 				if minetest.env:get_node({x=cx+divlen*2,y=1,z=cz+0}).name == "default:water_source" then | ||||
| 					num_water_around = num_water_around + 1 end | ||||
| 				if minetest.env:get_node({x=cx+0,y=1,z=cz-divlen*2}).name == "default:water_source" then | ||||
| 					num_water_around = num_water_around + 1 end | ||||
| 				if minetest.env:get_node({x=cx+0,y=1,z=cz+divlen*2}).name == "default:water_source" then | ||||
| 					num_water_around = num_water_around + 1 end | ||||
| 				if num_water_around >= 2 then | ||||
| 					is_shallow = false | ||||
| 				end	 | ||||
| 				if is_shallow then | ||||
| 					for x1=-divlen,divlen do | ||||
| 					for z1=-divlen,divlen do | ||||
| 						if minetest.env:get_node({x=cx+x1,y=0,z=cz+z1}).name == "default:sand" then | ||||
| 							minetest.env:set_node({x=cx+x1,y=0,z=cz+z1}, {name="default:clay"}) | ||||
| 						end | ||||
| 					end | ||||
| 					end | ||||
| 				end | ||||
| 			end | ||||
| 		end | ||||
| 		end | ||||
| 		-- Generate papyrus | ||||
| 		local perlin1 = minetest.env:get_perlin(354, 3, 0.7, 100) | ||||
| 		-- Assume X and Z lengths are equal | ||||
| 		local divlen = 8 | ||||
| 		local divs = (maxp.x-minp.x)/divlen+1; | ||||
| 		for divx=0,divs-1 do | ||||
| 		for divz=0,divs-1 do | ||||
| 			local x0 = minp.x + math.floor((divx+0)*divlen) | ||||
| 			local z0 = minp.z + math.floor((divz+0)*divlen) | ||||
| 			local x1 = minp.x + math.floor((divx+1)*divlen) | ||||
| 			local z1 = minp.z + math.floor((divz+1)*divlen) | ||||
| 			-- Determine papyrus amount from perlin noise | ||||
| 			local papyrus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 45 - 20) | ||||
| 			-- Find random positions for papyrus based on this random | ||||
| 			local pr = PseudoRandom(seed+1) | ||||
| 			for i=0,papyrus_amount do | ||||
| 				local x = pr:next(x0, x1) | ||||
| 				local z = pr:next(z0, z1) | ||||
| 				if minetest.env:get_node({x=x,y=1,z=z}).name == "default:dirt_with_grass" and | ||||
| 						minetest.env:find_node_near({x=x,y=1,z=z}, 1, "default:water_source") then | ||||
| 					default.make_papyrus({x=x,y=2,z=z}, pr:next(2, 4)) | ||||
| 				end | ||||
| 			end | ||||
| 		end | ||||
| 		end | ||||
| 		-- Generate cactuses | ||||
| 		local perlin1 = minetest.env:get_perlin(230, 3, 0.6, 100) | ||||
| 		-- Assume X and Z lengths are equal | ||||
| 		local divlen = 16 | ||||
| 		local divs = (maxp.x-minp.x)/divlen+1; | ||||
| 		for divx=0,divs-1 do | ||||
| 		for divz=0,divs-1 do | ||||
| 			local x0 = minp.x + math.floor((divx+0)*divlen) | ||||
| 			local z0 = minp.z + math.floor((divz+0)*divlen) | ||||
| 			local x1 = minp.x + math.floor((divx+1)*divlen) | ||||
| 			local z1 = minp.z + math.floor((divz+1)*divlen) | ||||
| 			-- Determine cactus amount from perlin noise | ||||
| 			local cactus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 6 - 3) | ||||
| 			-- Find random positions for cactus based on this random | ||||
| 			local pr = PseudoRandom(seed+1) | ||||
| 			for i=0,cactus_amount do | ||||
| 				local x = pr:next(x0, x1) | ||||
| 				local z = pr:next(z0, z1) | ||||
| 				-- Find ground level (0...15) | ||||
| 				local ground_y = nil | ||||
| 				for y=30,0,-1 do | ||||
| 					if minetest.env:get_node({x=x,y=y,z=z}).name ~= "air" then | ||||
| 						ground_y = y | ||||
| 						break | ||||
| 					end | ||||
| 				end | ||||
| 				-- If desert sand, make cactus | ||||
| 				if ground_y and minetest.env:get_node({x=x,y=ground_y,z=z}).name == "default:desert_sand" then | ||||
| 					default.make_cactus({x=x,y=ground_y+1,z=z}, pr:next(3, 4)) | ||||
| 				end | ||||
| 			end | ||||
| 		end | ||||
| 		end | ||||
| 		-- Generate dry shrubs | ||||
| 		local perlin1 = minetest.env:get_perlin(329, 3, 0.6, 100) | ||||
| 		-- Assume X and Z lengths are equal | ||||
| 		local divlen = 16 | ||||
| 		local divs = (maxp.x-minp.x)/divlen+1; | ||||
| 		for divx=0,divs-1 do | ||||
| 		for divz=0,divs-1 do | ||||
| 			local x0 = minp.x + math.floor((divx+0)*divlen) | ||||
| 			local z0 = minp.z + math.floor((divz+0)*divlen) | ||||
| 			local x1 = minp.x + math.floor((divx+1)*divlen) | ||||
| 			local z1 = minp.z + math.floor((divz+1)*divlen) | ||||
| 			-- Determine cactus amount from perlin noise | ||||
| 			local cactus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 5 + 0) | ||||
| 			-- Find random positions for cactus based on this random | ||||
| 			local pr = PseudoRandom(seed+1) | ||||
| 			for i=0,cactus_amount do | ||||
| 				local x = pr:next(x0, x1) | ||||
| 				local z = pr:next(z0, z1) | ||||
| 				-- Find ground level (0...15) | ||||
| 				local ground_y = nil | ||||
| 				for y=30,0,-1 do | ||||
| 					if minetest.env:get_node({x=x,y=y,z=z}).name ~= "air" then | ||||
| 						ground_y = y | ||||
| 						break | ||||
| 					end | ||||
| 				end | ||||
| 				-- If desert sand, make cactus | ||||
| 				if ground_y and minetest.env:get_node({x=x,y=ground_y,z=z}).name == "default:desert_sand" then | ||||
| 					minetest.env:set_node({x=x,y=ground_y+1,z=z}, {name="default:dry_shrub"}) | ||||
| 				end | ||||
| 			end | ||||
| 		end | ||||
| 		end | ||||
| 	end | ||||
| end) | ||||
|  | ||||
| Before Width: | Height: | Size: 1.1 KiB | 
| Before Width: | Height: | Size: 203 B | 
| Before Width: | Height: | Size: 292 B | 
| Before Width: | Height: | Size: 597 B | 
| Before Width: | Height: | Size: 604 B | 
| Before Width: | Height: | Size: 763 B | 
| Before Width: | Height: | Size: 682 B | 
| Before Width: | Height: | Size: 769 B | 
| Before Width: | Height: | Size: 871 B | 
| Before Width: | Height: | Size: 714 B | 
| Before Width: | Height: | Size: 628 B | 
| Before Width: | Height: | Size: 613 B | 
| Before Width: | Height: | Size: 249 B | 
| Before Width: | Height: | Size: 210 B | 
| Before Width: | Height: | Size: 118 B | 
| Before Width: | Height: | Size: 933 B | 
| Before Width: | Height: | Size: 744 B | 
| Before Width: | Height: | Size: 627 B | 
| Before Width: | Height: | Size: 517 B | 
| Before Width: | Height: | Size: 888 B | 
| Before Width: | Height: | Size: 450 B | 
| Before Width: | Height: | Size: 539 B | 
| Before Width: | Height: | Size: 246 B | 
| Before Width: | Height: | Size: 236 B | 
| Before Width: | Height: | Size: 978 B | 
| Before Width: | Height: | Size: 794 B | 
| Before Width: | Height: | Size: 856 B | 
| Before Width: | Height: | Size: 925 B | 
| Before Width: | Height: | Size: 591 B | 
| Before Width: | Height: | Size: 936 B | 
| Before Width: | Height: | Size: 672 B | 
| Before Width: | Height: | Size: 751 B | 
| Before Width: | Height: | Size: 865 B | 
| Before Width: | Height: | Size: 395 B | 
| Before Width: | Height: | Size: 772 B | 
| Before Width: | Height: | Size: 451 B | 
| Before Width: | Height: | Size: 299 B | 
| Before Width: | Height: | Size: 952 B | 
| Before Width: | Height: | Size: 1.6 KiB | 
| Before Width: | Height: | Size: 988 B | 
| Before Width: | Height: | Size: 303 B | 
| Before Width: | Height: | Size: 410 B | 
| Before Width: | Height: | Size: 203 B | 
| Before Width: | Height: | Size: 260 B | 
| Before Width: | Height: | Size: 242 B | 
| Before Width: | Height: | Size: 366 B | 
| Before Width: | Height: | Size: 507 B | 
| Before Width: | Height: | Size: 555 B | 
| Before Width: | Height: | Size: 545 B | 
| Before Width: | Height: | Size: 542 B | 
| Before Width: | Height: | Size: 732 B | 
| Before Width: | Height: | Size: 772 B | 
| Before Width: | Height: | Size: 358 B | 
| Before Width: | Height: | Size: 233 B | 
| Before Width: | Height: | Size: 617 B | 
| Before Width: | Height: | Size: 219 B | 
| Before Width: | Height: | Size: 207 B | 
| Before Width: | Height: | Size: 182 B | 
| Before Width: | Height: | Size: 558 B | 
| Before Width: | Height: | Size: 161 B | 
| Before Width: | Height: | Size: 186 B | 
| Before Width: | Height: | Size: 264 B | 
| Before Width: | Height: | Size: 341 B | 
| Before Width: | Height: | Size: 927 B | 
| Before Width: | Height: | Size: 322 B | 
| Before Width: | Height: | Size: 216 B | 
| Before Width: | Height: | Size: 306 B | 
| Before Width: | Height: | Size: 931 B | 
| Before Width: | Height: | Size: 365 B |