diff --git a/README.txt b/README.txt index 8d81ca6..7ab9abe 100644 --- a/README.txt +++ b/README.txt @@ -13,6 +13,7 @@ This mod works by adding your new plant to the {growing=1} group and numbering t Changelog: +1.30 - Added Garlic, Pepper and Onions thanks to Grizzly Adam for sharing textures 1.29 - Updating functions so requires Minetest 0.4.16 and above to run 1.28 - Added chili peppers and bowl of chili, optimized code and fixed a few bugs, added porridge 1.27 - Added meshoptions to api and wheat plants, added farming.rarity setting to spawn more/less crops on map, have separate cotton/string items (4x cotton = 1x wool, 2x cotton = 2x string) diff --git a/farming.conf_example b/farming.conf_example index be6e398..d8e40de 100644 --- a/farming.conf_example +++ b/farming.conf_example @@ -25,6 +25,9 @@ farming.grapes = true farming.barley = true farming.chili = true farming.hemp = true +farming.onion = true +farming.garlic = true +farming.pepper = true farming.donuts = true -- rarety of crops on map, default is 0.006 (higher number = more crops) diff --git a/garlic.lua b/garlic.lua new file mode 100644 index 0000000..ffbf3ec --- /dev/null +++ b/garlic.lua @@ -0,0 +1,128 @@ + +--[[ + 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", + 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 = {garlic = 1}, +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:garlic_clove 9", + 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", "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}, + 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 crop_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, flora = 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(crop_def)) + +-- stage 2 +crop_def.tiles = {"crops_garlic_plant_2.png"} +minetest.register_node("farming:garlic_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"crops_garlic_plant_3.png"} +minetest.register_node("farming:garlic_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"crops_garlic_plant_4.png"} +minetest.register_node("farming:garlic_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"crops_garlic_plant_5.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + max_items = 5, items = { + {items = {'farming:garlic'}, rarity = 1}, + {items = {'farming:garlic'}, rarity = 1}, + {items = {'farming:garlic'}, rarity = 1}, + {items = {'farming:garlic'}, rarity = 2}, + {items = {'farming:garlic'}, rarity = 5}, + } +} +minetest.register_node("farming:garlic_5", table.copy(crop_def)) diff --git a/init.lua b/init.lua index e4919ec..ab700de 100644 --- a/init.lua +++ b/init.lua @@ -7,7 +7,7 @@ farming = {} farming.mod = "redo" -farming.version = "1.29" +farming.version = "1.30" farming.path = minetest.get_modpath("farming") farming.select = { type = "fixed", @@ -595,6 +595,9 @@ farming.grapes = true farming.barley = true farming.chili = true farming.hemp = true +farming.garlic = true +farming.onion = true +farming.pepper = true farming.donuts = true farming.rarety = 0.006 @@ -646,6 +649,9 @@ if farming.barley then dofile(farming.path.."/barley.lua") end if farming.chili then dofile(farming.path.."/chili.lua") end if farming.hemp then dofile(farming.path.."/hemp.lua") end if farming.donuts then dofile(farming.path.."/donut.lua") end +if farming.garlic then dofile(farming.path.."/garlic.lua") end +if farming.onion then dofile(farming.path.."/onion.lua") end +if farming.pepper then dofile(farming.path.."/pepper.lua") end dofile(farming.path.."/mapgen.lua") dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility diff --git a/onion.lua b/onion.lua new file mode 100644 index 0000000..bf8737a --- /dev/null +++ b/onion.lua @@ -0,0 +1,67 @@ + +--[[ + 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:onion", { + description = S("Onion"), + inventory_image = "crops_onion.png", + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:onion_1") + end, + on_use = minetest.item_eat(1), +}) + +-- crop definition +local crop_def = { + drawtype = "plantlike", + tiles = {"crops_onion_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, flora = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:onion_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"crops_onion_plant_2.png"} +minetest.register_node("farming:onion_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"crops_onion_plant_3.png"} +minetest.register_node("farming:onion_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"crops_onion_plant_4.png"} +minetest.register_node("farming:onion_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"crops_onion_plant_5.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + max_items = 5, items = { + {items = {'farming:onion'}, rarity = 1}, + {items = {'farming:onion'}, rarity = 1}, + {items = {'farming:onion'}, rarity = 1}, + {items = {'farming:onion'}, rarity = 2}, + {items = {'farming:onion'}, rarity = 5}, + } +} +minetest.register_node("farming:onion_5", table.copy(crop_def)) diff --git a/pepper.lua b/pepper.lua new file mode 100644 index 0000000..3ce60cd --- /dev/null +++ b/pepper.lua @@ -0,0 +1,99 @@ + +--[[ + 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 + +-- peppercorn (seed) +minetest.register_craftitem("farming:peppercorn", { + description = S("Peppercorn"), + inventory_image = "crops_peppercorn.png", + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:pepper_1") + end, +}) + +-- green pepper +minetest.register_craftitem("farming:pepper", { + description = S("Pepper"), + inventory_image = "crops_pepper.png", + on_use = minetest.item_eat(2), + groups = {pepper = 1}, +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:peppercorn", + recipe = { "farming:pepper" } +}) + +-- ground pepper +minetest.register_node("farming:pepper_ground", { + description = ("Ground Pepper"), + inventory_image = "crops_pepper_ground.png", + wield_image = "crops_pepper_ground.png", + drawtype = "plantlike", + paramtype = "light", + tiles = {"crops_pepper_ground.png"}, + groups = {vessel = 1, pepper_ground = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, +}) + +minetest.register_craft( { + output = "farming:pepper_ground", + type = "shapeless", + recipe = {"farming:peppercorn", "vessels:glass_bottle"} +}) + +-- crop definition +local crop_def = { + drawtype = "plantlike", + tiles = {"crops_pepper_plant_1.png"}, + paramtype = "light", + paramtype2 = "meshoptions", + place_param2 = 1, + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 3, flora = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:pepper_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"crops_pepper_plant_2.png"} +minetest.register_node("farming:pepper_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"crops_pepper_plant_3.png"} +minetest.register_node("farming:pepper_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"crops_pepper_plant_4.png"} +minetest.register_node("farming:pepper_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"crops_pepper_plant_5.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + max_items = 2, items = { + {items = {'farming:pepper'}, rarity = 1}, + {items = {'farming:pepper'}, rarity = 2}, + } +} +minetest.register_node("farming:pepper_5", table.copy(crop_def)) diff --git a/textures/crops_garlic.png b/textures/crops_garlic.png new file mode 100644 index 0000000..a73638c Binary files /dev/null and b/textures/crops_garlic.png differ diff --git a/textures/crops_garlic_braid.png b/textures/crops_garlic_braid.png new file mode 100644 index 0000000..f5fa269 Binary files /dev/null and b/textures/crops_garlic_braid.png differ diff --git a/textures/crops_garlic_braid_side.png b/textures/crops_garlic_braid_side.png new file mode 100644 index 0000000..ce467b7 Binary files /dev/null and b/textures/crops_garlic_braid_side.png differ diff --git a/textures/crops_garlic_clove.png b/textures/crops_garlic_clove.png new file mode 100644 index 0000000..bfc1cee Binary files /dev/null and b/textures/crops_garlic_clove.png differ diff --git a/textures/crops_garlic_plant_1.png b/textures/crops_garlic_plant_1.png new file mode 100644 index 0000000..61eb9a8 Binary files /dev/null and b/textures/crops_garlic_plant_1.png differ diff --git a/textures/crops_garlic_plant_2.png b/textures/crops_garlic_plant_2.png new file mode 100644 index 0000000..217fd25 Binary files /dev/null and b/textures/crops_garlic_plant_2.png differ diff --git a/textures/crops_garlic_plant_3.png b/textures/crops_garlic_plant_3.png new file mode 100644 index 0000000..557b017 Binary files /dev/null and b/textures/crops_garlic_plant_3.png differ diff --git a/textures/crops_garlic_plant_4.png b/textures/crops_garlic_plant_4.png new file mode 100644 index 0000000..80ef076 Binary files /dev/null and b/textures/crops_garlic_plant_4.png differ diff --git a/textures/crops_garlic_plant_5.png b/textures/crops_garlic_plant_5.png new file mode 100644 index 0000000..8b8c31a Binary files /dev/null and b/textures/crops_garlic_plant_5.png differ diff --git a/textures/crops_onion.png b/textures/crops_onion.png new file mode 100644 index 0000000..2099c63 Binary files /dev/null and b/textures/crops_onion.png differ diff --git a/textures/crops_onion_plant_1.png b/textures/crops_onion_plant_1.png new file mode 100644 index 0000000..dea2d4b Binary files /dev/null and b/textures/crops_onion_plant_1.png differ diff --git a/textures/crops_onion_plant_2.png b/textures/crops_onion_plant_2.png new file mode 100644 index 0000000..1f850f1 Binary files /dev/null and b/textures/crops_onion_plant_2.png differ diff --git a/textures/crops_onion_plant_3.png b/textures/crops_onion_plant_3.png new file mode 100644 index 0000000..d9af239 Binary files /dev/null and b/textures/crops_onion_plant_3.png differ diff --git a/textures/crops_onion_plant_4.png b/textures/crops_onion_plant_4.png new file mode 100644 index 0000000..962b21b Binary files /dev/null and b/textures/crops_onion_plant_4.png differ diff --git a/textures/crops_onion_plant_5.png b/textures/crops_onion_plant_5.png new file mode 100644 index 0000000..dfb1f7f Binary files /dev/null and b/textures/crops_onion_plant_5.png differ diff --git a/textures/crops_pepper.png b/textures/crops_pepper.png new file mode 100644 index 0000000..bb8f40c Binary files /dev/null and b/textures/crops_pepper.png differ diff --git a/textures/crops_pepper_ground.png b/textures/crops_pepper_ground.png new file mode 100644 index 0000000..d72405a Binary files /dev/null and b/textures/crops_pepper_ground.png differ diff --git a/textures/crops_pepper_plant_1.png b/textures/crops_pepper_plant_1.png new file mode 100644 index 0000000..43ce6ba Binary files /dev/null and b/textures/crops_pepper_plant_1.png differ diff --git a/textures/crops_pepper_plant_2.png b/textures/crops_pepper_plant_2.png new file mode 100644 index 0000000..556f952 Binary files /dev/null and b/textures/crops_pepper_plant_2.png differ diff --git a/textures/crops_pepper_plant_3.png b/textures/crops_pepper_plant_3.png new file mode 100644 index 0000000..24e92e1 Binary files /dev/null and b/textures/crops_pepper_plant_3.png differ diff --git a/textures/crops_pepper_plant_4.png b/textures/crops_pepper_plant_4.png new file mode 100644 index 0000000..e33554d Binary files /dev/null and b/textures/crops_pepper_plant_4.png differ diff --git a/textures/crops_pepper_plant_5.png b/textures/crops_pepper_plant_5.png new file mode 100644 index 0000000..c2c92eb Binary files /dev/null and b/textures/crops_pepper_plant_5.png differ diff --git a/textures/crops_peppercorn.png b/textures/crops_peppercorn.png new file mode 100644 index 0000000..0ee3c49 Binary files /dev/null and b/textures/crops_peppercorn.png differ