forked from mtcontrib/moretrees
		
	Compare commits
	
		
			12 Commits
		
	
	
		
			26f1ec49d2
			...
			2019-10-03
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 6fd3729669 | ||
|  | 25250e6eea | ||
|  | 9bc0bc1b68 | ||
|  | d097fd6044 | ||
|  | 216acdc6b1 | ||
|  | dde035cb5e | ||
|  | acb534d8d0 | ||
|  | f45ffc09bf | ||
|  | e912fba6c8 | ||
|  | 7161cfbdee | ||
|  | a27af10d2e | ||
|  | e474194daf | 
| @@ -30,6 +30,10 @@ moretrees.spawn_saplings		= true | |||||||
|  |  | ||||||
| moretrees.enable_stairs			= true | moretrees.enable_stairs			= true | ||||||
|  |  | ||||||
|  | -- If this variable is set to true, register fences for moretrees wood | ||||||
|  |  | ||||||
|  | moretrees.enable_fences         = false | ||||||
|  |  | ||||||
| -- Set this to true if you want the plantlike drawtype for leaves, which | -- Set this to true if you want the plantlike drawtype for leaves, which | ||||||
| -- improves some peoples' framerates without resorting to making leaf nodes opaque. | -- improves some peoples' framerates without resorting to making leaf nodes opaque. | ||||||
| -- Affects default leaves and default jungle leaves also. | -- Affects default leaves and default jungle leaves also. | ||||||
| @@ -122,8 +126,8 @@ moretrees.dates_item_drop_ichance	= 10 		-- inverse probability of ripe dates dr | |||||||
|  |  | ||||||
| -- Sapling settings | -- Sapling settings | ||||||
|  |  | ||||||
| moretrees.sapling_interval		= 500 | moretrees.sapling_interval		= 100 | ||||||
| moretrees.sapling_chance		= 20 | moretrees.sapling_chance		= 5 | ||||||
|  |  | ||||||
| -- If this variable is set to true, drop leaves out as entities during leaf | -- If this variable is set to true, drop leaves out as entities during leaf | ||||||
| -- decay, rather than just disappearing them. | -- decay, rather than just disappearing them. | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| default | default | ||||||
| biome_lib | biome_lib | ||||||
| vessels | vessels | ||||||
|  | doors? | ||||||
| stairs? | stairs? | ||||||
| moreblocks? | moreblocks? | ||||||
| intllib? | intllib? | ||||||
|   | |||||||
							
								
								
									
										46
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								init.lua
									
									
									
									
									
								
							| @@ -15,6 +15,41 @@ | |||||||
