diff --git a/along_shore/init.lua b/along_shore/init.lua deleted file mode 100644 index dbaabe1..0000000 --- a/along_shore/init.lua +++ /dev/null @@ -1,9 +0,0 @@ ------------------------------------------------------------------------------------------------ -local title = "Along the Shore" -local version = "0.0.4" -local mname = "along_shore" ------------------------------------------------------------------------------------------------ - ------------------------------------------------------------------------------------------------ -print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...") ------------------------------------------------------------------------------------------------ \ No newline at end of file diff --git a/along_shore/mod.conf b/along_shore/mod.conf deleted file mode 100644 index 8d0c9dd..0000000 --- a/along_shore/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -name = along_shore -depends = default, biome_lib -optional_depends = flowers_plus diff --git a/along_shore/textures/along_shore_seaweed_1Darker.png b/along_shore/textures/along_shore_seaweed_1Darker.png deleted file mode 100644 index b5bd99c..0000000 Binary files a/along_shore/textures/along_shore_seaweed_1Darker.png and /dev/null differ diff --git a/along_shore/textures/credit_textures.txt b/along_shore/textures/credit_textures.txt deleted file mode 100644 index 89b4ce7..0000000 --- a/along_shore/textures/credit_textures.txt +++ /dev/null @@ -1,30 +0,0 @@ -------------------------------------------------------------- -Credit for textures of "along_shore" -------------------------------------------------------------- -(If more than one author is listed the names are in alphabetical order) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -FOLDER TEXTURE AUTHORS ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -../along_shore/textures along_shore_seaweed_1Darker.png Neuromancer, VanessaE ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -../along_shore/textures/old (along_shore_empty.png) (Mossmanikin) - along_shore_lilypads_1.png Mossmanikin, Neuromancer - along_shore_lilypads_2.png Mossmanikin, Neuromancer - along_shore_lilypads_3.png Mossmanikin, Neuromancer - along_shore_lilypads_4.png Mossmanikin, Neuromancer - along_shore_pondscum_1.png Neuromancer - along_shore_seaweed_1.png Neuromancer, VanessaE - along_shore_seaweed_2.png Mossmanikin, Neuromancer, VanessaE - along_shore_seaweed_3.png Mossmanikin, Neuromancer, VanessaE - along_shore_seaweed_4.png Mossmanikin, Neuromancer, VanessaE - flowers_seaweed.png Neuromancer, VanessaE - flowers_waterlily.png Mossmanikin, VanessaE - flowers_waterlily_22.5.png Mossmanikin, VanessaE - flowers_waterlily_45.png Mossmanikin, VanessaE - flowers_waterlily_67.5.png Mossmanikin, VanessaE - lillypad3Flower16x.png Neuromancer - LillyPad3x16.png Neuromancer - lillyPad5x16.png Neuromancer - MultiLilly16x.png Neuromancer - pondscum16xc.png Neuromancer ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/along_shore/textures/old/LillyPad3x16.png b/along_shore/textures/old/LillyPad3x16.png deleted file mode 100644 index 7d840bd..0000000 Binary files a/along_shore/textures/old/LillyPad3x16.png and /dev/null differ diff --git a/along_shore/textures/old/MultiLilly16x.png b/along_shore/textures/old/MultiLilly16x.png deleted file mode 100644 index 474ad05..0000000 Binary files a/along_shore/textures/old/MultiLilly16x.png and /dev/null differ diff --git a/along_shore/textures/old/along_shore_empty.png b/along_shore/textures/old/along_shore_empty.png deleted file mode 100644 index 2f6464b..0000000 Binary files a/along_shore/textures/old/along_shore_empty.png and /dev/null differ diff --git a/along_shore/textures/old/along_shore_lilypads_1.png b/along_shore/textures/old/along_shore_lilypads_1.png deleted file mode 100644 index a075ba9..0000000 Binary files a/along_shore/textures/old/along_shore_lilypads_1.png and /dev/null differ diff --git a/along_shore/textures/old/along_shore_lilypads_2.png b/along_shore/textures/old/along_shore_lilypads_2.png deleted file mode 100644 index 90f5364..0000000 Binary files a/along_shore/textures/old/along_shore_lilypads_2.png and /dev/null differ diff --git a/along_shore/textures/old/along_shore_lilypads_3.png b/along_shore/textures/old/along_shore_lilypads_3.png deleted file mode 100644 index 94d00d2..0000000 Binary files a/along_shore/textures/old/along_shore_lilypads_3.png and /dev/null differ diff --git a/along_shore/textures/old/along_shore_lilypads_4.png b/along_shore/textures/old/along_shore_lilypads_4.png deleted file mode 100644 index 9b6387f..0000000 Binary files a/along_shore/textures/old/along_shore_lilypads_4.png and /dev/null differ diff --git a/along_shore/textures/old/along_shore_pondscum_1.png b/along_shore/textures/old/along_shore_pondscum_1.png deleted file mode 100644 index 3502354..0000000 Binary files a/along_shore/textures/old/along_shore_pondscum_1.png and /dev/null differ diff --git a/along_shore/textures/old/along_shore_seaweed_1.png b/along_shore/textures/old/along_shore_seaweed_1.png deleted file mode 100644 index 7595ebc..0000000 Binary files a/along_shore/textures/old/along_shore_seaweed_1.png and /dev/null differ diff --git a/along_shore/textures/old/along_shore_seaweed_2.png b/along_shore/textures/old/along_shore_seaweed_2.png deleted file mode 100644 index 0b24730..0000000 Binary files a/along_shore/textures/old/along_shore_seaweed_2.png and /dev/null differ diff --git a/along_shore/textures/old/along_shore_seaweed_3.png b/along_shore/textures/old/along_shore_seaweed_3.png deleted file mode 100644 index d9b7f43..0000000 Binary files a/along_shore/textures/old/along_shore_seaweed_3.png and /dev/null differ diff --git a/along_shore/textures/old/along_shore_seaweed_4.png b/along_shore/textures/old/along_shore_seaweed_4.png deleted file mode 100644 index 887c183..0000000 Binary files a/along_shore/textures/old/along_shore_seaweed_4.png and /dev/null differ diff --git a/along_shore/textures/old/flowers_seaweed.png b/along_shore/textures/old/flowers_seaweed.png deleted file mode 100644 index 7595ebc..0000000 Binary files a/along_shore/textures/old/flowers_seaweed.png and /dev/null differ diff --git a/along_shore/textures/old/flowers_waterlily.png b/along_shore/textures/old/flowers_waterlily.png deleted file mode 100644 index 040a397..0000000 Binary files a/along_shore/textures/old/flowers_waterlily.png and /dev/null differ diff --git a/along_shore/textures/old/flowers_waterlily_22.5.png b/along_shore/textures/old/flowers_waterlily_22.5.png deleted file mode 100644 index c409bcb..0000000 Binary files a/along_shore/textures/old/flowers_waterlily_22.5.png and /dev/null differ diff --git a/along_shore/textures/old/flowers_waterlily_45.png b/along_shore/textures/old/flowers_waterlily_45.png deleted file mode 100644 index c870df4..0000000 Binary files a/along_shore/textures/old/flowers_waterlily_45.png and /dev/null differ diff --git a/along_shore/textures/old/flowers_waterlily_67.5.png b/along_shore/textures/old/flowers_waterlily_67.5.png deleted file mode 100644 index 5b9291b..0000000 Binary files a/along_shore/textures/old/flowers_waterlily_67.5.png and /dev/null differ diff --git a/along_shore/textures/old/lillyPad5x16.png b/along_shore/textures/old/lillyPad5x16.png deleted file mode 100644 index 761beb9..0000000 Binary files a/along_shore/textures/old/lillyPad5x16.png and /dev/null differ diff --git a/along_shore/textures/old/lillypad3Flower16x.png b/along_shore/textures/old/lillypad3Flower16x.png deleted file mode 100644 index 541200f..0000000 Binary files a/along_shore/textures/old/lillypad3Flower16x.png and /dev/null differ diff --git a/along_shore/textures/old/pondscum16xc.png b/along_shore/textures/old/pondscum16xc.png deleted file mode 100644 index 3502354..0000000 Binary files a/along_shore/textures/old/pondscum16xc.png and /dev/null differ diff --git a/bushes/init.lua b/bushes/init.lua index f0a2631..2252ccb 100644 --- a/bushes/init.lua +++ b/bushes/init.lua @@ -10,30 +10,39 @@ local random = math.random -- support for i18n local S = minetest.get_translator("bushes") - abstract_bushes = {} +abstract_bushes = {} - minetest.register_node("bushes:youngtree2_bottom", { +local bushes_bush_rarity = tonumber(minetest.settings:get("bushes_bush_rarity")) or 99.9 +local bushes_bush_rarity_fertility = tonumber(minetest.settings:get("bushes_bush_rarity_fertility")) or 1.5 +local bushes_bush_fertility = tonumber(minetest.settings:get("bushes_bush_fertility")) or -1 + +local bushes_youngtrees_rarity = tonumber(minetest.settings:get("bushes_youngtrees_rarity")) or 100 +local bushes_youngtrees_rarity_fertility = tonumber(minetest.settings:get("bushes_youngtrees_rarity_fertility")) or 0.6 +local bushes_youngtrees_fertility = tonumber(minetest.settings:get("bushes_youngtrees_fertility")) or -0.5 + + +minetest.register_node("bushes:youngtree2_bottom", { description = S("Young Tree 2 (bottom)"), - drawtype="nodebox", - tiles = {"bushes_youngtree2trunk.png"}, + drawtype="nodebox", + tiles = {"bushes_youngtree2trunk.png"}, inventory_image = "bushes_youngtree2trunk_inv.png", wield_image = "bushes_youngtree2trunk_inv.png", -paramtype = "light", + paramtype = "light", walkable = false, is_ground_content = true, -node_box = { - type = "fixed", - fixed = { - --{0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000}, --NodeBox 1 - {-0.0612,-0.500000,-0.500000,0.0612,0.500000,-0.375000}, --NodeBox 1 - } -}, + node_box = { + type = "fixed", + fixed = { + --{0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000}, --NodeBox 1 + {-0.0612,-0.500000,-0.500000,0.0612,0.500000,-0.375000}, --NodeBox 1 + } + }, groups = {snappy=3,flammable=2,attached_node=1}, sounds = default.node_sound_leaves_defaults(), drop = 'default:stick' }) - local BushBranchCenter = { {1,1}, {3,2} } +local BushBranchCenter = { {1,1}, {3,2} } for i in pairs(BushBranchCenter) do local Num = BushBranchCenter[i][1] local TexNum = BushBranchCenter[i][2] @@ -57,8 +66,8 @@ for i in pairs(BushBranchCenter) do }, inventory_image = "bushes_branches_center_"..TexNum..".png", paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, + paramtype2 = "facedir", + sunlight_propagates = true, groups = { -- tree=1, -- MM: disabled because some recipes use group:tree for trunks snappy=3, @@ -83,16 +92,16 @@ for i in pairs(BushBranchSide) do --[[bottom]]"bushes_branches_center_"..TexNum..".png", --[[right]] "bushes_branches_left_"..TexNum..".png", --[[left]] "bushes_branches_right_"..TexNum..".png", -- MM: We could also mirror the previous here, ---[[back]] "bushes_branches_center_"..TexNum..".png",-- unless U really want 'em 2 B different +--[[back]] "bushes_branches_center_"..TexNum..".png",-- unless U really want 'em 2 B different --[[front]] "bushes_branches_right_"..TexNum..".png" }, node_box = { type = "fixed", fixed = { --- { left , bottom , front, right , top , back } - {0.137748,-0.491944, 0.5 ,-0.125000,-0.179444,-0.007790}, --NodeBox 1 - {0.262748,-0.185995, 0.5 ,-0.237252, 0.126505,-0.260269}, --NodeBox 2 - {0.500000, 0.125000, 0.5 ,-0.500000, 0.500000,-0.500000}, --NodeBox 3 +-- { left , bottom , front, right , top , back } + {0.137748,-0.491944, 0.5 ,-0.125000,-0.179444,-0.007790}, --NodeBox 1 + {0.262748,-0.185995, 0.5 ,-0.237252, 0.126505,-0.260269}, --NodeBox 2 + {0.500000, 0.125000, 0.5 ,-0.500000, 0.500000,-0.500000}, --NodeBox 3 }, }, selection_box = { @@ -101,8 +110,8 @@ for i in pairs(BushBranchSide) do }, inventory_image = "bushes_branches_right_"..TexNum..".png", paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, + paramtype2 = "facedir", + sunlight_propagates = true, groups = { -- tree=1, -- MM: disabled because some recipes use group:tree for trunks snappy=3, @@ -151,9 +160,8 @@ abstract_bushes.grow_bush = function(pos) abstract_bushes.grow_bush_node(pos,5,leaf_type) end + abstract_bushes.grow_bush_node = function(pos,dir, leaf_type) - - local right_here = {x=pos.x, y=pos.y+1, z=pos.z} local above_right_here = {x=pos.x, y=pos.y+2, z=pos.z} @@ -175,7 +183,7 @@ abstract_bushes.grow_bush_node = function(pos,dir, leaf_type) dir = 1 end - if minetest.get_node(right_here).name == "air" -- instead of check_air = true, + if minetest.get_node(right_here).name == "air" -- instead of check_air = true, or minetest.get_node(right_here).name == "default:junglegrass" then minetest.swap_node(right_here, {name="bushes:bushbranches"..bush_branch_type , param2=dir}) --minetest.chat_send_all("leaf_type: (" .. leaf_type .. ")") @@ -189,62 +197,60 @@ end biome_lib.register_on_generate({ - surface = { - "default:dirt_with_grass", - "stoneage:grass_with_silex", - "sumpf:peat", - "sumpf:sumpf" + surface = { + "default:dirt_with_grass", + "stoneage:grass_with_silex", + "sumpf:peat", + "sumpf:sumpf" + }, + rarity = bushes_bush_rarity, + rarity_fertility = bushes_bush_rarity_fertility, + plantlife_limit = bushes_bush_fertility, + min_elevation = 1, -- above sea level }, - max_count = 15, --10,15 - rarity = 101 - 4, --3,4 - min_elevation = 1, -- above sea level - plantlife_limit = -0.9, - }, - abstract_bushes.grow_bush + abstract_bushes.grow_bush ) - abstract_bushes.grow_youngtree2 = function(pos) +abstract_bushes.grow_youngtree2 = function(pos) abstract_bushes.grow_youngtree_node2(pos, random(4,5)) end + abstract_bushes.grow_youngtree_node2 = function(pos, height) - - local right_here = {x=pos.x, y=pos.y+1, z=pos.z} local above_right_here = {x=pos.x, y=pos.y+2, z=pos.z} local two_above_right_here = {x=pos.x, y=pos.y+3, z=pos.z} local three_above_right_here = {x=pos.x, y=pos.y+4, z=pos.z} - if height == 4 and - (minetest.get_node(right_here).name == "air" -- instead of check_air = true, - or minetest.get_node(right_here).name == "default:junglegrass") then + if minetest.get_node(right_here).name == "air" -- instead of check_air = true, + or minetest.get_node(right_here).name == "default:junglegrass" then + if height == 4 then local two_above_right_here_south = {x=pos.x, y=pos.y+3, z=pos.z-1} local three_above_right_here_south = {x=pos.x, y=pos.y+4, z=pos.z-1} minetest.swap_node(right_here, {name="bushes:youngtree2_bottom"}) minetest.swap_node(above_right_here, {name="bushes:youngtree2_bottom"}) - minetest.swap_node(two_above_right_here, {name="bushes:bushbranches2" , param2=2}) - minetest.swap_node(two_above_right_here_south, {name="bushes:bushbranches2" , param2=0}) + minetest.swap_node(two_above_right_here, {name="bushes:bushbranches2" , param2=2}) + minetest.swap_node(two_above_right_here_south, {name="bushes:bushbranches2" , param2=0}) minetest.swap_node(three_above_right_here, {name="bushes:BushLeaves1" }) minetest.swap_node(three_above_right_here_south, {name="bushes:BushLeaves1" }) + end end end biome_lib.register_on_generate({ - surface = { - "default:dirt_with_grass", - "stoneage:grass_with_silex", - "sumpf:peat", - "sumpf:sumpf" + surface = { + "default:dirt_with_grass", + "stoneage:grass_with_silex", + "sumpf:peat", + "sumpf:sumpf" + }, + rarity = bushes_youngtrees_rarity, + rarity_fertility = bushes_youngtrees_rarity_fertility, + plantlife_limit = bushes_youngtrees_fertility, + min_elevation = 1, -- above sea level }, - max_count = 55, --10,15 - rarity = 101 - 4, --3,4 - min_elevation = 1, -- above sea level - plantlife_limit = -0.9, - }, - abstract_bushes.grow_youngtree2 + abstract_bushes.grow_youngtree2 ) - --http://dev.minetest.net/Node_Drawtypes - minetest.log("action", "[bushes] loaded.") diff --git a/bushes/settingtypes.txt b/bushes/settingtypes.txt new file mode 100644 index 0000000..77c5d57 --- /dev/null +++ b/bushes/settingtypes.txt @@ -0,0 +1,17 @@ +#Bush rarity % +bushes_bush_rarity (Bush rarity %) float 99.9 0 100 + +#How much the rarity is reduced by fertility % +bushes_bush_rarity_fertility (Bush rarity fertility reduction %) float 1.5 0 100 + +#Bush minimum fertility (-1 to +1) +bushes_bush_fertility (Bush minimum fertility) float -0.7 -1 1 + +#Youngtree (from bushes mod) rarity % +bushes_youngtrees_rarity (Youngtree bush rarity %) float 100 0 100 + +#How much the rarity is reduced by fertility % +bushes_youngtrees_rarity_fertility (Youngtree bush rarity fertility reduction %) float 0.6 0 100 + +#Youngtree (from bushes mod) minimum fertility (-1 to +1) +bushes_youngtrees_fertility (Youngtree bush minimum fertility) float -0.5 -1 1 diff --git a/dryplants/reedmace.lua b/dryplants/reedmace.lua index 602f0b8..1502109 100644 --- a/dryplants/reedmace.lua +++ b/dryplants/reedmace.lua @@ -267,7 +267,8 @@ minetest.register_node("dryplants:reedmace_sapling", { groups = { snappy=3, flammable=2, - attached_node=1 + attached_node=1, + sapling=1, }, sounds = default.node_sound_leaves_defaults(), selection_box = { diff --git a/ferns/gianttreefern.lua b/ferns/gianttreefern.lua index c5b0f14..f950d01 100644 --- a/ferns/gianttreefern.lua +++ b/ferns/gianttreefern.lua @@ -162,6 +162,14 @@ minetest.register_node("ferns:tree_fern_leave_big", { }, drop = "", sounds = default.node_sound_leaves_defaults(), + after_destruct = function(pos,oldnode) + for _, d in pairs({{x=-1,z=0},{x=1,z=0},{x=0,z=-1},{x=0,z=1}}) do + local node = minetest.get_node({x=pos.x+d.x,y=pos.y+1,z=pos.z+d.z}) + if node.name == "ferns:tree_fern_leave_big" then + minetest.dig_node({x=pos.x+d.x,y=pos.y+1,z=pos.z+d.z}) + end + end + end, }) ----------------------------------------------------------------------------------------------- @@ -274,7 +282,7 @@ minetest.register_node("ferns:sapling_giant_tree_fern", { tiles = {"ferns_sapling_tree_fern_giant.png"}, inventory_image = "ferns_sapling_tree_fern_giant.png", walkable = false, - groups = {snappy=3,flammable=2,flora=1,attached_node=1}, + groups = {snappy=3,flammable=2,flora=1,attached_node=1,sapling=1}, sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", diff --git a/ferns/treefern.lua b/ferns/treefern.lua index 488f74e..2570197 100644 --- a/ferns/treefern.lua +++ b/ferns/treefern.lua @@ -156,7 +156,7 @@ minetest.register_node("ferns:sapling_tree_fern", { tiles = {"ferns_sapling_tree_fern.png"}, inventory_image = "ferns_sapling_tree_fern.png", walkable = false, - groups = {snappy=3,flammable=2,flora=1,attached_node=1}, + groups = {snappy=3,flammable=2,flora=1,attached_node=1,sapling=1}, sounds = default.node_sound_leaves_defaults(), selection_box = { type = "fixed", diff --git a/flowers_plus/flowers-changelog.txt b/flowers_plus/flowers-changelog.txt deleted file mode 100644 index fbe7518..0000000 --- a/flowers_plus/flowers-changelog.txt +++ /dev/null @@ -1,24 +0,0 @@ -Changelog ---------- - -2012-08-06: Tweaked selection boxes on all nodes. Tweaked seaweed to use -signlike instead of raillike drawtype, (still forced to only spawn flat as -usual). Adjusted light level limits to give it more time to grow. Created -this changelog file using github commit messages as the basis. Shrunk the -geranium flower down a bit to better match the others. - -2012-08-03: Tuned out the random-numbers-inside-ABM stuff. Uses the ABM's -chance setting instead. Should be approximately the same as before, but -hopefully using a tad less CPU. Minor tweak to ABM interval/growing delay. - -2012-08-01: Added blue geranium to the collection of flowers. - -2012-07-31: Disable debug by default. - -2012-07-30: many updates over the course of the day - first commit, removed -some redundant files, added wield/inventory image entries for each item, to -force the game to draw them properly (these shouldn't be needed, must be a -bug). Tweaked spawn code so that the radius check also includes the name of -the item being spawned as well as items in group:flower, that way all items can -have a radius test, and not just those in group:flower. Fiddled with the spawn -rates a bit. diff --git a/flowers_plus/init.lua b/flowers_plus/init.lua deleted file mode 100644 index f0760e3..0000000 --- a/flowers_plus/init.lua +++ /dev/null @@ -1,484 +0,0 @@ --- support for i18n -local S = minetest.get_translator("flowers_plus") - --- This file supplies a few additional plants and some related crafts --- for the plantlife modpack. Last revision: 2013-04-24 - -local random = math.random - -flowers_plus = {} - -local SPAWN_DELAY = 1000 -local SPAWN_CHANCE = 200 -local flowers_seed_diff = 329 -local lilies_max_count = 320 -local lilies_rarity = 33 -local seaweed_max_count = 320 -local seaweed_rarity = 33 -local sunflowers_max_count = 10 -local sunflowers_rarity = 25 - --- register the various rotations of waterlilies - -local lilies_list = { - { nil , nil , 1 }, - { "225", "22.5" , 2 }, - { "45" , "45" , 3 }, - { "675", "67.5" , 4 }, - { "s1" , "small_1" , 5 }, - { "s2" , "small_2" , 6 }, - { "s3" , "small_3" , 7 }, - { "s4" , "small_4" , 8 }, -} - -for i in ipairs(lilies_list) do - local deg1 = "" - local deg2 = "" - local lily_groups = {snappy = 3,flammable=2,flower=1} - - if lilies_list[i][1] ~= nil then - deg1 = "_"..lilies_list[i][1] - deg2 = "_"..lilies_list[i][2] - lily_groups = { snappy = 3,flammable=2,flower=1, not_in_creative_inventory=1 } - end - - minetest.register_node(":flowers:waterlily"..deg1, { - description = S("Waterlily"), - drawtype = "nodebox", - tiles = { - "flowers_waterlily"..deg2..".png", - "flowers_waterlily"..deg2..".png^[transformFY" - }, - inventory_image = "flowers_waterlily.png", - wield_image = "flowers_waterlily.png", - sunlight_propagates = true, - paramtype = "light", - paramtype2 = "facedir", - walkable = false, - groups = lily_groups, - sounds = default.node_sound_leaves_defaults(), - selection_box = { - type = "fixed", - fixed = { -0.4, -0.5, -0.4, 0.4, -0.45, 0.4 }, - }, - node_box = { - type = "fixed", - fixed = { -0.5, -0.49, -0.5, 0.5, -0.49, 0.5 }, - }, - buildable_to = true, - node_placement_prediction = "", - - liquids_pointable = true, - drop = "flowers:waterlily", - on_place = function(itemstack, placer, pointed_thing) - local keys=placer:get_player_control() - local pt = pointed_thing - - local place_pos = nil - local top_pos = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z} - local under_node = minetest.get_node(pt.under) - local above_node = minetest.get_node(pt.above) - local top_node = minetest.get_node(top_pos) - - if biome_lib.get_nodedef_field(under_node.name, "buildable_to") then - if under_node.name ~= "default:water_source" then - place_pos = pt.under - elseif top_node.name ~= "default:water_source" - and biome_lib.get_nodedef_field(top_node.name, "buildable_to") then - place_pos = top_pos - else - return - end - elseif biome_lib.get_nodedef_field(above_node.name, "buildable_to") then - place_pos = pt.above - end - - if place_pos and not minetest.is_protected(place_pos, placer:get_player_name()) then - - local nodename = "default:cobble" -- if this block appears, something went....wrong :-) - - if not keys["sneak"] then - local node = minetest.get_node(pt.under) - local waterlily = random(1,8) - if waterlily == 1 then - nodename = "flowers:waterlily" - elseif waterlily == 2 then - nodename = "flowers:waterlily_225" - elseif waterlily == 3 then - nodename = "flowers:waterlily_45" - elseif waterlily == 4 then - nodename = "flowers:waterlily_675" - elseif waterlily == 5 then - nodename = "flowers:waterlily_s1" - elseif waterlily == 6 then - nodename = "flowers:waterlily_s2" - elseif waterlily == 7 then - nodename = "flowers:waterlily_s3" - elseif waterlily == 8 then - nodename = "flowers:waterlily_s4" - end - minetest.swap_node(place_pos, {name = nodename, param2 = random(0,3) }) - else - local fdir = minetest.dir_to_facedir(placer:get_look_dir()) - minetest.swap_node(place_pos, {name = "flowers:waterlily", param2 = fdir}) - end - - if not biome_lib.expect_infinite_stacks then - itemstack:take_item() - end - return itemstack - end - end, - }) -end - -local algae_list = { {nil}, {2}, {3}, {4} } - -for i in ipairs(algae_list) do - local num = "" - local algae_groups = {snappy = 3,flammable=2,flower=1} - - if algae_list[i][1] ~= nil then - num = "_"..algae_list[i][1] - algae_groups = { snappy = 3,flammable=2,flower=1, not_in_creative_inventory=1 } - end - - minetest.register_node(":flowers:seaweed"..num, { - description = S("Seaweed"), - drawtype = "nodebox", - tiles = { - "flowers_seaweed"..num..".png", - "flowers_seaweed"..num..".png^[transformFY" - }, - inventory_image = "flowers_seaweed_2.png", - wield_image = "flowers_seaweed_2.png", - sunlight_propagates = true, - paramtype = "light", - paramtype2 = "facedir", - walkable = false, - groups = algae_groups, - sounds = default.node_sound_leaves_defaults(), - selection_box = { - type = "fixed", - fixed = { -0.4, -0.5, -0.4, 0.4, -0.45, 0.4 }, - }, - node_box = { - type = "fixed", - fixed = { -0.5, -0.49, -0.5, 0.5, -0.49, 0.5 }, - }, - buildable_to = true, - - liquids_pointable = true, - drop = "flowers:seaweed", - on_place = function(itemstack, placer, pointed_thing) - local keys=placer:get_player_control() - local pt = pointed_thing - - local place_pos = nil - local top_pos = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z} - local under_node = minetest.get_node(pt.under) - local above_node = minetest.get_node(pt.above) - local top_node = minetest.get_node(top_pos) - - if biome_lib.get_nodedef_field(under_node.name, "buildable_to") then - if under_node.name ~= "default:water_source" then - place_pos = pt.under - elseif top_node.name ~= "default:water_source" - and biome_lib.get_nodedef_field(top_node.name, "buildable_to") then - place_pos = top_pos - else - return - end - elseif biome_lib.get_nodedef_field(above_node.name, "buildable_to") then - place_pos = pt.above - end - if not place_pos then return end -- something went wrong :P - - if not minetest.is_protected(place_pos, placer:get_player_name()) then - - local nodename = "default:cobble" -- :D - - if not keys["sneak"] then - --local node = minetest.get_node(pt.under) - local seaweed = random(1,4) - if seaweed == 1 then - nodename = "flowers:seaweed" - elseif seaweed == 2 then - nodename = "flowers:seaweed_2" - elseif seaweed == 3 then - nodename = "flowers:seaweed_3" - elseif seaweed == 4 then - nodename = "flowers:seaweed_4" - end - minetest.swap_node(place_pos, {name = nodename, param2 = random(0,3) }) - else - local fdir = minetest.dir_to_facedir(placer:get_look_dir()) - minetest.swap_node(place_pos, {name = "flowers:seaweed", param2 = fdir}) - end - - if not biome_lib.expect_infinite_stacks then - itemstack:take_item() - end - return itemstack - end - end, - }) -end - -local box = { - type="fixed", - fixed = { { -0.2, -0.5, -0.2, 0.2, 0.5, 0.2 } }, -} - -local sunflower_drop = "farming:seed_wheat" -if minetest.registered_items["farming:seed_spelt"] then - sunflower_drop = "farming:seed_spelt" -end - -minetest.register_node(":flowers:sunflower", { - description = S("Sunflower"), - drawtype = "mesh", - paramtype = "light", - paramtype2 = "facedir", - inventory_image = "flowers_sunflower_inv.png", - mesh = "flowers_sunflower.obj", - tiles = { "flowers_sunflower.png" }, - walkable = false, - buildable_to = true, - is_ground_content = true, - groups = { dig_immediate=3, flora=1, flammable=3, attached_node=1 }, - sounds = default.node_sound_leaves_defaults(), - selection_box = box, - collision_box = box, - drop = { - max_items = 1, - items = { - {items = {sunflower_drop}, rarity = 8}, - {items = {"flowers:sunflower"}}, - } - } -}) - -local extra_aliases = { - "waterlily", - "waterlily_225", - "waterlily_45", - "waterlily_675", - "seaweed" -} - -for i in ipairs(extra_aliases) do - local flower = extra_aliases[i] - minetest.register_alias("flowers:flower_"..flower, "flowers:"..flower) -end - -minetest.register_alias( "trunks:lilypad" , "flowers:waterlily_s1" ) -minetest.register_alias( "along_shore:lilypads_1" , "flowers:waterlily_s1" ) -minetest.register_alias( "along_shore:lilypads_2" , "flowers:waterlily_s2" ) -minetest.register_alias( "along_shore:lilypads_3" , "flowers:waterlily_s3" ) -minetest.register_alias( "along_shore:lilypads_4" , "flowers:waterlily_s4" ) -minetest.register_alias( "along_shore:pondscum_1" , "flowers:seaweed" ) -minetest.register_alias( "along_shore:seaweed_1" , "flowers:seaweed" ) -minetest.register_alias( "along_shore:seaweed_2" , "flowers:seaweed_2" ) -minetest.register_alias( "along_shore:seaweed_3" , "flowers:seaweed_3" ) -minetest.register_alias( "along_shore:seaweed_4" , "flowers:seaweed_4" ) - --- ongen registrations - -flowers_plus.grow_waterlily = function(pos) - local right_here = {x=pos.x, y=pos.y+1, z=pos.z} - for i in ipairs(lilies_list) do - local chance = random(1,8) - local ext = "" - local num = lilies_list[i][3] - - if lilies_list[i][1] ~= nil then - ext = "_"..lilies_list[i][1] - end - - if chance == num then - minetest.swap_node(right_here, {name="flowers:waterlily"..ext, param2=random(0,3)}) - end - end -end - -biome_lib.register_on_generate({ - surface = {"default:water_source"}, - max_count = lilies_max_count, - rarity = lilies_rarity, - min_elevation = 1, - max_elevation = 40, - near_nodes = {"default:dirt_with_grass"}, - near_nodes_size = 4, - near_nodes_vertical = 1, - near_nodes_count = 1, - plantlife_limit = -0.9, - temp_max = -0.22, - temp_min = 0.22, - }, - flowers_plus.grow_waterlily -) - -flowers_plus.grow_seaweed = function(pos) - local right_here = {x=pos.x, y=pos.y+1, z=pos.z} - minetest.swap_node(right_here, {name="along_shore:seaweed_"..random(1,4), param2=random(1,3)}) -end - -biome_lib.register_on_generate({ - surface = {"default:water_source"}, - max_count = seaweed_max_count, - rarity = seaweed_rarity, - min_elevation = 1, - max_elevation = 40, - near_nodes = {"default:dirt_with_grass"}, - near_nodes_size = 4, - near_nodes_vertical = 1, - near_nodes_count = 1, - plantlife_limit = -0.9, - }, - flowers_plus.grow_seaweed -) - --- seaweed at beaches --- MM: not satisfied with it, but IMHO some beaches should have some algae -biome_lib.register_on_generate({ - surface = {"default:water_source"}, - max_count = seaweed_max_count, - rarity = seaweed_rarity, - min_elevation = 1, - max_elevation = 40, - near_nodes = {"default:sand"}, - near_nodes_size = 1, - near_nodes_vertical = 0, - near_nodes_count = 3, - plantlife_limit = -0.9, - temp_max = -0.64, -- MM: more or less random values, just to make sure it's not everywhere - temp_min = -0.22, -- MM: more or less random values, just to make sure it's not everywhere - }, - flowers_plus.grow_seaweed -) -biome_lib.register_on_generate({ - surface = {"default:sand"}, - max_count = seaweed_max_count*2, - rarity = seaweed_rarity/2, - min_elevation = 1, - max_elevation = 40, - near_nodes = {"default:water_source"}, - near_nodes_size = 1, - near_nodes_vertical = 0, - near_nodes_count = 3, - plantlife_limit = -0.9, - temp_max = -0.64, -- MM: more or less random values, just to make sure it's not everywhere - temp_min = -0.22, -- MM: more or less random values, just to make sure it's not everywhere - }, - flowers_plus.grow_seaweed -) - -biome_lib.register_on_generate({ - surface = {"default:dirt_with_grass"}, - avoid_nodes = { "flowers:sunflower" }, - max_count = sunflowers_max_count, - rarity = sunflowers_rarity, - min_elevation = 0, - plantlife_limit = -0.9, - temp_max = 0.53, - random_facedir = {0,3}, - }, - "flowers:sunflower" -) - --- spawn ABM registrations - -biome_lib.register_active_spawner({ - spawn_delay = SPAWN_DELAY/2, - spawn_plants = { - "flowers:waterlily", - "flowers:waterlily_225", - "flowers:waterlily_45", - "flowers:waterlily_675", - "flowers:waterlily_s1", - "flowers:waterlily_s2", - "flowers:waterlily_s3", - "flowers:waterlily_s4" - }, - avoid_radius = 2.5, - spawn_chance = SPAWN_CHANCE*4, - spawn_surfaces = {"default:water_source"}, - avoid_nodes = {"group:flower", "group:flora" }, - seed_diff = flowers_seed_diff, - light_min = 9, - depth_max = 2, - random_facedir = {0,3} -}) - -biome_lib.register_active_spawner({ - spawn_delay = SPAWN_DELAY*2, - spawn_plants = {"flowers:seaweed"}, - spawn_chance = SPAWN_CHANCE*2, - spawn_surfaces = {"default:water_source"}, - avoid_nodes = {"group:flower", "group:flora"}, - seed_diff = flowers_seed_diff, - light_min = 4, - light_max = 10, - neighbors = {"default:dirt_with_grass"}, - facedir = 1 -}) - -biome_lib.register_active_spawner({ - spawn_delay = SPAWN_DELAY*2, - spawn_plants = {"flowers:seaweed"}, - spawn_chance = SPAWN_CHANCE*2, - spawn_surfaces = {"default:dirt_with_grass"}, - avoid_nodes = {"group:flower", "group:flora" }, - seed_diff = flowers_seed_diff, - light_min = 4, - light_max = 10, - neighbors = {"default:water_source"}, - ncount = 1, - facedir = 1 -}) - -biome_lib.register_active_spawner({ - spawn_delay = SPAWN_DELAY*2, - spawn_plants = {"flowers:seaweed"}, - spawn_chance = SPAWN_CHANCE*2, - spawn_surfaces = {"default:stone"}, - avoid_nodes = {"group:flower", "group:flora" }, - seed_diff = flowers_seed_diff, - light_min = 4, - light_max = 10, - neighbors = {"default:water_source"}, - ncount = 6, - facedir = 1 -}) - -biome_lib.register_active_spawner({ - spawn_delay = SPAWN_DELAY*2, - spawn_plants = {"flowers:sunflower"}, - spawn_chance = SPAWN_CHANCE*2, - spawn_surfaces = {"default:dirt_with_grass"}, - avoid_nodes = {"group:flower", "flowers:sunflower"}, - seed_diff = flowers_seed_diff, - light_min = 11, - light_max = 14, - min_elevation = 0, - plantlife_limit = -0.9, - temp_max = 0.53, - random_facedir = {0,3}, - avoid_radius = 5 -}) - --- Cotton plants are now provided by the default "farming" mod. --- old cotton plants -> farming cotton stage 8 --- cotton wads -> string (can be crafted into wool blocks) --- potted cotton plants -> potted white dandelions - -minetest.register_alias("flowers:cotton_plant", "farming:cotton_8") -minetest.register_alias("flowers:flower_cotton", "farming:cotton_8") -minetest.register_alias("flowers:flower_cotton_pot", "flowers:potted_dandelion_white") -minetest.register_alias("flowers:potted_cotton_plant", "flowers:potted_dandelion_white") -minetest.register_alias("flowers:cotton", "farming:string") -minetest.register_alias("flowers:cotton_wad", "farming:string") -minetest.register_alias("sunflower:sunflower", "flowers:sunflower") - -print("[Flowers] Loaded.") diff --git a/molehills/init.lua b/molehills/init.lua index 481c866..872e987 100644 --- a/molehills/init.lua +++ b/molehills/init.lua @@ -1,14 +1,13 @@ ----------------------------------------------------------------------------------------------- -local title = "Mole Hills" -local version = "0.0.3" -local mname = "molehills" ------------------------------------------------------------------------------------------------ -- Idea by Sokomine -- Code & textures by Mossmanikin abstract_molehills = {} -dofile(minetest.get_modpath("molehills").."/molehills_settings.txt") +local molehills_rarity = tonumber(minetest.settings:get("molehills_rarity")) or 99.5 +local molehills_rarity_fertility = tonumber(minetest.settings:get("molehills_rarity_fertility")) or 1 +local molehills_fertility = tonumber(minetest.settings:get("molehills_fertility")) or -0.6 + -- support for i18n local S = minetest.get_translator("molehills") @@ -49,11 +48,11 @@ minetest.register_craft({ -- molehills --> dirt -- GeNeRaTiNG ----------------------------------------------------------------------------------------------- abstract_molehills.place_molehill = function(pos) - local right_here = {x=pos.x , y=pos.y+1, z=pos.z } - if minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z }).name ~= "air" - and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z }).name ~= "air" - and minetest.get_node({x=pos.x , y=pos.y, z=pos.z+1}).name ~= "air" - and minetest.get_node({x=pos.x , y=pos.y, z=pos.z-1}).name ~= "air" + local right_here = {x=pos.x , y=pos.y+1, z=pos.z } + if minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z }).name ~= "air" + and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z }).name ~= "air" + and minetest.get_node({x=pos.x , y=pos.y, z=pos.z+1}).name ~= "air" + and minetest.get_node({x=pos.x , y=pos.y, z=pos.z-1}).name ~= "air" and minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z+1}).name ~= "air" and minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z-1}).name ~= "air" and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1}).name ~= "air" @@ -63,18 +62,14 @@ abstract_molehills.place_molehill = function(pos) end biome_lib.register_on_generate({ - surface = {"default:dirt_with_grass"}, - max_count = Molehills_Max_Count, - rarity = Molehills_Rarity, - min_elevation = 1, - max_elevation = 40, - avoid_nodes = {"group:tree","group:liquid","group:stone","group:falling_node"--[[,"air"]]}, - avoid_radius = 4, - plantlife_limit = -0.3, - }, - abstract_molehills.place_molehill + surface = {"default:dirt_with_grass"}, + rarity = molehills_rarity, + rarity_fertility = molehills_rarity_fertility, + plantlife_limit = molehills_fertility, + min_elevation = 1, + max_elevation = 40, + avoid_nodes = {"group:tree","group:liquid","group:stone","group:falling_node"--[[,"air"]]}, + avoid_radius = 4, + }, + abstract_molehills.place_molehill ) - ------------------------------------------------------------------------------------------------ -print("[Mod] "..title.." ["..version.."] ["..mname.."]".."Loaded...") ------------------------------------------------------------------------------------------------ diff --git a/molehills/molehills_settings.txt b/molehills/molehills_settings.txt deleted file mode 100644 index 1afc592..0000000 --- a/molehills/molehills_settings.txt +++ /dev/null @@ -1,6 +0,0 @@ --- Settings for generation of stuff (at map-generation time) - -Molehills_Max_Count = 320 -- absolute maximum number in an area of 80x80x80 nodes - -Molehills_Rarity = 95 -- larger values make molehills more rare (100 means chance of 0 %) - diff --git a/molehills/settingtypes.txt b/molehills/settingtypes.txt new file mode 100644 index 0000000..a10276a --- /dev/null +++ b/molehills/settingtypes.txt @@ -0,0 +1,8 @@ +#Molehills rarity % +molehills_rarity (Molehills rarity %) float 99.5 0 100 + +#How much the rarity is reduced by fertility % +molehills_rarity_fertility (Molehills rarity fertility reduction %) float 1 0 100 + +#Molehills minimum fertility (-1 to +1) +molehills_fertility (Molehills minimum fertility) float -0.6 -1 1 diff --git a/pl_seaweed/init.lua b/pl_seaweed/init.lua new file mode 100644 index 0000000..7dd0392 --- /dev/null +++ b/pl_seaweed/init.lua @@ -0,0 +1,168 @@ +-- support for i18n +local S = minetest.get_translator("pl_seaweed") + +pl_seaweed = {} + +local seaweed_max_count = tonumber(minetest.settings:get("pl_seaweed_max_count")) or 320 +local seaweed_rarity = tonumber(minetest.settings:get("pl_seaweed_rarity")) or 33 + + +local algae_list = { {nil}, {2}, {3}, {4} } + +for i in ipairs(algae_list) do + local num = "" + local algae_groups = {snappy = 3,flammable=2,flower=1} + + if algae_list[i][1] ~= nil then + num = "_"..algae_list[i][1] + algae_groups = { snappy = 3,flammable=2,flower=1, not_in_creative_inventory=1 } + end + + minetest.register_node(":flowers:seaweed"..num, { + description = S("Seaweed"), + drawtype = "nodebox", + tiles = { + "flowers_seaweed"..num..".png", + "flowers_seaweed"..num..".png^[transformFY" + }, + inventory_image = "flowers_seaweed_2.png", + wield_image = "flowers_seaweed_2.png", + sunlight_propagates = true, + paramtype = "light", + paramtype2 = "facedir", + walkable = false, + groups = algae_groups, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = { -0.4, -0.5, -0.4, 0.4, -0.45, 0.4 }, + }, + node_box = { + type = "fixed", + fixed = { -0.5, -0.49, -0.5, 0.5, -0.49, 0.5 }, + }, + buildable_to = true, + + liquids_pointable = true, + drop = "flowers:seaweed", + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + local pt = pointed_thing + + local place_pos = nil + local top_pos = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z} + local under_node = minetest.get_node(pt.under) + local above_node = minetest.get_node(pt.above) + local top_node = minetest.get_node(top_pos) + + if biome_lib.get_nodedef_field(under_node.name, "buildable_to") then + if under_node.name ~= "default:water_source" then + place_pos = pt.under + elseif top_node.name ~= "default:water_source" + and biome_lib.get_nodedef_field(top_node.name, "buildable_to") then + place_pos = top_pos + else + return + end + elseif biome_lib.get_nodedef_field(above_node.name, "buildable_to") then + place_pos = pt.above + end + if not place_pos then return end -- something went wrong :P + + if not minetest.is_protected(place_pos, placer:get_player_name()) then + + local nodename = "default:cobble" -- :D + + if not keys["sneak"] then + --local node = minetest.get_node(pt.under) + local seaweed = math.random(1,4) + if seaweed == 1 then + nodename = "flowers:seaweed" + elseif seaweed == 2 then + nodename = "flowers:seaweed_2" + elseif seaweed == 3 then + nodename = "flowers:seaweed_3" + elseif seaweed == 4 then + nodename = "flowers:seaweed_4" + end + minetest.swap_node(place_pos, {name = nodename, param2 = math.random(0,3) }) + else + local fdir = minetest.dir_to_facedir(placer:get_look_dir()) + minetest.swap_node(place_pos, {name = "flowers:seaweed", param2 = fdir}) + end + + if not biome_lib.expect_infinite_stacks then + itemstack:take_item() + end + return itemstack + end + end, + }) +end + +pl_seaweed.grow_seaweed = function(pos) + local right_here = {x=pos.x, y=pos.y+1, z=pos.z} + local seaweed = math.random(1,4) + local node_name = "flowers:seaweed" + if seaweed > 1 then + node_name = node_name .. "_" .. seaweed + end + minetest.swap_node(right_here, {name=node_name, param2=math.random(1,3)}) +end + +biome_lib.register_on_generate({ + surface = {"default:water_source"}, + max_count = seaweed_max_count, + rarity = seaweed_rarity, + min_elevation = 1, + max_elevation = 40, + near_nodes = {"default:dirt_with_grass"}, + near_nodes_size = 4, + near_nodes_vertical = 1, + near_nodes_count = 1, + plantlife_limit = -0.9, + }, + pl_seaweed.grow_seaweed +) + +-- pl_seaweed at beaches +-- MM: not satisfied with it, but IMHO some beaches should have some algae +biome_lib.register_on_generate({ + surface = {"default:water_source"}, + max_count = seaweed_max_count, + rarity = seaweed_rarity, + min_elevation = 1, + max_elevation = 40, + near_nodes = {"default:sand"}, + near_nodes_size = 1, + near_nodes_vertical = 0, + near_nodes_count = 3, + plantlife_limit = -0.9, + temp_max = -0.64, -- MM: more or less random values, just to make sure it's not everywhere + temp_min = -0.22, -- MM: more or less random values, just to make sure it's not everywhere + }, + pl_seaweed.grow_seaweed +) +biome_lib.register_on_generate({ + surface = {"default:sand"}, + max_count = seaweed_max_count*2, + rarity = seaweed_rarity/2, + min_elevation = 1, + max_elevation = 40, + near_nodes = {"default:water_source"}, + near_nodes_size = 1, + near_nodes_vertical = 0, + near_nodes_count = 3, + plantlife_limit = -0.9, + temp_max = -0.64, -- MM: more or less random values, just to make sure it's not everywhere + temp_min = -0.22, -- MM: more or less random values, just to make sure it's not everywhere + }, + pl_seaweed.grow_seaweed +) + +minetest.register_alias( "flowers:flower_seaweed" , "flowers:seaweed" ) +minetest.register_alias( "along_shore:pondscum_1" , "flowers:seaweed" ) +minetest.register_alias( "along_shore:seaweed_1" , "flowers:seaweed" ) +minetest.register_alias( "along_shore:seaweed_2" , "flowers:seaweed_2" ) +minetest.register_alias( "along_shore:seaweed_3" , "flowers:seaweed_3" ) +minetest.register_alias( "along_shore:seaweed_4" , "flowers:seaweed_4" ) diff --git a/pl_seaweed/locale/pl_seaweed.de.tr b/pl_seaweed/locale/pl_seaweed.de.tr new file mode 100644 index 0000000..89ed60d --- /dev/null +++ b/pl_seaweed/locale/pl_seaweed.de.tr @@ -0,0 +1,11 @@ +# textdomain: pl_seaweed + +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Xanthin, 2017. +# + + + +Seaweed=Seetang diff --git a/pl_seaweed/locale/pl_seaweed.fr.tr b/pl_seaweed/locale/pl_seaweed.fr.tr new file mode 100644 index 0000000..5a76eb8 --- /dev/null +++ b/pl_seaweed/locale/pl_seaweed.fr.tr @@ -0,0 +1,10 @@ +# textdomain: pl_seaweed + +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# fat115 , 2017. +# + + +Seaweed=Algues diff --git a/pl_seaweed/locale/pl_seaweed.tr.tr b/pl_seaweed/locale/pl_seaweed.tr.tr new file mode 100644 index 0000000..c1aa4bd --- /dev/null +++ b/pl_seaweed/locale/pl_seaweed.tr.tr @@ -0,0 +1,10 @@ +# textdomain: pl_seaweed + +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# mahmutelmas06@hotmail.com, 2017. +# + + +Seaweed=Deniz yosunu diff --git a/pl_seaweed/locale/pl_seawood.es.tr b/pl_seaweed/locale/pl_seawood.es.tr new file mode 100644 index 0000000..2927e3c --- /dev/null +++ b/pl_seaweed/locale/pl_seawood.es.tr @@ -0,0 +1,10 @@ +# textdomain: pl_seaweed + +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Carlos Barraza , 2017. +# + + +Seaweed=Algas marinas diff --git a/pl_seaweed/locale/template.txt b/pl_seaweed/locale/template.txt new file mode 100644 index 0000000..1950d90 --- /dev/null +++ b/pl_seaweed/locale/template.txt @@ -0,0 +1,11 @@ +# textdomain: pl_seaweed + +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# + + + +Seaweed= diff --git a/flowers_plus/mod.conf b/pl_seaweed/mod.conf similarity index 73% rename from flowers_plus/mod.conf rename to pl_seaweed/mod.conf index a3719e7..ed99972 100644 --- a/flowers_plus/mod.conf +++ b/pl_seaweed/mod.conf @@ -1,3 +1,3 @@ -name = flowers_plus +name = pl_seaweed depends = biome_lib optional_depends = farming, flowers diff --git a/pl_seaweed/settingtypes.txt b/pl_seaweed/settingtypes.txt new file mode 100644 index 0000000..3cb8772 --- /dev/null +++ b/pl_seaweed/settingtypes.txt @@ -0,0 +1,5 @@ +#Seaweed maximum count +pl_seaweed_max_count (Seaweed maximum count) int 320 1 1000 + +#Seaweed rarity +pl_seaweed_rarity (Seaweed rarity) int 33 0 100 diff --git a/flowers_plus/textures/flowers_seaweed.png b/pl_seaweed/textures/flowers_seaweed.png similarity index 100% rename from flowers_plus/textures/flowers_seaweed.png rename to pl_seaweed/textures/flowers_seaweed.png diff --git a/flowers_plus/textures/flowers_seaweedLight.png b/pl_seaweed/textures/flowers_seaweedLight.png similarity index 100% rename from flowers_plus/textures/flowers_seaweedLight.png rename to pl_seaweed/textures/flowers_seaweedLight.png diff --git a/flowers_plus/textures/flowers_seaweed_2.png b/pl_seaweed/textures/flowers_seaweed_2.png similarity index 100% rename from flowers_plus/textures/flowers_seaweed_2.png rename to pl_seaweed/textures/flowers_seaweed_2.png diff --git a/flowers_plus/textures/flowers_seaweed_3.png b/pl_seaweed/textures/flowers_seaweed_3.png similarity index 100% rename from flowers_plus/textures/flowers_seaweed_3.png rename to pl_seaweed/textures/flowers_seaweed_3.png diff --git a/flowers_plus/textures/flowers_seaweed_4.png b/pl_seaweed/textures/flowers_seaweed_4.png similarity index 100% rename from flowers_plus/textures/flowers_seaweed_4.png rename to pl_seaweed/textures/flowers_seaweed_4.png diff --git a/pl_sunflowers/init.lua b/pl_sunflowers/init.lua new file mode 100644 index 0000000..f997da0 --- /dev/null +++ b/pl_sunflowers/init.lua @@ -0,0 +1,55 @@ +-- support for i18n +local S = minetest.get_translator("pl_sunflowers") + +local sunflowers_max_count = tonumber(minetest.settings:get("pl_sunflowers_max_count")) or 10 +local sunflowers_rarity = tonumber(minetest.settings:get("pl_sunflowers_rarity")) or 25 + + +local box = { + type="fixed", + fixed = { { -0.2, -0.5, -0.2, 0.2, 0.5, 0.2 } }, +} + +local sunflower_drop = "farming:seed_wheat" +if minetest.registered_items["farming:seed_spelt"] then + sunflower_drop = "farming:seed_spelt" +end + +minetest.register_node(":flowers:sunflower", { + description = S("Sunflower"), + drawtype = "mesh", + paramtype = "light", + paramtype2 = "facedir", + inventory_image = "flowers_sunflower_inv.png", + mesh = "flowers_sunflower.obj", + tiles = { "flowers_sunflower.png" }, + walkable = false, + buildable_to = true, + is_ground_content = true, + groups = { dig_immediate=3, flora=1, flammable=3, attached_node=1 }, + sounds = default.node_sound_leaves_defaults(), + selection_box = box, + collision_box = box, + drop = { + max_items = 1, + items = { + {items = {sunflower_drop}, rarity = 8}, + {items = {"flowers:sunflower"}}, + } + } +}) + +biome_lib.register_on_generate({ + surface = {"default:dirt_with_grass"}, + avoid_nodes = { "flowers:sunflower" }, + max_count = sunflowers_max_count, + rarity = sunflowers_rarity, + min_elevation = 0, + plantlife_limit = -0.9, + temp_max = -0.1, + random_facedir = {0,3}, + }, + "flowers:sunflower" +) + +minetest.register_alias("sunflower:sunflower", "flowers:sunflower") diff --git a/flowers_plus/locale/flowers_plus.de.tr b/pl_sunflowers/locale/pl_sunflowers.de.tr similarity index 76% rename from flowers_plus/locale/flowers_plus.de.tr rename to pl_sunflowers/locale/pl_sunflowers.de.tr index 4eec876..ab40a42 100644 --- a/flowers_plus/locale/flowers_plus.de.tr +++ b/pl_sunflowers/locale/pl_sunflowers.de.tr @@ -1,4 +1,4 @@ -# textdomain: flowers_plus +# textdomain: pl_sunflowers # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER @@ -8,6 +8,4 @@ -Waterlily=Seerose -Seaweed=Seetang Sunflower=Sonnenblume diff --git a/pl_sunflowers/locale/pl_sunflowers.es.tr b/pl_sunflowers/locale/pl_sunflowers.es.tr new file mode 100644 index 0000000..b57f3b6 --- /dev/null +++ b/pl_sunflowers/locale/pl_sunflowers.es.tr @@ -0,0 +1,10 @@ +# textdomain: pl_sunflowers + +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Carlos Barraza , 2017. +# + + +Sunflower=Girasol diff --git a/flowers_plus/locale/flowers_plus.fr.tr b/pl_sunflowers/locale/pl_sunflowers.fr.tr similarity index 77% rename from flowers_plus/locale/flowers_plus.fr.tr rename to pl_sunflowers/locale/pl_sunflowers.fr.tr index 642b4ba..1c04e4f 100644 --- a/flowers_plus/locale/flowers_plus.fr.tr +++ b/pl_sunflowers/locale/pl_sunflowers.fr.tr @@ -1,4 +1,4 @@ -# textdomain: flowers_plus +# textdomain: pl_sunflowers # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER @@ -7,6 +7,4 @@ # -Waterlily=Nénuphar -Seaweed=Algues Sunflower=Tournesol diff --git a/flowers_plus/locale/flowers_plus.tr.tr b/pl_sunflowers/locale/pl_sunflowers.tr.tr similarity index 76% rename from flowers_plus/locale/flowers_plus.tr.tr rename to pl_sunflowers/locale/pl_sunflowers.tr.tr index 859025f..5b6409f 100644 --- a/flowers_plus/locale/flowers_plus.tr.tr +++ b/pl_sunflowers/locale/pl_sunflowers.tr.tr @@ -1,4 +1,4 @@ -# textdomain: flowers_plus +# textdomain: pl_sunflowers # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER @@ -7,6 +7,4 @@ # -Waterlily=Nilüfer -Seaweed=Deniz yosunu Sunflower=Ayçiçeği diff --git a/flowers_plus/locale/template.txt b/pl_sunflowers/locale/template.txt similarity index 81% rename from flowers_plus/locale/template.txt rename to pl_sunflowers/locale/template.txt index 130ce1e..46c6f0a 100644 --- a/flowers_plus/locale/template.txt +++ b/pl_sunflowers/locale/template.txt @@ -1,4 +1,4 @@ -# textdomain: flowers_plus +# textdomain: pl_sunflowers # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER @@ -8,6 +8,4 @@ -Waterlily= -Seaweed= Sunflower= diff --git a/pl_sunflowers/mod.conf b/pl_sunflowers/mod.conf new file mode 100644 index 0000000..1332723 --- /dev/null +++ b/pl_sunflowers/mod.conf @@ -0,0 +1,3 @@ +name = pl_sunflowers +depends = biome_lib +optional_depends = farming, flowers diff --git a/flowers_plus/models/flowers_sunflower.obj b/pl_sunflowers/models/flowers_sunflower.obj similarity index 100% rename from flowers_plus/models/flowers_sunflower.obj rename to pl_sunflowers/models/flowers_sunflower.obj diff --git a/pl_sunflowers/settingtypes.txt b/pl_sunflowers/settingtypes.txt new file mode 100644 index 0000000..67af9e4 --- /dev/null +++ b/pl_sunflowers/settingtypes.txt @@ -0,0 +1,5 @@ +#Sunflowers maximum count +pl_sunflowers_max_count (Sunflowers maximum count) int 10 1 1000 + +#Sunflowers rarity +pl_sunflowers_rarity (Sunflowers rarity) int 25 0 100 diff --git a/flowers_plus/textures/flowers_sunflower.png b/pl_sunflowers/textures/flowers_sunflower.png similarity index 100% rename from flowers_plus/textures/flowers_sunflower.png rename to pl_sunflowers/textures/flowers_sunflower.png diff --git a/flowers_plus/textures/flowers_sunflower_inv.png b/pl_sunflowers/textures/flowers_sunflower_inv.png similarity index 100% rename from flowers_plus/textures/flowers_sunflower_inv.png rename to pl_sunflowers/textures/flowers_sunflower_inv.png diff --git a/pl_waterlilies/init.lua b/pl_waterlilies/init.lua new file mode 100644 index 0000000..94fc3be --- /dev/null +++ b/pl_waterlilies/init.lua @@ -0,0 +1,164 @@ +-- support for i18n +local S = minetest.get_translator("pl_waterlilies") + +pl_waterlilies = {} + +local lilies_max_count = tonumber(minetest.settings:get("pl_waterlilies_max_count")) or 320 +local lilies_rarity = tonumber(minetest.settings:get("pl_waterlilies_rarity")) or 33 + + +local lilies_list = { + { nil , nil , 1 }, + { "225", "22.5" , 2 }, + { "45" , "45" , 3 }, + { "675", "67.5" , 4 }, + { "s1" , "small_1" , 5 }, + { "s2" , "small_2" , 6 }, + { "s3" , "small_3" , 7 }, + { "s4" , "small_4" , 8 }, +} + +for i in ipairs(lilies_list) do + local deg1 = "" + local deg2 = "" + local lily_groups = {snappy = 3,flammable=2,flower=1} + + if lilies_list[i][1] ~= nil then + deg1 = "_"..lilies_list[i][1] + deg2 = "_"..lilies_list[i][2] + lily_groups = { snappy = 3,flammable=2,flower=1, not_in_creative_inventory=1 } + end + + minetest.register_node(":flowers:waterlily"..deg1, { + description = S("Waterlily"), + drawtype = "nodebox", + tiles = { + "flowers_waterlily"..deg2..".png", + "flowers_waterlily"..deg2..".png^[transformFY" + }, + inventory_image = "flowers_waterlily.png", + wield_image = "flowers_waterlily.png", + sunlight_propagates = true, + paramtype = "light", + paramtype2 = "facedir", + walkable = false, + groups = lily_groups, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = { -0.4, -0.5, -0.4, 0.4, -0.45, 0.4 }, + }, + node_box = { + type = "fixed", + fixed = { -0.5, -0.49, -0.5, 0.5, -0.49, 0.5 }, + }, + buildable_to = true, + node_placement_prediction = "", + + liquids_pointable = true, + drop = "flowers:waterlily", + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + local pt = pointed_thing + + local place_pos = nil + local top_pos = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z} + local under_node = minetest.get_node(pt.under) + local above_node = minetest.get_node(pt.above) + local top_node = minetest.get_node(top_pos) + + if biome_lib.get_nodedef_field(under_node.name, "buildable_to") then + if under_node.name ~= "default:water_source" then + place_pos = pt.under + elseif top_node.name ~= "default:water_source" + and biome_lib.get_nodedef_field(top_node.name, "buildable_to") then + place_pos = top_pos + else + return + end + elseif biome_lib.get_nodedef_field(above_node.name, "buildable_to") then + place_pos = pt.above + end + + if place_pos and not minetest.is_protected(place_pos, placer:get_player_name()) then + + local nodename = "default:cobble" -- if this block appears, something went....wrong :-) + + if not keys["sneak"] then + local node = minetest.get_node(pt.under) + local waterlily = math.random(1,8) + if waterlily == 1 then + nodename = "flowers:waterlily" + elseif waterlily == 2 then + nodename = "flowers:waterlily_225" + elseif waterlily == 3 then + nodename = "flowers:waterlily_45" + elseif waterlily == 4 then + nodename = "flowers:waterlily_675" + elseif waterlily == 5 then + nodename = "flowers:waterlily_s1" + elseif waterlily == 6 then + nodename = "flowers:waterlily_s2" + elseif waterlily == 7 then + nodename = "flowers:waterlily_s3" + elseif waterlily == 8 then + nodename = "flowers:waterlily_s4" + end + minetest.swap_node(place_pos, {name = nodename, param2 = math.random(0,3) }) + else + local fdir = minetest.dir_to_facedir(placer:get_look_dir()) + minetest.swap_node(place_pos, {name = "flowers:waterlily", param2 = fdir}) + end + + if not biome_lib.expect_infinite_stacks then + itemstack:take_item() + end + return itemstack + end + end, + }) +end + +pl_waterlilies.grow_waterlily = function(pos) + local right_here = {x=pos.x, y=pos.y+1, z=pos.z} + for i in ipairs(lilies_list) do + local chance = math.random(1,8) + local ext = "" + local num = lilies_list[i][3] + + if lilies_list[i][1] ~= nil then + ext = "_"..lilies_list[i][1] + end + + if chance == num then + minetest.swap_node(right_here, {name="flowers:waterlily"..ext, param2=math.random(0,3)}) + end + end +end + +biome_lib.register_on_generate({ + surface = {"default:water_source"}, + max_count = lilies_max_count, + rarity = lilies_rarity, + min_elevation = 1, + max_elevation = 40, + near_nodes = {"default:dirt_with_grass"}, + near_nodes_size = 4, + near_nodes_vertical = 1, + near_nodes_count = 1, + plantlife_limit = -0.9, + temp_max = -0.22, + temp_min = 0.22, + }, + pl_waterlilies.grow_waterlily +) + +minetest.register_alias( "flowers:flower_waterlily", "flowers:waterlily") +minetest.register_alias( "flowers:flower_waterlily_225", "flowers:waterlily_225") +minetest.register_alias( "flowers:flower_waterlily_45", "flowers:waterlily_45") +minetest.register_alias( "flowers:flower_waterlily_675", "flowers:waterlily_675") +minetest.register_alias( "trunks:lilypad" , "flowers:waterlily_s1" ) +minetest.register_alias( "along_shore:lilypads_1" , "flowers:waterlily_s1" ) +minetest.register_alias( "along_shore:lilypads_2" , "flowers:waterlily_s2" ) +minetest.register_alias( "along_shore:lilypads_3" , "flowers:waterlily_s3" ) +minetest.register_alias( "along_shore:lilypads_4" , "flowers:waterlily_s4" ) diff --git a/pl_waterlilies/locale/pl_waterlilies.de.tr b/pl_waterlilies/locale/pl_waterlilies.de.tr new file mode 100644 index 0000000..58de1f5 --- /dev/null +++ b/pl_waterlilies/locale/pl_waterlilies.de.tr @@ -0,0 +1,11 @@ +# textdomain: pl_waterlilies + +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Xanthin, 2017. +# + + + +Waterlily=Seerose diff --git a/flowers_plus/locale/flowers_plus.es.tr b/pl_waterlilies/locale/pl_waterlilies.es.tr similarity index 77% rename from flowers_plus/locale/flowers_plus.es.tr rename to pl_waterlilies/locale/pl_waterlilies.es.tr index 3e90362..bf93642 100644 --- a/flowers_plus/locale/flowers_plus.es.tr +++ b/pl_waterlilies/locale/pl_waterlilies.es.tr @@ -1,4 +1,4 @@ -# textdomain: flowers_plus +# textdomain: pl_waterlilies # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER @@ -8,5 +8,3 @@ Waterlily=Lirio de agua -Seaweed=Algas marinas -Sunflower=Girasol diff --git a/pl_waterlilies/locale/pl_waterlilies.fr.tr b/pl_waterlilies/locale/pl_waterlilies.fr.tr new file mode 100644 index 0000000..c0e0fd1 --- /dev/null +++ b/pl_waterlilies/locale/pl_waterlilies.fr.tr @@ -0,0 +1,10 @@ +# textdomain: pl_waterlilies + +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# fat115 , 2017. +# + + +Waterlily=Nénuphar diff --git a/pl_waterlilies/locale/pl_waterlilies.tr.tr b/pl_waterlilies/locale/pl_waterlilies.tr.tr new file mode 100644 index 0000000..ae05de6 --- /dev/null +++ b/pl_waterlilies/locale/pl_waterlilies.tr.tr @@ -0,0 +1,10 @@ +# textdomain: pl_waterlilies + +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# mahmutelmas06@hotmail.com, 2017. +# + + +Waterlily=Nilüfer diff --git a/pl_waterlilies/locale/template.txt b/pl_waterlilies/locale/template.txt new file mode 100644 index 0000000..bdf61b3 --- /dev/null +++ b/pl_waterlilies/locale/template.txt @@ -0,0 +1,11 @@ +# textdomain: pl_waterlillies + +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# + + + +Waterlily= diff --git a/pl_waterlilies/mod.conf b/pl_waterlilies/mod.conf new file mode 100644 index 0000000..5233adb --- /dev/null +++ b/pl_waterlilies/mod.conf @@ -0,0 +1,3 @@ +name = pl_waterlilies +depends = biome_lib +optional_depends = farming, flowers diff --git a/pl_waterlilies/settingtypes.txt b/pl_waterlilies/settingtypes.txt new file mode 100644 index 0000000..523a677 --- /dev/null +++ b/pl_waterlilies/settingtypes.txt @@ -0,0 +1,5 @@ +#Water-lilies maximum count +pl_waterlilies_max_count (Water-lilies maximum count) int 320 1 1000 + +#Water-lilies rarity +pl_waterlilies_rarity (Water-lilies rarity) int 33 0 100 diff --git a/flowers_plus/textures/flowers_waterlily.png b/pl_waterlilies/textures/flowers_waterlily.png similarity index 100% rename from flowers_plus/textures/flowers_waterlily.png rename to pl_waterlilies/textures/flowers_waterlily.png diff --git a/flowers_plus/textures/flowers_waterlily_22.5.png b/pl_waterlilies/textures/flowers_waterlily_22.5.png similarity index 100% rename from flowers_plus/textures/flowers_waterlily_22.5.png rename to pl_waterlilies/textures/flowers_waterlily_22.5.png diff --git a/flowers_plus/textures/flowers_waterlily_45.png b/pl_waterlilies/textures/flowers_waterlily_45.png similarity index 100% rename from flowers_plus/textures/flowers_waterlily_45.png rename to pl_waterlilies/textures/flowers_waterlily_45.png diff --git a/flowers_plus/textures/flowers_waterlily_67.5.png b/pl_waterlilies/textures/flowers_waterlily_67.5.png similarity index 100% rename from flowers_plus/textures/flowers_waterlily_67.5.png rename to pl_waterlilies/textures/flowers_waterlily_67.5.png diff --git a/flowers_plus/textures/flowers_waterlily_small_1.png b/pl_waterlilies/textures/flowers_waterlily_small_1.png similarity index 100% rename from flowers_plus/textures/flowers_waterlily_small_1.png rename to pl_waterlilies/textures/flowers_waterlily_small_1.png diff --git a/flowers_plus/textures/flowers_waterlily_small_2.png b/pl_waterlilies/textures/flowers_waterlily_small_2.png similarity index 100% rename from flowers_plus/textures/flowers_waterlily_small_2.png rename to pl_waterlilies/textures/flowers_waterlily_small_2.png diff --git a/flowers_plus/textures/flowers_waterlily_small_3.png b/pl_waterlilies/textures/flowers_waterlily_small_3.png similarity index 100% rename from flowers_plus/textures/flowers_waterlily_small_3.png rename to pl_waterlilies/textures/flowers_waterlily_small_3.png diff --git a/flowers_plus/textures/flowers_waterlily_small_4.png b/pl_waterlilies/textures/flowers_waterlily_small_4.png similarity index 100% rename from flowers_plus/textures/flowers_waterlily_small_4.png rename to pl_waterlilies/textures/flowers_waterlily_small_4.png diff --git a/trunks/generating.lua b/trunks/generating.lua index 23cbfe5..396c6ea 100644 --- a/trunks/generating.lua +++ b/trunks/generating.lua @@ -4,11 +4,13 @@ -- TWiGS ----------------------------------------------------------------------------------------------- -local fakenode = { - name = "default:stone", -- could be anything that's guaranteed to exist at mapgen time, and isn't buildable_to - param1 = 0, - param2 = 0 -} +function check_node_buildable_to(pos) + local node = minetest.get_node(pos) + local def = minetest.registered_nodes[node.name] + if def then + return def.buildable_to + end +end abstract_trunks.place_twig = function(pos) local twig_size = math.random(1,27) @@ -23,25 +25,6 @@ abstract_trunks.place_twig = function(pos) local west = {x=pos.x-1, y=pos.y+1, z=pos.z } local north_west = {x=pos.x-1, y=pos.y+1, z=pos.z+1} - local node_here = minetest.get_node(right_here) - local node_north = minetest.get_node(north) - local node_n_e = minetest.get_node(north_east) - local node_east = minetest.get_node(east) - local node_s_e = minetest.get_node(south_east) - local node_south = minetest.get_node(south) - local node_s_w = minetest.get_node(south_west) - local node_west = minetest.get_node(west) - local node_n_w = minetest.get_node(north_west) - - node_north = minetest.registered_nodes[node_north.name] and node_north or fakenode - node_n_e = minetest.registered_nodes[node_n_e.name] and node_n_e or fakenode - node_east = minetest.registered_nodes[node_east.name] and node_east or fakenode - node_s_e = minetest.registered_nodes[node_s_e.name] and node_s_e or fakenode - node_south = minetest.registered_nodes[node_south.name] and node_south or fakenode - node_s_w = minetest.registered_nodes[node_s_w.name] and node_s_w or fakenode - node_west = minetest.registered_nodes[node_west.name] and node_west or fakenode - node_n_w = minetest.registered_nodes[node_n_w.name] and node_n_w or fakenode - -- small twigs if twig_size <= 16 then minetest.swap_node(right_here, {name="trunks:twig_"..math.random(1,4), param2=math.random(0,3)}) @@ -51,53 +34,18 @@ abstract_trunks.place_twig = function(pos) local n1, n2 local r1, r2 -- big twig 1 - if twig_size == 17 then - n1 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z+1}) - n2 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}) - r1 = n1 and minetest.registered_nodes[n1.name] - r2 = n2 and minetest.registered_nodes[n2.name] - if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then - if minetest.registered_nodes[node_here.name].buildable_to then - minetest.swap_node(right_here, {name="trunks:twig_5"}) - end - if minetest.registered_nodes[node_n_e.name].buildable_to then - minetest.swap_node(north_east, {name="trunks:twig_7"}) - end - if minetest.registered_nodes[node_east.name].buildable_to then - minetest.swap_node(east, {name="trunks:twig_8"}) - end + if twig_size == 17 then + if not (check_node_buildable_to({x=pos.x+1,y=pos.y,z=pos.z+1}) + or check_node_buildable_to({x=pos.x+1,y=pos.y,z=pos.z})) then + + if check_node_buildable_to(right_here) then + minetest.swap_node(right_here, {name="trunks:twig_5"}) end - elseif twig_size == 18 then - n1 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}) - n2 = minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}) - r1 = n1 and minetest.registered_nodes[n1.name] - r2 = n2 and minetest.registered_nodes[n2.name] - if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then - if minetest.registered_nodes[node_here.name].buildable_to then - minetest.swap_node(right_here, {name="trunks:twig_5", param2=1}) - end - if minetest.registered_nodes[node_s_e.name].buildable_to then - minetest.swap_node(south_east, {name="trunks:twig_7", param2=1}) - end - if minetest.registered_nodes[node_south.name].buildable_to then - minetest.swap_node(south, {name="trunks:twig_8", param2=1}) - end + if check_node_buildable_to(north_east) then + minetest.swap_node(north_east, {name="trunks:twig_7"}) end - elseif twig_size == 19 then - n1 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}) - n2 = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}) - r1 = n1 and minetest.registered_nodes[n1.name] - r2 = n2 and minetest.registered_nodes[n2.name] - if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then - if minetest.registered_nodes[node_here.name].buildable_to then - minetest.swap_node(right_here, {name="trunks:twig_5", param2=2}) - end - if minetest.registered_nodes[node_s_w.name].buildable_to then - minetest.swap_node(south_west, {name="trunks:twig_7", param2=2}) - end - if minetest.registered_nodes[node_west.name].buildable_to then - minetest.swap_node(west, {name="trunks:twig_8", param2=2}) - end + if check_node_buildable_to(east) then + minetest.swap_node(east, {name="trunks:twig_8"}) end elseif twig_size == 20 then n1 = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1}) @@ -183,6 +131,108 @@ abstract_trunks.place_twig = function(pos) elseif twig_size <= 25 then minetest.swap_node(right_here, {name="trunks:twig_"..math.random(12,13), param2=math.random(0,3)}) end + elseif twig_size == 18 then + if not (check_node_buildable_to({x=pos.x+1,y=pos.y,z=pos.z-1}) + or check_node_buildable_to({x=pos.x,y=pos.y,z=pos.z-1})) then + + if check_node_buildable_to(right_here) then + minetest.swap_node(right_here, {name="trunks:twig_5", param2=1}) + end + if check_node_buildable_to(south_east) then + minetest.swap_node(south_east, {name="trunks:twig_7", param2=1}) + end + if check_node_buildable_to(south) then + minetest.swap_node(south, {name="trunks:twig_8", param2=1}) + end + end + elseif twig_size == 19 then + if not (check_node_buildable_to({x=pos.x+1,y=pos.y,z=pos.z-1}) + or check_node_buildable_to({x=pos.x-1,y=pos.y,z=pos.z})) then + + if check_node_buildable_to(right_here) then + minetest.swap_node(right_here, {name="trunks:twig_5", param2=2}) + end + if check_node_buildable_to(south_west) then + minetest.swap_node(south_west, {name="trunks:twig_7", param2=2}) + end + if check_node_buildable_to(west) then + minetest.swap_node(west, {name="trunks:twig_8", param2=2}) + end + end + elseif twig_size == 20 then + if not (check_node_buildable_to({x=pos.x-1,y=pos.y,z=pos.z+1}) + or check_node_buildable_to({x=pos.x,y=pos.y,z=pos.z+1})) then + + if check_node_buildable_to(right_here) then + minetest.swap_node(right_here, {name="trunks:twig_5", param2=3}) + end + if check_node_buildable_to(north_west) then + minetest.swap_node(north_west, {name="trunks:twig_7", param2=3}) + end + if check_node_buildable_to(north) then + minetest.swap_node(north, {name="trunks:twig_8", param2=3}) + end + end +-- big twig 2 + elseif twig_size == 21 then + if not (check_node_buildable_to({x=pos.x,y=pos.y,z=pos.z+1}) + or check_node_buildable_to({x=pos.x+1,y=pos.y,z=pos.z+1})) then + + if check_node_buildable_to(right_here) then + minetest.swap_node(right_here, {name="trunks:twig_9"}) + end + if check_node_buildable_to(north) then + minetest.swap_node(north, {name="trunks:twig_10"}) + end + if check_node_buildable_to(north_east) then + minetest.swap_node(north_east, {name="trunks:twig_11"}) + end + end + elseif twig_size == 22 then + if not (check_node_buildable_to({x=pos.x+1,y=pos.y,z=pos.z}) + or check_node_buildable_to({x=pos.x+1,y=pos.y,z=pos.z-1})) then + + if check_node_buildable_to(right_here) then + minetest.swap_node(right_here, {name="trunks:twig_9", param2=1}) + end + if check_node_buildable_to(east) then + minetest.swap_node(east, {name="trunks:twig_10", param2=1}) + end + if check_node_buildable_to(south_east) then + minetest.swap_node(south_east, {name="trunks:twig_11", param2=1}) + end + end + elseif twig_size == 23 then + if not (check_node_buildable_to({x=pos.x,y=pos.y,z=pos.z-1}) + or check_node_buildable_to({x=pos.x-1,y=pos.y,z=pos.z-1})) then + + if check_node_buildable_to(right_here) then + minetest.swap_node(right_here, {name="trunks:twig_9", param2=2}) + end + if check_node_buildable_to(south) then + minetest.swap_node(south, {name="trunks:twig_10", param2=2}) + end + if check_node_buildable_to(south_west) then + minetest.swap_node(south_west, {name="trunks:twig_11", param2=2}) + end + end + elseif twig_size == 24 then + if not (check_node_buildable_to({x=pos.x-1,y=pos.y,z=pos.z}) + or check_node_buildable_to({x=pos.x-1,y=pos.y,z=pos.z+1})) then + + if check_node_buildable_to(right_here) then + minetest.swap_node(right_here, {name="trunks:twig_9", param2=3}) + end + if check_node_buildable_to(west) then + minetest.swap_node(west, {name="trunks:twig_10", param2=3}) + end + if check_node_buildable_to(north_west) then + minetest.swap_node(north_west, {name="trunks:twig_11", param2=3}) + end + end + elseif twig_size <= 25 then + minetest.swap_node(right_here, {name="trunks:twig_"..math.random(12,13), param2=math.random(0,3)}) + end end end @@ -274,16 +324,7 @@ abstract_trunks.place_trunk = function(pos) local east = {x=pos.x+1, y=pos.y+1, z=pos.z} local east2 = {x=pos.x+2, y=pos.y+1, z=pos.z} - local node_here = minetest.get_node(right_here) - local node_north = minetest.get_node(north) - local node_north2 = minetest.get_node(north2) - local node_south = minetest.get_node(south) - local node_south2 = minetest.get_node(south2) - local node_west = minetest.get_node(west) - local node_west2 = minetest.get_node(west2) - local node_east = minetest.get_node(east) - local node_east2 = minetest.get_node(east2) - if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true, + if check_node_buildable_to(right_here) then -- instead of check_air = true, for i in pairs(TRuNKS) do local MoD = TRuNKS[i][1] local TRuNK = TRuNKS[i][2] @@ -300,63 +341,63 @@ abstract_trunks.place_trunk = function(pos) end elseif trunk_type == 2 and Horizontal_Trunks == true then if minetest.get_modpath(MoD) ~= nil then - if minetest.registered_nodes[node_north.name].buildable_to then + if check_node_buildable_to(north) then minetest.swap_node(north, {name=MoD..":"..TRuNK, param2=4}) end - if length >= 4 and minetest.registered_nodes[node_north2.name].buildable_to then + if length >= 4 and check_node_buildable_to(north2) then minetest.swap_node(north2, {name=MoD..":"..TRuNK, param2=4}) end minetest.swap_node(right_here, {name=MoD..":"..TRuNK, param2=4}) - if minetest.registered_nodes[node_south.name].buildable_to then + if check_node_buildable_to(south) then minetest.swap_node(south, {name=MoD..":"..TRuNK, param2=4}) end - if length == 5 and minetest.registered_nodes[node_south2.name].buildable_to then + if length == 5 and check_node_buildable_to(south2) then minetest.swap_node(south2, {name=MoD..":"..TRuNK, param2=4}) end else - if minetest.registered_nodes[node_north.name].buildable_to then + if check_node_buildable_to(north) then minetest.swap_node(north, {name="default:tree", param2=4}) end - if length >= 4 and minetest.registered_nodes[node_north2.name].buildable_to then + if length >= 4 and check_node_buildable_to(north2) then minetest.swap_node(north2, {name="default:tree", param2=4}) end minetest.swap_node(right_here, {name="default:tree", param2=4}) - if minetest.registered_nodes[node_south.name].buildable_to then + if check_node_buildable_to(south) then minetest.swap_node(south, {name="default:tree", param2=4}) end - if length == 5 and minetest.registered_nodes[node_south2.name].buildable_to then + if length == 5 and check_node_buildable_to(south2) then minetest.swap_node(south2, {name="default:tree", param2=4}) end end elseif trunk_type == 3 and Horizontal_Trunks == true then if minetest.get_modpath(MoD) ~= nil then - if minetest.registered_nodes[node_west.name].buildable_to then + if check_node_buildable_to(west) then minetest.swap_node(west, {name=MoD..":"..TRuNK, param2=12}) end - if length >= 4 and minetest.registered_nodes[node_west2.name].buildable_to then + if length >= 4 and check_node_buildable_to(west2) then minetest.swap_node(west2, {name=MoD..":"..TRuNK, param2=12}) end minetest.swap_node(right_here, {name=MoD..":"..TRuNK, param2=12}) - if minetest.registered_nodes[node_east.name].buildable_to then + if check_node_buildable_to(east) then minetest.swap_node(east, {name=MoD..":"..TRuNK, param2=12}) end - if length == 5 and minetest.registered_nodes[node_east2.name].buildable_to then + if length == 5 and check_node_buildable_to(east2) then minetest.swap_node(east2, {name=MoD..":"..TRuNK, param2=12}) end else - if minetest.registered_nodes[node_west.name].buildable_to then + if check_node_buildable_to(west) then minetest.swap_node(west, {name="default:tree", param2=12}) end - if length >= 4 and minetest.registered_nodes[node_west2.name].buildable_to then + if length >= 4 and check_node_buildable_to(west2) then minetest.swap_node(west2, {name="default:tree", param2=12}) end minetest.swap_node(right_here, {name="default:tree", param2=12}) - if minetest.registered_nodes[node_east.name].buildable_to then + if check_node_buildable_to(east) then minetest.swap_node(east, {name="default:tree", param2=12}) end - if length == 5 and minetest.registered_nodes[node_east2.name].buildable_to then + if length == 5 and check_node_buildable_to(east2) then minetest.swap_node(east2, {name="default:tree", param2=12}) end end @@ -431,17 +472,9 @@ abstract_trunks.grow_moss_on_trunk = function(pos) local at_side_e = {x=pos.x+1, y=pos.y, z=pos.z} local at_side_s = {x=pos.x, y=pos.y, z=pos.z-1} local at_side_w = {x=pos.x-1, y=pos.y, z=pos.z} - local undrneath = {x=pos.x, y=pos.y-1, z=pos.z} - - local node_here = minetest.get_node(on_ground) - local node_north = minetest.get_node(at_side_n) - local node_east = minetest.get_node(at_side_e) - local node_south = minetest.get_node(at_side_s) - local node_west = minetest.get_node(at_side_w) - local node_under = minetest.get_node(undrneath) --if minetest.get_item_group(node_under.name, "tree") < 1 then - if minetest.registered_nodes[node_here.name].buildable_to then + if check_node_buildable_to(on_ground) then local moss_type = math.random(1,41) local rot = math.random(0,3) if moss_type == 1 then @@ -450,7 +483,7 @@ abstract_trunks.grow_moss_on_trunk = function(pos) minetest.swap_node(on_ground, {name="trunks:moss_plain_"..rot, param2=1}) end end - if minetest.registered_nodes[node_north.name].buildable_to then + if check_node_buildable_to(at_side_n) then local moss_type = math.random(1,31) -- cliche of more moss at north local rot = math.random(0,3) if moss_type == 1 then @@ -459,7 +492,7 @@ abstract_trunks.grow_moss_on_trunk = function(pos) minetest.swap_node(at_side_n, {name="trunks:moss_plain_"..rot, param2=5}) end end - if minetest.registered_nodes[node_east.name].buildable_to then + if check_node_buildable_to(at_side_e) then local moss_type = math.random(1,41) local rot = math.random(0,3) if moss_type == 1 then @@ -468,7 +501,7 @@ abstract_trunks.grow_moss_on_trunk = function(pos) minetest.swap_node(at_side_e, {name="trunks:moss_plain_"..rot, param2=3}) end end - if minetest.registered_nodes[node_south.name].buildable_to then + if check_node_buildable_to(at_side_s) then local moss_type = math.random(1,41) local rot = math.random(0,3) if moss_type == 1 then @@ -477,7 +510,7 @@ abstract_trunks.grow_moss_on_trunk = function(pos) minetest.swap_node(at_side_s, {name="trunks:moss_plain_"..rot, param2=4}) end end - if minetest.registered_nodes[node_west.name].buildable_to then + if check_node_buildable_to(at_side_w) then local moss_type = math.random(1,41) local rot = math.random(0,3) if moss_type == 1 then @@ -538,10 +571,6 @@ abstract_trunks.grow_roots = function(pos) local node_here = minetest.get_node(right_here) local node_below = minetest.get_node(below) - local node_north = minetest.get_node(north) - local node_east = minetest.get_node(east) - local node_south = minetest.get_node(south) - local node_west = minetest.get_node(west) for i in pairs(TRuNKS) do local MoD = TRuNKS[i][1] @@ -550,16 +579,16 @@ abstract_trunks.grow_roots = function(pos) and node_here.name == MoD..":"..TRuNK and string.find(node_below.name, "dirt") and node_here.param2 == 0 then - if minetest.registered_nodes[node_north.name].buildable_to then + if check_node_buildable_to(north) then minetest.swap_node(north, {name="trunks:"..TRuNK.."root", param2=2}) end - if minetest.registered_nodes[node_east.name].buildable_to then + if check_node_buildable_to(east) then minetest.swap_node(east, {name="trunks:"..TRuNK.."root", param2=3}) end - if minetest.registered_nodes[node_south.name].buildable_to then + if check_node_buildable_to(south) then minetest.swap_node(south, {name="trunks:"..TRuNK.."root", param2=0}) end - if minetest.registered_nodes[node_west.name].buildable_to then + if check_node_buildable_to(west) then minetest.swap_node(west, {name="trunks:"..TRuNK.."root", param2=1}) end end diff --git a/vines/init.lua b/vines/init.lua index f937b57..c447cc9 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -3,50 +3,97 @@ vines = { recipes = {} } -local enable_roots = minetest.settings:get_bool("vines_enable_roots") +local enable_vines = minetest.settings:get_bool("vines_enable_vines", true) +local enable_rope = minetest.settings:get_bool("vines_enable_rope", true) +local enable_roots = minetest.settings:get_bool("vines_enable_roots", true) +local enable_standard = minetest.settings:get_bool("vines_enable_standard", true) +local enable_side = minetest.settings:get_bool("vines_enable_side", true) +local enable_jungle = minetest.settings:get_bool("vines_enable_jungle", true) +local enable_willow = minetest.settings:get_bool("vines_enable_willow", true) + +local rarity_roots = tonumber(minetest.settings:get("vines_rarity_roots")) or 70 +local default_rarity = 95 +local rarity_standard = tonumber(minetest.settings:get("vines_rarity_standard")) or default_rarity +local rarity_side = tonumber(minetest.settings:get("vines_rarity_side")) or default_rarity +local rarity_jungle = tonumber(minetest.settings:get("vines_rarity_jungle")) or default_rarity +local rarity_willow = tonumber(minetest.settings:get("vines_rarity_willow")) or default_rarity + +local growth_min = tonumber(minetest.settings:get("vines_growth_min")) or 180 +local growth_max = tonumber(minetest.settings:get("vines_growth_max")) or 360 -- support for i18n local S = minetest.get_translator("vines") -- ITEMS -minetest.register_craftitem("vines:vines", { - description = S("Vines"), - inventory_image = "vines_item.png", - groups = {vines = 1, flammable = 2} -}) +if enable_vines ~= false then + minetest.register_craftitem("vines:vines", { + description = S("Vines"), + inventory_image = "vines_item.png", + groups = {vines = 1, flammable = 2} + }) +end -- FUNCTIONS local random = math.random -local function dig_down(pos, node, digger) +local function on_dig(pos, node, player) + local vine_name_end = node.name:gsub("_middle", "_end") + local drop_item = "vines:vines" + if enable_vines == false then + drop_item = vine_name_end + end - if digger == nil then return end + local wielded_item = player and player:get_wielded_item() + if wielded_item then + wielded_item:add_wear(1) + if wielded_item:get_name() == 'vines:shears' then + drop_item = vine_name_end + end + end - local np = {x = pos.x, y = pos.y - 1, z = pos.z} + local break_pos = {x = pos.x, y = pos.y, z = pos.z} + while minetest.get_item_group(minetest.get_node(break_pos).name, "vines") > 0 do + minetest.remove_node(break_pos) + minetest.handle_node_drops(break_pos, {drop_item}, player) + break_pos.y = break_pos.y - 1 + end +end + +local function ensure_vine_end(pos, oldnode) + local np = {x = pos.x, y = pos.y + 1, z = pos.z} local nn = minetest.get_node(np) + local vine_name_end = oldnode.name:gsub("_middle", "_end") + if minetest.get_item_group(nn.name, "vines") > 0 then - minetest.node_dig(np, nn, digger) + minetest.swap_node(np, { name = vine_name_end, param2 = oldnode.param2 }) + minetest.registered_items[vine_name_end].on_construct(np, minetest.get_node(np)) end end vines.register_vine = function( name, defs, biome ) - local groups = {vines = 1, snappy = 3, flammable = 2, attached_node = 1} + local groups = {vines = 1, snappy = 3, flammable = 2} local vine_name_end = 'vines:' .. name .. '_end' local vine_name_middle = 'vines:' .. name .. '_middle' local vine_image_end = "vines_" .. name .. "_end.png" local vine_image_middle = "vines_" .. name .. "_middle.png" - local drop_node = vine_name_end - biome.spawn_plants = {vine_name_end} - - local vine_group = 'group:' .. name .. '_vines' - - biome.spawn_surfaces[#biome.spawn_surfaces + 1] = vine_group + local spawn_plants = function(pos, fdir) + local max_length = math.random(defs.average_length) + local current_length = 1 + if minetest.get_node({ x=pos.x, y=pos.y - 1, z=pos.z }).name == 'air' then + while minetest.get_node({ x=pos.x, y=pos.y - 1, z=pos.z }).name == 'air' and current_length < max_length do + minetest.swap_node(pos, { name = vine_name_middle, param2 = fdir }) + pos.y = pos.y - 1 + current_length = current_length + 1 + end + minetest.set_node(pos, { name = vine_name_end, param2 = fdir }) + end + end local selection_box = {type = "wallmounted",} local drawtype = 'signlike' @@ -66,7 +113,7 @@ vines.register_vine = function( name, defs, biome ) walkable = false, climbable = true, wield_image = vine_image_end, - drop = "vines:vines", + drop = {}, sunlight_propagates = true, paramtype = "light", paramtype2 = "wallmounted", @@ -81,8 +128,7 @@ vines.register_vine = function( name, defs, biome ) on_construct = function(pos) local timer = minetest.get_node_timer(pos) - - timer:start(random(5, 10)) + timer:start(random(growth_min, growth_max)) end, on_timer = function(pos) @@ -90,12 +136,11 @@ vines.register_vine = function( name, defs, biome ) local node = minetest.get_node(pos) local bottom = {x = pos.x, y = pos.y - 1, z = pos.z} local bottom_node = minetest.get_node( bottom ) - if bottom_node.name == "air" then - if not random(defs.average_length) == 1 then + if random(defs.average_length) ~= 1 then - minetest.set_node(pos, { + minetest.swap_node(pos, { name = vine_name_middle, param2 = node.param2}) minetest.set_node(bottom, { @@ -103,13 +148,15 @@ vines.register_vine = function( name, defs, biome ) local timer = minetest.get_node_timer(bottom_node) - timer:start(random(5, 10)) + timer:start(random(growth_min, growth_max)) end end end, - after_dig_node = function(pos, node, metadata, digger) - dig_down(pos, node, digger) + on_dig = on_dig, + + after_destruct = function(pos, oldnode) + ensure_vine_end(pos, oldnode) end, }) @@ -117,7 +164,7 @@ vines.register_vine = function( name, defs, biome ) description = S("Matured") .. " " .. defs.description, walkable = false, climbable = true, - drop = "vines:vines", + drop = {}, sunlight_propagates = true, paramtype = "light", paramtype2 = "wallmounted", @@ -130,12 +177,14 @@ vines.register_vine = function( name, defs, biome ) sounds = default.node_sound_leaves_defaults(), selection_box = selection_box, - after_dig_node = function(pos, node, metadata, digger) - dig_down(pos, node, digger) + on_dig = on_dig, + + after_destruct = function(pos, oldnode) + ensure_vine_end(pos, oldnode) end, }) - biome_lib.register_active_spawner(biome) + biome_lib.register_on_generate(biome, spawn_plants) end -- ALIASES @@ -152,147 +201,136 @@ minetest.register_alias( 'vines:jungle_rotten', 'air' ) minetest.register_alias( 'vines:willow', 'air' ) minetest.register_alias( 'vines:willow_rotten', 'air' ) --- CRAFTS - -minetest.register_craft({ - output = 'vines:rope_block', - recipe = { - {'group:vines', 'group:vines', 'group:vines'}, - {'group:vines', 'group:wood', 'group:vines'}, - {'group:vines', 'group:vines', 'group:vines'}, - } -}) - -if minetest.get_modpath("moreblocks") then +-- ROPE +if enable_rope ~= false then minetest.register_craft({ output = 'vines:rope_block', recipe = { - {'moreblocks:rope', 'moreblocks:rope', 'moreblocks:rope'}, - {'moreblocks:rope', 'group:wood', 'moreblocks:rope'}, - {'moreblocks:rope', 'moreblocks:rope', 'moreblocks:rope'}, + {'group:vines', 'group:vines', 'group:vines'}, + {'group:vines', 'group:wood', 'group:vines'}, + {'group:vines', 'group:vines', 'group:vines'}, } }) -end -minetest.register_craft({ - output = 'vines:shears', - recipe = { - {'', 'default:steel_ingot', ''}, - {'group:stick', 'group:wood', 'default:steel_ingot'}, - {'', '', 'group:stick'} - } -}) - --- NODES - -minetest.register_node("vines:rope_block", { - description = S("Rope"), - sunlight_propagates = true, - paramtype = "light", - tiles = { - "default_wood.png^vines_rope.png", - "default_wood.png^vines_rope.png", - "default_wood.png", - "default_wood.png", - "default_wood.png^vines_rope.png", - "default_wood.png^vines_rope.png", - }, - groups = {flammable = 2, choppy = 2, oddly_breakable_by_hand = 1}, - - after_place_node = function(pos) - - local p = {x = pos.x, y = pos.y - 1, z = pos.z} - local n = minetest.get_node(p) - - if n.name == "air" then - minetest.add_node(p, {name = "vines:rope_end"}) - end - end, - - after_dig_node = function(pos, node, digger) - - local p = {x = pos.x, y = pos.y - 1, z = pos.z} - local n = minetest.get_node(p) - - while n.name == 'vines:rope' or n.name == 'vines:rope_end' do - - minetest.remove_node(p) - - p = {x = p.x, y = p.y - 1, z = p.z} - n = minetest.get_node(p) - end + if minetest.get_modpath("moreblocks") then + minetest.register_craft({ + output = 'vines:rope_block', + recipe = { + {'moreblocks:rope', 'moreblocks:rope', 'moreblocks:rope'}, + {'moreblocks:rope', 'group:wood', 'moreblocks:rope'}, + {'moreblocks:rope', 'moreblocks:rope', 'moreblocks:rope'}, + } + }) end -}) -minetest.register_node("vines:rope", { - description = S("Rope"), - walkable = false, - climbable = true, - sunlight_propagates = true, - paramtype = "light", - drop = {}, - tiles = {"vines_rope.png"}, - drawtype = "plantlike", - groups = {flammable = 2, not_in_creative_inventory = 1}, - sounds = default.node_sound_leaves_defaults(), - selection_box = { - type = "fixed", - fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, - }, -}) + minetest.register_node("vines:rope_block", { + description = S("Rope"), + sunlight_propagates = true, + paramtype = "light", + tiles = { + "default_wood.png^vines_rope.png", + "default_wood.png^vines_rope.png", + "default_wood.png", + "default_wood.png", + "default_wood.png^vines_rope.png", + "default_wood.png^vines_rope.png", + }, + groups = {flammable = 2, choppy = 2, oddly_breakable_by_hand = 1}, -minetest.register_node("vines:rope_end", { - description = S("Rope"), - walkable = false, - climbable = true, - sunlight_propagates = true, - paramtype = "light", - drop = {}, - tiles = {"vines_rope_end.png"}, - drawtype = "plantlike", - groups = {flammable = 2, not_in_creative_inventory = 1}, - sounds = default.node_sound_leaves_defaults(), + after_place_node = function(pos) - after_place_node = function(pos) + local p = {x = pos.x, y = pos.y - 1, z = pos.z} + local n = minetest.get_node(p) - local yesh = {x = pos.x, y = pos.y - 1, z = pos.z} + if n.name == "air" then + minetest.add_node(p, {name = "vines:rope_end"}) + end + end, - minetest.add_node(yesh, {name = "vines:rope"}) - end, + after_dig_node = function(pos, node, digger) - selection_box = { - type = "fixed", - fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, - }, + local p = {x = pos.x, y = pos.y - 1, z = pos.z} + local n = minetest.get_node(p) - on_construct = function(pos) + while n.name == 'vines:rope' or n.name == 'vines:rope_end' do - local timer = minetest.get_node_timer(pos) + minetest.remove_node(p) - timer:start(1) - end, + p = {x = p.x, y = p.y - 1, z = p.z} + n = minetest.get_node(p) + end + end + }) - on_timer = function( pos, elapsed ) + minetest.register_node("vines:rope", { + description = S("Rope"), + walkable = false, + climbable = true, + sunlight_propagates = true, + paramtype = "light", + drop = {}, + tiles = {"vines_rope.png"}, + drawtype = "plantlike", + groups = {flammable = 2, not_in_creative_inventory = 1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, + }, + }) - local p = {x = pos.x, y = pos.y - 1, z = pos.z} - local n = minetest.get_node(p) + minetest.register_node("vines:rope_end", { + description = S("Rope"), + walkable = false, + climbable = true, + sunlight_propagates = true, + paramtype = "light", + drop = {}, + tiles = {"vines_rope_end.png"}, + drawtype = "plantlike", + groups = {flammable = 2, not_in_creative_inventory = 1}, + sounds = default.node_sound_leaves_defaults(), - if n.name == "air" then + after_place_node = function(pos) - minetest.set_node(pos, {name = "vines:rope"}) - minetest.add_node(p, {name = "vines:rope_end"}) - else + local yesh = {x = pos.x, y = pos.y - 1, z = pos.z} + + minetest.add_node(yesh, {name = "vines:rope"}) + end, + + selection_box = { + type = "fixed", + fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, + }, + + on_construct = function(pos) local timer = minetest.get_node_timer(pos) timer:start(1) + end, + + on_timer = function( pos, elapsed ) + + local p = {x = pos.x, y = pos.y - 1, z = pos.z} + local n = minetest.get_node(p) + + if n.name == "air" then + + minetest.set_node(pos, {name = "vines:rope"}) + minetest.add_node(p, {name = "vines:rope_end"}) + else + + local timer = minetest.get_node_timer(pos) + + timer:start(1) + end end - end -}) + }) +end -- SHEARS - minetest.register_tool("vines:shears", { description = S("Shears"), inventory_image = "vines_shears.png", @@ -308,108 +346,144 @@ minetest.register_tool("vines:shears", { }, }) --- VINES -local spawn_root_surfaces = {} - -if enable_roots ~= false then - spawn_root_surfaces = { - "default:dirt_with_grass", - "default:dirt" +minetest.register_craft({ + output = 'vines:shears', + recipe = { + {'', 'default:steel_ingot', ''}, + {'group:stick', 'group:wood', 'default:steel_ingot'}, + {'', '', 'group:stick'} } +}) + +-- ROOT VINES +if enable_roots ~= false then + vines.register_vine('root', + {description = S("Roots"), average_length = 9}, { + check_air = false, + avoid_nodes = {"vines:root_middle"}, + avoid_radius = 5, + surface = { + "default:dirt_with_grass", + "default:dirt" + }, + spawn_on_bottom = true, + plantlife_limit = -0.6, + rarity = rarity_roots, + tries = 3, + humidity_min = 0.4, + temp_min = 0.4, + }) +else + minetest.register_alias('vines:root_middle', 'air') + minetest.register_alias('vines:root_end', 'air') end -vines.register_vine('root', - {description = S("Roots"), average_length = 9}, { - choose_random_wall = true, - avoid_nodes = {"vines:root_middle"}, - avoid_radius = 5, - spawn_delay = 500, - spawn_chance = 10, - spawn_surfaces = spawn_root_surfaces, - spawn_on_bottom = true, - plantlife_limit = -0.6, - humidity_min = 0.4, -}) +-- STANDARD VINES +if enable_standard ~= false then + vines.register_vine('vine', + {description = S("Vines"), average_length = 5}, { + check_air = false, + avoid_nodes = {"group:vines"}, + avoid_radius = 5, + surface = { + -- "default:leaves", + "default:jungleleaves", + "moretrees:jungletree_leaves_red", + "moretrees:jungletree_leaves_yellow", + "moretrees:jungletree_leaves_green" + }, + spawn_on_bottom = true, + plantlife_limit = -0.9, + rarity = rarity_standard, + tries = 1, + humidity_min = 0.7, + temp_min = 0.4, + }) +else + minetest.register_alias('vines:vine_middle', 'air') + minetest.register_alias('vines:vine_end', 'air') +end -vines.register_vine('vine', - {description = S("Vines"), average_length = 5}, { - choose_random_wall = true, - avoid_nodes = {"group:vines"}, - avoid_radius = 5, - spawn_delay = 500, - spawn_chance = 100, - spawn_surfaces = { --- "default:leaves", - "default:jungleleaves", - "moretrees:jungletree_leaves_red", - "moretrees:jungletree_leaves_yellow", - "moretrees:jungletree_leaves_green" - }, - spawn_on_bottom = true, - plantlife_limit = -0.9, - humidity_min = 0.7, -}) +-- SIDE VINES +if enable_side ~= false then + vines.register_vine('side', + {description = S("Vines"), average_length = 6}, { + check_air = false, + avoid_nodes = {"group:vines", "default:apple"}, + avoid_radius = 3, + surface = { + -- "default:leaves", + "default:jungleleaves", + "moretrees:jungletree_leaves_red", + "moretrees:jungletree_leaves_yellow", + "moretrees:jungletree_leaves_green" + }, + spawn_on_side = true, + plantlife_limit = -0.9, + rarity = rarity_side, + tries = 1, + humidity_min = 0.4, + temp_min = 0.4, + }) +else + minetest.register_alias('vines:side_middle', 'air') + minetest.register_alias('vines:side_end', 'air') +end -vines.register_vine('side', - {description = S("Vines"), average_length = 6}, { - choose_random_wall = true, - avoid_nodes = {"group:vines", "default:apple"}, - avoid_radius = 3, - spawn_delay = 500, - spawn_chance = 100, - spawn_surfaces = { --- "default:leaves", - "default:jungleleaves", - "moretrees:jungletree_leaves_red", - "moretrees:jungletree_leaves_yellow", - "moretrees:jungletree_leaves_green" - }, - spawn_on_side = true, - plantlife_limit = -0.9, - humidity_min = 0.4, -}) +-- JUNGLE VINES +if enable_jungle ~= false then + vines.register_vine("jungle", + {description = S("Jungle Vines"), average_length = 7}, { + check_air = false, + near_nodes = { + "default:jungleleaves", + "moretrees:jungletree_leaves_red", + "moretrees:jungletree_leaves_yellow", + "moretrees:jungletree_leaves_green" + }, + near_nodes_size = 4, + near_nodes_vertical = 4, + avoid_nodes = { + "vines:jungle_middle", + "vines:jungle_end", + }, + avoid_radius = 5, + surface = { + "default:jungletree", + "moretrees:jungletree_trunk" + }, + spawn_on_side = true, + plantlife_limit = -0.9, + rarity = rarity_jungle, + tries = 1, + humidity_min = 0.2, + temp_min = 0.3, + }) +else + minetest.register_alias('vines:jungle_middle', 'air') + minetest.register_alias('vines:jungle_end', 'air') +end -vines.register_vine("jungle", - {description = S("Jungle Vines"), average_length = 7}, { - choose_random_wall = true, - neighbors = { - "default:jungleleaves", - "moretrees:jungletree_leaves_red", - "moretrees:jungletree_leaves_yellow", - "moretrees:jungletree_leaves_green" - }, - avoid_nodes = { - "vines:jungle_middle", - "vines:jungle_end", - }, - avoid_radius = 5, - spawn_delay = 500, - spawn_chance = 100, - spawn_surfaces = { - "default:jungletree", - "moretrees:jungletree_trunk" - }, - spawn_on_side = true, - plantlife_limit = -0.9, - humidity_min = 0.2, -}) - -vines.register_vine( 'willow', - {description = S("Willow Vines"), average_length = 9}, { - choose_random_wall = true, - avoid_nodes = {"vines:willow_middle"}, - avoid_radius = 5, - near_nodes = {'default:water_source'}, - near_nodes_size = 1, - near_nodes_count = 1, - near_nodes_vertical = 7, - plantlife_limit = -0.8, - spawn_chance = 10, - spawn_delay = 500, - spawn_on_side = true, - spawn_surfaces = {"moretrees:willow_leaves"}, - humidity_min = 0.5 -}) - - -print("[Vines] Loaded!") +-- WILLOW VINES +if enable_willow ~= false then + vines.register_vine( 'willow', + {description = S("Willow Vines"), average_length = 9}, { + check_air = false, + avoid_nodes = {"vines:willow_middle"}, + avoid_radius = 5, + near_nodes = {'default:water_source'}, + near_nodes_size = 1, + near_nodes_count = 1, + near_nodes_vertical = 7, + plantlife_limit = -0.8, + spawn_on_side = true, + surface = {"moretrees:willow_leaves"}, + rarity = rarity_willow, + tries = 1, + humidity_min = 0.5, + temp_min = 0.5, + }) +else + minetest.register_alias('vines:willow_middle', 'air') + minetest.register_alias('vines:willow_end', 'air') +end diff --git a/vines/settingtypes.txt b/vines/settingtypes.txt new file mode 100644 index 0000000..6a5d0fb --- /dev/null +++ b/vines/settingtypes.txt @@ -0,0 +1,41 @@ +#Enable the vines item +vines_enable_vines (Enable vines item) bool true + +#Enables ropes made of vine. +vines_enable_rope (Enable vine ropes) bool true + +#Enables root vines. +vines_enable_roots (Enable root vines) bool true + +#Rarity of root vines, from 1 to 100, higher numbers are rarer. +vines_rarity_roots (Rarity of roots vines) float 95 0 100 + +#Enables the standard type of vines. +vines_enable_standard (Enable standard vines) bool true + +#Rarity of standard vines, from 1 to 100, higher numbers are rarer. +vines_rarity_standard (Rarity of standard vines) float 95 0 100 + +#Enables the type of vines that grow on the sides of leaf blocks. +vines_enable_side (Enable side vines) bool true + +#Rarity of side vines, from 1 to 100, higher numbers are rarer. +vines_rarity_side (Rarity of side vines) float 95 0 100 + +#Enables jungle style vines. +vines_enable_jungle (Enable jungle vines) bool true + +#Rarity of jungle vines, from 1 to 100, higher numbers are rarer. +vines_rarity_jungle (Rarity of jungle vines) float 95 0 100 + +#Enables willow vines. +vines_enable_willow (Enable willow vines) bool true + +#Rarity of willow vines, from 1 to 100, higher numbers are rarer. +vines_rarity_willow (Rarity of willow vines) float 95 0 100 + +#Vine growth speed, minimum number of seconds between each growth. +vines_growth_min (Minimum number of seconds between growth) int 180 1 3600 + +#Vine growth speed, maximum number of seconds between each growth. +vines_growth_max (Maximum number of seconds between growth) int 360 1 3600 diff --git a/youngtrees/init.lua b/youngtrees/init.lua index ce05c5c..c11ee8a 100644 --- a/youngtrees/init.lua +++ b/youngtrees/init.lua @@ -5,6 +5,11 @@ local random = math.random abstract_youngtrees = {} +local youngtrees_youngtrees_rarity = tonumber(minetest.settings:get("youngtrees_youngtrees_rarity")) or 100 +local youngtrees_youngtrees_rarity_fertility = tonumber(minetest.settings:get("youngtrees_youngtrees_rarity_fertility")) or 0.5 +local youngtrees_youngtrees_fertility = tonumber(minetest.settings:get("youngtrees_youngtrees_fertility")) or -0.3 + + minetest.register_node("youngtrees:bamboo", { description = S("Young Bamboo Tree"), drawtype="nodebox", @@ -42,7 +47,7 @@ minetest.register_node("youngtrees:youngtree2_middle",{ {-0.500000,0.125000,-0.500000,0.500000,0.500000,0.500000}, --NodeBox 3 } }, - groups = {snappy=3,flammable=2,attached_node=1}, + groups = {snappy=3,flammable=2,attached_node=1}, sounds = default.node_sound_leaves_defaults(), drop = 'trunks:twig_1' }) @@ -65,7 +70,6 @@ minetest.register_node("youngtrees:youngtree_top", { drop = 'trunks:twig_1' }) - minetest.register_node("youngtrees:youngtree_middle", { description = S("Young Tree (middle)"), drawtype = "plantlike", @@ -84,8 +88,6 @@ minetest.register_node("youngtrees:youngtree_middle", { drop = 'trunks:twig_1' }) - - minetest.register_node("youngtrees:youngtree_bottom", { description = S("Young Tree (bottom)"), drawtype = "plantlike", @@ -105,48 +107,47 @@ minetest.register_node("youngtrees:youngtree_bottom", { }) - abstract_youngtrees.grow_youngtree = function(pos) +abstract_youngtrees.grow_youngtree = function(pos) abstract_youngtrees.grow_youngtree_node(pos, random(1,3)) end + abstract_youngtrees.grow_youngtree_node = function(pos, height) - - local right_here = {x=pos.x, y=pos.y+1, z=pos.z} local above_right_here = {x=pos.x, y=pos.y+2, z=pos.z} - if minetest.get_node(right_here).name == "air" -- instead of check_air = true, + if minetest.get_node(right_here).name == "air" -- instead of check_air = true, or minetest.get_node(right_here).name == "default:junglegrass" then if height == 1 then - minetest.swap_node(right_here, {name="youngtrees:youngtree_top"}) + minetest.swap_node(right_here, {name="youngtrees:youngtree_top"}) end if height == 2 then - minetest.swap_node(right_here, {name="youngtrees:youngtree_bottom"}) - minetest.swap_node(above_right_here, {name="youngtrees:youngtree_top"}) + minetest.swap_node(right_here, {name="youngtrees:youngtree_bottom"}) + minetest.swap_node(above_right_here, {name="youngtrees:youngtree_top"}) end if height == 3 then - local two_above_right_here = {x=pos.x, y=pos.y+3, z=pos.z} - minetest.swap_node(right_here, {name="youngtrees:youngtree_bottom"}) - minetest.swap_node(above_right_here, {name="youngtrees:youngtree_middle"}) - minetest.swap_node(two_above_right_here, {name="youngtrees:youngtree_top"}) + local two_above_right_here = {x=pos.x, y=pos.y+3, z=pos.z} + minetest.swap_node(right_here, {name="youngtrees:youngtree_bottom"}) + minetest.swap_node(above_right_here, {name="youngtrees:youngtree_middle"}) + minetest.swap_node(two_above_right_here, {name="youngtrees:youngtree_top"}) end end end biome_lib.register_on_generate({ - surface = { - "default:dirt_with_grass", - "stoneage:grass_with_silex", - "sumpf:peat", - "sumpf:sumpf" + surface = { + "default:dirt_with_grass", + "stoneage:grass_with_silex", + "sumpf:peat", + "sumpf:sumpf" + }, + rarity = youngtrees_youngtrees_rarity, + rarity_fertility = youngtrees_youngtrees_rarity_fertility, + plantlife_limit = youngtrees_youngtrees_fertility, + min_elevation = 1, -- above sea level }, - max_count = 55, --10,15 - rarity = 101 - 4, --3,4 - min_elevation = 1, -- above sea level - plantlife_limit = -0.9, - }, - abstract_youngtrees.grow_youngtree + abstract_youngtrees.grow_youngtree ) minetest.log("action", "[youngtrees] loaded.") diff --git a/youngtrees/settingtypes.txt b/youngtrees/settingtypes.txt new file mode 100644 index 0000000..d9e6cfd --- /dev/null +++ b/youngtrees/settingtypes.txt @@ -0,0 +1,8 @@ +#Youngtree rarity % +youngtrees_youngtrees_rarity (Youngtree rarity %) float 100 0 100 + +#How much the rarity is reduced by fertility % +youngtrees_youngtrees_rarity_fertility (Youngtree rarity fertility reduction %) float 0.5 0 100 + +#Youngtree minimum fertility (-1 to +1) +youngtrees_youngtrees_fertility (Youngtree minimum fertility) float -0.3 -1 1