From 28ef3e0c4b3720b5245ce2814f990bd7188f0e0b Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Fri, 3 Dec 2021 20:38:16 +0000 Subject: [PATCH 01/23] Vines now generated at mapgen time. Vines now generated as a vine of random length. --- vines/init.lua | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/vines/init.lua b/vines/init.lua index 38c3901..674d0bf 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -40,11 +40,20 @@ vines.register_vine = function( name, defs, biome ) local vine_image_middle = "vines_" .. name .. "_middle.png" local drop_node = vine_name_end - biome.spawn_plants = {vine_name_end} + local spawn_plants = function(pos, fdir) + local max_length = math.random(defs.average_length) + local current_length = 0 + 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.swap_node(pos, { name = vine_name_end, param2 = fdir }) + end local vine_group = 'group:' .. name .. '_vines' - biome.spawn_surfaces[#biome.spawn_surfaces + 1] = vine_group + biome.surface[#biome.surface + 1] = vine_group local selection_box = {type = "wallmounted",} local drawtype = 'signlike' @@ -133,7 +142,7 @@ vines.register_vine = function( name, defs, biome ) end, }) - biome_lib.register_active_spawner(biome) + biome_lib.register_on_generate(biome, spawn_plants) end -- ALIASES @@ -321,12 +330,10 @@ vines.register_vine('root', choose_random_wall = true, avoid_nodes = {"vines:root_middle"}, avoid_radius = 5, - spawn_delay = 500, - spawn_chance = 10, - spawn_surfaces = spawn_root_surfaces, + surface = spawn_root_surfaces, spawn_on_bottom = true, plantlife_limit = -0.6, - humidity_min = 0.4, +-- humidity_min = 0.4, }) vines.register_vine('vine', @@ -334,9 +341,7 @@ vines.register_vine('vine', choose_random_wall = true, avoid_nodes = {"group:vines"}, avoid_radius = 5, - spawn_delay = 500, - spawn_chance = 100, - spawn_surfaces = { + surface = { -- "default:leaves", "default:jungleleaves", "moretrees:jungletree_leaves_red", @@ -345,7 +350,7 @@ vines.register_vine('vine', }, spawn_on_bottom = true, plantlife_limit = -0.9, - humidity_min = 0.7, +-- humidity_min = 0.7, }) vines.register_vine('side', @@ -353,9 +358,7 @@ vines.register_vine('side', choose_random_wall = true, avoid_nodes = {"group:vines", "default:apple"}, avoid_radius = 3, - spawn_delay = 500, - spawn_chance = 100, - spawn_surfaces = { + surface = { -- "default:leaves", "default:jungleleaves", "moretrees:jungletree_leaves_red", @@ -364,7 +367,7 @@ vines.register_vine('side', }, spawn_on_side = true, plantlife_limit = -0.9, - humidity_min = 0.4, +-- humidity_min = 0.4, }) vines.register_vine("jungle", @@ -381,15 +384,13 @@ vines.register_vine("jungle", "vines:jungle_end", }, avoid_radius = 5, - spawn_delay = 500, - spawn_chance = 100, - spawn_surfaces = { + surface = { "default:jungletree", "moretrees:jungletree_trunk" }, spawn_on_side = true, plantlife_limit = -0.9, - humidity_min = 0.2, +-- humidity_min = 0.2, }) vines.register_vine( 'willow', @@ -402,11 +403,9 @@ vines.register_vine( 'willow', 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 + surface = {"moretrees:willow_leaves"}, +-- humidity_min = 0.5 }) From 6df36da4e1d28082b3e2582e6fdaee0db71557ea Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Sat, 4 Dec 2021 13:46:30 +0000 Subject: [PATCH 02/23] Settings to disable any type of vine and vine rope. Settings to adjust rarity of vines. --- vines/init.lua | 364 ++++++++++++++++++++++------------------- vines/settingtypes.txt | 32 ++++ 2 files changed, 227 insertions(+), 169 deletions(-) create mode 100644 vines/settingtypes.txt diff --git a/vines/init.lua b/vines/init.lua index 674d0bf..6e3ad68 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -3,7 +3,19 @@ vines = { recipes = {} } +local enable_rope = minetest.settings:get_bool("vines_enable_rope") local enable_roots = minetest.settings:get_bool("vines_enable_roots") +local enable_standard = minetest.settings:get_bool("vines_enable_standard") +local enable_side = minetest.settings:get_bool("vines_enable_side") +local enable_jungle = minetest.settings:get_bool("vines_enable_jungle") +local enable_willow = minetest.settings:get_bool("vines_enable_willow") + +local default_rarity = 90 +local rarity_roots = tonumber(minetest.settings:get("vines_rarity_roots")) or default_rarity +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 -- support for i18n local S = minetest.get_translator("vines") @@ -193,110 +205,112 @@ minetest.register_craft({ -- 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}, +if enable_rope ~= false then + 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) + after_place_node = function(pos) - local p = {x = pos.x, y = pos.y - 1, z = pos.z} - local n = minetest.get_node(p) + 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"}) + 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 end - end, + }) - after_dig_node = function(pos, node, digger) + 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(), - while n.name == 'vines:rope' or n.name == 'vines:rope_end' do + after_place_node = function(pos) - minetest.remove_node(p) + local yesh = {x = pos.x, y = pos.y - 1, z = pos.z} - p = {x = p.x, y = p.y - 1, z = p.z} - n = minetest.get_node(p) - end - end -}) + minetest.add_node(yesh, {name = "vines: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}, - }, -}) + selection_box = { + type = "fixed", + fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, + }, -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) - - 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 + 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 @@ -323,90 +337,102 @@ if enable_roots ~= false then "default:dirt_with_grass", "default:dirt" } + + vines.register_vine('root', + {description = S("Roots"), average_length = 9}, { + choose_random_wall = true, + avoid_nodes = {"vines:root_middle"}, + avoid_radius = 5, + surface = spawn_root_surfaces, + spawn_on_bottom = true, + plantlife_limit = -0.6, + rarity = rarity_roots, + -- humidity_min = 0.4, + }) end -vines.register_vine('root', - {description = S("Roots"), average_length = 9}, { - choose_random_wall = true, - avoid_nodes = {"vines:root_middle"}, - avoid_radius = 5, - surface = spawn_root_surfaces, - spawn_on_bottom = true, - plantlife_limit = -0.6, --- humidity_min = 0.4, -}) +if enable_standard ~= false then + vines.register_vine('vine', + {description = S("Vines"), average_length = 5}, { + choose_random_wall = true, + 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, + -- humidity_min = 0.7, + }) +end -vines.register_vine('vine', - {description = S("Vines"), average_length = 5}, { - choose_random_wall = true, - 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, --- humidity_min = 0.7, -}) +if enable_side ~= false then + vines.register_vine('side', + {description = S("Vines"), average_length = 6}, { + choose_random_wall = true, + 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, + -- humidity_min = 0.4, + }) +end -vines.register_vine('side', - {description = S("Vines"), average_length = 6}, { - choose_random_wall = true, - 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, --- humidity_min = 0.4, -}) +if enable_jungle ~= false then + 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, + surface = { + "default:jungletree", + "moretrees:jungletree_trunk" + }, + spawn_on_side = true, + plantlife_limit = -0.9, + rarity = rarity_jungle, + -- humidity_min = 0.2, + }) +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, - surface = { - "default:jungletree", - "moretrees:jungletree_trunk" - }, - spawn_on_side = true, - plantlife_limit = -0.9, --- humidity_min = 0.2, -}) +if enable_willow ~= false then + 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_on_side = true, + surface = {"moretrees:willow_leaves"}, + rarity = rarity_willow, + -- humidity_min = 0.5 + }) +end -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_on_side = true, - surface = {"moretrees:willow_leaves"}, --- humidity_min = 0.5 -}) - - -print("[Vines] Loaded!") +print("[Vines] Loaded") diff --git a/vines/settingtypes.txt b/vines/settingtypes.txt new file mode 100644 index 0000000..e233181 --- /dev/null +++ b/vines/settingtypes.txt @@ -0,0 +1,32 @@ +#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) int 90 1 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) int 90 1 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) int 90 1 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) int 90 1 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) int 90 1 100 From ba98359dd048b58757c2b3a535891c20377ba021 Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Sat, 4 Dec 2021 15:05:06 +0000 Subject: [PATCH 03/23] When a vine is destroyed, ensure the remaining part of the vine ends with a vine end node. --- vines/init.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/vines/init.lua b/vines/init.lua index 6e3ad68..34b201e 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -42,6 +42,17 @@ local function dig_down(pos, node, digger) 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) + + vine_name_end = oldnode.name:gsub("_middle", "_end") + + if minetest.get_item_group(nn.name, "vines") > 0 then + minetest.swap_node(np, { name = vine_name_end, param2 = oldnode.param2 }) + end +end + vines.register_vine = function( name, defs, biome ) @@ -130,6 +141,10 @@ vines.register_vine = function( name, defs, biome ) after_dig_node = function(pos, node, metadata, digger) dig_down(pos, node, digger) end, + + after_destruct = function(pos, oldnode) + ensure_vine_end(pos, oldnode) + end, }) minetest.register_node( vine_name_middle, { @@ -152,6 +167,10 @@ vines.register_vine = function( name, defs, biome ) after_dig_node = function(pos, node, metadata, digger) dig_down(pos, node, digger) end, + + after_destruct = function(pos, oldnode) + ensure_vine_end(pos, oldnode) + end, }) biome_lib.register_on_generate(biome, spawn_plants) From 63914caed1bc8ad26909dc9095f8b3db945a909c Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Sat, 4 Dec 2021 16:39:39 +0000 Subject: [PATCH 04/23] Removing attached_node from vine groups, as it was causing breaking one vine to break the vine all the way up to the top, instantly --- vines/init.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vines/init.lua b/vines/init.lua index 34b201e..d66784c 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -56,7 +56,7 @@ 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" @@ -111,7 +111,6 @@ vines.register_vine = function( name, defs, biome ) on_construct = function(pos) local timer = minetest.get_node_timer(pos) - timer:start(math.random(5, 10)) end, @@ -120,7 +119,6 @@ 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 math.random(defs.average_length) == 1 then From a66b82f1f0080444f17b57980df68a0863032189 Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Sat, 4 Dec 2021 17:28:17 +0000 Subject: [PATCH 05/23] Fixing growth. Vines now grow once every 3-6 minutes. --- vines/init.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/vines/init.lua b/vines/init.lua index d66784c..cab098d 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -17,6 +17,9 @@ local rarity_side = tonumber(minetest.settings:get("vines_rarity_side")) or defa 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 = 60 * 3 +local growth_max = 60 * 6 + -- support for i18n local S = minetest.get_translator("vines") @@ -50,6 +53,7 @@ local function ensure_vine_end(pos, oldnode) if minetest.get_item_group(nn.name, "vines") > 0 then 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 @@ -71,7 +75,7 @@ vines.register_vine = function( name, defs, biome ) pos.y = pos.y - 1 current_length = current_length + 1 end - minetest.swap_node(pos, { name = vine_name_end, param2 = fdir }) + minetest.set_node(pos, { name = vine_name_end, param2 = fdir }) end local vine_group = 'group:' .. name .. '_vines' @@ -111,7 +115,7 @@ vines.register_vine = function( name, defs, biome ) on_construct = function(pos) local timer = minetest.get_node_timer(pos) - timer:start(math.random(5, 10)) + timer:start(math.random(growth_min, growth_max)) end, on_timer = function(pos) @@ -121,9 +125,9 @@ vines.register_vine = function( name, defs, biome ) local bottom_node = minetest.get_node( bottom ) if bottom_node.name == "air" then - if not math.random(defs.average_length) == 1 then + if math.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, { @@ -131,7 +135,7 @@ vines.register_vine = function( name, defs, biome ) local timer = minetest.get_node_timer(bottom_node) - timer:start(math.random(5, 10)) + timer:start(math.random(growth_min, growth_max)) end end end, From c7d0fd3c53b02ee2bfb21719439acf57d361a0dc Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Sat, 4 Dec 2021 18:53:39 +0000 Subject: [PATCH 06/23] Cutting vines with shears now gives the player the vine ends, so they can make their own vine farm --- vines/init.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/vines/init.lua b/vines/init.lua index cab098d..e38d5e2 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -33,6 +33,27 @@ minetest.register_craftitem("vines:vines", { -- FUNCTIONS +local function on_dig(pos, node, player) + wielded_item = player:get_wielded_item() + if wielded_item and wielded_item:get_name() == 'vines:shears' then + wielded_item:add_wear(1) + + vine_name_end = node.name:gsub("_middle", "_end") + minetest.remove_node(pos) + minetest.handle_node_drops(pos, {vine_name_end}, player) + + below_pos = {x = pos.x, y = pos.y - 1, z = pos.z} + while minetest.get_item_group(minetest.get_node(below_pos).name, "vines") > 0 do + minetest.remove_node(below_pos) + minetest.handle_node_drops(below_pos, {vine_name_end}, player) + below_pos.y = below_pos.y - 1 + end + + else + minetest.node_dig(pos, node, player) + end +end + local function dig_down(pos, node, digger) if digger == nil then return end @@ -140,6 +161,8 @@ vines.register_vine = function( name, defs, biome ) end end, + on_dig = on_dig, + after_dig_node = function(pos, node, metadata, digger) dig_down(pos, node, digger) end, @@ -166,6 +189,8 @@ vines.register_vine = function( name, defs, biome ) sounds = default.node_sound_leaves_defaults(), selection_box = selection_box, + on_dig = on_dig, + after_dig_node = function(pos, node, metadata, digger) dig_down(pos, node, digger) end, From c76fd45a2cf19c85d7ea3c4aa7f89c9906f1e5b7 Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Sat, 4 Dec 2021 19:22:11 +0000 Subject: [PATCH 07/23] Option to disable vines:vines item, as it seems pointless. All recipes allow the vines group, so any vine end item will work. --- vines/init.lua | 21 ++++++++++++++------- vines/settingtypes.txt | 3 +++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/vines/init.lua b/vines/init.lua index e38d5e2..d22b636 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -3,6 +3,7 @@ vines = { recipes = {} } +local enable_vines = minetest.settings:get_bool("vines_enable_vines") local enable_rope = minetest.settings:get_bool("vines_enable_rope") local enable_roots = minetest.settings:get_bool("vines_enable_roots") local enable_standard = minetest.settings:get_bool("vines_enable_standard") @@ -25,11 +26,13 @@ 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 @@ -86,7 +89,11 @@ vines.register_vine = function( name, defs, biome ) 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 + if enable_vines ~= false then + drop_node = "vines:vines" + end local spawn_plants = function(pos, fdir) local max_length = math.random(defs.average_length) @@ -121,7 +128,7 @@ vines.register_vine = function( name, defs, biome ) walkable = false, climbable = true, wield_image = vine_image_end, - drop = "vines:vines", + drop = drop_node, sunlight_propagates = true, paramtype = "light", paramtype2 = "wallmounted", @@ -176,7 +183,7 @@ vines.register_vine = function( name, defs, biome ) description = S("Matured") .. " " .. defs.description, walkable = false, climbable = true, - drop = "vines:vines", + drop = drop_node, sunlight_propagates = true, paramtype = "light", paramtype2 = "wallmounted", diff --git a/vines/settingtypes.txt b/vines/settingtypes.txt index e233181..601c18e 100644 --- a/vines/settingtypes.txt +++ b/vines/settingtypes.txt @@ -1,3 +1,6 @@ +#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 From 93265656ccdc73959ca2d2a9d7dd063249a1a47f Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Sat, 4 Dec 2021 20:28:11 +0000 Subject: [PATCH 08/23] Adding vine growth speed settings --- vines/init.lua | 4 ++-- vines/settingtypes.txt | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/vines/init.lua b/vines/init.lua index d22b636..66c44cf 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -18,8 +18,8 @@ local rarity_side = tonumber(minetest.settings:get("vines_rarity_side")) or defa 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 = 60 * 3 -local growth_max = 60 * 6 +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") diff --git a/vines/settingtypes.txt b/vines/settingtypes.txt index 601c18e..4e0f6d8 100644 --- a/vines/settingtypes.txt +++ b/vines/settingtypes.txt @@ -33,3 +33,9 @@ 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) int 90 1 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 From 54d3b669be3527091d24ce7ad67dc4d885da5707 Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Sun, 5 Dec 2021 11:08:51 +0000 Subject: [PATCH 09/23] Vines: Simplifying digging logic. --- vines/init.lua | 62 +++++++++++++++++--------------------------------- 1 file changed, 21 insertions(+), 41 deletions(-) diff --git a/vines/init.lua b/vines/init.lua index 66c44cf..245b29b 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -37,35 +37,28 @@ end -- FUNCTIONS local function on_dig(pos, node, player) - wielded_item = player:get_wielded_item() - if wielded_item and wielded_item:get_name() == 'vines:shears' then - wielded_item:add_wear(1) - - vine_name_end = node.name:gsub("_middle", "_end") - minetest.remove_node(pos) - minetest.handle_node_drops(pos, {vine_name_end}, player) - - below_pos = {x = pos.x, y = pos.y - 1, z = pos.z} - while minetest.get_item_group(minetest.get_node(below_pos).name, "vines") > 0 do - minetest.remove_node(below_pos) - minetest.handle_node_drops(below_pos, {vine_name_end}, player) - below_pos.y = below_pos.y - 1 - end - - else - minetest.node_dig(pos, node, player) + vine_name_end = node.name:gsub("_middle", "_end") + drop_item = "vines:vines" + if enable_vines == false then + drop_item = vine_name_end + end + + wielded_item = 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 -end -local function dig_down(pos, node, digger) + minetest.remove_node(pos) + minetest.handle_node_drops(pos, {drop_item}, player) - if digger == nil then return end - - local np = {x = pos.x, y = pos.y - 1, z = pos.z} - local nn = minetest.get_node(np) - - if minetest.get_item_group(nn.name, "vines") > 0 then - minetest.node_dig(np, nn, digger) + below_pos = {x = pos.x, y = pos.y - 1, z = pos.z} + while minetest.get_item_group(minetest.get_node(below_pos).name, "vines") > 0 do + minetest.remove_node(below_pos) + minetest.handle_node_drops(below_pos, {drop_item}, player) + below_pos.y = below_pos.y - 1 end end @@ -90,11 +83,6 @@ vines.register_vine = function( name, defs, biome ) local vine_image_end = "vines_" .. name .. "_end.png" local vine_image_middle = "vines_" .. name .. "_middle.png" - local drop_node = vine_name_end - if enable_vines ~= false then - drop_node = "vines:vines" - end - local spawn_plants = function(pos, fdir) local max_length = math.random(defs.average_length) local current_length = 0 @@ -128,7 +116,7 @@ vines.register_vine = function( name, defs, biome ) walkable = false, climbable = true, wield_image = vine_image_end, - drop = drop_node, + drop = {}, sunlight_propagates = true, paramtype = "light", paramtype2 = "wallmounted", @@ -170,10 +158,6 @@ vines.register_vine = function( name, defs, biome ) on_dig = on_dig, - after_dig_node = function(pos, node, metadata, digger) - dig_down(pos, node, digger) - end, - after_destruct = function(pos, oldnode) ensure_vine_end(pos, oldnode) end, @@ -183,7 +167,7 @@ vines.register_vine = function( name, defs, biome ) description = S("Matured") .. " " .. defs.description, walkable = false, climbable = true, - drop = drop_node, + drop = {}, sunlight_propagates = true, paramtype = "light", paramtype2 = "wallmounted", @@ -198,10 +182,6 @@ vines.register_vine = function( name, defs, biome ) on_dig = on_dig, - after_dig_node = function(pos, node, metadata, digger) - dig_down(pos, node, digger) - end, - after_destruct = function(pos, oldnode) ensure_vine_end(pos, oldnode) end, From 98f0c6c20fb2bb6873d110a3344ea5d8d6e799e2 Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Sun, 5 Dec 2021 11:41:49 +0000 Subject: [PATCH 10/23] Slight simplification of on_dig. Also minor fix to generating vines of a certain length. --- vines/init.lua | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/vines/init.lua b/vines/init.lua index 245b29b..0adbdf7 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -51,14 +51,11 @@ local function on_dig(pos, node, player) end end - minetest.remove_node(pos) - minetest.handle_node_drops(pos, {drop_item}, player) - - below_pos = {x = pos.x, y = pos.y - 1, z = pos.z} - while minetest.get_item_group(minetest.get_node(below_pos).name, "vines") > 0 do - minetest.remove_node(below_pos) - minetest.handle_node_drops(below_pos, {drop_item}, player) - below_pos.y = below_pos.y - 1 + 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 @@ -85,7 +82,7 @@ vines.register_vine = function( name, defs, biome ) local spawn_plants = function(pos, fdir) local max_length = math.random(defs.average_length) - local current_length = 0 + local current_length = 1 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 From e2486ca7f5979a65c1cf751e6111655bcc1bfb77 Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Mon, 6 Dec 2021 09:33:44 +0000 Subject: [PATCH 11/23] Adding default to boolean settings --- vines/init.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vines/init.lua b/vines/init.lua index 0adbdf7..9f7aeac 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -3,13 +3,13 @@ vines = { recipes = {} } -local enable_vines = minetest.settings:get_bool("vines_enable_vines") -local enable_rope = minetest.settings:get_bool("vines_enable_rope") -local enable_roots = minetest.settings:get_bool("vines_enable_roots") -local enable_standard = minetest.settings:get_bool("vines_enable_standard") -local enable_side = minetest.settings:get_bool("vines_enable_side") -local enable_jungle = minetest.settings:get_bool("vines_enable_jungle") -local enable_willow = minetest.settings:get_bool("vines_enable_willow") +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 default_rarity = 90 local rarity_roots = tonumber(minetest.settings:get("vines_rarity_roots")) or default_rarity From 1d3751d7552a3db54b2e9745840bf5ca119db08e Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Mon, 6 Dec 2021 09:42:33 +0000 Subject: [PATCH 12/23] Avoid one node vines on top of trees. --- vines/init.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vines/init.lua b/vines/init.lua index 9f7aeac..9e435a1 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -83,12 +83,14 @@ vines.register_vine = function( name, defs, biome ) local spawn_plants = function(pos, fdir) local max_length = math.random(defs.average_length) local current_length = 1 - 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 + 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 - minetest.set_node(pos, { name = vine_name_end, param2 = fdir }) end local vine_group = 'group:' .. name .. '_vines' From 2e4e4a2412d77baf858e387337262c157b3f5653 Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Mon, 6 Dec 2021 09:57:43 +0000 Subject: [PATCH 13/23] Replace vines with air if they've been disabled for compatibility --- vines/init.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/vines/init.lua b/vines/init.lua index 9e435a1..bcae2ad 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -381,6 +381,9 @@ if enable_roots ~= false then rarity = rarity_roots, -- humidity_min = 0.4, }) +else + minetest.register_alias('vines:root_middle', 'air') + minetest.register_alias('vines:root_end', 'air') end if enable_standard ~= false then @@ -401,6 +404,9 @@ if enable_standard ~= false then rarity = rarity_standard, -- humidity_min = 0.7, }) +else + minetest.register_alias('vines:vine_middle', 'air') + minetest.register_alias('vines:vine_end', 'air') end if enable_side ~= false then @@ -421,6 +427,9 @@ if enable_side ~= false then rarity = rarity_side, -- humidity_min = 0.4, }) +else + minetest.register_alias('vines:side_middle', 'air') + minetest.register_alias('vines:side_end', 'air') end if enable_jungle ~= false then @@ -447,6 +456,9 @@ if enable_jungle ~= false then rarity = rarity_jungle, -- humidity_min = 0.2, }) +else + minetest.register_alias('vines:jungle_middle', 'air') + minetest.register_alias('vines:jungle_end', 'air') end if enable_willow ~= false then @@ -465,6 +477,9 @@ if enable_willow ~= false then rarity = rarity_willow, -- humidity_min = 0.5 }) +else + minetest.register_alias('vines:willow_middle', 'air') + minetest.register_alias('vines:willow_end', 'air') end print("[Vines] Loaded") From a7d0e42cd13d16ab98a1e0c1199764a4f1e212a5 Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Tue, 7 Dec 2021 22:19:49 +0000 Subject: [PATCH 14/23] Update vines/init.lua Co-authored-by: SX <50966843+S-S-X@users.noreply.github.com> --- vines/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vines/init.lua b/vines/init.lua index bcae2ad..8491eb2 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -186,7 +186,7 @@ vines.register_vine = function( name, defs, biome ) end, }) - biome_lib.register_on_generate(biome, spawn_plants) + biome_lib.register_on_generate(biome, spawn_plants) end -- ALIASES From 4c48e5be2917e5f5a23c8989db528ad8654eca88 Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Tue, 7 Dec 2021 22:19:57 +0000 Subject: [PATCH 15/23] Update vines/init.lua Co-authored-by: SX <50966843+S-S-X@users.noreply.github.com> --- vines/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/vines/init.lua b/vines/init.lua index 8491eb2..594a00d 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -482,4 +482,3 @@ else minetest.register_alias('vines:willow_end', 'air') end -print("[Vines] Loaded") From a6dc4890d9d67f38bc020ff2e94914f759cee39a Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Wed, 8 Dec 2021 17:13:41 +0000 Subject: [PATCH 16/23] Vines: Fixed humidity, and set temperature. Also fixed a couple of issues with spawning: Roots are meant to spawn under dirt blocks, also vines were appearing on the side of snow. --- vines/init.lua | 49 +++++++++++++++++++++--------------------- vines/settingtypes.txt | 10 ++++----- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/vines/init.lua b/vines/init.lua index 594a00d..7873e54 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -11,7 +11,7 @@ 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 default_rarity = 90 +local default_rarity = 75 local rarity_roots = tonumber(minetest.settings:get("vines_rarity_roots")) or default_rarity 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 @@ -42,7 +42,7 @@ local function on_dig(pos, node, player) if enable_vines == false then drop_item = vine_name_end end - + wielded_item = player:get_wielded_item() if wielded_item then wielded_item:add_wear(1) @@ -93,10 +93,6 @@ vines.register_vine = function( name, defs, biome ) end end - local vine_group = 'group:' .. name .. '_vines' - - biome.surface[#biome.surface + 1] = vine_group - local selection_box = {type = "wallmounted",} local drawtype = 'signlike' @@ -362,24 +358,21 @@ minetest.register_tool("vines:shears", { }) -- VINES -local spawn_root_surfaces = {} - if enable_roots ~= false then - spawn_root_surfaces = { - "default:dirt_with_grass", - "default:dirt" - } - vines.register_vine('root', {description = S("Roots"), average_length = 9}, { - choose_random_wall = true, + check_air = false, avoid_nodes = {"vines:root_middle"}, avoid_radius = 5, - surface = spawn_root_surfaces, + surface = { + "default:dirt_with_grass", + "default:dirt" + }, spawn_on_bottom = true, plantlife_limit = -0.6, rarity = rarity_roots, - -- humidity_min = 0.4, + humidity_min = 0.4, + temp_min = 0.4, }) else minetest.register_alias('vines:root_middle', 'air') @@ -389,7 +382,7 @@ end if enable_standard ~= false then vines.register_vine('vine', {description = S("Vines"), average_length = 5}, { - choose_random_wall = true, + check_air = false, avoid_nodes = {"group:vines"}, avoid_radius = 5, surface = { @@ -402,7 +395,8 @@ if enable_standard ~= false then spawn_on_bottom = true, plantlife_limit = -0.9, rarity = rarity_standard, - -- humidity_min = 0.7, + humidity_min = 0.7, + temp_min = 0.4, }) else minetest.register_alias('vines:vine_middle', 'air') @@ -412,7 +406,7 @@ end if enable_side ~= false then vines.register_vine('side', {description = S("Vines"), average_length = 6}, { - choose_random_wall = true, + check_air = false, avoid_nodes = {"group:vines", "default:apple"}, avoid_radius = 3, surface = { @@ -425,7 +419,8 @@ if enable_side ~= false then spawn_on_side = true, plantlife_limit = -0.9, rarity = rarity_side, - -- humidity_min = 0.4, + humidity_min = 0.4, + temp_min = 0.4, }) else minetest.register_alias('vines:side_middle', 'air') @@ -435,13 +430,15 @@ end if enable_jungle ~= false then vines.register_vine("jungle", {description = S("Jungle Vines"), average_length = 7}, { - choose_random_wall = true, - neighbors = { + 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", @@ -454,7 +451,8 @@ if enable_jungle ~= false then spawn_on_side = true, plantlife_limit = -0.9, rarity = rarity_jungle, - -- humidity_min = 0.2, + humidity_min = 0.2, + temp_min = 0.3, }) else minetest.register_alias('vines:jungle_middle', 'air') @@ -464,7 +462,7 @@ end if enable_willow ~= false then vines.register_vine( 'willow', {description = S("Willow Vines"), average_length = 9}, { - choose_random_wall = true, + check_air = false, avoid_nodes = {"vines:willow_middle"}, avoid_radius = 5, near_nodes = {'default:water_source'}, @@ -475,7 +473,8 @@ if enable_willow ~= false then spawn_on_side = true, surface = {"moretrees:willow_leaves"}, rarity = rarity_willow, - -- humidity_min = 0.5 + humidity_min = 0.5, + temp_min = 0.5, }) else minetest.register_alias('vines:willow_middle', 'air') diff --git a/vines/settingtypes.txt b/vines/settingtypes.txt index 4e0f6d8..a1936bf 100644 --- a/vines/settingtypes.txt +++ b/vines/settingtypes.txt @@ -8,31 +8,31 @@ vines_enable_rope (Enable vine ropes) bool true 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) int 90 1 100 +vines_rarity_roots (Rarity of roots vines) int 75 1 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) int 90 1 100 +vines_rarity_standard (Rarity of standard vines) int 75 1 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) int 90 1 100 +vines_rarity_side (Rarity of side vines) int 75 1 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) int 90 1 100 +vines_rarity_jungle (Rarity of jungle vines) int 75 1 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) int 90 1 100 +vines_rarity_willow (Rarity of willow vines) int 75 1 100 #Vine growth speed, minimum number of seconds between each growth. vines_growth_min (Minimum number of seconds between growth) int 180 1 3600 From 1a96ac87a727554c57e60bbbd392a86a3db34818 Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Tue, 14 Dec 2021 12:05:23 +0000 Subject: [PATCH 17/23] Breaking up flowers_plus mod (#5) Splitting up flowers_plus into separate mods for seaweed, sunflowers and waterlillies, for clarity and so the user can disable them individually. Fixed sunflower maximum heat. Removed spawning, as we're already creating these things at worldgen. Added settings for rarity and max count to each mod - waterlilies, seaweed and sunflowers Removing along_shore mod as it does nothing now. --- along_shore/init.lua | 9 - along_shore/mod.conf | 3 - .../textures/along_shore_seaweed_1Darker.png | Bin 234 -> 0 bytes along_shore/textures/credit_textures.txt | 30 -- along_shore/textures/old/LillyPad3x16.png | Bin 439 -> 0 bytes along_shore/textures/old/MultiLilly16x.png | Bin 305 -> 0 bytes .../textures/old/along_shore_empty.png | Bin 74 -> 0 bytes .../textures/old/along_shore_lilypads_1.png | Bin 305 -> 0 bytes .../textures/old/along_shore_lilypads_2.png | Bin 382 -> 0 bytes .../textures/old/along_shore_lilypads_3.png | Bin 314 -> 0 bytes .../textures/old/along_shore_lilypads_4.png | Bin 209 -> 0 bytes .../textures/old/along_shore_pondscum_1.png | Bin 543 -> 0 bytes .../textures/old/along_shore_seaweed_1.png | Bin 222 -> 0 bytes .../textures/old/along_shore_seaweed_2.png | Bin 224 -> 0 bytes .../textures/old/along_shore_seaweed_3.png | Bin 226 -> 0 bytes .../textures/old/along_shore_seaweed_4.png | Bin 178 -> 0 bytes along_shore/textures/old/flowers_seaweed.png | Bin 222 -> 0 bytes .../textures/old/flowers_waterlily.png | Bin 404 -> 0 bytes .../textures/old/flowers_waterlily_22.5.png | Bin 429 -> 0 bytes .../textures/old/flowers_waterlily_45.png | Bin 424 -> 0 bytes .../textures/old/flowers_waterlily_67.5.png | Bin 427 -> 0 bytes along_shore/textures/old/lillyPad5x16.png | Bin 308 -> 0 bytes .../textures/old/lillypad3Flower16x.png | Bin 411 -> 0 bytes along_shore/textures/old/pondscum16xc.png | Bin 543 -> 0 bytes flowers_plus/flowers-changelog.txt | 24 - flowers_plus/init.lua | 482 ------------------ pl_seaweed/init.lua | 168 ++++++ pl_seaweed/locale/pl_seaweed.de.tr | 11 + pl_seaweed/locale/pl_seaweed.fr.tr | 10 + pl_seaweed/locale/pl_seaweed.tr.tr | 10 + pl_seaweed/locale/pl_seawood.es.tr | 10 + pl_seaweed/locale/template.txt | 11 + {flowers_plus => pl_seaweed}/mod.conf | 2 +- pl_seaweed/settingtypes.txt | 5 + .../textures/flowers_seaweed.png | Bin .../textures/flowers_seaweedLight.png | Bin .../textures/flowers_seaweed_2.png | Bin .../textures/flowers_seaweed_3.png | Bin .../textures/flowers_seaweed_4.png | Bin pl_sunflowers/init.lua | 55 ++ .../locale/pl_sunflowers.de.tr | 4 +- pl_sunflowers/locale/pl_sunflowers.es.tr | 10 + .../locale/pl_sunflowers.fr.tr | 4 +- .../locale/pl_sunflowers.tr.tr | 4 +- .../locale/template.txt | 4 +- pl_sunflowers/mod.conf | 3 + .../models/flowers_sunflower.obj | 0 pl_sunflowers/settingtypes.txt | 5 + .../textures/flowers_sunflower.png | Bin .../textures/flowers_sunflower_inv.png | Bin pl_waterlilies/init.lua | 164 ++++++ pl_waterlilies/locale/pl_waterlilies.de.tr | 11 + .../locale/pl_waterlilies.es.tr | 4 +- pl_waterlilies/locale/pl_waterlilies.fr.tr | 10 + pl_waterlilies/locale/pl_waterlilies.tr.tr | 10 + pl_waterlilies/locale/template.txt | 11 + pl_waterlilies/mod.conf | 3 + pl_waterlilies/settingtypes.txt | 5 + .../textures/flowers_waterlily.png | Bin .../textures/flowers_waterlily_22.5.png | Bin .../textures/flowers_waterlily_45.png | Bin .../textures/flowers_waterlily_67.5.png | Bin .../textures/flowers_waterlily_small_1.png | Bin .../textures/flowers_waterlily_small_2.png | Bin .../textures/flowers_waterlily_small_3.png | Bin .../textures/flowers_waterlily_small_4.png | Bin 66 files changed, 518 insertions(+), 564 deletions(-) delete mode 100644 along_shore/init.lua delete mode 100644 along_shore/mod.conf delete mode 100644 along_shore/textures/along_shore_seaweed_1Darker.png delete mode 100644 along_shore/textures/credit_textures.txt delete mode 100644 along_shore/textures/old/LillyPad3x16.png delete mode 100644 along_shore/textures/old/MultiLilly16x.png delete mode 100644 along_shore/textures/old/along_shore_empty.png delete mode 100644 along_shore/textures/old/along_shore_lilypads_1.png delete mode 100644 along_shore/textures/old/along_shore_lilypads_2.png delete mode 100644 along_shore/textures/old/along_shore_lilypads_3.png delete mode 100644 along_shore/textures/old/along_shore_lilypads_4.png delete mode 100644 along_shore/textures/old/along_shore_pondscum_1.png delete mode 100644 along_shore/textures/old/along_shore_seaweed_1.png delete mode 100644 along_shore/textures/old/along_shore_seaweed_2.png delete mode 100644 along_shore/textures/old/along_shore_seaweed_3.png delete mode 100644 along_shore/textures/old/along_shore_seaweed_4.png delete mode 100644 along_shore/textures/old/flowers_seaweed.png delete mode 100644 along_shore/textures/old/flowers_waterlily.png delete mode 100644 along_shore/textures/old/flowers_waterlily_22.5.png delete mode 100644 along_shore/textures/old/flowers_waterlily_45.png delete mode 100644 along_shore/textures/old/flowers_waterlily_67.5.png delete mode 100644 along_shore/textures/old/lillyPad5x16.png delete mode 100644 along_shore/textures/old/lillypad3Flower16x.png delete mode 100644 along_shore/textures/old/pondscum16xc.png delete mode 100644 flowers_plus/flowers-changelog.txt delete mode 100644 flowers_plus/init.lua create mode 100644 pl_seaweed/init.lua create mode 100644 pl_seaweed/locale/pl_seaweed.de.tr create mode 100644 pl_seaweed/locale/pl_seaweed.fr.tr create mode 100644 pl_seaweed/locale/pl_seaweed.tr.tr create mode 100644 pl_seaweed/locale/pl_seawood.es.tr create mode 100644 pl_seaweed/locale/template.txt rename {flowers_plus => pl_seaweed}/mod.conf (73%) create mode 100644 pl_seaweed/settingtypes.txt rename {flowers_plus => pl_seaweed}/textures/flowers_seaweed.png (100%) rename {flowers_plus => pl_seaweed}/textures/flowers_seaweedLight.png (100%) rename {flowers_plus => pl_seaweed}/textures/flowers_seaweed_2.png (100%) rename {flowers_plus => pl_seaweed}/textures/flowers_seaweed_3.png (100%) rename {flowers_plus => pl_seaweed}/textures/flowers_seaweed_4.png (100%) create mode 100644 pl_sunflowers/init.lua rename flowers_plus/locale/flowers_plus.de.tr => pl_sunflowers/locale/pl_sunflowers.de.tr (76%) create mode 100644 pl_sunflowers/locale/pl_sunflowers.es.tr rename flowers_plus/locale/flowers_plus.fr.tr => pl_sunflowers/locale/pl_sunflowers.fr.tr (77%) rename flowers_plus/locale/flowers_plus.tr.tr => pl_sunflowers/locale/pl_sunflowers.tr.tr (76%) rename {flowers_plus => pl_sunflowers}/locale/template.txt (81%) create mode 100644 pl_sunflowers/mod.conf rename {flowers_plus => pl_sunflowers}/models/flowers_sunflower.obj (100%) create mode 100644 pl_sunflowers/settingtypes.txt rename {flowers_plus => pl_sunflowers}/textures/flowers_sunflower.png (100%) rename {flowers_plus => pl_sunflowers}/textures/flowers_sunflower_inv.png (100%) create mode 100644 pl_waterlilies/init.lua create mode 100644 pl_waterlilies/locale/pl_waterlilies.de.tr rename flowers_plus/locale/flowers_plus.es.tr => pl_waterlilies/locale/pl_waterlilies.es.tr (77%) create mode 100644 pl_waterlilies/locale/pl_waterlilies.fr.tr create mode 100644 pl_waterlilies/locale/pl_waterlilies.tr.tr create mode 100644 pl_waterlilies/locale/template.txt create mode 100644 pl_waterlilies/mod.conf create mode 100644 pl_waterlilies/settingtypes.txt rename {flowers_plus => pl_waterlilies}/textures/flowers_waterlily.png (100%) rename {flowers_plus => pl_waterlilies}/textures/flowers_waterlily_22.5.png (100%) rename {flowers_plus => pl_waterlilies}/textures/flowers_waterlily_45.png (100%) rename {flowers_plus => pl_waterlilies}/textures/flowers_waterlily_67.5.png (100%) rename {flowers_plus => pl_waterlilies}/textures/flowers_waterlily_small_1.png (100%) rename {flowers_plus => pl_waterlilies}/textures/flowers_waterlily_small_2.png (100%) rename {flowers_plus => pl_waterlilies}/textures/flowers_waterlily_small_3.png (100%) rename {flowers_plus => pl_waterlilies}/textures/flowers_waterlily_small_4.png (100%) 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 b5bd99c5dc867bdd04db8059d5ecba3065ca3030..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 234 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPGa4)6(a1=7Zj8piHyR-V>YK@v7T zhOQBkZpp0v+2V80?b-vBW-JNv3ubV5b|VeQsr7Vm4B?PvJ-Cst$w0*6;_1_?V+}Ls za0?||)z?_UxrXn}FZQW3c4%cj*>20eCskMZg@)!)0fAq9(Y*rG=kKm#<>T3$o3JY7 z{&t=xzn?}%ELeNh_DJ*1Uw2&kC2t4s6P@R^GJX3Lo<+w$yYs&KwX%AqxrcLv=Y-Hs d6$Yk8d+l4IJbjm5eg-;(!PC{xWt~$(696uPQ)2)C 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 7d840bdb4508b7d02968532bb1dfb36fd18000ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 439 zcmV;o0Z9IdP)RQZ z;!gtdrCES{8zBA*#2^=~hpIVHa|s+g}=b4lmP~03^1L50=pU%_dsk2#EXDf z0oi~V7%_kvy@615>=;Qjs8Eg-X!}ci(Fw%f|NsAIzzU)(wB!hAeh2i9AWj3K$~E|a z&i#u+^KW1nc;~h|GBV%;z`&}(l9ayz11}vUpWo?%S3iSao+J}caU9ULUZCbyAkGG2 h*~}IjP)fzA4*;}6GSO}J9+v@l3`Ay-1V2mxItD6W1mXJm_TZR7 z#&7^K0LBJNhyk%U5KDlf2&5TFjuFXbMz|c%07j^(OlZ#IK+?>F&HrFSw(aj?Mm8Ni zfN;qH#ihXpOkNPgj4LXkni=rPGxX2#rp$n<4gE0Df>tJ5)o!6}i!If=m~ znb9?c$t{)HJ&na9oz*jo#VecDJBQ6Dm))m;(KnC7w~)y%pVP01*}s@2poBHBlr5-? zJ-D1Bs$8selJT=Q`@X#NYq?cz3^bRiB*-tA!L>lOLLJEK@^o`fjuCcURzVo`6%8|L;CuQ+v8${p)=$wqgoTP5stzp7<^Eo9$$GMCO%hMVDF!Q})*X#(qx*g~$22WQ%mvv4FO#t^2YFPjP 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 90f5364ad5393bd828d6ca4f717e566937494855..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 382 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbK}QGic~E0C_AZ{Ie>=Kufy-r1rM zMpcJF{~Yhh3xc-o@7i-@GDHwa!jWSFgHs}da}t9~GNWq>lUpjYdm4*JI;&?Ei+2v2 zPcFMp0i$mohi@U1UlFr^F-t%RYhWo`P#Jr0ImfrqmaRZrg-U|_K(1h5WMpIp0akuN zF>#4L9)|{?;7U&y#}Elg)`Of*ha3bL4o)jO%Iq@pWLn{3MfU&y7lp3SGE`ZyXw}yB z)vLOsrrx=(+c|APTK~26mm_}fQRmB@JKHnm$u5>-Ti&c>J8RZEM^bs?l;zEaEOQ=y z`uaE0BwDsnTtdp>U+#YM2Xl9v=e#L@Ix6^HR{V2YZ<}wqJD2Y{RvSHCqjc8x$~~tx zetm7$+xly>Z>Nm0WD`@Rw20jVhl()Kb25I*nHDhp-*3aGym-k4P`EO9y85}Sb4q9e E0Q|a+V*mgE 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 94d00d2f083e12354627366078ca3ca200c94c3d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 314 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbK}V1Q4EE0F&G|9?=STvWM6bcL2< z0)tZ`gL4vtOERNt3X@wZvwIqgM>?x#7K>Llt9K5YPcFMp0i$mohi@U1Up}W_5wm|W zOF#*0U@2Qr8GCR!N6ZA3c|b#1OM?7>may{4Ezr5L9Vjr_)5S4FLelnNW7uH@0oQ}S zuWWKy;Ivr!P`GiV9Fk;74Hgfi}~#gQAj;gvFci%s7Hd$)A8?E&ZI%7zS5_SPb2cXA_nzoy^QUA#{lu=afqhM~=1gy(^B6o`{an^L HB{Ts59Qtw< 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 9b6387f1c01fb9dae22cab0e803cf8fa6bb2da88..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 209 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!aez;VE0F&G|G#q*gG(}_YYLNF zDzisAt5-IwPXVKE9*1uslV3ikUlFr^F-t%RYhWo`P#L@Y$3{z_Hl~swKcF#Xlh0ZJ zdETBbjv*44*PgQ!I-tPg9GLi+p>zB1`DROJPVouZ7x?j_-C=!(hTROTPT%*KJxF|a zWu-#;jBG~N87qrz&nSP=%viLuV`J$Cj)u=)#Pzl_W&J1;2>=?);OXk;vd$@?2>>P> BLTms4 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 35023547473e7c3ba6086d13fa3f2b1f9a46d01d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 543 zcmV+)0^t3LP)G zUE%UaxENJ7U^Tw%3NL=)8V;@By>-RY~!>SZ@Oz9KBGtwb4WJ^?@P#GW`rKpoth`I=o)(8g4=O`Y< z1ba!36CEM=Of*BjO0$<}6$|7wf?@O!^-!F^5aC$dnHqLuFHswPWOcGb#1-P#WSiuB zDD9?AN7ikU>uaGRU{AEkHQ5uJF^)JBm)NDR6IsOrMX}u(1 zgnRf;03C?VCU1UMpPQJhUFe+9y4d+1{{;L$f`g!i2$S;_Ip=|P53m~u5)5S4_LzeZRBiA7V5!Z{;vu0(k^N`VY z3xB{QvhZ@!i2$S;_Ip=|P53m~uD)5S4_LzeZRHy4wk0Lz6{3wFHidYNL~ zG{3k(uw4B7TdpJRg~^1{=0FdpeodpY<*vJqHq<`No0}m2PvhRgC6=zH zTWbI9)s{8WTN;18LACe1H_Q1?ra6sn*Y27o8(lmWd|=}i4$hS_T_R08JPZCYdaV*V VwELCx9iS5!JYD@<);T3K0RVGzRG9z( 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 887c1839385a4982a0b08605cca5eec126c50016..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 178 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPGa2=EDU1=9cj|JU{xHI5OpNs+eC z6!kARjILFC_3~~7P>!i2$S;_Ip=|P53n0(k)5S4_LzeZRp=g7F0PBW&VeQ6mrEXk& zD_X1={&Raa2vtmA)?;G3*mz~r2BuaX6V(hIMh{ap+c^c#5B(G5>DZRoRdw?xBaa@p V&;5$!zko(Ec)I$ztaD0e0swghHQ4|F diff --git a/along_shore/textures/old/flowers_seaweed.png b/along_shore/textures/old/flowers_seaweed.png deleted file mode 100644 index 7595ebc9d046c760951966981cf8d79c393eae53..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 222 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^4e$wZ1=8C7qQ)^|HYw8fnWFyX zhS9ZZjS;%aKncc@AirP+hi5m^fShtq7sn6|S=NJwLQMt&4j1{~Eo)<3qie&^=OLSt z+&fvZbdKVk{~Y_+dz0!Ib$9)|nm$E&kv{Wn=lg7o?w&%4`KfOYGrrkZ9WH+0-K<3w zD{?DtSUw7xGkK?v;It3bX?_#mZwTd^YgcQ1T{xt*<|*6U;xi@;DN_HgS_r!btXO#t P=mZ8&S3j3^P6E+c;Ois&AP)L3MkC>1yqD8MKobVe zbkgZ$rl+d9rWu>r*f?fLinLD{yvt<_&jE~58EXd&+ZRzdz6CGjXuYiBtN$je*I2|< zfK(-d!mS0jWuesJs64Nr_x*~W&m7)+U6jKml&%t(q?)Dc3DcNnC zGE4UydyflpJo_}N1{lhxW+%{uq8M^b4aLwHfe^`NRWU}oHZL0afW2)AGfiyO7|54= z(~uxuXJ9aqjRCA5GQma)Ot=9@rvBHI7C_l+O&F_5pOhX@ki+?=3Hxlkfs{Btmx?BS yqg|at{)U5oM75ba4Fj}jQ&(7N&_AQu%*8L>#?!f{KjSC>0000f zMe?l;hXu1|t+UtKhp~TK`xgvmH2~9<5GhEA6&e0SjFlKtEe5-%A$6-D<0-H^Doz?< z!D((U7T}&!t&q6+Y^W2e;&3s3^ZR5Z(CMnkxFJ6~Q4hlEaDpxf zzXD{z?#qOVm?S^kK%%jRXlW);qsl{5#n_yb>B+F#6kwMNDARA=y6E%&;#V^QrW+9B zX9qfEKGe?5vDVk+Os`ftaWY!rps`Aqaa@PH@TQYo5(+IBJIgAYYL(T zwn!j|quP8US!ZNL6XQGdHWreXl~D;G;mTx5B~%f)Tv6bF2v$eKVR=QO?}e^9_A2!Q X{G!+Nm;u^)00000NkvXXu0mjfT*1HW 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 c870df486eb64d90f1d8bdca60dc699b87a5db8a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 424 zcmV;Z0ayNsP)RqBpTtxe?bAAa* zDn@A0fx}$jyPWSFA^vS8Pb4<#A*34;$zzGYz*tEj(-qimS=jYVy;neEE70YpGCH(!STY#T^Onzm)?CH-rW*j zMh~dnM87Apk9{cknnIpxj#omEcyDD6_gCMU#M} z?2mzttBsuyAv<^)4b-#HvAzk{nb^H}Lqp+;c`+yx?XJR)z*1Y4_p9#UiEX*ABpadp_P2!0bh4rjtEWpJi# zB6bvzV6`ggfCO3AV0SgjMMu0eg?hY77kQ@BISbf5iFkR6bN&dHw=)^+pVvEuh1kG_ Sg7EDC0000Pq z>CGbB^CDd1qmbo2hOGvdfJ9TH08KiOkS`}DK{LHM6z&!fDt?oS?|{LdV~CzGY@QMD zoMZc1x6^1-N~HF~65fVSDBdqlE@~jpkhtX1$7sV3RAdF=ifcST zOkYfPLllnNqEt4HRER+n|BMBMs!l}6ex&A>pzyIh*22}V-opyDHCS>_{|^4TJ^`yx V;8ViRB?JHf002ovPDHLkV1h*ny959L diff --git a/along_shore/textures/old/lillyPad5x16.png b/along_shore/textures/old/lillyPad5x16.png deleted file mode 100644 index 761beb95d18268995d0850786f1c4e2c0f3b5b9f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 308 zcmV-40n7f0P)DI4 zVUP>38cIOpdx8dFa~2YI$6^3Gh5_h?0K-5Is(}-x8H9o2GRW$HfyfM!;D;$d$3O*) zAY4D+9vm~s7!E)Nz}P?uF(4KPVhKM)>=0YHv1nj||k8nGrcP{4vi zc+Zi^pgHm#FKil-y&??6Z?Vb4!r>S$1AKtEev(}vE_s*%GUyUP1ycXpXS)8sa=GdM z*|Rk%cnv^`CT*BRai?k1sWVmo?i}!Zbo+YS_rw~t7X%GJ2Dfjts{--6+h?;c1L=S1 z4chy#81MyZvk1ucP$1rctRNs?^3jC(KCgP`dM+sLGL=S)sn0+h1=7fjCkBvl0o0qK zKx_oWTrhtt1MyNIJ_y9$@fh$8lv)|Eq;E-RT5u+i9za+Mn*ksf{3gN+AlGqY4RN5v z6e0|$0c9dw27q!}9}wRF;x|zLeuXCA`#{_P#7x-q0sxkwSBdCGzGMIZ002ovPDHLk FV1j0|sV@Kk diff --git a/along_shore/textures/old/pondscum16xc.png b/along_shore/textures/old/pondscum16xc.png deleted file mode 100644 index 35023547473e7c3ba6086d13fa3f2b1f9a46d01d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 543 zcmV+)0^t3LP)G zUE%UaxENJ7U^Tw%3NL=)8V;@By>-RY~!>SZ@Oz9KBGtwb4WJ^?@P#GW`rKpoth`I=o)(8g4=O`Y< z1ba!36CEM=Of*BjO0$<}6$|7wf?@O!^-!F^5aC$dnHqLuFHswPWOcGb#1-P#WSiuB zDD9?AN7ikU>uaGRU{AEkHQ5uJF^)JBm)NDR6IsOrMX}u(1 zgnRf;03C?VCU1UMpPQJhUFe+9y4d+1{{;L$f`g 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/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 From cb2373f0896becd09f92325d74bf24943b117c1c Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Thu, 16 Dec 2021 09:10:36 +0000 Subject: [PATCH 18/23] Trunks: Prevent crashing when unknown nodes exist (#9) Extension of commit 9ed47715159962cd42f69c441dcc9eee150e4f66 Co-authored-by: OgelGames --- trunks/generating.lua | 184 +++++++++++++++++------------------------- 1 file changed, 73 insertions(+), 111 deletions(-) diff --git a/trunks/generating.lua b/trunks/generating.lua index 5decb7c..145a945 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)}) @@ -50,115 +33,115 @@ abstract_trunks.place_twig = function(pos) if Big_Twigs == true then -- big twig 1 if twig_size == 17 then - if not (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z+1}).name].buildable_to - or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name].buildable_to) 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 minetest.registered_nodes[node_here.name].buildable_to then + if check_node_buildable_to(right_here) then minetest.swap_node(right_here, {name="trunks:twig_5"}) end - if minetest.registered_nodes[node_n_e.name].buildable_to then + if check_node_buildable_to(north_east) then minetest.swap_node(north_east, {name="trunks:twig_7"}) end - if minetest.registered_nodes[node_east.name].buildable_to then + if check_node_buildable_to(east) then minetest.swap_node(east, {name="trunks:twig_8"}) end end elseif twig_size == 18 then - if not (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}).name].buildable_to - or minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name].buildable_to) 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 minetest.registered_nodes[node_here.name].buildable_to then + if check_node_buildable_to(right_here) then minetest.swap_node(right_here, {name="trunks:twig_5", param2=1}) end - if minetest.registered_nodes[node_s_e.name].buildable_to then + if check_node_buildable_to(south_east) then minetest.swap_node(south_east, {name="trunks:twig_7", param2=1}) end - if minetest.registered_nodes[node_south.name].buildable_to then + 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 (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}).name].buildable_to - or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name].buildable_to) 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 minetest.registered_nodes[node_here.name].buildable_to then + if check_node_buildable_to(right_here) then minetest.swap_node(right_here, {name="trunks:twig_5", param2=2}) end - if minetest.registered_nodes[node_s_w.name].buildable_to then + if check_node_buildable_to(south_west) then minetest.swap_node(south_west, {name="trunks:twig_7", param2=2}) end - if minetest.registered_nodes[node_west.name].buildable_to then + 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 (minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1}).name].buildable_to - or minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name].buildable_to) 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 minetest.registered_nodes[node_here.name].buildable_to then + if check_node_buildable_to(right_here) then minetest.swap_node(right_here, {name="trunks:twig_5", param2=3}) end - if minetest.registered_nodes[node_n_w.name].buildable_to then + if check_node_buildable_to(north_west) then minetest.swap_node(north_west, {name="trunks:twig_7", param2=3}) end - if minetest.registered_nodes[node_north.name].buildable_to then + 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 (minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name].buildable_to - or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z+1}).name].buildable_to) 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 minetest.registered_nodes[node_here.name].buildable_to then + if check_node_buildable_to(right_here) then minetest.swap_node(right_here, {name="trunks:twig_9"}) end - if minetest.registered_nodes[node_north.name].buildable_to then + if check_node_buildable_to(north) then minetest.swap_node(north, {name="trunks:twig_10"}) end - if minetest.registered_nodes[node_n_e.name].buildable_to then + 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 (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name].buildable_to - or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}).name].buildable_to) 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 minetest.registered_nodes[node_here.name].buildable_to then + if check_node_buildable_to(right_here) then minetest.swap_node(right_here, {name="trunks:twig_9", param2=1}) end - if minetest.registered_nodes[node_east.name].buildable_to then + if check_node_buildable_to(east) then minetest.swap_node(east, {name="trunks:twig_10", param2=1}) end - if minetest.registered_nodes[node_s_e.name].buildable_to then + 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 (minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name].buildable_to - or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z-1}).name].buildable_to) 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 minetest.registered_nodes[node_here.name].buildable_to then + if check_node_buildable_to(right_here) then minetest.swap_node(right_here, {name="trunks:twig_9", param2=2}) end - if minetest.registered_nodes[node_south.name].buildable_to then + if check_node_buildable_to(south) then minetest.swap_node(south, {name="trunks:twig_10", param2=2}) end - if minetest.registered_nodes[node_s_w.name].buildable_to then + 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 (minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name].buildable_to - or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1}).name].buildable_to) 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 minetest.registered_nodes[node_here.name].buildable_to then + if check_node_buildable_to(right_here) then minetest.swap_node(right_here, {name="trunks:twig_9", param2=3}) end - if minetest.registered_nodes[node_west.name].buildable_to then + if check_node_buildable_to(west) then minetest.swap_node(west, {name="trunks:twig_10", param2=3}) end - if minetest.registered_nodes[node_n_w.name].buildable_to then + if check_node_buildable_to(north_west) then minetest.swap_node(north_west, {name="trunks:twig_11", param2=3}) end end @@ -256,16 +239,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] @@ -282,63 +256,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 @@ -413,17 +387,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 @@ -432,7 +398,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 @@ -441,7 +407,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 @@ -450,7 +416,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 @@ -459,7 +425,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 @@ -520,10 +486,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] @@ -532,16 +494,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 From 4953b1ba54f702ef295634386515f044ecb68b05 Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Fri, 24 Dec 2021 08:31:30 +0000 Subject: [PATCH 19/23] Rarity / fertility tweaks for various mods (#8) For bushes, molehills and youngtrees: Changes to rarity and minimum fertility. Also added use of rarity_fertility. Result is more balanced and less homogeneous, i.e. over a large area you'll see variation. For vines, some further tweaks to rarity, and using tries field to improve vines distribution. --- bushes/init.lua | 128 ++++++++++++++++--------------- bushes/settingtypes.txt | 17 ++++ molehills/init.lua | 43 +++++------ molehills/molehills_settings.txt | 6 -- molehills/settingtypes.txt | 8 ++ vines/init.lua | 9 ++- vines/settingtypes.txt | 10 +-- youngtrees/init.lua | 54 ++++++------- youngtrees/settingtypes.txt | 8 ++ 9 files changed, 157 insertions(+), 126 deletions(-) create mode 100644 bushes/settingtypes.txt delete mode 100644 molehills/molehills_settings.txt create mode 100644 molehills/settingtypes.txt create mode 100644 youngtrees/settingtypes.txt diff --git a/bushes/init.lua b/bushes/init.lua index a610667..4c57f85 100644 --- a/bushes/init.lua +++ b/bushes/init.lua @@ -8,30 +8,39 @@ -- 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] @@ -55,8 +64,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, @@ -81,16 +90,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 = { @@ -99,8 +108,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, @@ -160,9 +169,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} @@ -184,7 +192,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 .. ")") @@ -200,63 +208,59 @@ 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) local height = math.random(4,5) abstract_bushes.grow_youngtree_node2(pos,height) 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 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 == 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(three_above_right_here, {name="bushes:BushLeaves1" }) - minetest.swap_node(three_above_right_here_south, {name="bushes:BushLeaves1" }) + 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(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 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/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/vines/init.lua b/vines/init.lua index 7873e54..2fab36e 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -11,8 +11,8 @@ 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 default_rarity = 75 -local rarity_roots = tonumber(minetest.settings:get("vines_rarity_roots")) or default_rarity +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 @@ -371,6 +371,7 @@ if enable_roots ~= false then spawn_on_bottom = true, plantlife_limit = -0.6, rarity = rarity_roots, + tries = 3, humidity_min = 0.4, temp_min = 0.4, }) @@ -395,6 +396,7 @@ if enable_standard ~= false then spawn_on_bottom = true, plantlife_limit = -0.9, rarity = rarity_standard, + tries = 1, humidity_min = 0.7, temp_min = 0.4, }) @@ -419,6 +421,7 @@ if enable_side ~= false then spawn_on_side = true, plantlife_limit = -0.9, rarity = rarity_side, + tries = 1, humidity_min = 0.4, temp_min = 0.4, }) @@ -451,6 +454,7 @@ if enable_jungle ~= false then spawn_on_side = true, plantlife_limit = -0.9, rarity = rarity_jungle, + tries = 1, humidity_min = 0.2, temp_min = 0.3, }) @@ -473,6 +477,7 @@ if enable_willow ~= false then spawn_on_side = true, surface = {"moretrees:willow_leaves"}, rarity = rarity_willow, + tries = 1, humidity_min = 0.5, temp_min = 0.5, }) diff --git a/vines/settingtypes.txt b/vines/settingtypes.txt index a1936bf..6a5d0fb 100644 --- a/vines/settingtypes.txt +++ b/vines/settingtypes.txt @@ -8,31 +8,31 @@ vines_enable_rope (Enable vine ropes) bool true 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) int 75 1 100 +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) int 75 1 100 +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) int 75 1 100 +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) int 75 1 100 +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) int 75 1 100 +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 diff --git a/youngtrees/init.lua b/youngtrees/init.lua index 61c285f..96bcb9a 100644 --- a/youngtrees/init.lua +++ b/youngtrees/init.lua @@ -1,8 +1,12 @@ -- support for i18n local S = minetest.get_translator("youngtrees") - 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", @@ -40,7 +44,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' }) @@ -63,7 +67,6 @@ minetest.register_node("youngtrees:youngtree_top", { drop = 'trunks:twig_1' }) - minetest.register_node("youngtrees:youngtree_middle", { description = S("Young Tree (middle)"), drawtype = "plantlike", @@ -82,8 +85,6 @@ minetest.register_node("youngtrees:youngtree_middle", { drop = 'trunks:twig_1' }) - - minetest.register_node("youngtrees:youngtree_bottom", { description = S("Young Tree (bottom)"), drawtype = "plantlike", @@ -103,47 +104,46 @@ minetest.register_node("youngtrees:youngtree_bottom", { }) - abstract_youngtrees.grow_youngtree = function(pos) +abstract_youngtrees.grow_youngtree = function(pos) local height = math.random(1,3) abstract_youngtrees.grow_youngtree_node(pos,height) 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 ) 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 From c990942ba240115ebfc03c288937c59bb0309235 Mon Sep 17 00:00:00 2001 From: unknown <24964441+wsor4035@users.noreply.github.com> Date: Sat, 25 Dec 2021 21:42:42 -0500 Subject: [PATCH 20/23] fix https://github.com/mt-mods/plantlife_modpack/issues/11 --- vines/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vines/init.lua b/vines/init.lua index 2fab36e..f38f969 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -43,7 +43,7 @@ local function on_dig(pos, node, player) drop_item = vine_name_end end - wielded_item = player:get_wielded_item() + 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 From 7094d8a369d9d10d7a4828f74fec13c4d9ae452c Mon Sep 17 00:00:00 2001 From: Jordan Leppert Date: Tue, 28 Dec 2021 03:45:05 +0000 Subject: [PATCH 21/23] Vines: Fix recipes and global variables (#13) --- vines/init.lua | 69 +++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/vines/init.lua b/vines/init.lua index f38f969..02f4224 100644 --- a/vines/init.lua +++ b/vines/init.lua @@ -37,13 +37,13 @@ end -- FUNCTIONS local function on_dig(pos, node, player) - vine_name_end = node.name:gsub("_middle", "_end") - drop_item = "vines:vines" + 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 - wielded_item = player and player:get_wielded_item() + 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 @@ -51,7 +51,7 @@ local function on_dig(pos, node, player) end end - break_pos = {x = pos.x, y = pos.y, 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) @@ -63,7 +63,7 @@ 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) - vine_name_end = oldnode.name:gsub("_middle", "_end") + local vine_name_end = oldnode.name:gsub("_middle", "_end") if minetest.get_item_group(nn.name, "vines") > 0 then minetest.swap_node(np, { name = vine_name_end, param2 = oldnode.param2 }) @@ -199,41 +199,29 @@ 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'} - } -}) + 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 --- NODES - -if enable_rope ~= false then minetest.register_node("vines:rope_block", { description = S("Rope"), sunlight_propagates = true, @@ -341,7 +329,6 @@ if enable_rope ~= false then end -- SHEARS - minetest.register_tool("vines:shears", { description = S("Shears"), inventory_image = "vines_shears.png", @@ -357,7 +344,16 @@ minetest.register_tool("vines:shears", { }, }) --- VINES +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}, { @@ -380,6 +376,7 @@ else minetest.register_alias('vines:root_end', 'air') end +-- STANDARD VINES if enable_standard ~= false then vines.register_vine('vine', {description = S("Vines"), average_length = 5}, { @@ -405,6 +402,7 @@ else minetest.register_alias('vines:vine_end', 'air') end +-- SIDE VINES if enable_side ~= false then vines.register_vine('side', {description = S("Vines"), average_length = 6}, { @@ -430,6 +428,7 @@ else minetest.register_alias('vines:side_end', 'air') end +-- JUNGLE VINES if enable_jungle ~= false then vines.register_vine("jungle", {description = S("Jungle Vines"), average_length = 7}, { @@ -463,6 +462,7 @@ else minetest.register_alias('vines:jungle_end', 'air') end +-- WILLOW VINES if enable_willow ~= false then vines.register_vine( 'willow', {description = S("Willow Vines"), average_length = 9}, { @@ -485,4 +485,3 @@ else minetest.register_alias('vines:willow_middle', 'air') minetest.register_alias('vines:willow_end', 'air') end - From 32bab30e1fcdb3db87aa9060b24c79a7ea79adac Mon Sep 17 00:00:00 2001 From: nixnoxus Date: Mon, 10 Jan 2022 19:32:04 +0100 Subject: [PATCH 22/23] fix felling `farns: fern_trunk_big` --- ferns/gianttreefern.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ferns/gianttreefern.lua b/ferns/gianttreefern.lua index ec155df..43cd477 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, }) ----------------------------------------------------------------------------------------------- From 031d5f4e4e695a78a64ac8f9dd7980411e9436d8 Mon Sep 17 00:00:00 2001 From: nixnoxus Date: Tue, 11 Jan 2022 18:55:22 +0100 Subject: [PATCH 23/23] add group `sapling` --- dryplants/reedmace.lua | 3 ++- ferns/gianttreefern.lua | 2 +- ferns/treefern.lua | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dryplants/reedmace.lua b/dryplants/reedmace.lua index 0ab5a90..3c97f56 100644 --- a/dryplants/reedmace.lua +++ b/dryplants/reedmace.lua @@ -264,7 +264,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 ec155df..0efcbdf 100644 --- a/ferns/gianttreefern.lua +++ b/ferns/gianttreefern.lua @@ -271,7 +271,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 361417c..96947a9 100644 --- a/ferns/treefern.lua +++ b/ferns/treefern.lua @@ -158,7 +158,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",