|  |  | ||||||
| moretrees = {} | moretrees = {} | ||||||
|  |  | ||||||
|  | minetest.override_item("default:sapling", { | ||||||
|  | 	description = "Sapling" | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.override_item("default:tree", { | ||||||
|  | 	description = "Tree" | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.override_item("default:wood", { | ||||||
|  | 	description = "Wooden Planks" | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.override_item("default:leaves", { | ||||||
|  | 	description = "Leaves" | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.override_item("default:fence_wood", { | ||||||
|  | 	description = "Wooden Fence" | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.override_item("default:fence_rail_wood", { | ||||||
|  | 	description = "Wooden Fence Rail" | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | if minetest.get_modpath("doors") then | ||||||
|  | 	minetest.override_item("doors:gate_wood_closed", { | ||||||
|  | 		description = "Wooden Fence Gate" | ||||||
|  | 	}) | ||||||
|  |  | ||||||
|  | 	minetest.override_item("doors:gate_wood_open", { | ||||||
|  | 		description = "Wooden Fence Gate" | ||||||
|  | 	}) | ||||||
|  | end | ||||||
|  |  | ||||||
|  |  | ||||||
| -- Read the default config file (and if necessary, copy it to the world folder). | -- Read the default config file (and if necessary, copy it to the world folder). | ||||||
|  |  | ||||||
| local worldpath=minetest.get_worldpath() | local worldpath=minetest.get_worldpath() | ||||||
| @@ -36,17 +71,6 @@ else | |||||||
| end | end | ||||||
| moretrees.intllib = S | moretrees.intllib = S | ||||||
|  |  | ||||||
| -- clone node |  | ||||||
|  |  | ||||||
| function moretrees.clone_node(name) |  | ||||||
| 	local node2 = {} |  | ||||||
| 	local node = minetest.registered_nodes[name] |  | ||||||
| 	for k,v in pairs(node) do |  | ||||||
| 		node2[k]=v |  | ||||||
| 	end |  | ||||||
| 	return node2 |  | ||||||
| end |  | ||||||
|  |  | ||||||
| -- infinite stacks checking | -- infinite stacks checking | ||||||
|  |  | ||||||
| if minetest.get_modpath("unified_inventory") or not | if minetest.get_modpath("unified_inventory") or not | ||||||
|   | |||||||
| @@ -209,10 +209,45 @@ for i in ipairs(moretrees.treelist) do | |||||||
|  |  | ||||||
| 			end | 			end | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
|  | 		if moretrees.enable_fences then | ||||||
|  | 			local planks_name = "moretrees:" .. treename .. "_planks" | ||||||
|  | 			local planks_tile = "moretrees_" .. treename .. "_wood.png" | ||||||
|  | 			default.register_fence("moretrees:" .. treename .. "_fence", { | ||||||
|  | 				description = S(treedesc.." Fence"), | ||||||
|  | 				texture = planks_tile, | ||||||
|  | 				inventory_image = "default_fence_overlay.png^" .. planks_tile .. | ||||||
|  | 										"^default_fence_overlay.png^[makealpha:255,126,126", | ||||||
|  | 				wield_image = "default_fence_overlay.png^" .. planks_tile .. | ||||||
|  | 										"^default_fence_overlay.png^[makealpha:255,126,126", | ||||||
|  | 				material = planks_name, | ||||||
|  | 				groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, | ||||||
|  | 				sounds = default.node_sound_wood_defaults() | ||||||
|  | 			}) | ||||||
|  | 			default.register_fence_rail("moretrees:" .. treename .. "_fence_rail", { | ||||||
|  | 				description = S(treedesc.." Fence Rail"), | ||||||
|  | 				texture = planks_tile, | ||||||
|  | 				inventory_image = "default_fence_rail_overlay.png^" .. planks_tile .. | ||||||
|  | 										"^default_fence_rail_overlay.png^[makealpha:255,126,126", | ||||||
|  | 				wield_image = "default_fence_rail_overlay.png^" .. planks_tile .. | ||||||
|  | 										"^default_fence_rail_overlay.png^[makealpha:255,126,126", | ||||||
|  | 				material = planks_name, | ||||||
|  | 				groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, | ||||||
|  | 				sounds = default.node_sound_wood_defaults() | ||||||
|  | 			}) | ||||||
|  | 			if minetest.global_exists("doors") then | ||||||
|  | 				doors.register_fencegate("moretrees:" .. treename .. "_gate", { | ||||||
|  | 					description = S(treedesc .. " Fence Gate"), | ||||||
|  | 					texture = planks_tile, | ||||||
|  | 					material = planks_name, | ||||||
|  | 					groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2} | ||||||
|  | 				}) | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
| 	end | 	end | ||||||
|  |  | ||||||
| 	minetest.register_node("moretrees:"..treename.."_sapling_ongen", { | 	minetest.register_node("moretrees:"..treename.."_sapling_ongen", { | ||||||
| 		description = S(treedesc.." Sapling (on-generated)"), | 		description = S(treedesc.." Sapling (fast growth)"), | ||||||
| 		drawtype = "plantlike", | 		drawtype = "plantlike", | ||||||
| 		tiles = {saptex}, | 		tiles = {saptex}, | ||||||
| 		inventory_image = saptex, | 		inventory_image = saptex, | ||||||
| @@ -224,7 +259,7 @@ for i in ipairs(moretrees.treelist) do | |||||||
| 			type = "fixed", | 			type = "fixed", | ||||||
| 			fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} | 			fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} | ||||||
| 		}, | 		}, | ||||||
| 		groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,not_in_creative_inventory=1,sapling=1}, | 		groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1}, | ||||||
| 		sounds = default.node_sound_defaults(), | 		sounds = default.node_sound_defaults(), | ||||||
| 		drop = "moretrees:"..treename.."_sapling" | 		drop = "moretrees:"..treename.."_sapling" | ||||||
| 	}) | 	}) | ||||||
| @@ -360,6 +395,7 @@ end | |||||||
| -- we need our own copy of that node, which moretrees will match against. | -- we need our own copy of that node, which moretrees will match against. | ||||||
|  |  | ||||||
| local jungle_tree = table.copy(minetest.registered_nodes["default:jungletree"]) | local jungle_tree = table.copy(minetest.registered_nodes["default:jungletree"]) | ||||||
|  | jungle_tree.drop = "default:jungletree" | ||||||
| minetest.register_node("moretrees:jungletree_trunk", jungle_tree) | minetest.register_node("moretrees:jungletree_trunk", jungle_tree) | ||||||
|  |  | ||||||
| default.register_leafdecay({ | default.register_leafdecay({ | ||||||
| @@ -404,7 +440,7 @@ default.register_leafdecay({ | |||||||
|  |  | ||||||
|  |  | ||||||
| if moretrees.enable_redefine_apple then | if moretrees.enable_redefine_apple then | ||||||
| 	local appledef = moretrees.clone_node("default:apple") | 	local appledef = table.copy(minetest.registered_nodes["default:apple"]) | ||||||
| 	appledef.groups.attached_node = 1 | 	appledef.groups.attached_node = 1 | ||||||
| 	minetest.register_node(":default:apple", appledef) | 	minetest.register_node(":default:apple", appledef) | ||||||
| end | end | ||||||
|   | |||||||
							
								
								
									
										142
									
								
								saplings.lua
									
									
									
									
									
								
							
							
						
						
									
										142
									
								
								saplings.lua
									
									
									
									
									
								
							| @@ -1,98 +1,84 @@ | |||||||
| -- sapling growth | -- sapling growth | ||||||
|  | -- these tables only affect hand-placed saplings | ||||||
|  | -- mapgen-placed always use their biome def settings, which are much more | ||||||
|  | -- limited, in the interest of speed. | ||||||
|  |  | ||||||
|  | local dirt_surfaces = { | ||||||
|  | 	set = true, | ||||||
|  | 	["default:dirt"] = true, | ||||||
|  | 	["default:dirt_with_grass"] = true, | ||||||
|  | 	["default:dirt_with_dry_grass"] = true, | ||||||
|  | 	["default:dirt_with_coniferous_litter"] = true, | ||||||
|  | 	["default:dirt_with_rainforest_litter"] = true, | ||||||
|  | 	["woodsoils:dirt_with_leaves_1"] = true, | ||||||
|  | 	["woodsoils:dirt_with_leaves_2"] = true, | ||||||
|  | 	["woodsoils:grass_with_leaves_1"] = true, | ||||||
|  | 	["woodsoils:grass_with_leaves_2"] = true | ||||||
|  | } | ||||||
|  |  | ||||||
|  | local conifer_surfaces =  { | ||||||
|  | 	set = true, | ||||||
|  | 	["default:dirt"] = true, | ||||||
|  | 	["default:dirt_with_grass"] = true, | ||||||
|  | 	["default:dirt_with_dry_grass"] = true, | ||||||
|  | 	["default:dirt_with_coniferous_litter"] = true, | ||||||
|  | 	["default:dirt_with_rainforest_litter"] = true, | ||||||
|  | 	["woodsoils:dirt_with_leaves_1"] = true, | ||||||
|  | 	["woodsoils:dirt_with_leaves_2"] = true, | ||||||
|  | 	["woodsoils:grass_with_leaves_1"] = true, | ||||||
|  | 	["woodsoils:grass_with_leaves_2"] = true, | ||||||
|  | 	["default:dirt_with_snow"] = true | ||||||
|  | } | ||||||
|  |  | ||||||
|  | local sand_surfaces = { | ||||||
|  | 	set = true, | ||||||
|  | 	["default:sand"] = true, | ||||||
|  | 	["default:desert_sand"] = true, | ||||||
|  | 	["cottages:loam"] = true, | ||||||
|  | 	-- note, no silver sand here. | ||||||
|  | 	-- too cold for a palm, too... well... sandy for anything else. | ||||||
|  | } | ||||||
|  |  | ||||||
| for i in ipairs(moretrees.treelist) do | for i in ipairs(moretrees.treelist) do | ||||||
| 	local treename = moretrees.treelist[i][1] | 	local treename = moretrees.treelist[i][1] | ||||||
| 	local tree_model = treename.."_model" | 	local tree_model = treename.."_model" | ||||||
| 	local tree_biome = treename.."_biome" | 	local tree_biome = treename.."_biome" | ||||||
|  | 	local surfaces | ||||||
|  | 	local grow_function = moretrees[tree_model] | ||||||
|  |  | ||||||
| 	if treename ~= "birch" and treename ~= "spruce" and treename ~= "fir" and treename ~= "jungletree" then | 	if treename == "spruce" | ||||||
|  | 	  or treename == "fir" | ||||||
|  | 	  or treename == "cedar" | ||||||
|  | 	  or treename == "pine" then | ||||||
|  | 		surfaces = conifer_surfaces | ||||||
|  | 	elseif string.find(treename, "palm") then | ||||||
|  | 		surfaces = sand_surfaces | ||||||
|  | 	else | ||||||
|  | 		surfaces = dirt_surfaces | ||||||
|  | 	end | ||||||
|  |  | ||||||
|  | 	if treename == "spruce" | ||||||
|  | 	  or treename == "fir" | ||||||
|  | 	  or treename == "birch" | ||||||
|  | 	  or treename == "jungletree" then | ||||||
|  | 		grow_function = "moretrees.grow_"..treename | ||||||
|  | 	end | ||||||
|  |  | ||||||
| 	biome_lib:dbg(dump(moretrees[tree_biome].surface)) | 	biome_lib:dbg(dump(moretrees[tree_biome].surface)) | ||||||
|  |  | ||||||
| 	biome_lib:grow_plants({ | 	biome_lib:grow_plants({ | ||||||
| 		grow_delay = moretrees.sapling_interval, | 		grow_delay = moretrees.sapling_interval, | ||||||
| 		grow_chance = moretrees.sapling_chance, | 		grow_chance = moretrees.sapling_chance, | ||||||
| 		grow_plant = "moretrees:"..treename.."_sapling", | 		grow_plant = "moretrees:"..treename.."_sapling", | ||||||
| 			grow_nodes = moretrees[tree_biome].surface, | 		grow_nodes = surfaces, | ||||||
| 			grow_function = moretrees[tree_model], | 		grow_function = grow_function, | ||||||
| 	}) | 	}) | ||||||
|  |  | ||||||
| 		if moretrees.spawn_saplings then |  | ||||||
| 	biome_lib:grow_plants({ | 	biome_lib:grow_plants({ | ||||||
| 		grow_delay = 2, | 		grow_delay = 2, | ||||||
| 				grow_chance = 30, | 		grow_chance = 1, | ||||||
| 		grow_plant = "moretrees:"..treename.."_sapling_ongen", | 		grow_plant = "moretrees:"..treename.."_sapling_ongen", | ||||||
| 				grow_nodes = moretrees[tree_biome].surface, | 		grow_nodes = surfaces, | ||||||
| 				grow_function = moretrees[tree_model], | 		grow_function = grow_function, | ||||||
| 			}) |  | ||||||
| 		end |  | ||||||
|  |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| biome_lib:grow_plants({ |  | ||||||
| 	grow_delay = moretrees.sapling_interval, |  | ||||||
| 	grow_chance = moretrees.sapling_chance, |  | ||||||
| 	grow_plant = "moretrees:birch_sapling", |  | ||||||
| 	grow_nodes = moretrees.birch_biome.surface, |  | ||||||
| 	grow_function = "moretrees.grow_birch" |  | ||||||
| }) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| biome_lib:grow_plants({ |  | ||||||
| 	grow_delay = moretrees.sapling_interval, |  | ||||||
| 	grow_chance = moretrees.sapling_chance, |  | ||||||
| 	grow_plant = "moretrees:spruce_sapling", |  | ||||||
| 	grow_nodes = moretrees.spruce_biome.surface, |  | ||||||
| 	grow_function = "moretrees.grow_spruce" |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| biome_lib:grow_plants({ |  | ||||||
| 	grow_delay = moretrees.sapling_interval, |  | ||||||
| 	grow_chance = moretrees.sapling_chance, |  | ||||||
| 	grow_plant = "moretrees:fir_sapling", |  | ||||||
| 	grow_nodes = moretrees.fir_biome.surface, |  | ||||||
| 	grow_function = "moretrees.grow_fir" |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| biome_lib:grow_plants({ |  | ||||||
| 	grow_delay = moretrees.sapling_interval, |  | ||||||
| 	grow_chance = moretrees.sapling_chance, |  | ||||||
| 	grow_plant = "default:junglesapling", |  | ||||||
| 	grow_nodes = moretrees.jungletree_biome.surface, |  | ||||||
| 	grow_function = "moretrees.grow_jungletree" |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| if moretrees.spawn_saplings then |  | ||||||
| 	biome_lib:grow_plants({ |  | ||||||
| 		grow_delay = 2, |  | ||||||
| 		grow_chance = 30, |  | ||||||
| 		grow_plant = "moretrees:jungletree_sapling_ongen", |  | ||||||
| 		grow_nodes = moretrees.jungletree_biome.surface, |  | ||||||
| 		grow_function = "moretrees.grow_jungletree" |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	biome_lib:grow_plants({ |  | ||||||
| 		grow_delay = 2, |  | ||||||
| 		grow_chance = 30, |  | ||||||
| 		grow_plant = "moretrees:fir_sapling_ongen", |  | ||||||
| 		grow_nodes = moretrees.fir_biome.surface, |  | ||||||
| 		grow_function = "moretrees.grow_fir" |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	biome_lib:grow_plants({ |  | ||||||
| 		grow_delay = 2, |  | ||||||
| 		grow_chance = 30, |  | ||||||
| 		grow_plant = "moretrees:spruce_sapling_ongen", |  | ||||||
| 		grow_nodes = moretrees.spruce_biome.surface, |  | ||||||
| 		grow_function = "moretrees.grow_spruce" |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	biome_lib:grow_plants({ |  | ||||||
| 		grow_delay = 2, |  | ||||||
| 		grow_chance = 30, |  | ||||||
| 		grow_plant = "moretrees:birch_sapling_ongen", |  | ||||||
| 		grow_nodes = moretrees.birch_biome.surface, |  | ||||||
| 		grow_function = "moretrees.grow_birch" |  | ||||||
| 	}) | 	}) | ||||||
| end | end | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user