From 94d8b5a014944974642e412bbe526be1200763d0 Mon Sep 17 00:00:00 2001 From: thunderdog1138 Date: Fri, 17 Jul 2020 12:52:26 +0000 Subject: [PATCH] Upload files to 'mods/farming/crops' --- mods/farming/crops/pineapple.lua | 141 +++++++++++++++++++++ mods/farming/crops/potato.lua | 112 +++++++++++++++++ mods/farming/crops/pumpkin.lua | 206 +++++++++++++++++++++++++++++++ mods/farming/crops/raspberry.lua | 80 ++++++++++++ mods/farming/crops/rhubarb.lua | 77 ++++++++++++ 5 files changed, 616 insertions(+) create mode 100644 mods/farming/crops/pineapple.lua create mode 100644 mods/farming/crops/potato.lua create mode 100644 mods/farming/crops/pumpkin.lua create mode 100644 mods/farming/crops/raspberry.lua create mode 100644 mods/farming/crops/rhubarb.lua diff --git a/mods/farming/crops/pineapple.lua b/mods/farming/crops/pineapple.lua new file mode 100644 index 00000000..f57ccf0f --- /dev/null +++ b/mods/farming/crops/pineapple.lua @@ -0,0 +1,141 @@ + +local S = farming.intllib + +-- pineapple top +minetest.register_craftitem("farming:pineapple_top", { + description = S("Pineapple Top"), + inventory_image = "farming_pineapple_top.png", + groups = {seed = 2, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:pineapple_1") + end +}) + +-- pineapple +minetest.register_node("farming:pineapple", { + description = S("Pineapple"), + drawtype = "plantlike", + tiles = {"farming_pineapple.png"}, + inventory_image = "farming_pineapple.png", + wield_image = "farming_pineapple.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.27, -0.37, -0.27, 0.27, 0.44, 0.27} + }, + groups = {food_pineapple = 1, fleshy = 3, dig_immediate = 3, flammable = 2} +}) + +-- pineapple +minetest.register_craftitem("farming:pineapple_ring", { + description = S("Pineapple Ring"), + inventory_image = "farming_pineapple_ring.png", + groups = {food_pineapple_ring = 1, flammable = 2}, + on_use = minetest.item_eat(1) +}) + +minetest.register_craft( { + output = "farming:pineapple_ring 5", + type = "shapeless", + recipe = {"group:food_pineapple"}, + replacements = {{"farming:pineapple", "farming:pineapple_top"}} +}) + +-- pineapple juice +minetest.register_craftitem("farming:pineapple_juice", { + description = S("Pineapple Juice"), + inventory_image = "farming_pineapple_juice.png", + on_use = minetest.item_eat(4, "vessels:drinking_glass"), + groups = {vessel = 1, drink = 1} +}) + +minetest.register_craft({ + output = "farming:pineapple_juice", + type = "shapeless", + recipe = { + "vessels:drinking_glass", "group:food_pineapple_ring", + "group:food_pineapple_ring", "group:food_pineapple_ring", + "farming:juicer"}, + replacements = { + {"group:food_juicer", "farming:juicer"} + } +}) + +minetest.register_craft({ + output = "farming:pineapple_juice 2", + type = "shapeless", + recipe = { + "vessels:drinking_glass", "vessels:drinking_glass", + "group:food_pineapple", "farming:juicer" + }, + replacements = { + {"group:food_juicer", "farming:juicer"} + } +}) + +-- crop definition +local def = { + drawtype = "plantlike", + visual_scale = 1.5, + tiles = {"farming_pineapple_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:pineapple_1", table.copy(def)) + +-- stage 2 +def.tiles = {"farming_pineapple_2.png"} +minetest.register_node("farming:pineapple_2", table.copy(def)) + +-- stage 3 +def.tiles = {"farming_pineapple_3.png"} +minetest.register_node("farming:pineapple_3", table.copy(def)) + +-- stage 4 +def.tiles = {"farming_pineapple_4.png"} +minetest.register_node("farming:pineapple_4", table.copy(def)) + +-- stage 5 +def.tiles = {"farming_pineapple_5.png"} +minetest.register_node("farming:pineapple_5", table.copy(def)) + +-- stage 6 +def.tiles = {"farming_pineapple_6.png"} +minetest.register_node("farming:pineapple_6", table.copy(def)) + +-- stage 7 +def.tiles = {"farming_pineapple_7.png"} +minetest.register_node("farming:pineapple_7", table.copy(def)) + +-- stage 8 (final) +def.tiles = {"farming_pineapple_8.png"} +def.groups.growing = nil +def.drop = { + items = { + {items = {"farming:pineapple"}, rarity = 1}, + {items = {"farming:pineapple"}, rarity = 10} + } +} +minetest.register_node("farming:pineapple_8", table.copy(def)) + +-- add to registered_plants +farming.registered_plants["farming:pineapple"] = { + crop = "farming:pineapple", + seed = "farming:pineapple_top", + minlight = 13, + maxlight = 15, + steps = 8 +} diff --git a/mods/farming/crops/potato.lua b/mods/farming/crops/potato.lua new file mode 100644 index 00000000..8c087d0c --- /dev/null +++ b/mods/farming/crops/potato.lua @@ -0,0 +1,112 @@ + +--[[ + Original textures from DocFarming mod + https://forum.minetest.net/viewtopic.php?id=3948 +]] + +local S = farming.intllib + +-- potato +minetest.register_craftitem("farming:potato", { + description = S("Potato"), + inventory_image = "farming_potato.png", + groups = {seed = 2, food_potato = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:potato_1") + end, + -- 1 in 3 chance of being poisoned + on_use = function(itemstack, user, pointed_thing) + if user then + if math.random(3) == 1 then + return minetest.do_item_eat(-1, nil, itemstack, user, pointed_thing) + else + return minetest.do_item_eat(1, nil, itemstack, user, pointed_thing) + end + end + end +}) + +-- baked potato +minetest.register_craftitem("farming:baked_potato", { + description = S("Baked Potato"), + inventory_image = "farming_baked_potato.png", + on_use = minetest.item_eat(6) +}) + +minetest.register_craft({ + type = "cooking", + cooktime = 10, + output = "farming:baked_potato", + recipe = "group:food_potato" +}) + +-- Potato and cucumber Salad +minetest.register_craftitem("farming:potato_salad", { + description = S("Cucumber and Potato Salad"), + inventory_image = "farming_potato_salad.png", + on_use = minetest.item_eat(10, "farming:bowl") +}) + +minetest.register_craft({ + output = "farming:potato_salad", + recipe = { + {"group:food_cucumber"}, + {"farming:baked_potato"}, + {"group:food_bowl"} + } +}) + +-- potato definition +local def = { + drawtype = "plantlike", + tiles = {"farming_potato_1.png"}, + paramtype = "light", + sunlight_propagates = true, + waving = 1, + 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:potato_1", table.copy(def)) + +-- stage 2 +def.tiles = {"farming_potato_2.png"} +minetest.register_node("farming:potato_2", table.copy(def)) + +-- stage 3 +def.tiles = {"farming_potato_3.png"} +def.drop = { + items = { + {items = {"farming:potato"}, rarity = 1}, + {items = {"farming:potato"}, rarity = 3} + } +} +minetest.register_node("farming:potato_3", table.copy(def)) + +-- stage 4 +def.tiles = {"farming_potato_4.png"} +def.groups.growing = nil +def.drop = { + items = { + {items = {"farming:potato 2"}, rarity = 1}, + {items = {"farming:potato 3"}, rarity = 2} + } +} +minetest.register_node("farming:potato_4", table.copy(def)) + +-- add to registered_plants +farming.registered_plants["farming:potato"] = { + crop = "farming:potato", + seed = "farming:potato", + minlight = 13, + maxlight = 15, + steps = 4 +} diff --git a/mods/farming/crops/pumpkin.lua b/mods/farming/crops/pumpkin.lua new file mode 100644 index 00000000..1b0b8c45 --- /dev/null +++ b/mods/farming/crops/pumpkin.lua @@ -0,0 +1,206 @@ + +--[[ + Big thanks to PainterlyPack.net for allowing me to use these textures +]] + +local S = farming.intllib + +-- pumpkin slice +minetest.register_craftitem("farming:pumpkin_slice", { + description = S("Pumpkin Slice"), + inventory_image = "farming_pumpkin_slice.png", + groups = {seed = 2, food_pumpkin_slice = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1") + end, + on_use = minetest.item_eat(2) +}) + +minetest.register_craft({ + output = "farming:pumpkin", + recipe = { + {"farming:pumpkin_slice", "farming:pumpkin_slice"}, + {"farming:pumpkin_slice", "farming:pumpkin_slice"} + } +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:pumpkin_slice 4", + recipe = {"farming:pumpkin", "farming:cutting_board"}, + replacements = {{"farming:cutting_board", "farming:cutting_board"}} +}) + +-- jack 'o lantern +minetest.register_node("farming:jackolantern", { + description = S("Jack 'O Lantern (punch to turn on and off)"), + tiles = { + "farming_pumpkin_top.png", "farming_pumpkin_top.png", + "farming_pumpkin_side.png", "farming_pumpkin_side.png", + "farming_pumpkin_side.png", "farming_pumpkin_face_off.png" + }, + paramtype2 = "facedir", + groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + on_punch = function(pos, node, puncher) + local name = puncher:get_player_name() or "" + if minetest.is_protected(pos, name) then return end + node.name = "farming:jackolantern_on" + minetest.swap_node(pos, node) + end +}) + +minetest.register_node("farming:jackolantern_on", { + tiles = { + "farming_pumpkin_top.png", "farming_pumpkin_top.png", + "farming_pumpkin_side.png", "farming_pumpkin_side.png", + "farming_pumpkin_side.png", "farming_pumpkin_face_on.png" + }, + light_source = default.LIGHT_MAX - 1, + paramtype2 = "facedir", + groups = { + choppy = 1, oddly_breakable_by_hand = 1, flammable = 2, + not_in_creative_inventory = 1 + }, + sounds = default.node_sound_wood_defaults(), + drop = "farming:jackolantern", + on_punch = function(pos, node, puncher) + local name = puncher:get_player_name() or "" + if minetest.is_protected(pos, name) then return end + node.name = "farming:jackolantern" + minetest.swap_node(pos, node) + end +}) + +minetest.register_craft({ + output = "farming:jackolantern", + recipe = { + {"default:torch"}, + {"group:food_pumpkin"} + } +}) + +--- wooden scarecrow base +minetest.register_node("farming:scarecrow_bottom", { + description = S("Scarecrow Bottom"), + paramtype = "light", + sunlight_propagates = true, + paramtype2 = "facedir", + tiles = {"default_wood.png"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-1/16, -8/16, -1/16, 1/16, 8/16, 1/16}, + {-12/16, 4/16, -1/16, 12/16, 2/16, 1/16}, + } + }, + groups = {snappy = 3, flammable = 2} +}) + +minetest.register_craft({ + output = "farming:scarecrow_bottom", + recipe = { + {"", "group:stick", ""}, + {"group:stick", "group:stick", "group:stick"}, + {"", "group:stick", ""} + } +}) + +-- pumpkin bread +minetest.register_craftitem("farming:pumpkin_bread", { + description = S("Pumpkin Bread"), + inventory_image = "farming_pumpkin_bread.png", + on_use = minetest.item_eat(8), + groups = {food_bread = 1, flammable = 2} +}) + +minetest.register_craftitem("farming:pumpkin_dough", { + description = S("Pumpkin Dough"), + inventory_image = "farming_pumpkin_dough.png" +}) + +minetest.register_craft({ + output = "farming:pumpkin_dough", + type = "shapeless", + recipe = {"group:food_flour", "group:food_pumpkin_slice", "group:food_pumpkin_slice"} +}) + +minetest.register_craft({ + type = "cooking", + output = "farming:pumpkin_bread", + recipe = "farming:pumpkin_dough", + cooktime = 10 +}) + +-- pumpkin definition +local def = { + drawtype = "plantlike", + tiles = {"farming_pumpkin_1.png"}, + paramtype = "light", + sunlight_propagates = true, + waving = 1, + 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:pumpkin_1", table.copy(def)) + +-- stage 2 +def.tiles = {"farming_pumpkin_2.png"} +minetest.register_node("farming:pumpkin_2", table.copy(def)) + +-- stage 3 +def.tiles = {"farming_pumpkin_3.png"} +minetest.register_node("farming:pumpkin_3", table.copy(def)) + +-- stage 4 +def.tiles = {"farming_pumpkin_4.png"} +minetest.register_node("farming:pumpkin_4", table.copy(def)) + +-- stage 5 +def.tiles = {"farming_pumpkin_5.png"} +minetest.register_node("farming:pumpkin_5", table.copy(def)) + +-- stage 6 +def.tiles = {"farming_pumpkin_6.png"} +minetest.register_node("farming:pumpkin_6", table.copy(def)) + +-- stage 7 +def.tiles = {"farming_pumpkin_7.png"} +minetest.register_node("farming:pumpkin_7", table.copy(def)) + +-- stage 8 (final) +minetest.register_node("farming:pumpkin_8", { + description = S("Pumpkin"), + tiles = { + "farming_pumpkin_top.png", + "farming_pumpkin_top.png", + "farming_pumpkin_side.png" + }, + groups = { + food_pumpkin = 1, choppy = 2, oddly_breakable_by_hand = 1, + flammable = 2, plant = 1 + }, + drop = "farming:pumpkin_8", + sounds = default.node_sound_wood_defaults() +}) + +minetest.register_alias("farming:pumpkin", "farming:pumpkin_8") + +-- add to registered_plants +farming.registered_plants["farming:pumpkin"] = { + crop = "farming:pumpkin", + seed = "farming:pumpkin_slice", + minlight = 13, + maxlight = 15, + steps = 8 +} diff --git a/mods/farming/crops/raspberry.lua b/mods/farming/crops/raspberry.lua new file mode 100644 index 00000000..0914aa40 --- /dev/null +++ b/mods/farming/crops/raspberry.lua @@ -0,0 +1,80 @@ + +local S = farming.intllib + +-- raspberries +minetest.register_craftitem("farming:raspberries", { + description = S("Raspberries"), + inventory_image = "farming_raspberries.png", + groups = {seed = 2, food_raspberries = 1, food_raspberry = 1, + food_berry = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:raspberry_1") + end, + on_use = minetest.item_eat(1) +}) + +-- raspberry smoothie +minetest.register_craftitem("farming:smoothie_raspberry", { + description = S("Raspberry Smoothie"), + inventory_image = "farming_raspberry_smoothie.png", + on_use = minetest.item_eat(2, "vessels:drinking_glass"), + groups = {vessel = 1, drink = 1} +}) + +minetest.register_craft({ + output = "farming:smoothie_raspberry", + recipe = { + {"default:snow"}, + {"group:food_raspberries"}, + {"vessels:drinking_glass"} + } +}) + +-- raspberries definition +local def = { + drawtype = "plantlike", + tiles = {"farming_raspberry_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:raspberry_1", table.copy(def)) + +-- stage 2 +def.tiles = {"farming_raspberry_2.png"} +minetest.register_node("farming:raspberry_2", table.copy(def)) + +-- stage 3 +def.tiles = {"farming_raspberry_3.png"} +minetest.register_node("farming:raspberry_3", table.copy(def)) + +-- stage 4 (final) +def.tiles = {"farming_raspberry_4.png"} +def.groups.growing = nil +def.drop = { + items = { + {items = {"farming:raspberries 2"}, rarity = 1}, + {items = {"farming:raspberries"}, rarity = 2}, + {items = {"farming:raspberries"}, rarity = 3} + } +} +minetest.register_node("farming:raspberry_4", table.copy(def)) + +-- add to registered_plants +farming.registered_plants["farming:raspberries"] = { + crop = "farming:raspberry", + seed = "farming:raspberries", + minlight = 13, + maxlight = 15, + steps = 4 +} diff --git a/mods/farming/crops/rhubarb.lua b/mods/farming/crops/rhubarb.lua new file mode 100644 index 00000000..bd44a713 --- /dev/null +++ b/mods/farming/crops/rhubarb.lua @@ -0,0 +1,77 @@ + +local S = farming.intllib + +-- rhubarb +minetest.register_craftitem("farming:rhubarb", { + description = S("Rhubarb"), + inventory_image = "farming_rhubarb.png", + groups = {seed = 2, food_rhubarb = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:rhubarb_1") + end, + on_use = minetest.item_eat(1) +}) + +-- rhubarb pie +minetest.register_craftitem("farming:rhubarb_pie", { + description = S("Rhubarb Pie"), + inventory_image = "farming_rhubarb_pie.png", + on_use = minetest.item_eat(6) +}) + +minetest.register_craft({ + output = "farming:rhubarb_pie", + recipe = { + {"farming:baking_tray", "group:food_sugar", ""}, + {"group:food_rhubarb", "group:food_rhubarb", "group:food_rhubarb"}, + {"group:food_wheat", "group:food_wheat", "group:food_wheat"} + }, + replacements = {{"group:food_baking_tray", "farming:baking_tray"}} +}) + +-- rhubarb definition +local def = { + drawtype = "plantlike", + tiles = {"farming_rhubarb_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(), + minlight = 10, + maxlight = 12, +} + +-- stage 1 +minetest.register_node("farming:rhubarb_1", table.copy(def)) + +-- stage2 +def.tiles = {"farming_rhubarb_2.png"} +minetest.register_node("farming:rhubarb_2", table.copy(def)) + +-- stage 3 (final) +def.tiles = {"farming_rhubarb_3.png"} +def.groups.growing = nil +def.drop = { + items = { + {items = {"farming:rhubarb 2"}, rarity = 1}, + {items = {"farming:rhubarb"}, rarity = 2}, + {items = {"farming:rhubarb"}, rarity = 3} + } +} +minetest.register_node("farming:rhubarb_3", table.copy(def)) + +-- add to registered_plants +farming.registered_plants["farming:rhubarb"] = { + crop = "farming:rhubarb", + seed = "farming:rhubarb", + minlight = 13, + maxlight = 15, + steps = 3 +}