summaryrefslogtreecommitdiff
path: root/dryplants
diff options
context:
space:
mode:
Diffstat (limited to 'dryplants')
-rw-r--r--dryplants/crafting.lua718
-rw-r--r--dryplants/init.lua412
-rw-r--r--dryplants/juncus.lua4
-rw-r--r--dryplants/meadowvariation.lua6
-rw-r--r--dryplants/moregrass.lua66
-rw-r--r--dryplants/reed.lua766
-rw-r--r--dryplants/reedmace.lua8
7 files changed, 990 insertions, 990 deletions
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