From b528a028e1aad959ec41b2411fa27ba7cd7137df Mon Sep 17 00:00:00 2001 From: thunderdog1138 Date: Fri, 17 Jul 2020 12:46:52 +0000 Subject: [PATCH] Upload files to 'mods/farming/crops' --- mods/farming/crops/cotton.lua | 186 ++++++++++++++++++++++ mods/farming/crops/cucumber.lua | 65 ++++++++ mods/farming/crops/garlic.lua | 135 ++++++++++++++++ mods/farming/crops/grapes.lua | 263 ++++++++++++++++++++++++++++++++ mods/farming/crops/hemp.lua | 260 +++++++++++++++++++++++++++++++ 5 files changed, 909 insertions(+) create mode 100644 mods/farming/crops/cotton.lua create mode 100644 mods/farming/crops/cucumber.lua create mode 100644 mods/farming/crops/garlic.lua create mode 100644 mods/farming/crops/grapes.lua create mode 100644 mods/farming/crops/hemp.lua diff --git a/mods/farming/crops/cotton.lua b/mods/farming/crops/cotton.lua new file mode 100644 index 00000000..067b444b --- /dev/null +++ b/mods/farming/crops/cotton.lua @@ -0,0 +1,186 @@ + +local S = farming.intllib + +-- wild cotton as a source of cotton seed and a chance of cotton itself +minetest.register_node("farming:cotton_wild", { + description = S("Wild Cotton"), + drawtype = "plantlike", + waving = 1, + tiles = {"farming_cotton_wild.png"}, + inventory_image = "farming_cotton_wild.png", + wield_image = "farming_cotton_wild.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, attached_node = 1, flammable = 4}, + drop = { + items = { + {items = {"farming:cotton"}, rarity = 2}, + {items = {"farming:seed_cotton"}, rarity = 1} + } + }, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-6 / 16, -8 / 16, -6 / 16, 6 / 16, 5 / 16, 6 / 16} + } +}) + +-- cotton seeds +minetest.register_node("farming:seed_cotton", { + description = S("Cotton Seed"), + tiles = {"farming_cotton_seed.png"}, + inventory_image = "farming_cotton_seed.png", + wield_image = "farming_cotton_seed.png", + drawtype = "signlike", + groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4}, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = farming.select, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_1") + end +}) + +-- cotton +minetest.register_craftitem("farming:cotton", { + description = S("Cotton"), + inventory_image = "farming_cotton.png", + groups = {flammable = 4} +}) + +-- string +minetest.register_craftitem("farming:string", { + description = S("String"), + inventory_image = "farming_string.png", + groups = {flammable = 2} +}) + +-- cotton to wool +minetest.register_craft({ + output = "wool:white", + recipe = { + {"farming:cotton", "farming:cotton"}, + {"farming:cotton", "farming:cotton"} + } +}) + +-- cotton to string +minetest.register_craft({ + output = "farming:string 2", + recipe = { + {"farming:cotton"}, + {"farming:cotton"} + } +}) + +-- can be used as fuel +minetest.register_craft({ + type = "fuel", + recipe = "farming:string", + burntime = 1 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:cotton", + burntime = 1 +}) + +-- cotton definition +local def = { + drawtype = "plantlike", + tiles = {"farming_cotton_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 4, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:cotton_1", table.copy(def)) + +-- stage 2 +def.tiles = {"farming_cotton_2.png"} +minetest.register_node("farming:cotton_2", table.copy(def)) + +-- stage 3 +def.tiles = {"farming_cotton_3.png"} +minetest.register_node("farming:cotton_3", table.copy(def)) + +-- stage 4 +def.tiles = {"farming_cotton_4.png"} +minetest.register_node("farming:cotton_4", table.copy(def)) + +-- stage 5 +def.tiles = {"farming_cotton_5.png"} +def.drop = { + items = { + {items = {"farming:seed_cotton"}, rarity = 1} + } +} +minetest.register_node("farming:cotton_5", table.copy(def)) + +-- stage 6 +def.tiles = {"farming_cotton_6.png"} +def.drop = { + items = { + {items = {"farming:cotton"}, rarity = 1}, + {items = {"farming:cotton"}, rarity = 2} + } +} +minetest.register_node("farming:cotton_6", table.copy(def)) + +-- stage 7 +def.tiles = {"farming_cotton_7.png"} +def.drop = { + items = { + {items = {"farming:cotton"}, rarity = 1}, + {items = {"farming:cotton"}, rarity = 2}, + {items = {"farming:seed_cotton"}, rarity = 1}, + {items = {"farming:seed_cotton"}, rarity = 2} + } +} +minetest.register_node("farming:cotton_7", table.copy(def)) + +-- stage 8 (final) +def.tiles = {"farming_cotton_8.png"} +def.groups.growing = nil +def.drop = { + items = { + {items = {"farming:cotton"}, rarity = 1}, + {items = {"farming:cotton"}, rarity = 2}, + {items = {"farming:cotton"}, rarity = 3}, + {items = {"farming:seed_cotton"}, rarity = 1}, + {items = {"farming:seed_cotton"}, rarity = 2}, + {items = {"farming:seed_cotton"}, rarity = 3} + } +} +minetest.register_node("farming:cotton_8", table.copy(def)) + +-- add to registered_plants +farming.registered_plants["farming:cotton"] = { + crop = "farming:cotton", + seed = "farming:seed_cotton", + minlight = 13, + maxlight = 15, + steps = 8 +} + +--[[ Cotton using api +farming.register_plant("farming:cotton", { + description = "Cotton seed", + inventory_image = "farming_cotton_seed.png", + groups = {flammable = 2}, + steps = 8, +})]] diff --git a/mods/farming/crops/cucumber.lua b/mods/farming/crops/cucumber.lua new file mode 100644 index 00000000..fc15e479 --- /dev/null +++ b/mods/farming/crops/cucumber.lua @@ -0,0 +1,65 @@ + +--[[ + Original textures from DocFarming mod + https://forum.minetest.net/viewtopic.php?id=3948 +]] + +local S = farming.intllib + +-- cucumber +minetest.register_craftitem("farming:cucumber", { + description = S("Cucumber"), + inventory_image = "farming_cucumber.png", + groups = {seed = 2, food_cucumber = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1") + end, + on_use = minetest.item_eat(4) +}) + +-- cucumber definition +local def = { + drawtype = "plantlike", + tiles = {"farming_cucumber_1.png"}, + paramtype = "light", + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:cucumber_1", table.copy(def)) + +-- stage 2 +def.tiles = {"farming_cucumber_2.png"} +minetest.register_node("farming:cucumber_2", table.copy(def)) + +-- stage 3 +def.tiles = {"farming_cucumber_3.png"} +minetest.register_node("farming:cucumber_3", table.copy(def)) + +-- stage 4 (final) +def.tiles = {"farming_cucumber_4.png"} +def.groups.growing = nil +def.drop = { + items = { + {items = {"farming:cucumber 2"}, rarity = 1}, + {items = {"farming:cucumber 2"}, rarity = 2} + } +} +minetest.register_node("farming:cucumber_4", table.copy(def)) + +-- add to registered_plants +farming.registered_plants["farming:cucumber"] = { + crop = "farming:cucumber", + seed = "farming:cucumber", + minlight = 13, + maxlight = 15, + steps = 4 +} diff --git a/mods/farming/crops/garlic.lua b/mods/farming/crops/garlic.lua new file mode 100644 index 00000000..7fe75655 --- /dev/null +++ b/mods/farming/crops/garlic.lua @@ -0,0 +1,135 @@ + +--[[ + Original textures from Crops Plus mod + Copyright (C) 2018 Grizzly Adam + https://forum.minetest.net/viewtopic.php?f=9&t=19488 +]] + +local S = farming.intllib + +-- potato +minetest.register_craftitem("farming:garlic_clove", { + description = S("Garlic clove"), + inventory_image = "crops_garlic_clove.png", + groups = {seed = 2, food_garlic_clove = 1, flammable = 3}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:garlic_1") + end +}) + +-- garlic bulb +minetest.register_craftitem("farming:garlic", { + description = S("Garlic"), + inventory_image = "crops_garlic.png", + on_use = minetest.item_eat(1), + groups = {food_garlic = 1, flammable = 3} +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:garlic_clove 8", + recipe = {"farming:garlic"} +}) + +minetest.register_craft({ + output = "farming:garlic", + recipe = { + {"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"}, + {"farming:garlic_clove", "", "farming:garlic_clove"}, + {"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"} + } +}) + +-- garlic braid +minetest.register_node("farming:garlic_braid", { + description = S("Garlic Braid"), + inventory_image = "crops_garlic_braid.png", + wield_image = "crops_garlic_braid.png", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = { + "crops_garlic_braid_side.png","crops_garlic_braid.png", + "crops_garlic_braid_side.png^[transformFx","crops_garlic_braid_side.png", + "crops_garlic_braid.png","crops_garlic_braid.png" + }, + groups = {vessel = 1, dig_immediate = 3, flammable = 3}, + sounds = default.node_sound_leaves_defaults(), + node_box = { + type = "fixed", + fixed = { + {-0.13, -0.45, 0.5, 0.13, 0.45, 0.24} + } + } +}) + +minetest.register_craft({ + output = "farming:garlic_braid", + recipe = { + {"farming:garlic", "farming:garlic", "farming:garlic"}, + {"farming:garlic", "farming:garlic", "farming:garlic"}, + {"farming:garlic", "farming:garlic", "farming:garlic"} + } +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:garlic 9", + recipe = {"farming:garlic_braid"} +}) + +-- crop definition +local def = { + drawtype = "plantlike", + tiles = {"crops_garlic_plant_1.png"}, + paramtype = "light", + paramtype2 = "meshoptions", + place_param2 = 3, + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 3, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:garlic_1", table.copy(def)) + +-- stage 2 +def.tiles = {"crops_garlic_plant_2.png"} +minetest.register_node("farming:garlic_2", table.copy(def)) + +-- stage 3 +def.tiles = {"crops_garlic_plant_3.png"} +minetest.register_node("farming:garlic_3", table.copy(def)) + +-- stage 4 +def.tiles = {"crops_garlic_plant_4.png"} +minetest.register_node("farming:garlic_4", table.copy(def)) + +-- stage 5 +def.tiles = {"crops_garlic_plant_5.png"} +def.groups.growing = nil +def.drop = { + items = { + {items = {"farming:garlic 3"}, rarity = 1}, + {items = {"farming:garlic"}, rarity = 2}, + {items = {"farming:garlic"}, rarity = 5} + } +} +minetest.register_node("farming:garlic_5", table.copy(def)) + +-- add to registered_plants +farming.registered_plants["farming:garlic"] = { + crop = "farming:garlic", + seed = "farming:garlic_clove", + minlight = 13, + maxlight = 15, + steps = 5 +} diff --git a/mods/farming/crops/grapes.lua b/mods/farming/crops/grapes.lua new file mode 100644 index 00000000..5d13dc65 --- /dev/null +++ b/mods/farming/crops/grapes.lua @@ -0,0 +1,263 @@ + +local S = farming.intllib + +-- place trellis +local function place_grapes(itemstack, placer, pointed_thing, plantname) + + local pt = pointed_thing + + -- check if pointing at a node + if not pt or pt.type ~= "node" then + return + end + + local under = minetest.get_node(pt.under) + + -- return if any of the nodes are not registered + if not minetest.registered_nodes[under.name] then + return + end + + -- am I right-clicking on something that has a custom on_place set? + -- thanks to Krock for helping with this issue :) + local def = minetest.registered_nodes[under.name] + if placer and itemstack and def and def.on_rightclick then + return def.on_rightclick(pt.under, under, placer, itemstack) + end + + -- is player planting seed? + local name = placer and placer:get_player_name() or "" + + -- check for protection + if minetest.is_protected(pt.under, name) then + return + end + + -- check if pointing at trellis + if under.name ~= "farming:trellis" then + return + end + + -- add the node and remove 1 item from the itemstack + minetest.set_node(pt.under, {name = plantname}) + + minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0}) + + if placer and not farming.is_creative(placer:get_player_name()) then + + itemstack:take_item() + + -- check for refill + if itemstack:get_count() == 0 then + + minetest.after(0.20, + farming.refill_plant, + placer, + "farming:grapes", + placer:get_wield_index() + ) + end + end + + return itemstack +end + +-- grapes +minetest.register_craftitem("farming:grapes", { + description = S("Grapes"), + inventory_image = "farming_grapes.png", + on_use = minetest.item_eat(2), + groups = {seed = 2, food_grapes = 1, flammable = 3}, + on_place = function(itemstack, placer, pointed_thing) + return place_grapes(itemstack, placer, pointed_thing, "farming:grapes_1") + end +}) + +-- grapes can be used for violet dye +minetest.register_craft({ + output = "dye:violet", + recipe = { + {"farming:grapes"} + } +}) + +-- trellis +minetest.register_node("farming:trellis", { + description = S("Trellis (place on soil before planting grapes)"), + drawtype = "plantlike", + tiles = {"farming_trellis.png"}, + inventory_image = "farming_trellis.png", + visual_scale = 1.9, + paramtype = "light", + walkable = false, + buildable_to = true, + sunlight_propagates = true, + drop = "farming:trellis", + selection_box = farming.select, + groups = {snappy = 3, flammable = 2, attached_node = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_place = function(itemstack, placer, pointed_thing) + + local pt = pointed_thing + + -- check if pointing at a node + if not pt or pt.type ~= "node" then + return + end + + local under = minetest.get_node(pt.under) + + -- return if any of the nodes are not registered + if not minetest.registered_nodes[under.name] then + return + end + + -- am I right-clicking on something that has a custom on_place set? + -- thanks to Krock for helping with this issue :) + local def = minetest.registered_nodes[under.name] + if def and def.on_rightclick then + return def.on_rightclick(pt.under, under, placer, itemstack) + end + + if minetest.is_protected(pt.above, placer:get_player_name()) then + return + end + + local nodename = under.name + + if minetest.get_item_group(nodename, "soil") < 2 then + return + end + + local top = { + x = pointed_thing.above.x, + y = pointed_thing.above.y + 1, + z = pointed_thing.above.z + } + + nodename = minetest.get_node(top).name + + if nodename ~= "air" then + return + end + + minetest.set_node(pointed_thing.above, {name = "farming:trellis"}) + + if not farming.is_creative(placer:get_player_name()) then + itemstack:take_item() + end + + return itemstack + end +}) + +minetest.register_craft({ + output = "farming:trellis", + recipe = { + {"default:stick", "default:stick", "default:stick"}, + {"default:stick", "default:stick", "default:stick"}, + {"default:stick", "default:stick", "default:stick"} + } +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:trellis", + burntime = 15 +}) + +-- grapes definition +local def = { + drawtype = "plantlike", + tiles = {"farming_grapes_1.png"}, + visual_scale = 1.9, + paramtype = "light", + walkable = false, + buildable_to = true, + sunlight_propagates = true, + drop = { + items = { + {items = {"farming:trellis"}, rarity = 1}, + } + }, + selection_box = farming.select, + groups = { + snappy = 3, flammable = 3, not_in_creative_inventory = 1, + attached_node = 1, growing = 1, plant = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:grapes_1", table.copy(def)) + +-- stage2 +def.tiles = {"farming_grapes_2.png"} +minetest.register_node("farming:grapes_2", table.copy(def)) + +-- stage 3 +def.tiles = {"farming_grapes_3.png"} +minetest.register_node("farming:grapes_3", table.copy(def)) + +-- stage 4 +def.tiles = {"farming_grapes_4.png"} +minetest.register_node("farming:grapes_4", table.copy(def)) + +-- stage 5 +def.tiles = {"farming_grapes_5.png"} +minetest.register_node("farming:grapes_5", table.copy(def)) + +-- stage 6 +def.tiles = {"farming_grapes_6.png"} +minetest.register_node("farming:grapes_6", table.copy(def)) + +-- stage 7 +def.tiles = {"farming_grapes_7.png"} +minetest.register_node("farming:grapes_7", table.copy(def)) + +-- stage 8 (final) +def.tiles = {"farming_grapes_8.png"} +def.groups.growing = nil +def.drop = { + items = { + {items = {"farming:trellis"}, rarity = 1}, + {items = {"farming:grapes 3"}, rarity = 1}, + {items = {"farming:grapes 1"}, rarity = 2}, + {items = {"farming:grapes 1"}, rarity = 3} + } +} +minetest.register_node("farming:grapes_8", table.copy(def)) + +-- add to registered_plants +farming.registered_plants["farming:grapes"] = { + crop = "farming:grapes", + seed = "farming:grapes", + minlight = 13, + maxlight = 15, + steps = 8 +} + +-- wild grape vine (this is what you find on the map) +minetest.register_node("farming:grapebush", { + drawtype = "plantlike", + tiles = {"farming_grapebush.png"}, + paramtype = "light", + waving = 1, + walkable = false, + buildable_to = true, + sunlight_propagates = true, + drop = { + items = { + {items = {"farming:grapes 1"}, rarity = 1}, + {items = {"farming:grapes 1"}, rarity = 2}, + {items = {"farming:grapes 1"}, rarity = 3} + } + }, + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1 + }, + sounds = default.node_sound_leaves_defaults() +}) diff --git a/mods/farming/crops/hemp.lua b/mods/farming/crops/hemp.lua new file mode 100644 index 00000000..08b54cd7 --- /dev/null +++ b/mods/farming/crops/hemp.lua @@ -0,0 +1,260 @@ + +local S = farming.intllib + +-- hemp seeds +minetest.register_node("farming:seed_hemp", { + description = S("Hemp Seed"), + tiles = {"farming_hemp_seed.png"}, + inventory_image = "farming_hemp_seed.png", + wield_image = "farming_hemp_seed.png", + drawtype = "signlike", + groups = {seed = 1, snappy = 3, attached_node = 1}, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = farming.select, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:hemp_1") + end +}) + +-- harvested hemp +minetest.register_craftitem("farming:hemp_leaf", { + description = S("Hemp Leaf"), + inventory_image = "farming_hemp_leaf.png" +}) + +-- hemp oil +minetest.register_node("farming:hemp_oil", { + description = S("Bottle of Hemp Oil"), + drawtype = "plantlike", + tiles = {"farming_hemp_oil.png"}, + inventory_image = "farming_hemp_oil.png", + wield_image = "farming_hemp_oil.png", + paramtype = "light", + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + groups = {food_oil = 1, vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults() +}) + +minetest.register_craft( { + output = "farming:hemp_oil", + recipe = { + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"", "vessels:glass_bottle", ""} + } +}) + +minetest.register_craft( { + output = "farming:hemp_oil", + recipe = { + {"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"}, + {"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"}, + {"farming:seed_hemp", "vessels:glass_bottle", "farming:seed_hemp"} + } +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:hemp_oil", + burntime = 20, + replacements = {{ "farming:hemp_oil", "vessels:glass_bottle"}} +}) + +-- hemp fibre +minetest.register_craftitem("farming:hemp_fibre", { + description = S("Hemp Fibre"), + inventory_image = "farming_hemp_fibre.png" +}) + +minetest.register_craft( { + output = "farming:hemp_fibre 8", + recipe = { + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "bucket:bucket_water", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"} + }, + replacements = {{ "bucket:bucket_water", "bucket:bucket_empty"}} +}) + +minetest.register_craft( { + output = "farming:hemp_fibre 8", + recipe = { + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "bucket:bucket_river_water", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"} + }, + replacements = {{ "bucket:bucket_river_water", "bucket:bucket_empty"}} +}) + +-- hemp block +minetest.register_node("farming:hemp_block", { + description = S("Hemp Block"), + tiles = {"farming_hemp_block.png"}, + paramtype = "light", + groups = {snappy = 1, oddly_breakable_by_hand = 1, flammable = 2} +}) + +minetest.register_craft( { + output = "farming:hemp_block", + recipe = { + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"} + } +}) + +-- check and register stairs +if minetest.global_exists("stairs") then + + if stairs.mod and stairs.mod == "redo" then + + stairs.register_all("hemp_block", "farming:hemp_block", + {snappy = 1, flammable = 2}, + {"farming_hemp_block.png"}, + "Hemp Block", + default.node_sound_leaves_defaults()) + else + + stairs.register_stair_and_slab("hemp_block", "farming:hemp_block", + {snappy = 1, flammable = 2}, + {"farming_hemp_block.png"}, + "Hemp Block Stair", + "Hemp Block Slab", + default.node_sound_leaves_defaults()) + end +end + +-- paper +minetest.register_craft( { + output = "default:paper 3", + recipe = { + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"} + } +}) + +-- string +minetest.register_craft( { + output = "farming:cotton 3", + recipe = { + {"farming:hemp_fibre"}, + {"farming:hemp_fibre"}, + {"farming:hemp_fibre"} + } +}) + +-- hemp rope +minetest.register_node("farming:hemp_rope", { + description = S("Hemp Rope"), + walkable = false, + climbable = true, + sunlight_propagates = true, + paramtype = "light", + tiles = {"farming_hemp_rope.png"}, + wield_image = "farming_hemp_rope.png", + inventory_image = "farming_hemp_rope.png", + drawtype = "plantlike", + groups = {flammable = 2, choppy = 3, oddly_breakable_by_hand = 3}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7} + } +}) + +-- string +minetest.register_craft( { + output = "farming:hemp_rope 6", + recipe = { + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, + {"farming:cotton", "farming:cotton", "farming:cotton"}, + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"} + } +}) + +-- hemp definition +local def = { + drawtype = "plantlike", + tiles = {"farming_hemp_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:hemp_1", table.copy(def)) + +-- stage 2 +def.tiles = {"farming_hemp_2.png"} +minetest.register_node("farming:hemp_2", table.copy(def)) + +-- stage 3 +def.tiles = {"farming_hemp_3.png"} +minetest.register_node("farming:hemp_3", table.copy(def)) + +-- stage 4 +def.tiles = {"farming_hemp_4.png"} +minetest.register_node("farming:hemp_4", table.copy(def)) + +-- stage 5 +def.tiles = {"farming_hemp_5.png"} +minetest.register_node("farming:hemp_5", table.copy(def)) + +-- stage 6 +def.tiles = {"farming_hemp_6.png"} +def.drop = { + items = { + {items = {"farming:hemp_leaf"}, rarity = 2}, + {items = {"farming:seed_hemp"}, rarity = 1} + } +} +minetest.register_node("farming:hemp_6", table.copy(def)) + +-- stage 7 +def.tiles = {"farming_hemp_7.png"} +def.drop = { + items = { + {items = {"farming:hemp_leaf"}, rarity = 1}, + {items = {"farming:hemp_leaf"}, rarity = 3}, + {items = {"farming:seed_hemp"}, rarity = 1}, + {items = {"farming:seed_hemp"}, rarity = 3} + } +} +minetest.register_node("farming:hemp_7", table.copy(def)) + +-- stage 8 (final) +def.tiles = {"farming_hemp_8.png"} +def.groups.growing = nil +def.drop = { + items = { + {items = {"farming:hemp_leaf 2"}, rarity = 1}, + {items = {"farming:hemp_leaf"}, rarity = 2}, + {items = {"farming:seed_hemp"}, rarity = 1}, + {items = {"farming:seed_hemp"}, rarity = 2} + } +} +minetest.register_node("farming:hemp_8", table.copy(def)) + +-- add to registered_plants +farming.registered_plants["farming:hemp"] = { + crop = "farming:hemp", + seed = "farming:seed_hemp", + minlight = 13, + maxlight = 15, + steps = 8 +}