From 0af7b69afaef4bf22b2c16bd04c8aff722215059 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Sat, 17 Feb 2018 16:28:43 -0800 Subject: [PATCH] `cleanfile` run: remove trailing whitespace. When it's this far out of hand you really need to clean up or else everyone will be submitting patches with more whitespace problems. --- along_shore/init.lua | 2 +- bushes/init.lua | 82 +-- cavestuff/init.lua | 2 +- cavestuff/mapgen.lua | 4 +- dryplants/crafting.lua | 718 +++++++++++++-------------- dryplants/init.lua | 412 ++++++++-------- dryplants/juncus.lua | 4 +- dryplants/meadowvariation.lua | 6 +- dryplants/moregrass.lua | 66 +-- dryplants/reed.lua | 766 ++++++++++++++--------------- dryplants/reedmace.lua | 8 +- ferns/crafting.lua | 210 ++++---- ferns/fern.lua | 398 +++++++-------- ferns/gianttreefern.lua | 4 +- ferns/horsetail.lua | 6 +- ferns/init.lua | 4 +- ferns/settings.lua | 8 +- ferns/treefern.lua | 4 +- flowers_plus/init.lua | 2 +- molehills/init.lua | 4 +- nature_classic/global_function.lua | 2 +- trunks/generating.lua | 160 +++--- trunks/init.lua | 2 +- trunks/nodes.lua | 16 +- vines/recipes.lua | 1 - woodsoils/generating.lua | 2 +- woodsoils/init.lua | 2 +- 27 files changed, 1447 insertions(+), 1448 deletions(-) diff --git a/along_shore/init.lua b/along_shore/init.lua index 719d324..dbaabe1 100644 --- a/along_shore/init.lua +++ b/along_shore/init.lua @@ -1,6 +1,6 @@ ----------------------------------------------------------------------------------------------- local title = "Along the Shore" -local version = "0.0.4" +local version = "0.0.4" local mname = "along_shore" ----------------------------------------------------------------------------------------------- diff --git a/bushes/init.lua b/bushes/init.lua index 70db2ec..b880bd2 100644 --- a/bushes/init.lua +++ b/bushes/init.lua @@ -4,17 +4,17 @@ -- bush leaf textures are cc-by-sa 3.0. from VannessaE's moretrees mod. (Leaf texture created by RealBadAngel or VanessaE) -- Branch textures created by Neuromancer. -- Licence for Code and Non-Bush leaf code is WTFPL. - + -- support for i18n local S = plantlife_i18n.gettext - abstract_bushes = {} + abstract_bushes = {} minetest.register_node("bushes:youngtree2_bottom", { description = S("Young Tree 2 (bottom)"), drawtype="nodebox", tiles = {"bushes_youngtree2trunk.png"}, - inventory_image = "bushes_youngtree2trunk_inv.png", - wield_image = "bushes_youngtree2trunk_inv.png", + inventory_image = "bushes_youngtree2trunk_inv.png", + wield_image = "bushes_youngtree2trunk_inv.png", paramtype = "light", walkable = false, is_ground_content = true, @@ -29,11 +29,11 @@ node_box = { 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] + local Num = BushBranchCenter[i][1] + local TexNum = BushBranchCenter[i][2] minetest.register_node("bushes:bushbranches"..Num, { description = S("Bush Branches @1", Num), drawtype = "nodebox", @@ -58,8 +58,8 @@ for i in pairs(BushBranchCenter) do sunlight_propagates = true, groups = { -- tree=1, -- MM: disabled because some recipes use group:tree for trunks - snappy=3, - flammable=2, + snappy=3, + flammable=2, leaves=1 }, sounds = default.node_sound_leaves_defaults(), @@ -67,20 +67,20 @@ for i in pairs(BushBranchCenter) do }) end -local BushBranchSide = { {2,1}, {4,2} } +local BushBranchSide = { {2,1}, {4,2} } for i in pairs(BushBranchSide) do - local Num = BushBranchSide[i][1] - local TexNum = BushBranchSide[i][2] + local Num = BushBranchSide[i][1] + local TexNum = BushBranchSide[i][2] minetest.register_node("bushes:bushbranches"..Num, { description = S("Bush Branches @1", Num), drawtype = "nodebox", tiles = { ---[[top]] "bushes_leaves_"..TexNum..".png", +--[[top]] "bushes_leaves_"..TexNum..".png", --[[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 ---[[front]] "bushes_branches_right_"..TexNum..".png" +--[[back]] "bushes_branches_center_"..TexNum..".png",-- unless U really want 'em 2 B different +--[[front]] "bushes_branches_right_"..TexNum..".png" }, node_box = { type = "fixed", @@ -101,8 +101,8 @@ for i in pairs(BushBranchSide) do sunlight_propagates = true, groups = { -- tree=1, -- MM: disabled because some recipes use group:tree for trunks - snappy=3, - flammable=2, + snappy=3, + flammable=2, leaves=1 }, sounds = default.node_sound_leaves_defaults(), @@ -110,25 +110,25 @@ for i in pairs(BushBranchSide) do }) end -local BushLeafNode = { {1}, {2}} +local BushLeafNode = { {1}, {2}} for i in pairs(BushLeafNode) do - local Num = BushLeafNode[i][1] + local Num = BushLeafNode[i][1] minetest.register_node("bushes:BushLeaves"..Num, { description = S("Bush Leaves @1", Num), drawtype = "allfaces_optional", tiles = {"bushes_leaves_"..Num..".png"}, paramtype = "light", - groups = { -- MM: Should we add leafdecay? + groups = { -- MM: Should we add leafdecay? snappy=3, flammable=2, attached_node=1 }, - sounds = default.node_sound_leaves_defaults(), - }) + sounds = default.node_sound_leaves_defaults(), + }) end abstract_bushes.grow_bush = function(pos) - local leaf_type = math.random(1,2) + local leaf_type = math.random(1,2) local bush_side_height = math.random(0,1) local chance_of_bush_node_right = math.random(1,10) if chance_of_bush_node_right> 5 then @@ -146,25 +146,25 @@ abstract_bushes.grow_bush = function(pos) bush_side_height = math.random(0,1) local front_pos = {x=pos.x, y=pos.y+bush_side_height, z=pos.z+1} abstract_bushes.grow_bush_node(front_pos,2,leaf_type) - end + end local chance_of_bush_node_back = math.random(1,10) if chance_of_bush_node_back> 5 then bush_side_height = math.random(0,1) local back_pos = {x=pos.x, y=pos.y+bush_side_height, z=pos.z-1} abstract_bushes.grow_bush_node(back_pos,0,leaf_type) end - + 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} - + local bush_branch_type = 2 - + -- MM: I'm not sure if it's slower now than before... if dir ~= 5 and leaf_type == 1 then bush_branch_type = 2 @@ -180,7 +180,7 @@ abstract_bushes.grow_bush_node = function(pos,dir, leaf_type) bush_branch_type = 3 dir = 1 end - + if minetest.get_node(right_here).name == "air" -- instead of check_air = true, or minetest.get_node(right_here).name == "default:junglegrass" then minetest.set_node(right_here, {name="bushes:bushbranches"..bush_branch_type , param2=dir}) @@ -198,7 +198,7 @@ end biome_lib:register_generate_plant({ surface = { - "default:dirt_with_grass", + "default:dirt_with_grass", "stoneage:grass_with_silex", "sumpf:peat", "sumpf:sumpf" @@ -209,21 +209,21 @@ biome_lib:register_generate_plant({ plantlife_limit = -0.9, }, abstract_bushes.grow_bush -) +) abstract_bushes.grow_youngtree2 = function(pos) - local height = math.random(4,5) + 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, or minetest.get_node(right_here).name == "default:junglegrass" then if height == 4 then @@ -236,14 +236,14 @@ abstract_bushes.grow_youngtree_node2 = function(pos, height) minetest.set_node(three_above_right_here, {name="bushes:BushLeaves1" }) minetest.set_node(three_above_right_here_south, {name="bushes:BushLeaves1" }) end - + end end biome_lib:register_generate_plant({ surface = { - "default:dirt_with_grass", + "default:dirt_with_grass", "stoneage:grass_with_silex", "sumpf:peat", "sumpf:sumpf" @@ -254,6 +254,6 @@ biome_lib:register_generate_plant({ plantlife_limit = -0.9, }, abstract_bushes.grow_youngtree2 -) - +) + --http://dev.minetest.net/Node_Drawtypes diff --git a/cavestuff/init.lua b/cavestuff/init.lua index ad8b9f4..b1e984a 100644 --- a/cavestuff/init.lua +++ b/cavestuff/init.lua @@ -1,6 +1,6 @@ ----------------------------------------------------------------------------------------------- local title = "Cave Stuff" -local version = "0.0.3" +local version = "0.0.3" local mname = "cavestuff" ----------------------------------------------------------------------------------------------- diff --git a/cavestuff/mapgen.lua b/cavestuff/mapgen.lua index a91a2f0..fc890b3 100644 --- a/cavestuff/mapgen.lua +++ b/cavestuff/mapgen.lua @@ -28,7 +28,7 @@ minetest.register_on_generated(function(minp, maxp, seed) break end end - + if ground_y then local p = {x=x,y=ground_y+1,z=z} local nn = minetest.get_node(p).name @@ -44,7 +44,7 @@ minetest.register_on_generated(function(minp, maxp, seed) end end end - + end end end diff --git a/dryplants/crafting.lua b/dryplants/crafting.lua index 69154b5..0a188e7 100644 --- a/dryplants/crafting.lua +++ b/dryplants/crafting.lua @@ -1,360 +1,360 @@ ------------------------------------------------------------------------------------------------ --- Dry Plants - Recipes 0.1.0 -- Short Grass -> Dirt ------------------------------------------------------------------------------------------------ --- by Mossmanikin --- License (everything): WTFPL --- Looked at code from: darkage, default, farming, sickle, stairs --- Dependencies: default, farming --- Supports: flint, stoneage, sumpf ------------------------------------------------------------------------------------------------ - ------------------------------------------------------------------------------------------------ --- Short Grass ------------------------------------------------------------------------------------------------ -minetest.register_craft({ - output = "default:dirt", - recipe = { - {"dryplants:grass_short"}, - } -}) - ------------------------------------------------------------------------------------------------ --- Cut Grass ------------------------------------------------------------------------------------------------ --- grass recipes (remove roots) -minetest.register_craft({ - output = "dryplants:grass", - recipe = { - {"default:grass_1"}, - } -}) -minetest.register_craft({ - output = "dryplants:grass", - recipe = { - {"default:junglegrass"}, - } -}) -if minetest.get_modpath("sumpf") ~= nil then - minetest.register_craft({ - output = "dryplants:grass", - recipe = { - {"sumpf:gras"}, - } - }) -end - ------------------------------------------------------------------------------------------------ --- Sickle ------------------------------------------------------------------------------------------------ -minetest.register_craft({ - output = "dryplants:sickle", - recipe = { - {"group:stone",""}, - {"", "default:stick"}, - {"default:stick",""} - } -}) -if minetest.get_modpath("flint") ~= nil then - minetest.register_craft({ - output = "dryplants:sickle", - recipe = { - {"flint:flintstone",""}, - {"", "default:stick"}, - {"default:stick",""} - } - }) -end -if minetest.get_modpath("stoneage") ~= nil then - minetest.register_craft({ - output = "dryplants:sickle", - recipe = { - {"stoneage:silex",""}, - {"", "default:stick"}, - {"default:stick",""} - } - }) -end - ------------------------------------------------------------------------------------------------ --- Hay ------------------------------------------------------------------------------------------------ ---cooking -minetest.register_craft({ - type = "cooking", - output = "dryplants:hay", - recipe = "dryplants:grass", - cooktime = 2, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "dryplants:hay", - burntime = 1, -}) - ------------------------------------------------------------------------------------------------ --- Wet Reed ------------------------------------------------------------------------------------------------ -minetest.register_craft({ -- papyrus -> wetreed - output = "dryplants:wetreed 2", - recipe = { - {"default:papyrus","default:papyrus"}, - {"default:papyrus","default:papyrus"}, - } -}) -minetest.register_craft({ -- reedmace_sapling -> wetreed - output = "dryplants:wetreed 2", - recipe = { - {"dryplants:reedmace_sapling","dryplants:reedmace_sapling"}, - {"dryplants:reedmace_sapling","dryplants:reedmace_sapling"}, - } -}) -minetest.register_craft({ -- reedmace_top -> wetreed - output = "dryplants:wetreed 2", - recipe = { - {"dryplants:reedmace_top","dryplants:reedmace_top"}, - {"dryplants:reedmace_top","dryplants:reedmace_top"}, - } -}) -minetest.register_craft({ -- reedmace -> wetreed - output = "dryplants:wetreed 2", - recipe = { - {"dryplants:reedmace","dryplants:reedmace"}, - {"dryplants:reedmace","dryplants:reedmace"}, - } -}) -minetest.register_craft({ -- reedmace_bottom -> wetreed - output = "dryplants:wetreed 2", - recipe = { - {"dryplants:reedmace_bottom","dryplants:reedmace_bottom"}, - {"dryplants:reedmace_bottom","dryplants:reedmace_bottom"}, - } -}) - - -local ReeD = { - {"wetreed"}, - {"reed"} -} -for i in pairs(ReeD) do - local reed = "dryplants:"..ReeD[i][1] - local slab = reed.."_slab" - local roof = reed.."_roof" - local corner = roof.."_corner" - local corner_2 = corner.."_2" ------------------------------------------------------------------------------------------------ --- Block ------------------------------------------------------------------------------------------------ - minetest.register_craft({ -- slab -> block - output = reed, - recipe = { - {slab}, - {slab}, - } - }) - minetest.register_craft({ -- roof -> block - output = reed, - recipe = { - {roof}, - {roof}, - } - }) - minetest.register_craft({ -- corner -> block - type = "shapeless", - output = reed.." 3", - recipe = {corner,corner,corner,corner,corner,corner,corner,corner}, -- 8x - }) - minetest.register_craft({ -- corner_2 -> block - type = "shapeless", - output = reed.." 3", - recipe = {corner_2,corner_2,corner_2,corner_2,corner_2,corner_2,corner_2,corner_2}, -- 8x - }) ------------------------------------------------------------------------------------------------ --- Slab ------------------------------------------------------------------------------------------------ - minetest.register_craft({ -- block -> slab - output = slab.." 6", - recipe = { - {reed,reed,reed}, - } - }) - minetest.register_craft({ -- roof -> slab - output = slab, - recipe = { - {roof}, - } - }) - minetest.register_craft({ -- corner -> slab - output = slab.." 3", - recipe = { - {corner,corner}, - {corner,corner}, - } - }) - minetest.register_craft({ -- corner_2 -> slab - output = slab.." 3", - recipe = { - {corner_2,corner_2}, - {corner_2,corner_2}, - } - }) ------------------------------------------------------------------------------------------------ --- Roof ------------------------------------------------------------------------------------------------ - minetest.register_craft({ -- block -> roof - output = roof.." 4", - recipe = { - {reed,""}, - {"",reed}, - } - }) - minetest.register_craft({ -- block -> roof - output = roof.." 4", - recipe = { - {"",reed}, - {reed,""}, - } - }) - minetest.register_craft({ -- slab -> roof - output = roof, - recipe = { - {slab}, - } - }) ------------------------------------------------------------------------------------------------ --- Roof Corner ------------------------------------------------------------------------------------------------ - minetest.register_craft({ -- block -> corner - output = corner.." 8", - recipe = { - {"",reed,""}, - {reed,"",reed}, - } - }) - minetest.register_craft({ -- corner_2 -> corner - output = corner, - recipe = { - {corner_2}, - } - }) ------------------------------------------------------------------------------------------------ --- Roof Corner 2 ------------------------------------------------------------------------------------------------ - minetest.register_craft({ -- block -> corner_2 - output = corner_2.." 8", - recipe = { - {reed,"",reed}, - {"",reed,""}, - } - }) - minetest.register_craft({ -- corner -> corner_2 - output = corner_2, - recipe = { - {corner}, - } - }) -end - ------------------------------------------------------------------------------------------------ --- Reed ------------------------------------------------------------------------------------------------ -minetest.register_craft({ -- hay -> reed - output = "dryplants:reed 2", - recipe = { - {"dryplants:hay","dryplants:hay"}, - {"dryplants:hay","dryplants:hay"}, - } -}) ---cooking -minetest.register_craft({ -- wetreed -> reed - type = "cooking", - output = "dryplants:reed", - recipe = "dryplants:wetreed", - cooktime = 2, -}) ---fuel -minetest.register_craft({ - type = "fuel", - recipe = "dryplants:reed", - burntime = 4, -}) ------------------------------------------------------------------------------------------------ --- Reed Slab ------------------------------------------------------------------------------------------------ ---cooking -minetest.register_craft({ -- wetreed_slab -> reed_slab - type = "cooking", - output = "dryplants:reed_slab", - recipe = "dryplants:wetreed_slab", - cooktime = 1, -}) ---fuel -minetest.register_craft({ - type = "fuel", - recipe = "dryplants:reed_slab", - burntime = 2, -}) ------------------------------------------------------------------------------------------------ --- Reed Roof ------------------------------------------------------------------------------------------------ ---cooking -minetest.register_craft({ -- wetreed_roof -> reed_roof - type = "cooking", - output = "dryplants:reed_roof", - recipe = "dryplants:wetreed_roof", - cooktime = 1, -}) ---fuel -minetest.register_craft({ - type = "fuel", - recipe = "dryplants:reed_roof", - burntime = 2, -}) ------------------------------------------------------------------------------------------------ --- Reed Roof Corner ------------------------------------------------------------------------------------------------ ---cooking -minetest.register_craft({ -- wetreed_roof_corner -> reed_roof_corner - type = "cooking", - output = "dryplants:reed_roof_corner", - recipe = "dryplants:wetreed_roof_corner", - cooktime = 1, -}) ---fuel -minetest.register_craft({ - type = "fuel", - recipe = "dryplants:reed_roof_corner", - burntime = 2, -}) ------------------------------------------------------------------------------------------------ --- Wet Reed Roof Corner 2 ------------------------------------------------------------------------------------------------ ---cooking -minetest.register_craft({ -- wetreed_roof_corner -> reed_roof_corner - type = "cooking", - output = "dryplants:reed_roof_corner_2", - recipe = "dryplants:wetreed_roof_corner_2", - cooktime = 1, -}) ---fuel -minetest.register_craft({ - type = "fuel", - recipe = "dryplants:reed_roof_corner_2", - burntime = 2, -}) ------------------------------------------------------------------------------------------------ --- Dandelion Leave ------------------------------------------------------------------------------------------------ ---[[minetest.register_craftitem("dryplants:dandelion_leave", { - description = "Dandelion Leave", - inventory_image = "dryplants_dandelion_leave.png", - on_use = minetest.item_eat(1), -}) -minetest.register_craft({ - type = "shapeless", - output = "dryplants:dandelion_leave 4", - recipe = {"flowers:dandelion_yellow"}, - replacements = { - {"flowers:dandelion_yellow", "dye:yellow"} - }, +----------------------------------------------------------------------------------------------- +-- Dry Plants - Recipes 0.1.0 -- Short Grass -> Dirt +----------------------------------------------------------------------------------------------- +-- by Mossmanikin +-- License (everything): WTFPL +-- Looked at code from: darkage, default, farming, sickle, stairs +-- Dependencies: default, farming +-- Supports: flint, stoneage, sumpf +----------------------------------------------------------------------------------------------- + +----------------------------------------------------------------------------------------------- +-- Short Grass +----------------------------------------------------------------------------------------------- +minetest.register_craft({ + output = "default:dirt", + recipe = { + {"dryplants:grass_short"}, + } +}) + +----------------------------------------------------------------------------------------------- +-- Cut Grass +----------------------------------------------------------------------------------------------- +-- grass recipes (remove roots) +minetest.register_craft({ + output = "dryplants:grass", + recipe = { + {"default:grass_1"}, + } +}) +minetest.register_craft({ + output = "dryplants:grass", + recipe = { + {"default:junglegrass"}, + } +}) +if minetest.get_modpath("sumpf") ~= nil then + minetest.register_craft({ + output = "dryplants:grass", + recipe = { + {"sumpf:gras"}, + } + }) +end + +----------------------------------------------------------------------------------------------- +-- Sickle +----------------------------------------------------------------------------------------------- +minetest.register_craft({ + output = "dryplants:sickle", + recipe = { + {"group:stone",""}, + {"", "default:stick"}, + {"default:stick",""} + } +}) +if minetest.get_modpath("flint") ~= nil then + minetest.register_craft({ + output = "dryplants:sickle", + recipe = { + {"flint:flintstone",""}, + {"", "default:stick"}, + {"default:stick",""} + } + }) +end +if minetest.get_modpath("stoneage") ~= nil then + minetest.register_craft({ + output = "dryplants:sickle", + recipe = { + {"stoneage:silex",""}, + {"", "default:stick"}, + {"default:stick",""} + } + }) +end + +----------------------------------------------------------------------------------------------- +-- Hay +----------------------------------------------------------------------------------------------- +--cooking +minetest.register_craft({ + type = "cooking", + output = "dryplants:hay", + recipe = "dryplants:grass", + cooktime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "dryplants:hay", + burntime = 1, +}) + +----------------------------------------------------------------------------------------------- +-- Wet Reed +----------------------------------------------------------------------------------------------- +minetest.register_craft({ -- papyrus -> wetreed + output = "dryplants:wetreed 2", + recipe = { + {"default:papyrus","default:papyrus"}, + {"default:papyrus","default:papyrus"}, + } +}) +minetest.register_craft({ -- reedmace_sapling -> wetreed + output = "dryplants:wetreed 2", + recipe = { + {"dryplants:reedmace_sapling","dryplants:reedmace_sapling"}, + {"dryplants:reedmace_sapling","dryplants:reedmace_sapling"}, + } +}) +minetest.register_craft({ -- reedmace_top -> wetreed + output = "dryplants:wetreed 2", + recipe = { + {"dryplants:reedmace_top","dryplants:reedmace_top"}, + {"dryplants:reedmace_top","dryplants:reedmace_top"}, + } +}) +minetest.register_craft({ -- reedmace -> wetreed + output = "dryplants:wetreed 2", + recipe = { + {"dryplants:reedmace","dryplants:reedmace"}, + {"dryplants:reedmace","dryplants:reedmace"}, + } +}) +minetest.register_craft({ -- reedmace_bottom -> wetreed + output = "dryplants:wetreed 2", + recipe = { + {"dryplants:reedmace_bottom","dryplants:reedmace_bottom"}, + {"dryplants:reedmace_bottom","dryplants:reedmace_bottom"}, + } +}) + + +local ReeD = { + {"wetreed"}, + {"reed"} +} +for i in pairs(ReeD) do + local reed = "dryplants:"..ReeD[i][1] + local slab = reed.."_slab" + local roof = reed.."_roof" + local corner = roof.."_corner" + local corner_2 = corner.."_2" +----------------------------------------------------------------------------------------------- +-- Block +----------------------------------------------------------------------------------------------- + minetest.register_craft({ -- slab -> block + output = reed, + recipe = { + {slab}, + {slab}, + } + }) + minetest.register_craft({ -- roof -> block + output = reed, + recipe = { + {roof}, + {roof}, + } + }) + minetest.register_craft({ -- corner -> block + type = "shapeless", + output = reed.." 3", + recipe = {corner,corner,corner,corner,corner,corner,corner,corner}, -- 8x + }) + minetest.register_craft({ -- corner_2 -> block + type = "shapeless", + output = reed.." 3", + recipe = {corner_2,corner_2,corner_2,corner_2,corner_2,corner_2,corner_2,corner_2}, -- 8x + }) +----------------------------------------------------------------------------------------------- +-- Slab +----------------------------------------------------------------------------------------------- + minetest.register_craft({ -- block -> slab + output = slab.." 6", + recipe = { + {reed,reed,reed}, + } + }) + minetest.register_craft({ -- roof -> slab + output = slab, + recipe = { + {roof}, + } + }) + minetest.register_craft({ -- corner -> slab + output = slab.." 3", + recipe = { + {corner,corner}, + {corner,corner}, + } + }) + minetest.register_craft({ -- corner_2 -> slab + output = slab.." 3", + recipe = { + {corner_2,corner_2}, + {corner_2,corner_2}, + } + }) +----------------------------------------------------------------------------------------------- +-- Roof +----------------------------------------------------------------------------------------------- + minetest.register_craft({ -- block -> roof + output = roof.." 4", + recipe = { + {reed,""}, + {"",reed}, + } + }) + minetest.register_craft({ -- block -> roof + output = roof.." 4", + recipe = { + {"",reed}, + {reed,""}, + } + }) + minetest.register_craft({ -- slab -> roof + output = roof, + recipe = { + {slab}, + } + }) +----------------------------------------------------------------------------------------------- +-- Roof Corner +----------------------------------------------------------------------------------------------- + minetest.register_craft({ -- block -> corner + output = corner.." 8", + recipe = { + {"",reed,""}, + {reed,"",reed}, + } + }) + minetest.register_craft({ -- corner_2 -> corner + output = corner, + recipe = { + {corner_2}, + } + }) +----------------------------------------------------------------------------------------------- +-- Roof Corner 2 +----------------------------------------------------------------------------------------------- + minetest.register_craft({ -- block -> corner_2 + output = corner_2.." 8", + recipe = { + {reed,"",reed}, + {"",reed,""}, + } + }) + minetest.register_craft({ -- corner -> corner_2 + output = corner_2, + recipe = { + {corner}, + } + }) +end + +----------------------------------------------------------------------------------------------- +-- Reed +----------------------------------------------------------------------------------------------- +minetest.register_craft({ -- hay -> reed + output = "dryplants:reed 2", + recipe = { + {"dryplants:hay","dryplants:hay"}, + {"dryplants:hay","dryplants:hay"}, + } +}) +--cooking +minetest.register_craft({ -- wetreed -> reed + type = "cooking", + output = "dryplants:reed", + recipe = "dryplants:wetreed", + cooktime = 2, +}) +--fuel +minetest.register_craft({ + type = "fuel", + recipe = "dryplants:reed", + burntime = 4, +}) +----------------------------------------------------------------------------------------------- +-- Reed Slab +----------------------------------------------------------------------------------------------- +--cooking +minetest.register_craft({ -- wetreed_slab -> reed_slab + type = "cooking", + output = "dryplants:reed_slab", + recipe = "dryplants:wetreed_slab", + cooktime = 1, +}) +--fuel +minetest.register_craft({ + type = "fuel", + recipe = "dryplants:reed_slab", + burntime = 2, +}) +----------------------------------------------------------------------------------------------- +-- Reed Roof +----------------------------------------------------------------------------------------------- +--cooking +minetest.register_craft({ -- wetreed_roof -> reed_roof + type = "cooking", + output = "dryplants:reed_roof", + recipe = "dryplants:wetreed_roof", + cooktime = 1, +}) +--fuel +minetest.register_craft({ + type = "fuel", + recipe = "dryplants:reed_roof", + burntime = 2, +}) +----------------------------------------------------------------------------------------------- +-- Reed Roof Corner +----------------------------------------------------------------------------------------------- +--cooking +minetest.register_craft({ -- wetreed_roof_corner -> reed_roof_corner + type = "cooking", + output = "dryplants:reed_roof_corner", + recipe = "dryplants:wetreed_roof_corner", + cooktime = 1, +}) +--fuel +minetest.register_craft({ + type = "fuel", + recipe = "dryplants:reed_roof_corner", + burntime = 2, +}) +----------------------------------------------------------------------------------------------- +-- Wet Reed Roof Corner 2 +----------------------------------------------------------------------------------------------- +--cooking +minetest.register_craft({ -- wetreed_roof_corner -> reed_roof_corner + type = "cooking", + output = "dryplants:reed_roof_corner_2", + recipe = "dryplants:wetreed_roof_corner_2", + cooktime = 1, +}) +--fuel +minetest.register_craft({ + type = "fuel", + recipe = "dryplants:reed_roof_corner_2", + burntime = 2, +}) +----------------------------------------------------------------------------------------------- +-- Dandelion Leave +----------------------------------------------------------------------------------------------- +--[[minetest.register_craftitem("dryplants:dandelion_leave", { + description = "Dandelion Leave", + inventory_image = "dryplants_dandelion_leave.png", + on_use = minetest.item_eat(1), +}) +minetest.register_craft({ + type = "shapeless", + output = "dryplants:dandelion_leave 4", + recipe = {"flowers:dandelion_yellow"}, + replacements = { + {"flowers:dandelion_yellow", "dye:yellow"} + }, })]] \ No newline at end of file diff --git a/dryplants/init.lua b/dryplants/init.lua index fac599c..461a9dd 100644 --- a/dryplants/init.lua +++ b/dryplants/init.lua @@ -1,206 +1,206 @@ ------------------------------------------------------------------------------------------------ -local title = "Grasses" -- former "Dry plants" -local version = "0.1.5" -local mname = "dryplants" ------------------------------------------------------------------------------------------------ --- by Mossmanikin --- textures & ideas partly by Neuromancer - --- License (everything): WTFPL --- Contains code from: default, farming --- Looked at code from: darkage, sickle, stairs --- Dependencies: default, farming, biome_lib --- Supports: ------------------------------------------------------------------------------------------------ -abstract_dryplants = {} - --- support for i18n -local S = plantlife_i18n.gettext - -dofile(minetest.get_modpath("dryplants").."/crafting.lua") -dofile(minetest.get_modpath("dryplants").."/settings.txt") -dofile(minetest.get_modpath("dryplants").."/reed.lua") -if REEDMACE_GENERATES == true then -dofile(minetest.get_modpath("dryplants").."/reedmace.lua") -end -if SMALL_JUNCUS_GENERATES == true then -dofile(minetest.get_modpath("dryplants").."/juncus.lua") -end -if EXTRA_TALL_GRASS_GENERATES == true then -dofile(minetest.get_modpath("dryplants").."/moregrass.lua") -end ---dofile(minetest.get_modpath("dryplants").."/meadowvariation.lua") - ------------------------------------------------------------------------------------------------ --- Sickle ------------------------------------------------------------------------------------------------ -local function sickle_can_break(pos, deff, player) - local def = ItemStack({name=deff.name}):get_definition() - - if not def.diggable or (def.can_dig and not def.can_dig(pos,player)) then - minetest.log("info", player:get_player_name() .. " tried to sickle " - .. def.name .. " which is not diggable " - .. minetest.pos_to_string(pos)) - return - end - - if minetest.is_protected(pos, player:get_player_name()) then - minetest.log("action", player:get_player_name() - .. " tried to sickle " .. def.name - .. " at protected position " - .. minetest.pos_to_string(pos)) - minetest.record_protection_violation(pos, player:get_player_name()) - return - end - - return true -end --- turns nodes with group flora=1 & flower=0 into cut grass -local function sickle_on_use(itemstack, user, pointed_thing, uses) - local pt = pointed_thing - -- check if pointing at a node - if not pt then - return - end - if pt.type ~= "node" then - return - end - - local under = minetest.get_node(pt.under) - local above_pos = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z} - local above = minetest.get_node(above_pos) - - -- return if any of the nodes is not registered - if not minetest.registered_nodes[under.name] then - return - end - if not minetest.registered_nodes[above.name] then - return - end - - if not sickle_can_break(pt.under, under, user) then - return - end - -- check if something that can be cut using fine tools - if minetest.get_item_group(under.name, "snappy") > 0 then - -- check if flora but no flower - if minetest.get_item_group(under.name, "flora") == 1 and minetest.get_item_group(under.name, "flower") == 0 then - -- turn the node into cut grass, wear out item and play sound - minetest.set_node(pt.under, {name="dryplants:grass"}) - else -- otherwise dig the node - if not minetest.node_dig(pt.under, under, user) then - return - end - end - minetest.sound_play("default_dig_crumbly", { - pos = pt.under, - gain = 0.5, - }) - itemstack:add_wear(65535/(uses-1)) - return itemstack - elseif string.find(under.name, "default:dirt_with_grass") then - if minetest.is_protected(above_pos, user:get_player_name()) or above.name ~= "air" then - return - end - minetest.set_node(pt.under, {name="dryplants:grass_short"}) - minetest.set_node(above_pos, {name="dryplants:grass"}) - minetest.sound_play("default_dig_crumbly", { - pos = pt.under, - gain = 0.5, - }) - itemstack:add_wear(65535/(uses-1)) - return itemstack - end -end --- the tool -minetest.register_tool("dryplants:sickle", { - description = S("Sickle"), - inventory_image = "dryplants_sickle.png", - on_use = function(itemstack, user, pointed_thing) - return sickle_on_use(itemstack, user, pointed_thing, 220) - end, -}) - ------------------------------------------------------------------------------------------------ --- Cut Grass ------------------------------------------------------------------------------------------------ -minetest.register_node("dryplants:grass", { - description = S("Cut Grass"), - inventory_image = "dryplants_grass.png", - wield_image = "dryplants_grass.png", - paramtype = "light", - sunlight_propagates = true, - tiles = {"dryplants_grass.png"}, - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = {-0.5 , -0.5 , -0.5 , 0.5 , -0.4375, 0.5 }, - }, - groups = {snappy=3, flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - ------------------------------------------------------------------------------------------------ --- Cut Grass becomes Hay over time ------------------------------------------------------------------------------------------------ -minetest.register_abm({ - nodenames = {"dryplants:grass"}, - interval = HAY_DRYING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle - chance = 1, - action = function(pos) - minetest.set_node(pos, {name="dryplants:hay"}) - end, -}) - ------------------------------------------------------------------------------------------------ --- Hay ------------------------------------------------------------------------------------------------ -minetest.register_node("dryplants:hay", { - description = S("Hay"), - inventory_image = "dryplants_hay.png", - wield_image = "dryplants_hay.png", - paramtype = "light", - sunlight_propagates = true, - tiles = {"dryplants_hay.png"}, - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = {-0.5 , -0.5 , -0.5 , 0.5 , -0.4375, 0.5 }, - }, - groups = {snappy=3, flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - ------------------------------------------------------------------------------------------------ --- Short Grass ------------------------------------------------------------------------------------------------ -minetest.register_node("dryplants:grass_short", { - description = S("Short Grass"), - tiles = {"default_grass.png^dryplants_grass_short.png", "default_dirt.png", "default_dirt.png^default_grass_side.png^dryplants_grass_short_side.png"}, - is_ground_content = true, - groups = {crumbly=3,soil=1,not_in_creative_inventory=1}, - --drop = 'default:dirt', - sounds = default.node_sound_dirt_defaults({ - footstep = {name="default_grass_footstep", gain=0.4}, - }), -}) - ------------------------------------------------------------------------------------------------ --- Short Grass becomes Dirt with Grass over time ------------------------------------------------------------------------------------------------ -minetest.register_abm({ - nodenames = {"dryplants:grass_short"}, - interval = GRASS_REGROWING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle - chance = 100/GRASS_REGROWING_CHANCE, - action = function(pos) - -- Only become dirt with grass if no cut grass or hay lies on top - local above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}) - if above.name ~= "dryplants:grass" and above.name ~= "dryplants:hay" then - minetest.set_node(pos, {name="default:dirt_with_grass"}) - end - end, -}) - ------------------------------------------------------------------------------------------------ -print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...") ------------------------------------------------------------------------------------------------ +----------------------------------------------------------------------------------------------- +local title = "Grasses" -- former "Dry plants" +local version = "0.1.5" +local mname = "dryplants" +----------------------------------------------------------------------------------------------- +-- by Mossmanikin +-- textures & ideas partly by Neuromancer + +-- License (everything): WTFPL +-- Contains code from: default, farming +-- Looked at code from: darkage, sickle, stairs +-- Dependencies: default, farming, biome_lib +-- Supports: +----------------------------------------------------------------------------------------------- +abstract_dryplants = {} + +-- support for i18n +local S = plantlife_i18n.gettext + +dofile(minetest.get_modpath("dryplants").."/crafting.lua") +dofile(minetest.get_modpath("dryplants").."/settings.txt") +dofile(minetest.get_modpath("dryplants").."/reed.lua") +if REEDMACE_GENERATES == true then +dofile(minetest.get_modpath("dryplants").."/reedmace.lua") +end +if SMALL_JUNCUS_GENERATES == true then +dofile(minetest.get_modpath("dryplants").."/juncus.lua") +end +if EXTRA_TALL_GRASS_GENERATES == true then +dofile(minetest.get_modpath("dryplants").."/moregrass.lua") +end +--dofile(minetest.get_modpath("dryplants").."/meadowvariation.lua") + +----------------------------------------------------------------------------------------------- +-- Sickle +----------------------------------------------------------------------------------------------- +local function sickle_can_break(pos, deff, player) + local def = ItemStack({name=deff.name}):get_definition() + + if not def.diggable or (def.can_dig and not def.can_dig(pos,player)) then + minetest.log("info", player:get_player_name() .. " tried to sickle " + .. def.name .. " which is not diggable " + .. minetest.pos_to_string(pos)) + return + end + + if minetest.is_protected(pos, player:get_player_name()) then + minetest.log("action", player:get_player_name() + .. " tried to sickle " .. def.name + .. " at protected position " + .. minetest.pos_to_string(pos)) + minetest.record_protection_violation(pos, player:get_player_name()) + return + end + + return true +end +-- turns nodes with group flora=1 & flower=0 into cut grass +local function sickle_on_use(itemstack, user, pointed_thing, uses) + local pt = pointed_thing + -- check if pointing at a node + if not pt then + return + end + if pt.type ~= "node" then + return + end + + local under = minetest.get_node(pt.under) + local above_pos = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z} + local above = minetest.get_node(above_pos) + + -- return if any of the nodes is not registered + if not minetest.registered_nodes[under.name] then + return + end + if not minetest.registered_nodes[above.name] then + return + end + + if not sickle_can_break(pt.under, under, user) then + return + end + -- check if something that can be cut using fine tools + if minetest.get_item_group(under.name, "snappy") > 0 then + -- check if flora but no flower + if minetest.get_item_group(under.name, "flora") == 1 and minetest.get_item_group(under.name, "flower") == 0 then + -- turn the node into cut grass, wear out item and play sound + minetest.set_node(pt.under, {name="dryplants:grass"}) + else -- otherwise dig the node + if not minetest.node_dig(pt.under, under, user) then + return + end + end + minetest.sound_play("default_dig_crumbly", { + pos = pt.under, + gain = 0.5, + }) + itemstack:add_wear(65535/(uses-1)) + return itemstack + elseif string.find(under.name, "default:dirt_with_grass") then + if minetest.is_protected(above_pos, user:get_player_name()) or above.name ~= "air" then + return + end + minetest.set_node(pt.under, {name="dryplants:grass_short"}) + minetest.set_node(above_pos, {name="dryplants:grass"}) + minetest.sound_play("default_dig_crumbly", { + pos = pt.under, + gain = 0.5, + }) + itemstack:add_wear(65535/(uses-1)) + return itemstack + end +end +-- the tool +minetest.register_tool("dryplants:sickle", { + description = S("Sickle"), + inventory_image = "dryplants_sickle.png", + on_use = function(itemstack, user, pointed_thing) + return sickle_on_use(itemstack, user, pointed_thing, 220) + end, +}) + +----------------------------------------------------------------------------------------------- +-- Cut Grass +----------------------------------------------------------------------------------------------- +minetest.register_node("dryplants:grass", { + description = S("Cut Grass"), + inventory_image = "dryplants_grass.png", + wield_image = "dryplants_grass.png", + paramtype = "light", + sunlight_propagates = true, + tiles = {"dryplants_grass.png"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = {-0.5 , -0.5 , -0.5 , 0.5 , -0.4375, 0.5 }, + }, + groups = {snappy=3, flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- Cut Grass becomes Hay over time +----------------------------------------------------------------------------------------------- +minetest.register_abm({ + nodenames = {"dryplants:grass"}, + interval = HAY_DRYING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle + chance = 1, + action = function(pos) + minetest.set_node(pos, {name="dryplants:hay"}) + end, +}) + +----------------------------------------------------------------------------------------------- +-- Hay +----------------------------------------------------------------------------------------------- +minetest.register_node("dryplants:hay", { + description = S("Hay"), + inventory_image = "dryplants_hay.png", + wield_image = "dryplants_hay.png", + paramtype = "light", + sunlight_propagates = true, + tiles = {"dryplants_hay.png"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = {-0.5 , -0.5 , -0.5 , 0.5 , -0.4375, 0.5 }, + }, + groups = {snappy=3, flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- Short Grass +----------------------------------------------------------------------------------------------- +minetest.register_node("dryplants:grass_short", { + description = S("Short Grass"), + tiles = {"default_grass.png^dryplants_grass_short.png", "default_dirt.png", "default_dirt.png^default_grass_side.png^dryplants_grass_short_side.png"}, + is_ground_content = true, + groups = {crumbly=3,soil=1,not_in_creative_inventory=1}, + --drop = 'default:dirt', + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_grass_footstep", gain=0.4}, + }), +}) + +----------------------------------------------------------------------------------------------- +-- Short Grass becomes Dirt with Grass over time +----------------------------------------------------------------------------------------------- +minetest.register_abm({ + nodenames = {"dryplants:grass_short"}, + interval = GRASS_REGROWING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle + chance = 100/GRASS_REGROWING_CHANCE, + action = function(pos) + -- Only become dirt with grass if no cut grass or hay lies on top + local above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}) + if above.name ~= "dryplants:grass" and above.name ~= "dryplants:hay" then + minetest.set_node(pos, {name="default:dirt_with_grass"}) + end + end, +}) + +----------------------------------------------------------------------------------------------- +print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...") +----------------------------------------------------------------------------------------------- diff --git a/dryplants/juncus.lua b/dryplants/juncus.lua index 4a16ebc..34176ce 100644 --- a/dryplants/juncus.lua +++ b/dryplants/juncus.lua @@ -4,8 +4,8 @@ -- by Mossmanikin -- textures & ideas partly by Neuromancer --- License (everything): WTFPL --- Contains code from: biome_lib +-- License (everything): WTFPL +-- Contains code from: biome_lib -- Looked at code from: default ----------------------------------------------------------------------------------------------- diff --git a/dryplants/meadowvariation.lua b/dryplants/meadowvariation.lua index 8477657..d703ae6 100644 --- a/dryplants/meadowvariation.lua +++ b/dryplants/meadowvariation.lua @@ -3,9 +3,9 @@ ----------------------------------------------------------------------------------------------- -- by Mossmanikin --- License (everything): WTFPL --- Contains code from: biome_lib --- Looked at code from: default +-- License (everything): WTFPL +-- Contains code from: biome_lib +-- Looked at code from: default ----------------------------------------------------------------------------------------------- abstract_dryplants.grow_grass_variation = function(pos) diff --git a/dryplants/moregrass.lua b/dryplants/moregrass.lua index 88761c8..2593d73 100644 --- a/dryplants/moregrass.lua +++ b/dryplants/moregrass.lua @@ -1,33 +1,33 @@ ------------------------------------------------------------------------------------------------ --- Grasses - More Tall Grass 0.0.2 ------------------------------------------------------------------------------------------------ --- by Mossmanikin - --- License (everything): WTFPL --- Contains code from: biome_lib --- Looked at code from: default ------------------------------------------------------------------------------------------------ - -abstract_dryplants.grow_grass = function(pos) - local right_here = {x=pos.x, y=pos.y+1, z=pos.z} - local grass_size = math.random(1,5) - if minetest.get_node(right_here).name == "air" -- instead of check_air = true, - or minetest.get_node(right_here).name == "default:junglegrass" then - minetest.set_node(right_here, {name="default:grass_"..grass_size}) - end -end - -biome_lib:register_generate_plant({ - surface = { - "default:dirt_with_grass", - "stoneage:grass_with_silex", - "sumpf:peat", - "sumpf:sumpf" - }, - max_count = TALL_GRASS_PER_MAPBLOCK, - rarity = 101 - TALL_GRASS_RARITY, - min_elevation = 1, -- above sea level - plantlife_limit = -0.9, - }, - abstract_dryplants.grow_grass -) +----------------------------------------------------------------------------------------------- +-- Grasses - More Tall Grass 0.0.2 +----------------------------------------------------------------------------------------------- +-- by Mossmanikin + +-- License (everything): WTFPL +-- Contains code from: biome_lib +-- Looked at code from: default +----------------------------------------------------------------------------------------------- + +abstract_dryplants.grow_grass = function(pos) + local right_here = {x=pos.x, y=pos.y+1, z=pos.z} + local grass_size = math.random(1,5) + if minetest.get_node(right_here).name == "air" -- instead of check_air = true, + or minetest.get_node(right_here).name == "default:junglegrass" then + minetest.set_node(right_here, {name="default:grass_"..grass_size}) + end +end + +biome_lib:register_generate_plant({ + surface = { + "default:dirt_with_grass", + "stoneage:grass_with_silex", + "sumpf:peat", + "sumpf:sumpf" + }, + max_count = TALL_GRASS_PER_MAPBLOCK, + rarity = 101 - TALL_GRASS_RARITY, + min_elevation = 1, -- above sea level + plantlife_limit = -0.9, + }, + abstract_dryplants.grow_grass +) diff --git a/dryplants/reed.lua b/dryplants/reed.lua index db7d937..707cafc 100644 --- a/dryplants/reed.lua +++ b/dryplants/reed.lua @@ -1,383 +1,383 @@ ------------------------------------------------------------------------------------------------ --- Dry Plants - Reed 0.0.5 ------------------------------------------------------------------------------------------------ --- by Mossmanikin --- License (everything): WTFPL --- Looked at code from: darkage, default, stairs --- Dependencies: default ------------------------------------------------------------------------------------------------ --- support for i18n -local S = plantlife_i18n.gettext - -minetest.register_alias("stairs:stair_wetreed", "dryplants:wetreed_roof") -minetest.register_alias("stairs:slab_wetreed", "dryplants:wetreed_slab") -minetest.register_alias("stairs:stair_reed", "dryplants:reed_roof") -minetest.register_alias("stairs:slab_reed", "dryplants:reed_slab") - - ------------------------------------------------------------------------------------------------ --- Wet Reed ------------------------------------------------------------------------------------------------ -minetest.register_node("dryplants:wetreed", { - description = S("Wet Reed"), - paramtype = "light", - paramtype2 = "facedir", - tiles = {"dryplants_reed_wet.png"}, - groups = {snappy=3, flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - ------------------------------------------------------------------------------------------------ --- Wet Reed Slab ------------------------------------------------------------------------------------------------ -minetest.register_node("dryplants:wetreed_slab", { - description = S("Wet Reed Slab"), - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - tiles = {"dryplants_reed_wet.png"}, - node_box = { - type = "fixed", - fixed = {-1/2, -1/2, -1/2, 1/2, 0, 1/2}, - }, - selection_box = { - type = "fixed", - fixed = {-1/2, -1/2, -1/2, 1/2, 0, 1/2}, - }, - groups = {snappy=3, flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - ------------------------------------------------------------------------------------------------ --- Wet Reed Roof ------------------------------------------------------------------------------------------------ -minetest.register_node("dryplants:wetreed_roof", { - description = S("Wet Reed Roof"), - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - tiles = {"dryplants_reed_wet.png"}, - node_box = { - type = "fixed", --- { left , bottom , front , right , top , back } - fixed = { - {-1/2, 0, 0, 1/2, 1/2, 1/2}, - {-1/2, -1/2, -1/2, 1/2, 0, 0}, - } - }, - selection_box = { - type = "fixed", - fixed = { - {-1/2, 0, 0, 1/2, 1/2, 1/2}, - {-1/2, -1/2, -1/2, 1/2, 0, 0}, - } - }, - groups = {snappy=3, flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - -if AUTO_ROOF_CORNER == true then - - local CoRNeR = { --- MaTeRiaL - {"wetreed"}, - {"reed"} - } - - for i in pairs(CoRNeR) do - - local MaTeRiaL = CoRNeR[i][1] - local roof = "dryplants:"..MaTeRiaL.."_roof" - local corner = "dryplants:"..MaTeRiaL.."_roof_corner" - local corner_2 = "dryplants:"..MaTeRiaL.."_roof_corner_2" - - minetest.register_abm({ - nodenames = {roof}, - interval = 1, - chance = 1, - action = function(pos) - - local node_east = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z }) - local node_west = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z }) - local node_north = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1}) - local node_south = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1}) - -- corner 1 - if ((node_west.name == roof and node_west.param2 == 0) - or (node_west.name == corner and node_west.param2 == 1)) - and ((node_north.name == roof and node_north.param2 == 3) - or (node_north.name == corner and node_north.param2 == 3)) - then - minetest.set_node(pos, {name=corner, param2=0}) - end - - if ((node_north.name == roof and node_north.param2 == 1) - or (node_north.name == corner and node_north.param2 == 2)) - and ((node_east.name == roof and node_east.param2 == 0) - or (node_east.name == corner and node_east.param2 == 0)) - then - minetest.set_node(pos, {name=corner, param2=1}) - end - - if ((node_east.name == roof and node_east.param2 == 2) - or (node_east.name == corner and node_east.param2 == 3)) - and ((node_south.name == roof and node_south.param2 == 1) - or (node_south.name == corner and node_south.param2 == 1)) - then - minetest.set_node(pos, {name=corner, param2=2}) - end - - if ((node_south.name == roof and node_south.param2 == 3) - or (node_south.name == corner and node_south.param2 == 0)) - and ((node_west.name == roof and node_west.param2 == 2) - or (node_west.name == corner and node_west.param2 == 2)) - then - minetest.set_node(pos, {name=corner, param2=3}) - end - -- corner 2 - if ((node_west.name == roof and node_west.param2 == 2) - or (node_west.name == corner_2 and node_west.param2 == 1)) - and ((node_north.name == roof and node_north.param2 == 1) - or (node_north.name == corner_2 and node_north.param2 == 3)) - then - minetest.set_node(pos, {name=corner_2, param2=0}) - end - - if ((node_north.name == roof and node_north.param2 == 3) - or (node_north.name == corner_2 and node_north.param2 == 2)) - and ((node_east.name == roof and node_east.param2 == 2) - or (node_east.name == corner_2 and node_east.param2 == 0)) - then - minetest.set_node(pos, {name=corner_2, param2=1}) - end - - if ((node_east.name == roof and node_east.param2 == 0) - or (node_east.name == corner_2 and node_east.param2 == 3)) - and ((node_south.name == roof and node_south.param2 == 3) - or (node_south.name == corner_2 and node_south.param2 == 1)) - then - minetest.set_node(pos, {name=corner_2, param2=2}) - end - - if ((node_south.name == roof and node_south.param2 == 1) - or (node_south.name == corner_2 and node_south.param2 == 0)) - and ((node_west.name == roof and node_west.param2 == 0) - or (node_west.name == corner_2 and node_west.param2 == 2)) - then - minetest.set_node(pos, {name=corner_2, param2=3}) - end - - end, - }) - end -end - ------------------------------------------------------------------------------------------------ --- Wet Reed Roof Corner ------------------------------------------------------------------------------------------------ -minetest.register_node("dryplants:wetreed_roof_corner", { - description = S("Wet Reed Roof Corner"), - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - tiles = {"dryplants_reed_wet.png"}, - node_box = { - type = "fixed", --- { left , bottom , front , right , top , back } - fixed = { - {-1/2, 0, 0, 0, 1/2, 1/2}, - {0, -1/2, 0, 1/2, 0, 1/2}, - {-1/2, -1/2, -1/2, 0, 0, 0}, - } - }, - selection_box = { - type = "fixed", - fixed = { - {-1/2, 0, 0, 0, 1/2, 1/2}, - {0, -1/2, 0, 1/2, 0, 1/2}, - {-1/2, -1/2, -1/2, 0, 0, 0}, - } - }, - groups = {snappy=3, flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - ------------------------------------------------------------------------------------------------ --- Wet Reed Roof Corner 2 ------------------------------------------------------------------------------------------------ -minetest.register_node("dryplants:wetreed_roof_corner_2", { - description = S("Wet Reed Roof Corner 2"), - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - tiles = {"dryplants_reed_wet.png"}, - node_box = { - type = "fixed", --- { left , bottom , front , right , top , back } - fixed = { - {-1/2, -1/2, 0, 0, 0, 1/2}, - {0, 0, 0, 1/2, 1/2, 1/2}, - {-1/2, 0, -1/2, 0, 1/2, 0}, - } - }, - selection_box = { - type = "fixed", - fixed = { - {-1/2, -1/2, 0, 0, 0, 1/2}, - {0, 0, 0, 1/2, 1/2, 1/2}, - {-1/2, 0, -1/2, 0, 1/2, 0}, - } - }, - groups = {snappy=3, flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - ------------------------------------------------------------------------------------------------ --- Wet Reed becomes (dry) Reed over time ------------------------------------------------------------------------------------------------ -if REED_WILL_DRY == true then - - local DRyiNG = { --- WeT DRy - {"dryplants:wetreed", "dryplants:reed"}, - {"dryplants:wetreed_slab", "dryplants:reed_slab"}, - {"dryplants:wetreed_roof", "dryplants:reed_roof"}, - {"dryplants:wetreed_roof_corner", "dryplants:reed_roof_corner"}, - {"dryplants:wetreed_roof_corner_2", "dryplants:reed_roof_corner_2"} - } - for i in pairs(DRyiNG) do - - local WeT = DRyiNG[i][1] - local DRy = DRyiNG[i][2] - - minetest.register_abm({ - nodenames = {WeT}, - interval = REED_DRYING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle - chance = 1, - action = function(pos) - local direction = minetest.get_node(pos).param2 - minetest.set_node(pos, {name=DRy, param2=direction}) - end, - }) - end -end - ------------------------------------------------------------------------------------------------ --- Reed ------------------------------------------------------------------------------------------------ -minetest.register_node("dryplants:reed", { - description = S("Reed"), - paramtype = "light", - paramtype2 = "facedir", - tiles = {"dryplants_reed.png"}, - groups = {snappy=3, flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - ------------------------------------------------------------------------------------------------ --- Reed Slab ------------------------------------------------------------------------------------------------ -minetest.register_node("dryplants:reed_slab", { - description = S("Reed Slab"), - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - tiles = {"dryplants_reed.png"}, - node_box = { - type = "fixed", - fixed = {-1/2, -1/2, -1/2, 1/2, 0, 1/2}, - }, - selection_box = { - type = "fixed", - fixed = {-1/2, -1/2, -1/2, 1/2, 0, 1/2}, - }, - groups = {snappy=3, flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - ------------------------------------------------------------------------------------------------ --- Reed Roof ------------------------------------------------------------------------------------------------ -minetest.register_node("dryplants:reed_roof", { - description = S("Reed Roof"), - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - tiles = {"dryplants_reed.png"}, - node_box = { - type = "fixed", --- { left , bottom , front , right , top , back } - fixed = { - {-1/2, 0, 0, 1/2, 1/2, 1/2}, - {-1/2, -1/2, -1/2, 1/2, 0, 0}, - } - }, - selection_box = { - type = "fixed", - fixed = { - {-1/2, 0, 0, 1/2, 1/2, 1/2}, - {-1/2, -1/2, -1/2, 1/2, 0, 0}, - } - }, - groups = {snappy=3, flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - ------------------------------------------------------------------------------------------------ --- Reed Roof Corner ------------------------------------------------------------------------------------------------ -minetest.register_node("dryplants:reed_roof_corner", { - description = S("Reed Roof Corner"), - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - tiles = {"dryplants_reed.png"}, - node_box = { - type = "fixed", --- { left , bottom , front , right , top , back } - fixed = { - {-1/2, 0, 0, 0, 1/2, 1/2}, - {0, -1/2, 0, 1/2, 0, 1/2}, - {-1/2, -1/2, -1/2, 0, 0, 0}, - } - }, - selection_box = { - type = "fixed", - fixed = { - {-1/2, 0, 0, 0, 1/2, 1/2}, - {0, -1/2, 0, 1/2, 0, 1/2}, - {-1/2, -1/2, -1/2, 0, 0, 0}, - } - }, - groups = {snappy=3, flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - ------------------------------------------------------------------------------------------------ --- Reed Roof Corner 2 ------------------------------------------------------------------------------------------------ -minetest.register_node("dryplants:reed_roof_corner_2", { - description = S("Reed Roof Corner 2"), - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - tiles = {"dryplants_reed.png"}, - node_box = { - type = "fixed", --- { left , bottom , front , right , top , back } - fixed = { - {-1/2, -1/2, 0, 0, 0, 1/2}, - {0, 0, 0, 1/2, 1/2, 1/2}, - {-1/2, 0, -1/2, 0, 1/2, 0}, - } - }, - selection_box = { - type = "fixed", - fixed = { - {-1/2, -1/2, 0, 0, 0, 1/2}, - {0, 0, 0, 1/2, 1/2, 1/2}, - {-1/2, 0, -1/2, 0, 1/2, 0}, - } - }, - groups = {snappy=3, flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) +----------------------------------------------------------------------------------------------- +-- Dry Plants - Reed 0.0.5 +----------------------------------------------------------------------------------------------- +-- by Mossmanikin +-- License (everything): WTFPL +-- Looked at code from: darkage, default, stairs +-- Dependencies: default +----------------------------------------------------------------------------------------------- +-- support for i18n +local S = plantlife_i18n.gettext + +minetest.register_alias("stairs:stair_wetreed", "dryplants:wetreed_roof") +minetest.register_alias("stairs:slab_wetreed", "dryplants:wetreed_slab") +minetest.register_alias("stairs:stair_reed", "dryplants:reed_roof") +minetest.register_alias("stairs:slab_reed", "dryplants:reed_slab") + + +----------------------------------------------------------------------------------------------- +-- Wet Reed +----------------------------------------------------------------------------------------------- +minetest.register_node("dryplants:wetreed", { + description = S("Wet Reed"), + paramtype = "light", + paramtype2 = "facedir", + tiles = {"dryplants_reed_wet.png"}, + groups = {snappy=3, flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- Wet Reed Slab +----------------------------------------------------------------------------------------------- +minetest.register_node("dryplants:wetreed_slab", { + description = S("Wet Reed Slab"), + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = {"dryplants_reed_wet.png"}, + node_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 0, 1/2}, + }, + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 0, 1/2}, + }, + groups = {snappy=3, flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- Wet Reed Roof +----------------------------------------------------------------------------------------------- +minetest.register_node("dryplants:wetreed_roof", { + description = S("Wet Reed Roof"), + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = {"dryplants_reed_wet.png"}, + node_box = { + type = "fixed", +-- { left , bottom , front , right , top , back } + fixed = { + {-1/2, 0, 0, 1/2, 1/2, 1/2}, + {-1/2, -1/2, -1/2, 1/2, 0, 0}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-1/2, 0, 0, 1/2, 1/2, 1/2}, + {-1/2, -1/2, -1/2, 1/2, 0, 0}, + } + }, + groups = {snappy=3, flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + +if AUTO_ROOF_CORNER == true then + + local CoRNeR = { +-- MaTeRiaL + {"wetreed"}, + {"reed"} + } + + for i in pairs(CoRNeR) do + + local MaTeRiaL = CoRNeR[i][1] + local roof = "dryplants:"..MaTeRiaL.."_roof" + local corner = "dryplants:"..MaTeRiaL.."_roof_corner" + local corner_2 = "dryplants:"..MaTeRiaL.."_roof_corner_2" + + minetest.register_abm({ + nodenames = {roof}, + interval = 1, + chance = 1, + action = function(pos) + + local node_east = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z }) + local node_west = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z }) + local node_north = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1}) + local node_south = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1}) + -- corner 1 + if ((node_west.name == roof and node_west.param2 == 0) + or (node_west.name == corner and node_west.param2 == 1)) + and ((node_north.name == roof and node_north.param2 == 3) + or (node_north.name == corner and node_north.param2 == 3)) + then + minetest.set_node(pos, {name=corner, param2=0}) + end + + if ((node_north.name == roof and node_north.param2 == 1) + or (node_north.name == corner and node_north.param2 == 2)) + and ((node_east.name == roof and node_east.param2 == 0) + or (node_east.name == corner and node_east.param2 == 0)) + then + minetest.set_node(pos, {name=corner, param2=1}) + end + + if ((node_east.name == roof and node_east.param2 == 2) + or (node_east.name == corner and node_east.param2 == 3)) + and ((node_south.name == roof and node_south.param2 == 1) + or (node_south.name == corner and node_south.param2 == 1)) + then + minetest.set_node(pos, {name=corner, param2=2}) + end + + if ((node_south.name == roof and node_south.param2 == 3) + or (node_south.name == corner and node_south.param2 == 0)) + and ((node_west.name == roof and node_west.param2 == 2) + or (node_west.name == corner and node_west.param2 == 2)) + then + minetest.set_node(pos, {name=corner, param2=3}) + end + -- corner 2 + if ((node_west.name == roof and node_west.param2 == 2) + or (node_west.name == corner_2 and node_west.param2 == 1)) + and ((node_north.name == roof and node_north.param2 == 1) + or (node_north.name == corner_2 and node_north.param2 == 3)) + then + minetest.set_node(pos, {name=corner_2, param2=0}) + end + + if ((node_north.name == roof and node_north.param2 == 3) + or (node_north.name == corner_2 and node_north.param2 == 2)) + and ((node_east.name == roof and node_east.param2 == 2) + or (node_east.name == corner_2 and node_east.param2 == 0)) + then + minetest.set_node(pos, {name=corner_2, param2=1}) + end + + if ((node_east.name == roof and node_east.param2 == 0) + or (node_east.name == corner_2 and node_east.param2 == 3)) + and ((node_south.name == roof and node_south.param2 == 3) + or (node_south.name == corner_2 and node_south.param2 == 1)) + then + minetest.set_node(pos, {name=corner_2, param2=2}) + end + + if ((node_south.name == roof and node_south.param2 == 1) + or (node_south.name == corner_2 and node_south.param2 == 0)) + and ((node_west.name == roof and node_west.param2 == 0) + or (node_west.name == corner_2 and node_west.param2 == 2)) + then + minetest.set_node(pos, {name=corner_2, param2=3}) + end + + end, + }) + end +end + +----------------------------------------------------------------------------------------------- +-- Wet Reed Roof Corner +----------------------------------------------------------------------------------------------- +minetest.register_node("dryplants:wetreed_roof_corner", { + description = S("Wet Reed Roof Corner"), + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = {"dryplants_reed_wet.png"}, + node_box = { + type = "fixed", +-- { left , bottom , front , right , top , back } + fixed = { + {-1/2, 0, 0, 0, 1/2, 1/2}, + {0, -1/2, 0, 1/2, 0, 1/2}, + {-1/2, -1/2, -1/2, 0, 0, 0}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-1/2, 0, 0, 0, 1/2, 1/2}, + {0, -1/2, 0, 1/2, 0, 1/2}, + {-1/2, -1/2, -1/2, 0, 0, 0}, + } + }, + groups = {snappy=3, flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- Wet Reed Roof Corner 2 +----------------------------------------------------------------------------------------------- +minetest.register_node("dryplants:wetreed_roof_corner_2", { + description = S("Wet Reed Roof Corner 2"), + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = {"dryplants_reed_wet.png"}, + node_box = { + type = "fixed", +-- { left , bottom , front , right , top , back } + fixed = { + {-1/2, -1/2, 0, 0, 0, 1/2}, + {0, 0, 0, 1/2, 1/2, 1/2}, + {-1/2, 0, -1/2, 0, 1/2, 0}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-1/2, -1/2, 0, 0, 0, 1/2}, + {0, 0, 0, 1/2, 1/2, 1/2}, + {-1/2, 0, -1/2, 0, 1/2, 0}, + } + }, + groups = {snappy=3, flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- Wet Reed becomes (dry) Reed over time +----------------------------------------------------------------------------------------------- +if REED_WILL_DRY == true then + + local DRyiNG = { +-- WeT DRy + {"dryplants:wetreed", "dryplants:reed"}, + {"dryplants:wetreed_slab", "dryplants:reed_slab"}, + {"dryplants:wetreed_roof", "dryplants:reed_roof"}, + {"dryplants:wetreed_roof_corner", "dryplants:reed_roof_corner"}, + {"dryplants:wetreed_roof_corner_2", "dryplants:reed_roof_corner_2"} + } + for i in pairs(DRyiNG) do + + local WeT = DRyiNG[i][1] + local DRy = DRyiNG[i][2] + + minetest.register_abm({ + nodenames = {WeT}, + interval = REED_DRYING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle + chance = 1, + action = function(pos) + local direction = minetest.get_node(pos).param2 + minetest.set_node(pos, {name=DRy, param2=direction}) + end, + }) + end +end + +----------------------------------------------------------------------------------------------- +-- Reed +----------------------------------------------------------------------------------------------- +minetest.register_node("dryplants:reed", { + description = S("Reed"), + paramtype = "light", + paramtype2 = "facedir", + tiles = {"dryplants_reed.png"}, + groups = {snappy=3, flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- Reed Slab +----------------------------------------------------------------------------------------------- +minetest.register_node("dryplants:reed_slab", { + description = S("Reed Slab"), + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = {"dryplants_reed.png"}, + node_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 0, 1/2}, + }, + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 0, 1/2}, + }, + groups = {snappy=3, flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- Reed Roof +----------------------------------------------------------------------------------------------- +minetest.register_node("dryplants:reed_roof", { + description = S("Reed Roof"), + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = {"dryplants_reed.png"}, + node_box = { + type = "fixed", +-- { left , bottom , front , right , top , back } + fixed = { + {-1/2, 0, 0, 1/2, 1/2, 1/2}, + {-1/2, -1/2, -1/2, 1/2, 0, 0}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-1/2, 0, 0, 1/2, 1/2, 1/2}, + {-1/2, -1/2, -1/2, 1/2, 0, 0}, + } + }, + groups = {snappy=3, flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- Reed Roof Corner +----------------------------------------------------------------------------------------------- +minetest.register_node("dryplants:reed_roof_corner", { + description = S("Reed Roof Corner"), + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = {"dryplants_reed.png"}, + node_box = { + type = "fixed", +-- { left , bottom , front , right , top , back } + fixed = { + {-1/2, 0, 0, 0, 1/2, 1/2}, + {0, -1/2, 0, 1/2, 0, 1/2}, + {-1/2, -1/2, -1/2, 0, 0, 0}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-1/2, 0, 0, 0, 1/2, 1/2}, + {0, -1/2, 0, 1/2, 0, 1/2}, + {-1/2, -1/2, -1/2, 0, 0, 0}, + } + }, + groups = {snappy=3, flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + +----------------------------------------------------------------------------------------------- +-- Reed Roof Corner 2 +----------------------------------------------------------------------------------------------- +minetest.register_node("dryplants:reed_roof_corner_2", { + description = S("Reed Roof Corner 2"), + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = {"dryplants_reed.png"}, + node_box = { + type = "fixed", +-- { left , bottom , front , right , top , back } + fixed = { + {-1/2, -1/2, 0, 0, 0, 1/2}, + {0, 0, 0, 1/2, 1/2, 1/2}, + {-1/2, 0, -1/2, 0, 1/2, 0}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-1/2, -1/2, 0, 0, 0, 1/2}, + {0, 0, 0, 1/2, 1/2, 1/2}, + {-1/2, 0, -1/2, 0, 1/2, 0}, + } + }, + groups = {snappy=3, flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) diff --git a/dryplants/reedmace.lua b/dryplants/reedmace.lua index c34231f..ec37442 100644 --- a/dryplants/reedmace.lua +++ b/dryplants/reedmace.lua @@ -4,8 +4,8 @@ -- by Mossmanikin -- textures & ideas partly by Neuromancer --- License (everything): WTFPL --- Contains code from: biome_lib +-- License (everything): WTFPL +-- Contains code from: biome_lib -- Looked at code from: default, trees ----------------------------------------------------------------------------------------------- @@ -280,9 +280,9 @@ minetest.register_abm({ chance = 100/REEDMACE_GROWING_CHANCE, action = function(pos, node, _, _) if string.find(minetest.get_node({x = pos.x + 1, y = pos.y, z = pos.z }).name, "default:water") - or string.find(minetest.get_node({x = pos.x, y = pos.y, z = pos.z + 1}).name, "default:water") + or string.find(minetest.get_node({x = pos.x, y = pos.y, z = pos.z + 1}).name, "default:water") or string.find(minetest.get_node({x = pos.x - 1, y = pos.y, z = pos.z }).name, "default:water") - or string.find(minetest.get_node({x = pos.x, y = pos.y, z = pos.z - 1}).name, "default:water") then + or string.find(minetest.get_node({x = pos.x, y = pos.y, z = pos.z - 1}).name, "default:water") then if minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name == "air" then abstract_dryplants.grow_reedmace_water({x = pos.x, y = pos.y - 1, z = pos.z}) end diff --git a/ferns/crafting.lua b/ferns/crafting.lua index 7a74579..67caf1a 100644 --- a/ferns/crafting.lua +++ b/ferns/crafting.lua @@ -1,105 +1,105 @@ --- support for i18n -local S = plantlife_i18n.gettext ------------------------------------------------------------------------------------------------ --- Ferns - Crafting 0.0.5 ------------------------------------------------------------------------------------------------ --- (by Mossmanikin) --- License (everything): WTFPL ------------------------------------------------------------------------------------------------ -minetest.register_craft({ - type = "shapeless", - output = "ferns:fiddlehead 3", - recipe = {"ferns:fern_01"}, - replacements = { - {"ferns:fern_01", "ferns:ferntuber"} - }, -}) - -minetest.register_craft({ - type = "shapeless", - output = "ferns:fiddlehead 3", - recipe = {"ferns:tree_fern_leaves"}, - replacements = { - {"ferns:tree_fern_leaves", "ferns:sapling_tree_fern"} - }, -}) ------------------------------------------------------------------------------------------------ --- FIDDLEHEAD ------------------------------------------------------------------------------------------------ -minetest.register_alias("archaeplantae:fiddlehead", "ferns:fiddlehead") - -minetest.register_craftitem("ferns:fiddlehead", { - description = S("Fiddlehead"), - inventory_image = "ferns_fiddlehead.png", - on_use = minetest.item_eat(-1), -- slightly poisonous when raw -}) -minetest.register_craft({ - type = "cooking", - output = "ferns:fiddlehead_roasted", - recipe = "ferns:fiddlehead", - cooktime = 1, -}) -minetest.register_craftitem("ferns:fiddlehead_roasted", { - description = S("Roasted Fiddlehead"), - inventory_image = "ferns_fiddlehead_roasted.png", - on_use = minetest.item_eat(1), -- edible when cooked -}) ------------------------------------------------------------------------------------------------ --- FERN TUBER ------------------------------------------------------------------------------------------------ -minetest.register_alias("archaeplantae:ferntuber", "ferns:ferntuber") - -minetest.register_craftitem("ferns:ferntuber", { - description = S("Fern Tuber"), - inventory_image = "ferns_ferntuber.png", -}) -minetest.register_craft({ - type = "cooking", - output = "ferns:ferntuber_roasted", - recipe = "ferns:ferntuber", - cooktime = 3, -}) - -minetest.register_alias("archaeplantae:ferntuber_roasted", "ferns:ferntuber_roasted") - -minetest.register_craftitem("ferns:ferntuber_roasted", { - description = S("Roasted Fern Tuber"), - inventory_image = "ferns_ferntuber_roasted.png", - on_use = minetest.item_eat(3), -}) ------------------------------------------------------------------------------------------------ --- HORSETAIL (EQUISETUM) --> GREEN DYE https://en.wikipedia.org/wiki/Equisetum ------------------------------------------------------------------------------------------------ -minetest.register_craft({ - type = "shapeless", - output = "dye:green", - recipe = {"group:horsetail"}, -}) ------------------------------------------------------------------------------------------------ --- GLUE WOODEN TOOLS with RESIN & POLISH them with HORSETAIL (planned) ------------------------------------------------------------------------------------------------ ---[[minetest.register_craft({ - type = "shapeless", - output = "default:pick_wood", - recipe = {"default:pick_wood","group:horsetail","farming:string","default:stick"}, -}) -minetest.register_craft({ - type = "shapeless", - output = "default:shovel_wood", - recipe = {"default:shovel_wood","group:horsetail","farming:string","default:stick"}, -}) -minetest.register_craft({ - type = "shapeless", - output = "default:axe_wood", - recipe = {"default:axe_wood","group:horsetail","farming:string","default:stick"}, -}) -minetest.register_craft({ - type = "shapeless", - output = "default:sword_wood", - recipe = {"default:sword_wood","group:horsetail","farming:string","default:stick"}, -}) -minetest.register_craft({ - type = "shapeless", - output = "farming:hoe_wood", - recipe = {"farming:hoe_wood","group:horsetail","farming:string","default:stick"}, -})]] +-- support for i18n +local S = plantlife_i18n.gettext +----------------------------------------------------------------------------------------------- +-- Ferns - Crafting 0.0.5 +----------------------------------------------------------------------------------------------- +-- (by Mossmanikin) +-- License (everything): WTFPL +----------------------------------------------------------------------------------------------- +minetest.register_craft({ + type = "shapeless", + output = "ferns:fiddlehead 3", + recipe = {"ferns:fern_01"}, + replacements = { + {"ferns:fern_01", "ferns:ferntuber"} + }, +}) + +minetest.register_craft({ + type = "shapeless", + output = "ferns:fiddlehead 3", + recipe = {"ferns:tree_fern_leaves"}, + replacements = { + {"ferns:tree_fern_leaves", "ferns:sapling_tree_fern"} + }, +}) +----------------------------------------------------------------------------------------------- +-- FIDDLEHEAD +----------------------------------------------------------------------------------------------- +minetest.register_alias("archaeplantae:fiddlehead", "ferns:fiddlehead") + +minetest.register_craftitem("ferns:fiddlehead", { + description = S("Fiddlehead"), + inventory_image = "ferns_fiddlehead.png", + on_use = minetest.item_eat(-1), -- slightly poisonous when raw +}) +minetest.register_craft({ + type = "cooking", + output = "ferns:fiddlehead_roasted", + recipe = "ferns:fiddlehead", + cooktime = 1, +}) +minetest.register_craftitem("ferns:fiddlehead_roasted", { + description = S("Roasted Fiddlehead"), + inventory_image = "ferns_fiddlehead_roasted.png", + on_use = minetest.item_eat(1), -- edible when cooked +}) +----------------------------------------------------------------------------------------------- +-- FERN TUBER +----------------------------------------------------------------------------------------------- +minetest.register_alias("archaeplantae:ferntuber", "ferns:ferntuber") + +minetest.register_craftitem("ferns:ferntuber", { + description = S("Fern Tuber"), + inventory_image = "ferns_ferntuber.png", +}) +minetest.register_craft({ + type = "cooking", + output = "ferns:ferntuber_roasted", + recipe = "ferns:ferntuber", + cooktime = 3, +}) + +minetest.register_alias("archaeplantae:ferntuber_roasted", "ferns:ferntuber_roasted") + +minetest.register_craftitem("ferns:ferntuber_roasted", { + description = S("Roasted Fern Tuber"), + inventory_image = "ferns_ferntuber_roasted.png", + on_use = minetest.item_eat(3), +}) +----------------------------------------------------------------------------------------------- +-- HORSETAIL (EQUISETUM) --> GREEN DYE https://en.wikipedia.org/wiki/Equisetum +----------------------------------------------------------------------------------------------- +minetest.register_craft({ + type = "shapeless", + output = "dye:green", + recipe = {"group:horsetail"}, +}) +----------------------------------------------------------------------------------------------- +-- GLUE WOODEN TOOLS with RESIN & POLISH them with HORSETAIL (planned) +----------------------------------------------------------------------------------------------- +--[[minetest.register_craft({ + type = "shapeless", + output = "default:pick_wood", + recipe = {"default:pick_wood","group:horsetail","farming:string","default:stick"}, +}) +minetest.register_craft({ + type = "shapeless", + output = "default:shovel_wood", + recipe = {"default:shovel_wood","group:horsetail","farming:string","default:stick"}, +}) +minetest.register_craft({ + type = "shapeless", + output = "default:axe_wood", + recipe = {"default:axe_wood","group:horsetail","farming:string","default:stick"}, +}) +minetest.register_craft({ + type = "shapeless", + output = "default:sword_wood", + recipe = {"default:sword_wood","group:horsetail","farming:string","default:stick"}, +}) +minetest.register_craft({ + type = "shapeless", + output = "farming:hoe_wood", + recipe = {"farming:hoe_wood","group:horsetail","farming:string","default:stick"}, +})]] diff --git a/ferns/fern.lua b/ferns/fern.lua index ed0bd71..e291d39 100644 --- a/ferns/fern.lua +++ b/ferns/fern.lua @@ -1,199 +1,199 @@ ------------------------------------------------------------------------------------------------ --- Ferns - Fern 0.1.0 ------------------------------------------------------------------------------------------------ --- by Mossmanikin --- License (everything): WTFPL --- Contains code from: biome_lib --- Looked at code from: default, flowers, painting, trees --- Dependencies: biome_lib --- Supports: dryplants, stoneage, sumpf ------------------------------------------------------------------------------------------------ --- some inspiration from here --- https://en.wikipedia.org/wiki/Athyrium_yokoscense --- http://www.mygarden.net.au/gardening/athyrium-yokoscense/3900/1 ------------------------------------------------------------------------------------------------ - -assert(abstract_ferns.config.enable_lady_fern == true) - --- support for i18n -local S = plantlife_i18n.gettext - --- Maintain backward compatibilty -minetest.register_alias("archaeplantae:fern", "ferns:fern_03") -minetest.register_alias("archaeplantae:fern_mid", "ferns:fern_02") -minetest.register_alias("archaeplantae:fern_small", "ferns:fern_01") -minetest.register_alias("ferns:fern_04", "ferns:fern_02") -- for placing - -local nodenames = {} - -local function create_nodes() - local images = { "ferns_fern.png", "ferns_fern_mid.png", "ferns_fern_big.png" } - local vscales = { 1, math.sqrt(8), math.sqrt(11) } - local descs = { S("Lady-fern (Athyrium)"), nil, nil } - - for i = 1, 3 do - local node_on_place = nil - if i == 1 then - node_on_place = function(itemstack, placer, pointed_thing) - -- place a random fern - local stack = ItemStack("ferns:fern_0"..math.random(1,4)) - local ret = minetest.item_place(stack, placer, pointed_thing) - return ItemStack("ferns:fern_01 "..itemstack:get_count()-(1-ret:get_count())) -- TODO FIXME? - end - end - nodenames[i] = "ferns:fern_"..string.format("%02d", i) - minetest.register_node(nodenames[i], { - description = descs[i] or (S("Lady-fern (Athyrium)").." " .. string.format("%02d", i)), - inventory_image = "ferns_fern.png", - drawtype = "plantlike", - visual_scale = vscales[i], - paramtype = "light", - tiles = { images[i] }, - walkable = false, - buildable_to = true, - groups = {snappy=3,flammable=2,attached_node=1,not_in_creative_inventory=1}, - sounds = default.node_sound_leaves_defaults(), - selection_box = { - type = "fixed", - fixed = {-7/16, -1/2, -7/16, 7/16, 0, 7/16}, - }, - drop = "ferns:fern_01", - on_place = node_on_place - }) - end -end - ------------------------------------------------------------------------------------------------ --- Init ------------------------------------------------------------------------------------------------ - -create_nodes() - ------------------------------------------------------------------------------------------------ --- Spawning ------------------------------------------------------------------------------------------------ - -if abstract_ferns.config.lady_ferns_near_tree == true then - biome_lib:register_generate_plant({ -- near trees (woodlands) - surface = { - "default:dirt_with_grass", - "default:mossycobble", - "default:desert_sand", - "default:sand", - "default:jungletree", - "stoneage:grass_with_silex", - "sumpf:sumpf" - }, - max_count = 30, - rarity = 62,--63, - min_elevation = 1, -- above sea level - near_nodes = {"group:tree"}, - near_nodes_size = 3,--4, - near_nodes_vertical = 2,--3, - near_nodes_count = 1, - plantlife_limit = -0.9, - humidity_max = -1.0, - humidity_min = 0.4, - temp_max = -0.5, -- 55 °C (too hot?) - temp_min = 0.75, -- -12 °C - random_facedir = { 0, 179 }, - }, - nodenames - ) -end - -if abstract_ferns.config.lady_ferns_near_rock == true then - biome_lib:register_generate_plant({ -- near stone (mountains) - surface = { - "default:dirt_with_grass", - "default:mossycobble", - "group:falling_node", - --"default:jungletree", - "stoneage:grass_with_silex", - "sumpf:sumpf" - }, - max_count = 35, - rarity = 40, - min_elevation = 1, -- above sea level - near_nodes = {"group:stone"}, - near_nodes_size = 1, - near_nodes_count = 16, - plantlife_limit = -0.9, - humidity_max = -1.0, - humidity_min = 0.4, - temp_max = -0.5, -- 55 °C (too hot?) - temp_min = 0.75, -- -12 °C - random_facedir = { 0, 179 }, - }, - nodenames - ) -end - -if abstract_ferns.config.lady_ferns_near_ores == true then -- this one causes a huge fps drop - biome_lib:register_generate_plant({ -- near ores (potential mining sites) - surface = { - "default:dirt_with_grass", - "default:mossycobble", - "default:stone_with_coal", - "default:stone_with_iron", - "moreores:mineral_tin", - "moreores:mineral_silver", - "sumpf:sumpf" - }, - max_count = 1200,--1600, -- maybe too much? :D - rarity = 25,--15, - min_elevation = 1, -- above sea level - near_nodes = { - "default:stone_with_iron", - --"default:stone_with_copper", - --"default:stone_with_mese", - --"default:stone_with_gold", - --"default:stone_with_diamond", - "moreores:mineral_tin", - "moreores:mineral_silver" - --"moreores:mineral_mithril" - }, - near_nodes_size = 2, - near_nodes_vertical = 4,--5,--6, - near_nodes_count = 2,--3, - plantlife_limit = -0.9, - humidity_max = -1.0, - humidity_min = 0.4, - temp_max = -0.5, -- 55 °C (too hot?) - temp_min = 0.75, -- -12 °C - random_facedir = { 0, 179 }, - }, - nodenames - ) -end - -if abstract_ferns.config.lady_ferns_in_groups == true then -- this one is meant as a replacement of Ferns_near_Ores - biome_lib:register_generate_plant({ - surface = { - "default:dirt_with_grass", - "default:mossycobble", - "default:stone_with_coal", - "default:stone_with_iron", - "moreores:mineral_tin", - "moreores:mineral_silver", - "sumpf:sumpf" - }, - max_count = 70, - rarity = 25,--15, - min_elevation = 1, -- above sea level - near_nodes = { - "default:stone" - }, - near_nodes_size = 2, - near_nodes_vertical = 2,--6, - near_nodes_count = 3, - plantlife_limit = -0.9, - humidity_max = -1.0, - humidity_min = 0.4, - temp_max = -0.5, -- 55 °C (too hot?) - temp_min = 0.75, -- -12 °C - random_facedir = { 0, 179 }, - }, - nodenames - ) -end +----------------------------------------------------------------------------------------------- +-- Ferns - Fern 0.1.0 +----------------------------------------------------------------------------------------------- +-- by Mossmanikin +-- License (everything): WTFPL +-- Contains code from: biome_lib +-- Looked at code from: default, flowers, painting, trees +-- Dependencies: biome_lib +-- Supports: dryplants, stoneage, sumpf +----------------------------------------------------------------------------------------------- +-- some inspiration from here +-- https://en.wikipedia.org/wiki/Athyrium_yokoscense +-- http://www.mygarden.net.au/gardening/athyrium-yokoscense/3900/1 +----------------------------------------------------------------------------------------------- + +assert(abstract_ferns.config.enable_lady_fern == true) + +-- support for i18n +local S = plantlife_i18n.gettext + +-- Maintain backward compatibilty +minetest.register_alias("archaeplantae:fern", "ferns:fern_03") +minetest.register_alias("archaeplantae:fern_mid", "ferns:fern_02") +minetest.register_alias("archaeplantae:fern_small", "ferns:fern_01") +minetest.register_alias("ferns:fern_04", "ferns:fern_02") -- for placing + +local nodenames = {} + +local function create_nodes() + local images = { "ferns_fern.png", "ferns_fern_mid.png", "ferns_fern_big.png" } + local vscales = { 1, math.sqrt(8), math.sqrt(11) } + local descs = { S("Lady-fern (Athyrium)"), nil, nil } + + for i = 1, 3 do + local node_on_place = nil + if i == 1 then + node_on_place = function(itemstack, placer, pointed_thing) + -- place a random fern + local stack = ItemStack("ferns:fern_0"..math.random(1,4)) + local ret = minetest.item_place(stack, placer, pointed_thing) + return ItemStack("ferns:fern_01 "..itemstack:get_count()-(1-ret:get_count())) -- TODO FIXME? + end + end + nodenames[i] = "ferns:fern_"..string.format("%02d", i) + minetest.register_node(nodenames[i], { + description = descs[i] or (S("Lady-fern (Athyrium)").." " .. string.format("%02d", i)), + inventory_image = "ferns_fern.png", + drawtype = "plantlike", + visual_scale = vscales[i], + paramtype = "light", + tiles = { images[i] }, + walkable = false, + buildable_to = true, + groups = {snappy=3,flammable=2,attached_node=1,not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-7/16, -1/2, -7/16, 7/16, 0, 7/16}, + }, + drop = "ferns:fern_01", + on_place = node_on_place + }) + end +end + +----------------------------------------------------------------------------------------------- +-- Init +----------------------------------------------------------------------------------------------- + +create_nodes() + +----------------------------------------------------------------------------------------------- +-- Spawning +----------------------------------------------------------------------------------------------- + +if abstract_ferns.config.lady_ferns_near_tree == true then + biome_lib:register_generate_plant({ -- near trees (woodlands) + surface = { + "default:dirt_with_grass", + "default:mossycobble", + "default:desert_sand", + "default:sand", + "default:jungletree", + "stoneage:grass_with_silex", + "sumpf:sumpf" + }, + max_count = 30, + rarity = 62,--63, + min_elevation = 1, -- above sea level + near_nodes = {"group:tree"}, + near_nodes_size = 3,--4, + near_nodes_vertical = 2,--3, + near_nodes_count = 1, + plantlife_limit = -0.9, + humidity_max = -1.0, + humidity_min = 0.4, + temp_max = -0.5, -- 55 °C (too hot?) + temp_min = 0.75, -- -12 °C + random_facedir = { 0, 179 }, + }, + nodenames + ) +end + +if abstract_ferns.config.lady_ferns_near_rock == true then + biome_lib:register_generate_plant({ -- near stone (mountains) + surface = { + "default:dirt_with_grass", + "default:mossycobble", + "group:falling_node", + --"default:jungletree", + "stoneage:grass_with_silex", + "sumpf:sumpf" + }, + max_count = 35, + rarity = 40, + min_elevation = 1, -- above sea level + near_nodes = {"group:stone"}, + near_nodes_size = 1, + near_nodes_count = 16, + plantlife_limit = -0.9, + humidity_max = -1.0, + humidity_min = 0.4, + temp_max = -0.5, -- 55 °C (too hot?) + temp_min = 0.75, -- -12 °C + random_facedir = { 0, 179 }, + }, + nodenames + ) +end + +if abstract_ferns.config.lady_ferns_near_ores == true then -- this one causes a huge fps drop + biome_lib:register_generate_plant({ -- near ores (potential mining sites) + surface = { + "default:dirt_with_grass", + "default:mossycobble", + "default:stone_with_coal", + "default:stone_with_iron", + "moreores:mineral_tin", + "moreores:mineral_silver", + "sumpf:sumpf" + }, + max_count = 1200,--1600, -- maybe too much? :D + rarity = 25,--15, + min_elevation = 1, -- above sea level + near_nodes = { + "default:stone_with_iron", + --"default:stone_with_copper", + --"default:stone_with_mese", + --"default:stone_with_gold", + --"default:stone_with_diamond", + "moreores:mineral_tin", + "moreores:mineral_silver" + --"moreores:mineral_mithril" + }, + near_nodes_size = 2, + near_nodes_vertical = 4,--5,--6, + near_nodes_count = 2,--3, + plantlife_limit = -0.9, + humidity_max = -1.0, + humidity_min = 0.4, + temp_max = -0.5, -- 55 °C (too hot?) + temp_min = 0.75, -- -12 °C + random_facedir = { 0, 179 }, + }, + nodenames + ) +end + +if abstract_ferns.config.lady_ferns_in_groups == true then -- this one is meant as a replacement of Ferns_near_Ores + biome_lib:register_generate_plant({ + surface = { + "default:dirt_with_grass", + "default:mossycobble", + "default:stone_with_coal", + "default:stone_with_iron", + "moreores:mineral_tin", + "moreores:mineral_silver", + "sumpf:sumpf" + }, + max_count = 70, + rarity = 25,--15, + min_elevation = 1, -- above sea level + near_nodes = { + "default:stone" + }, + near_nodes_size = 2, + near_nodes_vertical = 2,--6, + near_nodes_count = 3, + plantlife_limit = -0.9, + humidity_max = -1.0, + humidity_min = 0.4, + temp_max = -0.5, -- 55 °C (too hot?) + temp_min = 0.75, -- -12 °C + random_facedir = { 0, 179 }, + }, + nodenames + ) +end diff --git a/ferns/gianttreefern.lua b/ferns/gianttreefern.lua index c746194..5f5ac63 100644 --- a/ferns/gianttreefern.lua +++ b/ferns/gianttreefern.lua @@ -2,8 +2,8 @@ -- Ferns - Giant Tree Fern 0.1.1 ----------------------------------------------------------------------------------------------- -- by Mossmanikin --- License (everything): WTFPL --- Contains code from: biome_lib +-- License (everything): WTFPL +-- Contains code from: biome_lib -- Looked at code from: 4seasons, default -- Supports: vines ----------------------------------------------------------------------------------------------- diff --git a/ferns/horsetail.lua b/ferns/horsetail.lua index 16d1c90..a84e1ae 100644 --- a/ferns/horsetail.lua +++ b/ferns/horsetail.lua @@ -2,10 +2,10 @@ -- Archae Plantae - Horsetail 0.0.5 ----------------------------------------------------------------------------------------------- -- by Mossmanikin --- License (everything): WTFPL --- Contains code from: biome_lib +-- License (everything): WTFPL +-- Contains code from: biome_lib -- Looked at code from: default, flowers, trees --- Dependencies: biome_lib +-- Dependencies: biome_lib -- Supports: dryplants, stoneage, sumpf ----------------------------------------------------------------------------------------------- diff --git a/ferns/init.lua b/ferns/init.lua index 6e7dcac..3e65bd6 100644 --- a/ferns/init.lua +++ b/ferns/init.lua @@ -1,10 +1,10 @@ ----------------------------------------------------------------------------------------------- local title = "Ferns" -- former "Archae Plantae" -local version = "0.2.0" +local version = "0.2.0" local mname = "ferns" -- former "archaeplantae" ----------------------------------------------------------------------------------------------- -- (by Mossmanikin) --- License (everything): WTFPL +-- License (everything): WTFPL ----------------------------------------------------------------------------------------------- abstract_ferns = {} diff --git a/ferns/settings.lua b/ferns/settings.lua index 8254fcf..0fcdfbb 100644 --- a/ferns/settings.lua +++ b/ferns/settings.lua @@ -1,6 +1,6 @@ -- In case you don't wanna have errors: --- Only change what's behind a "=" (or "--"). +-- Only change what's behind a "=" (or "--"). -- Don't use caps (behind a "="). -- If there's a "false" (behind a "=") you can change it to "true" (and the other way around). @@ -31,12 +31,12 @@ abstract_ferns.config.lady_ferns_in_groups = false -- this one is meant as a -- -- Horsetails abstract_ferns.config.enable_horsetails_spawning = false -- horsetails will grow in already explored areas, over time, near water or gravel -abstract_ferns.config.enable_horsetails_on_grass = true -- on dirt with grass and swamp (sumpf mod) -abstract_ferns.config.enable_horsetails_on_stones = true -- on gravel, mossy cobble and silex (stoneage mod) +abstract_ferns.config.enable_horsetails_on_grass = true -- on dirt with grass and swamp (sumpf mod) +abstract_ferns.config.enable_horsetails_on_stones = true -- on gravel, mossy cobble and silex (stoneage mod) -- -- Tree_Fern abstract_ferns.config.enable_treeferns_in_jungle = true -abstract_ferns.config.enable_treeferns_in_oases = true -- for oases and tropical beaches +abstract_ferns.config.enable_treeferns_in_oases = true -- for oases and tropical beaches -- -- Giant_Tree_Fern abstract_ferns.config.enable_giant_treeferns_in_jungle = true diff --git a/ferns/treefern.lua b/ferns/treefern.lua index 8a96ce8..4d3b4f9 100644 --- a/ferns/treefern.lua +++ b/ferns/treefern.lua @@ -2,8 +2,8 @@ -- Ferns - Tree Fern 0.1.1 ----------------------------------------------------------------------------------------------- -- by Mossmanikin --- License (everything): WTFPL --- Contains code from: biome_lib +-- License (everything): WTFPL +-- Contains code from: biome_lib -- Looked at code from: default , trees ----------------------------------------------------------------------------------------------- diff --git a/flowers_plus/init.lua b/flowers_plus/init.lua index 910d304..d60dcab 100644 --- a/flowers_plus/init.lua +++ b/flowers_plus/init.lua @@ -19,7 +19,7 @@ local sunflowers_rarity = 25 -- register the various rotations of waterlilies local lilies_list = { - { nil , nil , 1 }, + { nil , nil , 1 }, { "225", "22.5" , 2 }, { "45" , "45" , 3 }, { "675", "67.5" , 4 }, diff --git a/molehills/init.lua b/molehills/init.lua index f04dded..cd8a0e3 100644 --- a/molehills/init.lua +++ b/molehills/init.lua @@ -1,6 +1,6 @@ ----------------------------------------------------------------------------------------------- local title = "Mole Hills" -local version = "0.0.3" +local version = "0.0.3" local mname = "molehills" ----------------------------------------------------------------------------------------------- -- Idea by Sokomine @@ -49,7 +49,7 @@ 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 } + 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" diff --git a/nature_classic/global_function.lua b/nature_classic/global_function.lua index 3a5b9e3..c6b158a 100644 --- a/nature_classic/global_function.lua +++ b/nature_classic/global_function.lua @@ -64,7 +64,7 @@ end function nature:grow_node(pos, nodename) if pos ~= nil then local light_enough = (minetest.get_node_light(pos, nil) or 0) - >= nature.minimum_growth_light + >= nature.minimum_growth_light if is_not_young(pos) and light_enough then minetest.set_node(pos, { name = nodename }) diff --git a/trunks/generating.lua b/trunks/generating.lua index e544a21..6595f2b 100644 --- a/trunks/generating.lua +++ b/trunks/generating.lua @@ -14,38 +14,38 @@ end ----------------------------------------------------------------------------------------------- abstract_trunks.place_twig = function(pos) - local twig_size = math.random(1,27) - - local right_here = {x=pos.x , y=pos.y+1, z=pos.z } - local north = {x=pos.x , y=pos.y+1, z=pos.z+1} - local north_east = {x=pos.x+1, y=pos.y+1, z=pos.z+1} - local east = {x=pos.x+1, y=pos.y+1, z=pos.z } - local south_east = {x=pos.x+1, y=pos.y+1, z=pos.z-1} - local south = {x=pos.x , y=pos.y+1, z=pos.z-1} - local south_west = {x=pos.x-1, y=pos.y+1, z=pos.z-1} - 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) --- small twigs + local twig_size = math.random(1,27) + + local right_here = {x=pos.x , y=pos.y+1, z=pos.z } + local north = {x=pos.x , y=pos.y+1, z=pos.z+1} + local north_east = {x=pos.x+1, y=pos.y+1, z=pos.z+1} + local east = {x=pos.x+1, y=pos.y+1, z=pos.z } + local south_east = {x=pos.x+1, y=pos.y+1, z=pos.z-1} + local south = {x=pos.x , y=pos.y+1, z=pos.z-1} + local south_west = {x=pos.x-1, y=pos.y+1, z=pos.z-1} + 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) +-- small twigs if twig_size <= 16 then minetest.set_node(right_here, {name="trunks:twig_"..math.random(1,4), param2=math.random(0,3)}) end --- big twigs +-- big twigs if Big_Twigs == true then --- big twig 1 +-- 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 minetest.registered_nodes[node_here.name].buildable_to then minetest.set_node(right_here, {name="trunks:twig_5"}) end @@ -53,13 +53,13 @@ abstract_trunks.place_twig = function(pos) minetest.set_node(north_east, {name="trunks:twig_7"}) end if minetest.registered_nodes[node_east.name].buildable_to then - minetest.set_node(east, {name="trunks:twig_8"}) + minetest.set_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 minetest.registered_nodes[node_here.name].buildable_to then minetest.set_node(right_here, {name="trunks:twig_5", param2=1}) end @@ -67,13 +67,13 @@ abstract_trunks.place_twig = function(pos) minetest.set_node(south_east, {name="trunks:twig_7", param2=1}) end if minetest.registered_nodes[node_south.name].buildable_to then - minetest.set_node(south, {name="trunks:twig_8", param2=1}) + minetest.set_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 minetest.registered_nodes[node_here.name].buildable_to then minetest.set_node(right_here, {name="trunks:twig_5", param2=2}) end @@ -81,13 +81,13 @@ abstract_trunks.place_twig = function(pos) minetest.set_node(south_west, {name="trunks:twig_7", param2=2}) end if minetest.registered_nodes[node_west.name].buildable_to then - minetest.set_node(west, {name="trunks:twig_8", param2=2}) + minetest.set_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 minetest.registered_nodes[node_here.name].buildable_to then minetest.set_node(right_here, {name="trunks:twig_5", param2=3}) end @@ -95,19 +95,19 @@ abstract_trunks.place_twig = function(pos) minetest.set_node(north_west, {name="trunks:twig_7", param2=3}) end if minetest.registered_nodes[node_north.name].buildable_to then - minetest.set_node(north, {name="trunks:twig_8", param2=3}) + minetest.set_node(north, {name="trunks:twig_8", param2=3}) end end --- big twig 2 +-- 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 minetest.registered_nodes[node_here.name].buildable_to then minetest.set_node(right_here, {name="trunks:twig_9"}) end if minetest.registered_nodes[node_north.name].buildable_to then - minetest.set_node(north, {name="trunks:twig_10"}) + minetest.set_node(north, {name="trunks:twig_10"}) end if minetest.registered_nodes[node_n_e.name].buildable_to then minetest.set_node(north_east, {name="trunks:twig_11"}) @@ -116,12 +116,12 @@ abstract_trunks.place_twig = function(pos) 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 minetest.registered_nodes[node_here.name].buildable_to then minetest.set_node(right_here, {name="trunks:twig_9", param2=1}) end if minetest.registered_nodes[node_east.name].buildable_to then - minetest.set_node(east, {name="trunks:twig_10", param2=1}) + minetest.set_node(east, {name="trunks:twig_10", param2=1}) end if minetest.registered_nodes[node_s_e.name].buildable_to then minetest.set_node(south_east, {name="trunks:twig_11", param2=1}) @@ -130,12 +130,12 @@ abstract_trunks.place_twig = function(pos) 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 minetest.registered_nodes[node_here.name].buildable_to then minetest.set_node(right_here, {name="trunks:twig_9", param2=2}) end if minetest.registered_nodes[node_south.name].buildable_to then - minetest.set_node(south, {name="trunks:twig_10", param2=2}) + minetest.set_node(south, {name="trunks:twig_10", param2=2}) end if minetest.registered_nodes[node_s_w.name].buildable_to then minetest.set_node(south_west, {name="trunks:twig_11", param2=2}) @@ -144,12 +144,12 @@ abstract_trunks.place_twig = function(pos) 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 minetest.registered_nodes[node_here.name].buildable_to then minetest.set_node(right_here, {name="trunks:twig_9", param2=3}) end if minetest.registered_nodes[node_west.name].buildable_to then - minetest.set_node(west, {name="trunks:twig_10", param2=3}) + minetest.set_node(west, {name="trunks:twig_10", param2=3}) end if minetest.registered_nodes[node_n_w.name].buildable_to then minetest.set_node(north_west, {name="trunks:twig_11", param2=3}) @@ -199,12 +199,12 @@ end -- TRuNKS ----------------------------------------------------------------------------------------------- local TRuNKS = { --- MoD TRuNK NR - {"default", "tree", 1}, +-- MoD TRuNK NR + {"default", "tree", 1}, {"default", "jungletree", 2}, {"default", "pine_tree", 12}, - {"trees", "tree_conifer", 3}, + {"trees", "tree_conifer", 3}, {"trees", "tree_mangrove", 4}, {"trees", "tree_palm", 5}, @@ -223,11 +223,11 @@ local TRuNKS = { if Horizontal_Trunks == true then -- see settings.txt for i in pairs(TRuNKS) do - local MoD = TRuNKS[i][1] - local TRuNK = TRuNKS[i][2] - local NR = TRuNKS[i][3] + local MoD = TRuNKS[i][1] + local TRuNK = TRuNKS[i][2] + local NR = TRuNKS[i][3] local trunkname = MoD..":"..TRuNK - if minetest.get_modpath(MoD) ~= nil + if minetest.get_modpath(MoD) ~= nil and NR < 6 -- moretrees trunks allready have facedir and minetest.registered_nodes[trunkname] then -- the node being called exists. temptrunk = clone_node(trunkname) @@ -236,9 +236,9 @@ for i in pairs(TRuNKS) do end end end - + abstract_trunks.place_trunk = function(pos) - + local right_here = {x=pos.x, y=pos.y+1, z=pos.z} local north = {x=pos.x, y=pos.y+1, z=pos.z+1} local north2 = {x=pos.x, y=pos.y+1, z=pos.z+2} @@ -248,7 +248,7 @@ abstract_trunks.place_trunk = function(pos) local west2 = {x=pos.x-2, y=pos.y+1, z=pos.z} 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) @@ -260,11 +260,11 @@ abstract_trunks.place_trunk = function(pos) local node_east2 = minetest.get_node(east2) if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true, for i in pairs(TRuNKS) do - local MoD = TRuNKS[i][1] - local TRuNK = TRuNKS[i][2] - local NR = TRuNKS[i][3] - local chance = math.random(1, 17) - local length = math.random(3,5) + local MoD = TRuNKS[i][1] + local TRuNK = TRuNKS[i][2] + local NR = TRuNKS[i][3] + local chance = math.random(1, 17) + local length = math.random(3,5) if chance == NR then local trunk_type = math.random(1,3) if trunk_type == 1 then @@ -278,7 +278,7 @@ abstract_trunks.place_trunk = function(pos) if minetest.registered_nodes[node_north.name].buildable_to then minetest.set_node(north, {name=MoD..":"..TRuNK, param2=4}) end - + if length >= 4 and minetest.registered_nodes[node_north2.name].buildable_to then minetest.set_node(north2, {name=MoD..":"..TRuNK, param2=4}) end @@ -365,13 +365,13 @@ if Moss_on_ground == true then abstract_trunks.grow_moss_on_ground = function(pos) local on_ground = {x=pos.x, y=pos.y+1, z=pos.z} local moss_type = math.random(1,21) - + if moss_type == 1 then minetest.set_node(on_ground, {name="trunks:moss_fungus", param2=math.random(0,3)}) else minetest.set_node(on_ground, {name="trunks:moss", param2=math.random(0,3)}) end - + end biome_lib:register_generate_plant({ @@ -406,14 +406,14 @@ abstract_trunks.grow_moss_on_trunk = function(pos) 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 local moss_type = math.random(1,41) if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true, @@ -491,32 +491,32 @@ biome_lib:register_generate_plant({ end ----------------------------------------------------------------------------------------------- --- RooTS +-- RooTS ----------------------------------------------------------------------------------------------- if Roots == true then -- see settings.txt abstract_trunks.grow_roots = function(pos) - local twig_size = math.random(1,27) - - local right_here = {x=pos.x , y=pos.y , z=pos.z } - local below = {x=pos.x , y=pos.y-1, z=pos.z } - local north = {x=pos.x , y=pos.y , z=pos.z+1} - local east = {x=pos.x+1, y=pos.y , z=pos.z } - local south = {x=pos.x , y=pos.y , z=pos.z-1} - local west = {x=pos.x-1, y=pos.y , z=pos.z } - - local node_here = minetest.get_node(right_here) + local twig_size = math.random(1,27) + + local right_here = {x=pos.x , y=pos.y , z=pos.z } + local below = {x=pos.x , y=pos.y-1, z=pos.z } + local north = {x=pos.x , y=pos.y , z=pos.z+1} + local east = {x=pos.x+1, y=pos.y , z=pos.z } + local south = {x=pos.x , y=pos.y , z=pos.z-1} + local west = {x=pos.x-1, y=pos.y , z=pos.z } + + 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) + 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] - local TRuNK = TRuNKS[i][2] - if minetest.get_modpath(MoD) ~= nil - and node_here.name == MoD..":"..TRuNK + local MoD = TRuNKS[i][1] + local TRuNK = TRuNKS[i][2] + if minetest.get_modpath(MoD) ~= nil + 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 diff --git a/trunks/init.lua b/trunks/init.lua index 899f6a9..727e484 100644 --- a/trunks/init.lua +++ b/trunks/init.lua @@ -1,6 +1,6 @@ ----------------------------------------------------------------------------------------------- local title = "Trunks" -local version = "0.1.4" +local version = "0.1.4" local mname = "trunks" ----------------------------------------------------------------------------------------------- -- Code by Mossmanikin & Neuromancer diff --git a/trunks/nodes.lua b/trunks/nodes.lua index e5d4815..d46d2e5 100644 --- a/trunks/nodes.lua +++ b/trunks/nodes.lua @@ -217,10 +217,10 @@ if Auto_Roof_Corner == true then chance = 1, action = function(pos) - local node_east = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z }) - local node_west = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z }) - local node_north = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1}) - local node_south = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1}) + local node_east = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z }) + local node_west = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z }) + local node_north = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1}) + local node_south = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1}) -- corner 1 if ((node_west.name == roof and node_west.param2 == 0) or (node_west.name == corner and node_west.param2 == 1)) @@ -302,8 +302,8 @@ local roots_cube = {-2/16, -1/2, -3/16, 2/16, 1/16, 1/2} local roots_sheet = {0, -1/2, -1/2, 0, 1/16, 1/2} local TRuNKS = { --- MoD TRuNK - {"default", "tree" }, +-- MoD TRuNK + {"default", "tree" }, {"default", "jungletree" }, {"default", "pine_tree" }, @@ -325,8 +325,8 @@ local TRuNKS = { } for i in pairs(TRuNKS) do - local MoD = TRuNKS[i][1] - local TRuNK = TRuNKS[i][2] + local MoD = TRuNKS[i][1] + local TRuNK = TRuNKS[i][2] if minetest.get_modpath(MoD) ~= nil then local node = minetest.registered_nodes[MoD..":"..TRuNK] diff --git a/vines/recipes.lua b/vines/recipes.lua index d64dcea..991712b 100644 --- a/vines/recipes.lua +++ b/vines/recipes.lua @@ -9,4 +9,3 @@ vines.recipes['shears'] = { {'group:stick', 'group:wood', 'default:steel_ingot'}, {'', '', 'group:stick'} } - diff --git a/woodsoils/generating.lua b/woodsoils/generating.lua index 1d03ed7..087e03c 100644 --- a/woodsoils/generating.lua +++ b/woodsoils/generating.lua @@ -26,7 +26,7 @@ local RaDiuS = { } -- e = + , n = + abstract_woodsoils.place_soil = function(pos) - + if minetest.get_item_group(minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name, "soil") > 0 or minetest.get_item_group(minetest.get_node({x=pos.x,y=pos.y-2,z=pos.z}).name, "soil") > 0 then for i in pairs(RaDiuS) do diff --git a/woodsoils/init.lua b/woodsoils/init.lua index 19ff61d..ad30642 100644 --- a/woodsoils/init.lua +++ b/woodsoils/init.lua @@ -1,6 +1,6 @@ ----------------------------------------------------------------------------------------------- local title = "Wood Soils" -- former "Forest Soils" -local version = "0.0.9" +local version = "0.0.9" local mname = "woodsoils" -- former "forestsoils" -----------------------------------------------------------------------------------------------