diff --git a/README.md b/README.md index cfabffa..56c20d2 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,20 @@ -minetest mod Farming Redo -========================= - -This mod improves all food and farming related content +Farming Redo mod for Minetest +============================= Information ----------- -This mod must be named `farming` a simplified but improved version of the built-in farming -mod in minetest but with more foods, it comes with wheat, cotton, carrot, cucumber, -potato, melon, cotton, cocoa, corn, better pumpkin and tomato to start out with which -spawn throughout the map... - -It also features that foods can be planted on tilled soil so for those then no seeds are required, -original wheat and cotton will require seeds which are found inside normal and jungle grass... +This mod replaces the default `farming` mod with a fully compatible API that allows +players to grow crops even when they are not nearby. It also includes many new foods +and crops which can be planted directly onto tilled soil without seeds. Crops that do +require seeds like wheat and cotton are found when digging in long grasses. ![screenshot.png](screenshot.png) Tech information ---------------- -Farming Redo is a simplified version of the built-in farming mod in minetest and comes with wheat, cotton, carrot, cucumber, potato and tomato to start out with which spawn throughout the map... new foods need only be planted on tilled soil so no seeds are required, original wheat and cotton will require seeds which are found inside normal and jungle grass... - -This mod works by adding your new plant to the {growing=1} group and numbering the stages from _1 to as many stages as you like, but the underscore MUST be used only once in the node name to separate plant from stage number e.g. +Crops grow by adding your new plant to the {growing = 1} group and numbering the stages from _1 to as many stages as you like, but the underscore MUST be used only once in the node name to separate plant from stage number e.g. * "farming:cotton_1" through to "farming:cotton_8" * "farming:wheat_1" through to "farming:wheat_8" @@ -45,63 +38,67 @@ Optional dependences: #### Configuration -It reads the configuration values from two places, `minetest.conf` and `farming.conf`, this last -must be at world path, if you have older place at mod path will be read but must be deprecated. +`farming.conf` is used to load custom settings for each crop and can be found in either the +farming mod folder or the world folder. Also `minetest.conf` contains a setting for crop growth speed. -| Configuration | type | default | place file | Notes about | +| Configuration | type | default | file | Notes | | -------------------- | ----- | ------- | ------------ | ----------------------------------------- | -| time_speed | float | 73 | minetest.conf | Speed to grow up the plants on engine (used as base for seed) | | farming_stage_length | float | 160.0 | minetest.conf | Contains a value used for speed of crop growth in seconds | -| farming.rarety | float | 0.002 | farming.conf | default rarety of crops on map (higher number = more crops) | -| farming.min_light | int | 12 | farming.conf | default minimum and maximum light levels crops need to grow | -| farming.max_light | int | 15 | farming.conf | default minimum and maximum light levels crops need to grow | -| farming.carrot | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.potato | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.tomato | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.cucumber | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.corn | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.coffee | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.melon | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.pumpkin | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.cocoa | bool | true | farming.conf | true or false only | -| farming.raspberry | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.blueberry | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.rhubarb | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.beans | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.grapes | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.barley | bool | true | farming.conf | true or false only | -| farming.chili | float | 0.003 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.hemp | float | 0.003 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.garlic | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.onion | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.pepper | float | 0.002 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.pineapple | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.peas | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.beetroot | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.mint | float | 0.005 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.cabbage | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.blackberry | float | 0.002 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.lettuce | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.soy | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.vanilla | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.artichoke | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.parsley | float | 0.002 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.sunflower | float | 0.001 | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | -| farming.grains | bool | true | farming.conf | true or false only | -| farming.rice | bool | true | farming.conf | true to enable crop/food in-game and on mapgen set spawn rarety | +| farming.min_light | int | 12 | farming.conf | default minimum light levels crops need to grow | +| farming.max_light | int | 15 | farming.conf | default maximum light levels crops need to grow | +| farming.carrot | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.potato | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.tomato | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.cucumber | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.corn | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.coffee | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.melon | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.pumpkin | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.cocoa | bool | true | farming.conf | true to enable crop/food or false to disable | +| farming.raspberry | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.blueberry | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.rhubarb | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.beans | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.grapes | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.barley | bool | true | farming.conf | true to enable crop/food, false to disable | +| farming.chili | float | 0.003 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.hemp | float | 0.003 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.garlic | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.onion | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.pepper | float | 0.002 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.pineapple | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.peas | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.beetroot | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.mint | float | 0.005 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.cabbage | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.blackberry | float | 0.002 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.lettuce | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.soy | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.vanilla | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.artichoke | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.parsley | float | 0.002 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.sunflower | float | 0.001 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.grains | bool | true | farming.conf | true to enable crop/food or false to disable | +| farming.rice | bool | true | farming.conf | true to enable crop/food or false to disable | +| farming.asparagus | float | 0.002 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.eggplant | float | 0.002 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.spinach | float | 0.002 | farming.conf | rarety value to enable crop/food in-game, false to disable | +| farming.strawberry | float | 0.002 | farming.conf | rarety value to enable crop/food in-game, false to disable | #### Nodes and food -This farming mod provides a large featured basic foods production of farming: +This farming mod provides a large selection of craftable food and items: | Node name | Description name | | ----------------------- | --------------------- | | farming:salt | Salt | -| farming:salt_crystal | Salt crystal | +| farming:salt_crystal | Salt Crystal | +| farming:chili_powder | Chili Powder | | farming:rose_water | Rose Water | | farming:glass_water | Glass of Water | | farming:sugar | Sugar | +| farming:sugar_cube | Sugar Cube | | farming:caramel | Caramel | | farming:turkish_delight | Turkish Delight | | farming:garlic_bread | Garlic Bread | @@ -113,6 +110,7 @@ This farming mod provides a large featured basic foods production of farming: | farming:apple_pie | Apple Pie | | farming:cactus_juice | Cactus Juice | | farming:pasta | Pasta | +| farming:mac_and_cheese | Mac & Cheese | | farming:spaghetti | Spaghetti | | farming:bibimbap | Bibimbap | | farming:burger | Burger | @@ -123,15 +121,72 @@ This farming mod provides a large featured basic foods production of farming: | farming:paella | Paella | | farming:flan | Vanilla Flan | | farming:cheese_vegan | Vegan Cheese | -| farming:onigiri | Onirigi | +| farming:onigiri | Onigiri | | farming:gyoza | Gyoza | | farming:mochi | Mochi | +| farming:beetroot_soup | Beetroot Soup | +| farming:muffin_blueberry | Blueberry Muffin | +| farming:blueberry_pie | Blueberry Pie | +| farming:carrot_juice | Carrot Juice | +| farming:carrot_gold | Golden Carrot (revives) | +| farming:chili_bowl | Bowl or Chili | +| farming:cocoa_beans | Cocoa Beans | +| farming:cookie | Chocolate Cookie | +| farming:chocolate_dark | Bar of Dark Chocolate | +| farming:chocolate_block | Chocolate Block | +| farming:coffee_cup | Cup of Coffee | +| farming:corn_cob | Corn on the Cob | +| farming:popcorn | Popcorn | +| farming:cornstarch | Cornstarch | +| farming:ethanol | Bottle of Ethanol (fuel) | +| farming:string | String | +| farming:garlic_braid | Garlic Braid | +| farming:garlic_clove | Garlic Clove | +| farming:hemp_oil | Hemp Oil | +| farming:hemp_fibre | Hemp Fibre | +| farming:hemp_block | Hemp Block | +| farming:hemp_rope | Hemp Rope | +| farming:mint_tea | Mint Tea | +| farming:onion_soup | Onion Soup | +| farming:pea_soup | Pea Soup | +| farming:pepper_ground | Ground Pepper | +| farming:pineapple_ring | Pineapple Ring | +| farming:pineapple_juice | Pineapple Juice | +| farming:baked_potato | Baked Potato | +| farming:potato_salad | Cucumber & Potato Salad | +| farming:jackolantern | Jack 'O Lantern | +| farming:scarecrow_bottom | Scarecrow Bottom | +| farming:pumpkin_dough | Pumpkin Dough | +| farming:pumpkin_bread | Pumpkin Bread | +| farming:smoothie_raspberry | Raspberry Smoothie | +| farming:rhubarb_pie | Rhybarb Pie | +| farming:rice_flour | Rice Flour | +| farming:rice_bread | Rice Bread | +| farming:flour_multigrain | Multigrain Rice | +| farming:bread_multigrain | Multigrain Bread | +| farming:soy_sauce | Soy Sauce | +| farming:soy_milk | Soy Milk | +| farming:tofu | Tofu | +| farming:tofu_cooked | Cooked Tofu | +| farming:sunflower_seeds_toasted | Toasted Sunflower Seeds | +| farming:sunflower_oil | Sunflower Oil | +| farming:sunflower_bread | Sunflower Bread | +| farming:tomato_soup | Tomato Soup | +| farming:vanilla_extract | Vanilla Extract | +| farming:flour | Flour | +| farming:bread | Bread | +| farming:straw | Straw Block | +| farming:bread_slice | Bread Slice | +| farming:toast | Toast | +| farming:toast_sandwich | Toast Sandwich | -#### Items tools +#### Item and Tools | node name | Description | | ----------------------- | --------------------- | -| farming:scythe_mithril | Mithril Scythe (Use to harvest and replant crops) | +| farming:trellis | Trellis (for growing grapes) | +| farming:beanpole | Bean Pole (for growing beans) | +| farming:scythe_mithril | Mithril Scythe (Use to harvest and replant crops) | | farming:hoe_bomb | Hoe Bomb (use or throw on grassy areas to hoe land) | | farming:hoe_wood | Wooden Hoe | | farming:hoe_stone | Stone Hoe | @@ -153,17 +208,17 @@ This farming mod provides a large featured basic foods production of farming: #### Nodes and Aliasing -This mod is a direct replacement for the old Farming Plus mod and -replaces all of it's nodes and items with one's found within -Farming Redo. +This mod is also a direct replacement for the older Farming Plus mod and will replace all +of it's nodes and items with one's found within Farming Redo. -#### AMB +#### ABM -There is one abm for new group `group:growing`. +The ABM checks every 5 minutes to make sure crops in `group:growing` that were planted +on an older map are enabled and growing properly. ### Changelog: -- NEXT - Now blueberries can make blue dye, tweak soil types to work better with older 0.4.x clients and add spanish translation (thx mckaygerhard), add trellis setting to registered_crops and fix pea and soy crop names (thx nixnoxus) +- 1.47 - Now blueberries can make blue dye, tweak soil types to work better with older 0.4.x clients and add spanish translation (thx mckaygerhard), add trellis setting to registered_crops and fix pea and soy crop names (thx nixnoxus), add strawberries if ethereal mod not active, added asparagus; spinach; eggplant (thx Atlante for new textures), Sugar Cube - 1.46 - Added min/max default light settings, added lettuce and blackberries with food items (thanks OgelGames), added soya, vanilla and sunflowers (thanks Felfa), added tofu, added salt crystals (thanks gorlock) - 1.45 - Dirt and Hoes are more in line with default by using dry/wet/base, added cactus juice, added pasta, spaghetti, cabbage, korean bibimbap, code tidy options, onion soup added (thanks edcrypt), Added apple pie, added wild cotton to savanna @@ -218,5 +273,3 @@ options, onion soup added (thanks edcrypt), Added apple pie, added wild cotton t - 0.2 - Fixed check for wet soil - 0.1 - Fixed growing bug - 0.0 - Initial release - -### Lucky Blocks: 39 diff --git a/compatibility.lua b/compatibility.lua index 1fdf620..425132e 100644 --- a/compatibility.lua +++ b/compatibility.lua @@ -131,29 +131,12 @@ alias("farming_plus:rhubarb", "farming:rhubarb_3") alias("farming_plus:rhubarb_item", "farming:rhubarb") -- Strawberry -if eth then - alias("farming_plus:strawberry_item", "ethereal:strawberry") - alias("farming_plus:strawberry_seed", "ethereal:strawberry") - alias("farming_plus:strawberry_1", "ethereal:strawberry_1") - alias("farming_plus:strawberry_2", "ethereal:strawberry_3") - alias("farming_plus:strawberry_3", "ethereal:strawberry_5") - alias("farming_plus:strawberry", "ethereal:strawberry_7") -else - minetest.register_craftitem(":ethereal:strawberry", { - description = S("Strawberry"), - inventory_image = "farming_strawberry.png", - wield_image = "farming_strawberry.png", - groups = {food_strawberry = 1, flammable = 2}, - on_use = minetest.item_eat(1) - }) - - alias("farming_plus:strawberry_item", "ethereal:strawberry") - alias("farming_plus:strawberry_seed", "ethereal:strawberry") - alias("farming_plus:strawberry_1", "farming:raspberry_1") - alias("farming_plus:strawberry_2", "farming:raspberry_2") - alias("farming_plus:strawberry_3", "farming:raspberry_3") - alias("farming_plus:strawberry", "farming:raspberry_4") -end +alias("farming_plus:strawberry_item", "ethereal:strawberry") +alias("farming_plus:strawberry_seed", "ethereal:strawberry") +alias("farming_plus:strawberry_1", "ethereal:strawberry_1") +alias("farming_plus:strawberry_2", "ethereal:strawberry_3") +alias("farming_plus:strawberry_3", "ethereal:strawberry_5") +alias("farming_plus:strawberry", "ethereal:strawberry_7") -- Tomato alias("farming_plus:tomato_seed", "farming:tomato") diff --git a/crops/artichoke.lua b/crops/artichoke.lua index 92143f6..2dc5deb 100644 --- a/crops/artichoke.lua +++ b/crops/artichoke.lua @@ -19,7 +19,8 @@ local def = { sunlight_propagates = true, walkable = false, buildable_to = true, - drop = "", + drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -46,6 +47,7 @@ minetest.register_node("farming:artichoke_4", table.copy(def)) -- stage 5 (final) def.tiles = {"farming_artichoke_5.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:artichoke 2"}, rarity = 1}, @@ -62,3 +64,23 @@ farming.registered_plants["farming:artichoke"] = { maxlight = 15, steps = 5 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.artichoke, + spread = {x = 100, y = 100, z = 100}, + seed = 123, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 13, + decoration = {"farming:artichoke_5"}, + spawn_by = "group:tree", + num_spawn_by = 1 +}) diff --git a/crops/asparagus.lua b/crops/asparagus.lua new file mode 100644 index 0000000..5924037 --- /dev/null +++ b/crops/asparagus.lua @@ -0,0 +1,94 @@ + +local S = farming.intllib + +-- asparagus +minetest.register_craftitem("farming:asparagus", { + description = S("Asparagus"), + inventory_image = "farming_asparagus.png", + groups = {seed = 2, food_asparagus = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:asparagus_1") + end, + on_use = minetest.item_eat(1) +}) + +-- asparagus definition +local def = { + drawtype = "plantlike", + tiles = {"farming_asparagus_1.png"}, + paramtype = "light", + paramtype2 = "meshoptions", + place_param2 = 3, + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + waving = 1, + 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:asparagus_1", table.copy(def)) + +-- stage 2 +def.tiles = {"farming_asparagus_2.png"} +minetest.register_node("farming:asparagus_2", table.copy(def)) + +-- stage 3 +def.tiles = {"farming_asparagus_3.png"} +minetest.register_node("farming:asparagus_3", table.copy(def)) + +-- stage 4 +def.tiles = {"farming_asparagus_4.png"} +def.drop = { + items = { + {items = {"farming:asparagus"}, rarity = 2} + } +} +minetest.register_node("farming:asparagus_4", table.copy(def)) + +-- stage 5 +def.tiles = {"farming_asparagus_5.png"} +def.groups.growing = nil +def.selection_box = farming.select_final +def.drop = { + items = { + {items = {"farming:asparagus"}, rarity = 1}, + {items = {"farming:asparagus 2"}, rarity = 2} + } +} +minetest.register_node("farming:asparagus_5", table.copy(def)) + +-- add to registered_plants +farming.registered_plants["farming:asparagus"] = { + crop = "farming:asparagus", + seed = "farming:asparagus", + minlight = 7, + maxlight = farming.max_light, + steps = 5 +} + +-- mapgen +minetest.register_decoration({ + name = "farming:asparagus_5", + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.1, + scale = farming.asparagus, + spread = {x = 100, y = 100, z = 100}, + seed = 234, + octaves = 3, + persist = 0.6 + }, + y_min = 8, + y_max = 32, + decoration = "farming:asparagus_5", + param2 = 3 +}) diff --git a/crops/barley.lua b/crops/barley.lua index e7f3840..cf2d932 100644 --- a/crops/barley.lua +++ b/crops/barley.lua @@ -8,14 +8,15 @@ minetest.register_node("farming:seed_barley", { inventory_image = "farming_barley_seed.png", wield_image = "farming_barley_seed.png", drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1}, + groups = {seed = 1, snappy = 3, attached_node = 1, growing = 1}, paramtype = "light", paramtype2 = "wallmounted", walkable = false, sunlight_propagates = true, + next_plant = "farming:barley_1", selection_box = farming.select, on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:barley_1") + return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_barley") end }) @@ -47,6 +48,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -72,12 +74,6 @@ minetest.register_node("farming:barley_4", table.copy(def)) -- stage 5 def.tiles = {"farming_barley_5.png"} -def.drop = { - items = { - {items = {"farming:barley"}, rarity = 2}, - {items = {"farming:seed_barley"}, rarity = 2} - } -} minetest.register_node("farming:barley_5", table.copy(def)) -- stage 6 @@ -85,14 +81,25 @@ def.tiles = {"farming_barley_6.png"} def.drop = { items = { {items = {"farming:barley"}, rarity = 2}, - {items = {"farming:seed_barley"}, rarity = 1} + {items = {"farming:seed_barley"}, rarity = 2} } } minetest.register_node("farming:barley_6", table.copy(def)) --- stage 7 (final) +-- stage 7 def.tiles = {"farming_barley_7.png"} +def.drop = { + items = { + {items = {"farming:barley"}, rarity = 2}, + {items = {"farming:seed_barley"}, rarity = 1} + } +} +minetest.register_node("farming:barley_7", table.copy(def)) + +-- stage 8 (final) +def.tiles = {"farming_barley_8.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:barley"}, rarity = 1}, @@ -101,7 +108,7 @@ def.drop = { {items = {"farming:seed_barley"}, rarity = 3} } } -minetest.register_node("farming:barley_7", table.copy(def)) +minetest.register_node("farming:barley_8", table.copy(def)) -- add to registered_plants farming.registered_plants["farming:barley"] = { @@ -109,7 +116,7 @@ farming.registered_plants["farming:barley"] = { seed = "farming:seed_barley", minlight = farming.min_light, maxlight = farming.max_light, - steps = 7 + steps = 8 } -- Fuel diff --git a/crops/beans.lua b/crops/beans.lua index 02ebe1a..90a30bd 100644 --- a/crops/beans.lua +++ b/crops/beans.lua @@ -210,6 +210,7 @@ minetest.register_node("farming:beanpole_4", table.copy(def)) -- stage 5 (final) def.tiles = {"farming_beanpole_5.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:beanpole"}, rarity = 1}, @@ -253,3 +254,21 @@ minetest.register_node("farming:beanbush", { }, sounds = default.node_sound_leaves_defaults() }) + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.beans, + spread = {x = 100, y = 100, z = 100}, + seed = 345, + octaves = 3, + persist = 0.6 + }, + y_min = 18, + y_max = 38, + decoration = "farming:beanbush" +}) diff --git a/crops/beetroot.lua b/crops/beetroot.lua index 05e0b3a..b8be3ef 100644 --- a/crops/beetroot.lua +++ b/crops/beetroot.lua @@ -69,6 +69,7 @@ minetest.register_node("farming:beetroot_4", table.copy(def)) -- stage 5 def.tiles = {"farming_beetroot_5.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { max_items = 4, items = { {items = {"farming:beetroot"}, rarity = 1}, @@ -87,3 +88,21 @@ farming.registered_plants["farming:beetroot"] = { maxlight = farming.max_light, steps = 5 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.beetroot, + spread = {x = 100, y = 100, z = 100}, + seed = 456, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 20, + decoration = "farming:beetroot_5" +}) diff --git a/crops/blackberry.lua b/crops/blackberry.lua index e2122fd..47dd08e 100644 --- a/crops/blackberry.lua +++ b/crops/blackberry.lua @@ -10,7 +10,7 @@ minetest.register_craftitem("farming:blackberry", { on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:blackberry_1") end, - on_use = minetest.item_eat(1), + on_use = minetest.item_eat(1) }) local def = { @@ -43,6 +43,7 @@ minetest.register_node("farming:blackberry_3", table.copy(def)) -- stage 4 def.tiles = {"farming_blackberry_4.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {'farming:blackberry 2'}, rarity = 1}, @@ -60,3 +61,21 @@ farming.registered_plants["farming:blackberry"] = { maxlight = farming.max_light, steps = 4 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.blackberry, + spread = {x = 100, y = 100, z = 100}, + seed = 567, + octaves = 3, + persist = 0.6 + }, + y_min = 3, + y_max = 20, + decoration = "farming:blackberry_4" +}) diff --git a/crops/blueberry.lua b/crops/blueberry.lua index be1d3b2..1713bd1 100644 --- a/crops/blueberry.lua +++ b/crops/blueberry.lua @@ -80,6 +80,7 @@ minetest.register_node("farming:blueberry_3", table.copy(def)) -- stage 4 (final) def.tiles = {"farming_blueberry_4.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:blueberries 2"}, rarity = 1}, @@ -97,3 +98,21 @@ farming.registered_plants["farming:blueberries"] = { maxlight = farming.max_light, steps = 4 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.blueberry, + spread = {x = 100, y = 100, z = 100}, + seed = 678, + octaves = 3, + persist = 0.6 + }, + y_min = 3, + y_max = 15, + decoration = "farming:blueberry_4" +}) diff --git a/crops/cabbage.lua b/crops/cabbage.lua index b57ac00..622782b 100644 --- a/crops/cabbage.lua +++ b/crops/cabbage.lua @@ -51,6 +51,7 @@ minetest.register_node("farming:cabbage_5", table.copy(def)) -- stage 6 def.tiles = {"farming_cabbage_6.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { max_items = 2, items = { {items = {"farming:cabbage 2"}, rarity = 1}, @@ -67,3 +68,21 @@ farming.registered_plants["farming:cabbage"] = { maxlight = farming.max_light, steps = 6 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.cabbage, + spread = {x = 100, y = 100, z = 100}, + seed = 789, + octaves = 3, + persist = 0.6 + }, + y_min = 2, + y_max = 15, + decoration = "farming:cabbage_6" +}) diff --git a/crops/carrot.lua b/crops/carrot.lua index 2dd45f3..0f53c87 100644 --- a/crops/carrot.lua +++ b/crops/carrot.lua @@ -46,11 +46,7 @@ minetest.register_craftitem("farming:carrot_gold", { minetest.register_craft({ output = "farming:carrot_gold", - recipe = { - {"", "default:gold_lump", ""}, - {"default:gold_lump", "group:food_carrot", "default:gold_lump"}, - {"", "default:gold_lump", ""} - } + recipe = {{"group:food_carrot", "default:gold_lump"}} }) -- carrot definition @@ -62,6 +58,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -107,6 +104,7 @@ minetest.register_node("farming:carrot_7", table.copy(def)) -- stage 8 (final) def.tiles = {"farming_carrot_8.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:carrot 2"}, rarity = 1}, @@ -123,3 +121,31 @@ farming.registered_plants["farming:carrot"] = { maxlight = farming.max_light, steps = 8 } + +-- mapgen +local mg = farming.mapgen == "v6" + +def = { + y_max = mg and 30 or 20, + near = mg and "group:water" or nil, + num = mg and 1 or -1, +} + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.carrot, + spread = {x = 100, y = 100, z = 100}, + seed = 890, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = def.y_max, + decoration = "farming:carrot_8", + spawn_by = def.near, + num_spawn_by = def.num +}) diff --git a/crops/chili.lua b/crops/chili.lua index 95f3a30..21aa371 100644 --- a/crops/chili.lua +++ b/crops/chili.lua @@ -33,6 +33,22 @@ minetest.register_craft({ recipe = {{"farming:chili_pepper"}} }) +-- chili powder +minetest.register_craftitem("farming:chili_powder", { + description = S("Chili Powder"), + on_use = minetest.item_eat(-1), + inventory_image = "farming_chili_powder.png" +}) + +minetest.register_craft({ + output = "farming:chili_powder", + recipe = { + {"farming:chili_pepper", "farming:mortar_pestle"} + }, + replacements = {{"farming:mortar_pestle", "farming:mortar_pestle"}} +}) + + -- chili definition local def = { drawtype = "plantlike", @@ -42,6 +58,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 4, plant = 1, attached_node = 1, @@ -80,6 +97,7 @@ minetest.register_node("farming:chili_7", table.copy(def)) -- stage 8 (final) def.tiles = {"farming_chili_8.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:chili_pepper 3"}, rarity = 1}, @@ -96,3 +114,23 @@ farming.registered_plants["farming:chili_pepper"] = { maxlight = farming.max_light, steps = 8 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.chili, + spread = {x = 100, y = 100, z = 100}, + seed = 901, + octaves = 3, + persist = 0.6 + }, + y_min = 5, + y_max = 35, + decoration = {"farming:chili_8"}, + spawn_by = "group:tree", + num_spawn_by = 1 +}) diff --git a/crops/cocoa.lua b/crops/cocoa.lua index 8c3e64e..47045d4 100644 --- a/crops/cocoa.lua +++ b/crops/cocoa.lua @@ -207,6 +207,9 @@ farming.registered_plants["farming:cocoa_beans"] = { steps = 4 } +-- localize math.random for speed +local random = math.random + -- add random cocoa pods to jungle tree's minetest.register_on_generated(function(minp, maxp) @@ -224,7 +227,7 @@ minetest.register_on_generated(function(minp, maxp) if minetest.find_node_near(pos, 1, {"default:jungleleaves", "moretrees:jungletree_leaves_green"}) then - dir = math.random(1, 80) + dir = random(80) if dir == 1 then pos.x = pos.x + 1 elseif dir == 2 then pos.x = pos.x - 1 @@ -239,7 +242,7 @@ minetest.register_on_generated(function(minp, maxp) --print ("Cocoa Pod added at " .. minetest.pos_to_string(pos)) minetest.swap_node(pos, { - name = "farming:cocoa_" .. tostring(math.random(4)) + name = "farming:cocoa_" .. tostring(random(4)) }) end end diff --git a/crops/coffee.lua b/crops/coffee.lua index 490547e..64d4e13 100644 --- a/crops/coffee.lua +++ b/crops/coffee.lua @@ -52,6 +52,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -78,6 +79,7 @@ minetest.register_node("farming:coffee_4", table.copy(def)) -- stage 5 (final) def.tiles = {"farming_coffee_5.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:coffee_beans 2"}, rarity = 1}, @@ -95,3 +97,29 @@ farming.registered_plants["farming:coffee"] = { maxlight = farming.max_light, steps = 5 } + +-- mapgen +local mg = farming.mapgen == "v6" + +def = { + y_max = mg and 50 or 55, + spawn_on = mg and {"default:dirt_with_grass"} or {"default:dirt_with_dry_grass", + "default:dirt_with_rainforest_litter", "default:dry_dirt_with_dry_grass"} +} + +minetest.register_decoration({ + deco_type = "simple", + place_on = def.spawn_on, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.coffee, + spread = {x = 100, y = 100, z = 100}, + seed = 12, + octaves = 3, + persist = 0.6 + }, + y_min = 20, + y_max = def.y_max, + decoration = "farming:coffee_5" +}) diff --git a/crops/corn.lua b/crops/corn.lua index 97bb86a..b124e19 100644 --- a/crops/corn.lua +++ b/crops/corn.lua @@ -113,6 +113,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -159,6 +160,7 @@ minetest.register_node("farming:corn_7", table.copy(def)) -- stage 8 (final) def.tiles = {"farming_corn_8.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:corn 2"}, rarity = 1}, @@ -176,3 +178,21 @@ farming.registered_plants["farming:corn"] = { maxlight = farming.max_light, steps = 8 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.corn, + spread = {x = 100, y = 100, z = 100}, + seed = 134, + octaves = 3, + persist = 0.6 + }, + y_min = 12, + y_max = 25, + decoration = "farming:corn_7" +}) diff --git a/crops/cotton.lua b/crops/cotton.lua index 6ea2e6f..f231f24 100644 --- a/crops/cotton.lua +++ b/crops/cotton.lua @@ -34,14 +34,15 @@ minetest.register_node("farming:seed_cotton", { inventory_image = "farming_cotton_seed.png", wield_image = "farming_cotton_seed.png", drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4}, + groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4, growing = 1}, paramtype = "light", paramtype2 = "wallmounted", walkable = false, sunlight_propagates = true, selection_box = farming.select, + next_plant = "farming:cotton_1", on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_1") + return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_cotton") end }) @@ -99,6 +100,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 4, plant = 1, attached_node = 1, @@ -156,6 +158,7 @@ minetest.register_node("farming:cotton_7", table.copy(def)) -- stage 8 (final) def.tiles = {"farming_cotton_8.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:cotton"}, rarity = 1}, @@ -184,3 +187,30 @@ farming.register_plant("farming:cotton", { groups = {flammable = 2}, steps = 8, })]] + +-- mapgen +local mg = farming.mapgen == "v6" + +def = { + grow_on = mg and {"default:dirt_with_grass"} or {"default:dry_dirt_with_dry_grass"}, + biome = mg and {"jungle"} or {"savanna"} +} + +minetest.register_decoration({ + name = "farming:cotton_wild", + deco_type = "simple", + place_on = def.grow_on, + sidelen = 16, + noise_params = { + offset = -0.1, + scale = 0.1, + spread = {x = 50, y = 50, z = 50}, + seed = 4242, + octaves = 3, + persist = 0.7 + }, + biomes = def.biome, + y_max = 31000, + y_min = 1, + decoration = "farming:cotton_wild" +}) diff --git a/crops/cucumber.lua b/crops/cucumber.lua index c5e70de..3494b16 100644 --- a/crops/cucumber.lua +++ b/crops/cucumber.lua @@ -47,6 +47,7 @@ minetest.register_node("farming:cucumber_3", table.copy(def)) -- stage 4 (final) def.tiles = {"farming_cucumber_4.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:cucumber 2"}, rarity = 1}, @@ -63,3 +64,30 @@ farming.registered_plants["farming:cucumber"] = { maxlight = farming.max_light, steps = 4 } + +-- mapgen +local mg = farming.mapgen == "v6" + +def = { + near = mg and "group:water" or nil, + num = mg and 1 or -1, +} + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.cucumber, + spread = {x = 100, y = 100, z = 100}, + seed = 245, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 20, + decoration = "farming:cucumber_4", + spawn_by = def.near, + num_spawn_by = def.num +}) diff --git a/crops/eggplant.lua b/crops/eggplant.lua new file mode 100644 index 0000000..7b6a8f3 --- /dev/null +++ b/crops/eggplant.lua @@ -0,0 +1,90 @@ + +local S = farming.intllib + +-- eggplant +minetest.register_craftitem("farming:eggplant", { + description = S("Eggplant"), + inventory_image = "farming_eggplant.png", + groups = {seed = 2, food_eggplant = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:eggplant_1") + end, + on_use = minetest.item_eat(3) +}) + +-- definition +local def = { + drawtype = "plantlike", + tiles = {"farming_eggplant_1.png"}, + paramtype = "light", + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + drop = "", + waving = 1, + 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:eggplant_1", table.copy(def)) + +-- stage 2 +def.tiles = {"farming_eggplant_2.png"} +minetest.register_node("farming:eggplant_2", table.copy(def)) + +-- stage 3 +def.tiles = {"farming_eggplant_3.png"} +def.drop = { + items = { + {items = {"farming:eggplant"}, rarity = 1}, + {items = {"farming:eggplant"}, rarity = 3} + } +} +minetest.register_node("farming:eggplant_3", table.copy(def)) + +-- stage 4 +def.tiles = {"farming_eggplant_4.png"} +def.groups.growing = nil +def.selection_box = farming.select_final +def.drop = { + items = { + {items = {"farming:eggplant 2"}, rarity = 1}, + {items = {"farming:eggplant 2"}, rarity = 2} + } +} +minetest.register_node("farming:eggplant_4", table.copy(def)) + +-- add to registered_plants +farming.registered_plants["farming:eggplant"] = { + crop = "farming:eggplant", + seed = "farming:eggplant", + minlight = 7, + maxlight = farming.max_light, + steps = 4 +} + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.1, + scale = farming.eggplant, + spread = {x = 100, y = 100, z = 100}, + seed = 356, + octaves = 3, + persist = 0.6 + }, + biomes = {"deciduous_forest"}, + y_max = 31000, + y_min = 1, + decoration = "farming:eggplant_4", + param2 = 3 +}) diff --git a/crops/garlic.lua b/crops/garlic.lua index e141479..ca2005a 100644 --- a/crops/garlic.lua +++ b/crops/garlic.lua @@ -7,7 +7,7 @@ local S = farming.intllib --- potato +-- garlic clove minetest.register_craftitem("farming:garlic_clove", { description = S("Garlic clove"), inventory_image = "crops_garlic_clove.png", @@ -26,9 +26,8 @@ minetest.register_craftitem("farming:garlic", { }) minetest.register_craft({ - type = "shapeless", output = "farming:garlic_clove 8", - recipe = {"farming:garlic"} + recipe = {{"farming:garlic"}} }) minetest.register_craft({ @@ -117,6 +116,7 @@ minetest.register_node("farming:garlic_4", table.copy(def)) -- stage 5 def.tiles = {"crops_garlic_plant_5.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:garlic 3"}, rarity = 1}, @@ -134,3 +134,23 @@ farming.registered_plants["farming:garlic"] = { maxlight = farming.max_light, steps = 5 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.garlic, + spread = {x = 100, y = 100, z = 100}, + seed = 467, + octaves = 3, + persist = 0.6 + }, + y_min = 3, + y_max = 35, + decoration = "farming:garlic_5", + spawn_by = "group:tree", + num_spawn_by = 1 +}) diff --git a/crops/ginger.lua b/crops/ginger.lua new file mode 100644 index 0000000..7cfbd05 --- /dev/null +++ b/crops/ginger.lua @@ -0,0 +1,89 @@ + +local S = farming.intllib + +-- ginger +minetest.register_craftitem("farming:ginger", { + description = S("Ginger"), + inventory_image = "farming_ginger.png", + groups = {seed = 2, food_ginger = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:ginger_1") + end, + on_use = minetest.item_eat(1) +}) + +-- ginger definition +local def = { + drawtype = "plantlike", + tiles = {"farming_ginger_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + waving = 1, + 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:ginger_1", table.copy(def)) + +-- stage 2 +def.tiles = {"farming_ginger_2.png"} +minetest.register_node("farming:ginger_2", table.copy(def)) + +-- stage 3 +def.tiles = {"farming_ginger_3.png"} +def.drop = { + items = { + {items = {"farming:ginger"}, rarity = 1}, + {items = {"farming:ginger"}, rarity = 3} + } +} +minetest.register_node("farming:ginger_3", table.copy(def)) + +-- stage 4 (final) +def.tiles = {"farming_ginger_4.png"} +def.groups.growing = nil +def.selection_box = farming.select_final +def.drop = { + items = { + {items = {"farming:ginger 2"}, rarity = 1}, + {items = {"farming:ginger 2"}, rarity = 2} + } +} +minetest.register_node("farming:ginger_4", table.copy(def)) + +-- add to registered_plants +farming.registered_plants["farming:ginger"] = { + crop = "farming:ginger", + seed = "farming:ginger", + minlight = 5, + maxlight = default.LIGHT_MAX, + steps = 4 +} + +-- mapgen +minetest.register_decoration({ + name = "farming:ginger_4", + deco_type = "simple", + place_on = {"default:dirt_with_rainforest_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.ginger, + spread = {x = 100, y = 100, z = 100}, + seed = 999, + octaves = 3, + persist = 0.6 + }, + y_max = 80, + y_min = 1, + decoration = "farming:ginger_3", + param2 = 3 +}) diff --git a/crops/grapes.lua b/crops/grapes.lua index ee8fe38..7622c0e 100644 --- a/crops/grapes.lua +++ b/crops/grapes.lua @@ -217,6 +217,7 @@ minetest.register_node("farming:grapes_7", table.copy(def)) -- stage 8 (final) def.tiles = {"farming_grapes_8.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:trellis"}, rarity = 1}, @@ -260,3 +261,21 @@ minetest.register_node("farming:grapebush", { }, sounds = default.node_sound_leaves_defaults() }) + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.grapes, + spread = {x = 100, y = 100, z = 100}, + seed = 578, + octaves = 3, + persist = 0.6 + }, + y_min = 25, + y_max = 50, + decoration = "farming:grapebush" +}) diff --git a/crops/hemp.lua b/crops/hemp.lua index c63487a..da5d568 100644 --- a/crops/hemp.lua +++ b/crops/hemp.lua @@ -8,14 +8,15 @@ minetest.register_node("farming:seed_hemp", { inventory_image = "farming_hemp_seed.png", wield_image = "farming_hemp_seed.png", drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1}, + groups = {seed = 1, snappy = 3, attached_node = 1, growing = 1}, paramtype = "light", paramtype2 = "wallmounted", walkable = false, sunlight_propagates = true, selection_box = farming.select, + next_plant = "farming:hemp_1", on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:hemp_1") + return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_hemp") end }) @@ -191,6 +192,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -243,6 +245,7 @@ minetest.register_node("farming:hemp_7", table.copy(def)) -- stage 8 (final) def.tiles = {"farming_hemp_8.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:hemp_leaf 2"}, rarity = 1}, @@ -257,7 +260,27 @@ minetest.register_node("farming:hemp_8", table.copy(def)) farming.registered_plants["farming:hemp"] = { crop = "farming:hemp", seed = "farming:seed_hemp", - mminlight = farming.min_light, + minlight = farming.min_light, maxlight = farming.max_light, steps = 8 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.hemp, + spread = {x = 100, y = 100, z = 100}, + seed = 420, + octaves = 3, + persist = 0.6 + }, + y_min = 3, + y_max = 45, + decoration = "farming:hemp_7", + spawn_by = "group:tree", + num_spawn_by = 1 +}) diff --git a/crops/lettuce.lua b/crops/lettuce.lua index bbd7138..9e3d314 100644 --- a/crops/lettuce.lua +++ b/crops/lettuce.lua @@ -8,7 +8,7 @@ minetest.register_craftitem("farming:lettuce", { on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:lettuce_1") end, - on_use = minetest.item_eat(2), + on_use = minetest.item_eat(2) }) local def = { @@ -45,6 +45,7 @@ minetest.register_node("farming:lettuce_4", table.copy(def)) -- stage 5 def.tiles = {"farming_lettuce_5.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {'farming:lettuce 2'}, rarity = 1}, @@ -61,3 +62,21 @@ farming.registered_plants["farming:lettuce"] = { maxlight = farming.max_light, steps = 5 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.lettuce, + spread = {x = 100, y = 100, z = 100}, + seed = 689, + octaves = 3, + persist = 0.6 + }, + y_min = 5, + y_max = 35, + decoration = "farming:lettuce_5" +}) diff --git a/crops/melon.lua b/crops/melon.lua index 66decdc..dd81ecb 100644 --- a/crops/melon.lua +++ b/crops/melon.lua @@ -79,7 +79,7 @@ minetest.register_node("farming:melon_8", { "farming_melon_side.png" }, groups = { - food_melon = 1, snappy = 2, oddly_breakable_by_hand = 1, + food_melon = 1, snappy = 3, choppy = 3, oddly_breakable_by_hand = 2, flammable = 2, plant = 1 }, drop = "farming:melon_8", @@ -96,3 +96,33 @@ farming.registered_plants["farming:melon"] = { maxlight = farming.max_light, steps = 8 } + +-- mapgen +local mg = farming.mapgen == "v6" + +def = { + y_max = mg and 20 or 6, + spawn_on = mg and {"default:dirt_with_grass"} or {"default:dirt_with_dry_grass", + "default:dirt_with_rainforest_litter"}, + near = mg and "group:water" or nil, + num = mg and 1 or -1, +} + +minetest.register_decoration({ + deco_type = "simple", + place_on = def.spawn_on, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.melon, + spread = {x = 100, y = 100, z = 100}, + seed = 790, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = def.y_max, + decoration = "farming:melon_8", + spawn_by = def.near, + num_spawn_by = def.num +}) diff --git a/crops/mint.lua b/crops/mint.lua index de4b6b3..a0057a5 100644 --- a/crops/mint.lua +++ b/crops/mint.lua @@ -2,13 +2,21 @@ local S = farming.intllib -- mint seed -minetest.register_craftitem("farming:seed_mint", { +minetest.register_node("farming:seed_mint", { description = S("Mint Seeds"), + tiles = {"farming_mint_seeds.png"}, inventory_image = "farming_mint_seeds.png", - groups = {seed = 2, flammable = 2}, + wield_image = "farming_mint_seeds.png", + drawtype = "signlike", + groups = {seed = 1, snappy = 3, attached_node = 1, growing = 1, flammable = 2}, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = farming.select, + next_plant = "farming:mint_1", on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed( - itemstack, placer, pointed_thing, "farming:mint_1") + return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_mint") end }) @@ -47,6 +55,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -69,6 +78,7 @@ minetest.register_node("farming:mint_3", table.copy(def)) -- stage 4 (final) def.tiles = {"farming_mint_4.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:mint_leaf 2"}, rarity = 1}, @@ -87,3 +97,23 @@ farming.registered_plants["farming:mint"] = { maxlight = farming.max_light, steps = 4 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass", "default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.mint, + spread = {x = 100, y = 100, z = 100}, + seed = 801, + octaves = 3, + persist = 0.6 + }, + y_min = 0, + y_max = 75, + decoration = "farming:mint_4", + spawn_by = {"group:water", "group:sand"}, + num_spawn_by = 1 +}) diff --git a/crops/onion.lua b/crops/onion.lua index 63cdbe5..2b6fd91 100644 --- a/crops/onion.lua +++ b/crops/onion.lua @@ -36,6 +36,12 @@ minetest.register_craft({ replacements = {{"farming:pot", "farming:pot"}} }) +-- yellow dye +minetest.register_craft({ + output = "dye:yellow", + recipe = {{"group:food_onion"}} +}) + -- crop definition local def = { drawtype = "plantlike", @@ -48,6 +54,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 3, plant = 1, attached_node = 1, @@ -74,6 +81,7 @@ minetest.register_node("farming:onion_4", table.copy(def)) -- stage 5 def.tiles = {"crops_onion_plant_5.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { max_items = 5, items = { {items = {"farming:onion"}, rarity = 1}, @@ -93,3 +101,21 @@ farming.registered_plants["farming:onion"] = { maxlight = farming.max_light, steps = 5 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.onion, + spread = {x = 100, y = 100, z = 100}, + seed = 912, + octaves = 3, + persist = 0.6 + }, + y_min = 5, + y_max = 28, + decoration = "farming:onion_5" +}) diff --git a/crops/parsley.lua b/crops/parsley.lua index 0bc20eb..e2dab3e 100644 --- a/crops/parsley.lua +++ b/crops/parsley.lua @@ -19,6 +19,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -37,6 +38,7 @@ minetest.register_node("farming:parsley_2", table.copy(def)) -- stage 3 (final) def.tiles = {"farming_parsley_3.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:parsley 2"}, rarity = 1}, @@ -54,3 +56,21 @@ farming.registered_plants["farming:parsley"] = { maxlight = 15, steps = 3 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.parsley, + spread = {x = 100, y = 100, z = 100}, + seed = 23, + octaves = 3, + persist = 0.6 + }, + y_min = 10, + y_max = 40, + decoration = "farming:parsley_3" +}) diff --git a/crops/peas.lua b/crops/peas.lua index 94053f2..00ff5e3 100644 --- a/crops/peas.lua +++ b/crops/peas.lua @@ -71,6 +71,7 @@ minetest.register_node("farming:pea_4", table.copy(def)) -- stage 5 def.tiles = {"farming_pea_5.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { max_items = 5, items = { {items = {"farming:pea_pod"}, rarity = 1}, @@ -89,3 +90,21 @@ farming.registered_plants["farming:pea_pod"] = { maxlight = farming.max_light, steps = 5 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.peas, + spread = {x = 100, y = 100, z = 100}, + seed = 132, + octaves = 3, + persist = 0.6 + }, + y_min = 25, + y_max = 55, + decoration = "farming:pea_5" +}) diff --git a/crops/pepper.lua b/crops/pepper.lua index bdf6287..b5a4298 100644 --- a/crops/pepper.lua +++ b/crops/pepper.lua @@ -113,6 +113,7 @@ minetest.register_node("farming:pepper_4", table.copy(def)) -- stage 5 (green pepper) def.tiles = {"crops_pepper_plant_5.png"} +def.selection_box = farming.select_final def.drop = { max_items = 2, items = { {items = {"farming:pepper 2"}, rarity = 1}, @@ -153,3 +154,29 @@ farming.registered_plants["farming:pepper"] = { maxlight = farming.max_light, steps = 5 } + +-- mapgen +local mg = farming.mapgen == "v6" + +def = { + grow_on = mg and {"default:dirt_with_grass"} or {"default:dirt_with_rainforest_litter"} +} + +minetest.register_decoration({ + deco_type = "simple", + place_on = def.grow_on, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.pepper, + spread = {x = 100, y = 100, z = 100}, + seed = 243, + octaves = 3, + persist = 0.6 + }, + y_min = 5, + y_max = 35, + decoration = {"farming:pepper_5", "farming:pepper_6", "farming:pepper_7"}, + spawn_by = "group:tree", + num_spawn_by = 1 +}) diff --git a/crops/pineapple.lua b/crops/pineapple.lua index 6bb1918..73cd6bc 100644 --- a/crops/pineapple.lua +++ b/crops/pineapple.lua @@ -85,6 +85,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -123,6 +124,7 @@ minetest.register_node("farming:pineapple_7", table.copy(def)) -- stage 8 (final) def.tiles = {"farming_pineapple_8.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:pineapple"}, rarity = 1}, @@ -139,3 +141,32 @@ farming.registered_plants["farming:pineapple"] = { maxlight = farming.max_light, steps = 8 } + +-- mapgen +local mg = farming.mapgen == "v6" + +def = { + grow_on = mg and {"default:dirt_with_grass"} or {"default:dirt_with_dry_grass", + "default:dry_dirt_with_dry_grass"}, + grow_near = mg and "group:sand" or nil, + num = mg and 1 or -1 +} + +minetest.register_decoration({ + deco_type = "simple", + place_on = def.grow_on, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.pineapple, + spread = {x = 100, y = 100, z = 100}, + seed = 354, + octaves = 3, + persist = 0.6 + }, + y_min = 11, + y_max = 30, + decoration = {"farming:pineapple_8"}, + spawn_by = def.grow_near, + num_spawn_by = def.num +}) diff --git a/crops/potato.lua b/crops/potato.lua index a55ab29..dc69bff 100644 --- a/crops/potato.lua +++ b/crops/potato.lua @@ -94,6 +94,7 @@ minetest.register_node("farming:potato_3", table.copy(def)) -- stage 4 def.tiles = {"farming_potato_4.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:potato 2"}, rarity = 1}, @@ -110,3 +111,21 @@ farming.registered_plants["farming:potato"] = { maxlight = farming.max_light, steps = 4 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.potato, + spread = {x = 100, y = 100, z = 100}, + seed = 465, + octaves = 3, + persist = 0.6 + }, + y_min = 15, + y_max = 40, + decoration = "farming:potato_3" +}) diff --git a/crops/pumpkin.lua b/crops/pumpkin.lua index 2829d47..b32b17f 100644 --- a/crops/pumpkin.lua +++ b/crops/pumpkin.lua @@ -1,8 +1,4 @@ ---[[ - Big thanks to PainterlyPack.net for allowing me to use these textures -]] - local S = farming.intllib -- pumpkin slice @@ -34,12 +30,12 @@ minetest.register_craft({ 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_bottom.png^farming_pumpkin_top.png", "farming_pumpkin_bottom.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", - "farming_pumpkin_side.png", "farming_pumpkin_face_off.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}, + groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, sounds = default.node_sound_wood_defaults(), on_punch = function(pos, node, puncher) local name = puncher:get_player_name() or "" @@ -51,14 +47,14 @@ minetest.register_node("farming:jackolantern", { minetest.register_node("farming:jackolantern_on", { tiles = { - "farming_pumpkin_top.png", "farming_pumpkin_top.png", + "farming_pumpkin_bottom.png^farming_pumpkin_top.png", "farming_pumpkin_bottom.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", - "farming_pumpkin_side.png", "farming_pumpkin_face_on.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, + snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, not_in_creative_inventory = 1 }, sounds = default.node_sound_wood_defaults(), @@ -182,12 +178,12 @@ minetest.register_node("farming:pumpkin_7", table.copy(def)) minetest.register_node("farming:pumpkin_8", { description = S("Pumpkin"), tiles = { - "farming_pumpkin_top.png", + "farming_pumpkin_bottom.png^farming_pumpkin_top.png", "farming_pumpkin_bottom.png", "farming_pumpkin_side.png" }, groups = { - food_pumpkin = 1, choppy = 2, oddly_breakable_by_hand = 1, + food_pumpkin = 1, snappy = 3, choppy = 3, oddly_breakable_by_hand = 2, flammable = 2, plant = 1 }, drop = "farming:pumpkin_8", @@ -206,3 +202,31 @@ farming.registered_plants["farming:pumpkin"] = { maxlight = farming.max_light, steps = 8 } + +-- mapgen +local mg = farming.mapgen == "v6" + +def = { + y_max = mg and 20 or 6, + near = mg and "group:water" or nil, + num = mg and 1 or -1, +} + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.pumpkin, + spread = {x = 100, y = 100, z = 100}, + seed = 576, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = def.y_max, + decoration = "farming:pumpkin_8", + spawn_by = def.near, + num_spawn_by = def.num +}) diff --git a/crops/raspberry.lua b/crops/raspberry.lua index df1d3d9..6d85461 100644 --- a/crops/raspberry.lua +++ b/crops/raspberry.lua @@ -61,6 +61,7 @@ minetest.register_node("farming:raspberry_3", table.copy(def)) -- stage 4 (final) def.tiles = {"farming_raspberry_4.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:raspberries 2"}, rarity = 1}, @@ -78,3 +79,21 @@ farming.registered_plants["farming:raspberries"] = { maxlight = farming.max_light, steps = 4 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.raspberry, + spread = {x = 100, y = 100, z = 100}, + seed = 687, + octaves = 3, + persist = 0.6 + }, + y_min = 3, + y_max = 15, + decoration = "farming:raspberry_4" +}) diff --git a/crops/rhubarb.lua b/crops/rhubarb.lua index d0ac58a..989b72b 100644 --- a/crops/rhubarb.lua +++ b/crops/rhubarb.lua @@ -38,6 +38,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -55,17 +56,27 @@ minetest.register_node("farming:rhubarb_1", table.copy(def)) def.tiles = {"farming_rhubarb_2.png"} minetest.register_node("farming:rhubarb_2", table.copy(def)) --- stage 3 (final) +-- stage3 def.tiles = {"farming_rhubarb_3.png"} -def.groups.growing = nil def.drop = { items = { - {items = {"farming:rhubarb 2"}, rarity = 1}, + {items = {"farming:rhubarb"}, rarity = 1}, + } +} +minetest.register_node("farming:rhubarb_3", table.copy(def)) + +-- stage 4 (final) +def.tiles = {"farming_rhubarb_4.png"} +def.groups.growing = nil +def.selection_box = farming.select_final +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)) +minetest.register_node("farming:rhubarb_4", table.copy(def)) -- add to registered_plants farming.registered_plants["farming:rhubarb"] = { @@ -73,5 +84,23 @@ farming.registered_plants["farming:rhubarb"] = { seed = "farming:rhubarb", minlight = 10, maxlight = 12, - steps = 3 + steps = 4 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.rhubarb, + spread = {x = 100, y = 100, z = 100}, + seed = 798, + octaves = 3, + persist = 0.6 + }, + y_min = 3, + y_max = 20, + decoration = "farming:rhubarb_3" +}) diff --git a/crops/rice.lua b/crops/rice.lua index 6b8e2be..892278d 100644 --- a/crops/rice.lua +++ b/crops/rice.lua @@ -1,19 +1,41 @@ local S = farming.intllib +-- rice seed +minetest.register_node("farming:seed_rice", { + description = S("Rice Seed"), + tiles = {"farming_rice_seed.png"}, + inventory_image = "farming_rice_seed.png", + wield_image = "farming_rice_seed.png", + drawtype = "signlike", + groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4, growing = 1}, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = farming.select, + next_plant = "farming:rice_1", + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_rice") + end +}) + -- rice minetest.register_craftitem("farming:rice", { description = S("Rice"), inventory_image = "farming_rice.png", groups = {seed = 2, food_rice = 1, flammable = 2}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:rice_1") - end }) --- replacement for rice seeds that was removed -minetest.register_alias("farming:seed_rice", "farming:rice") +-- dry rice seed to give edible rice +minetest.register_craft({ + type = "cooking", + cooktime = 1, + output = "farming:rice", + recipe = "farming:seed_rice" +}) +-- rice flour and bread minetest.register_craftitem("farming:rice_bread", { description = S("Rice Bread"), inventory_image = "farming_rice_bread.png", @@ -54,6 +76,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 4, plant = 1, attached_node = 1, @@ -99,8 +122,9 @@ minetest.register_node("farming:rice_6", table.copy(def)) def.tiles = {"farming_rice_7.png"} def.drop = { items = { - {items = {"farming:rice"}, rarity = 1}, - {items = {"farming:rice"}, rarity = 3} + {items = {"farming:seed_rice"}, rarity = 1}, + {items = {"farming:seed_rice"}, rarity = 2}, + {items = {"farming:seed_rice"}, rarity = 3} } } minetest.register_node("farming:rice_7", table.copy(def)) @@ -108,10 +132,12 @@ minetest.register_node("farming:rice_7", table.copy(def)) -- stage 8 (final) def.tiles = {"farming_rice_8.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { - {items = {"farming:rice 2"}, rarity = 1}, - {items = {"farming:rice"}, rarity = 2} + {items = {"farming:seed_rice 2"}, rarity = 1}, + {items = {"farming:seed_rice 2"}, rarity = 2}, + {items = {"farming:seed_rice"}, rarity = 3} } } minetest.register_node("farming:rice_8", table.copy(def)) @@ -119,7 +145,7 @@ minetest.register_node("farming:rice_8", table.copy(def)) -- add to registered_plants farming.registered_plants["farming:rice"] = { crop = "farming:rice", - seed = "farming:rice", + seed = "farming:seed_rice", minlight = farming.min_light, maxlight = farming.max_light, steps = 8 diff --git a/crops/soy.lua b/crops/soy.lua index e0ed093..13c20af 100644 --- a/crops/soy.lua +++ b/crops/soy.lua @@ -171,6 +171,7 @@ minetest.register_node("farming:soy_6", table.copy(def)) -- stage 7 def.tiles = {"farming_soy_7.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { max_items = 5, items = { {items = {"farming:soy_pod"}, rarity = 1}, @@ -190,3 +191,28 @@ farming.registered_plants["farming:soy_pod"] = { maxlight = farming.max_light, steps = 7 } + +-- mapgen +local mg = farming.mapgen == "v6" + +def = { + spawn_on = mg and {"default:dirt_with_grass"} or {"default:dirt_with_dry_grass", + "default:dirt_with_rainforest_litter", "default:dry_dirt_with_dry_grass"} +} + +minetest.register_decoration({ + deco_type = "simple", + place_on = def.spawn_on, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.soy, + spread = {x = 100, y = 100, z = 100}, + seed = 809, + octaves = 3, + persist = 0.6 + }, + y_min = 20, + y_max = 50, + decoration = "farming:soy_6" +}) diff --git a/crops/spinach.lua b/crops/spinach.lua new file mode 100644 index 0000000..528e7bf --- /dev/null +++ b/crops/spinach.lua @@ -0,0 +1,90 @@ + +local S = farming.intllib + +-- spinach +minetest.register_craftitem("farming:spinach", { + description = S("Spinach"), + inventory_image = "farming_spinach.png", + groups = {seed = 2, food_spinach = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:spinach_1") + end, + on_use = minetest.item_eat(1) +}) + +-- definition +local def = { + drawtype = "plantlike", + tiles = {"farming_spinach_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:spinach_1", table.copy(def)) + +-- stage 2 +def.tiles = {"farming_spinach_2.png"} +minetest.register_node("farming:spinach_2", table.copy(def)) + +-- stage 3 +def.tiles = {"farming_spinach_3.png"} +def.drop = { + items = { + {items = {"farming:spinach"}, rarity = 1}, + {items = {"farming:spinach"}, rarity = 3} + } +} +minetest.register_node("farming:spinach_3", table.copy(def)) + +-- stage 4 +def.tiles = {"farming_spinach_4.png"} +def.groups.growing = nil +def.selection_box = farming.select_final +def.drop = { + items = { + {items = {"farming:spinach 2"}, rarity = 1}, + {items = {"farming:spinach 2"}, rarity = 2}, + {items = {"farming:spinach 2"}, rarity = 3} + } +} +minetest.register_node("farming:spinach_4", table.copy(def)) + +-- add to registered_plants +farming.registered_plants["farming:spinach"] = { + crop = "farming:spinach", + seed = "farming:spinach", + minlight = 7, + maxlight = farming.max_light, + steps = 4 +} + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.1, + scale = farming.spinach, + spread = {x = 100, y = 100, z = 100}, + seed = 910, + octaves = 3, + persist = 0.6 + }, + biomes = {"deciduous_forest"}, + y_max = 31000, + y_min = 1, + decoration = "farming:spinach_4", + param2 = 3 +}) diff --git a/crops/strawberry.lua b/crops/strawberry.lua new file mode 100644 index 0000000..9e0792b --- /dev/null +++ b/crops/strawberry.lua @@ -0,0 +1,112 @@ + +local S = farming.intllib + +-- Strawberry (can also be planted as seed) +minetest.register_craftitem(":ethereal:strawberry", { + description = S("Strawberry"), + inventory_image = "ethereal_strawberry.png", + groups = {seed = 2, food_strawberry = 1, food_berry = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "ethereal:strawberry_1") + end, + on_use = minetest.item_eat(1) +}) + +-- Define Strawberry Bush growth stages +local def = { + drawtype = "plantlike", + tiles = {"ethereal_strawberry_1.png"}, + paramtype = "light", + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + drop = "", + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} + }, + 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(":ethereal:strawberry_1", table.copy(def)) + +-- stage 2 +def.tiles = {"ethereal_strawberry_2.png"} +minetest.register_node(":ethereal:strawberry_2", table.copy(def)) + +-- stage 3 +def.tiles = {"ethereal_strawberry_3.png"} +minetest.register_node(":ethereal:strawberry_3", table.copy(def)) + +-- stage 4 +def.tiles = {"ethereal_strawberry_4.png"} +minetest.register_node(":ethereal:strawberry_4", table.copy(def)) + +-- stage 5 +def.tiles = {"ethereal_strawberry_5.png"} +minetest.register_node(":ethereal:strawberry_5", table.copy(def)) + +-- stage 6 +def.tiles = {"ethereal_strawberry_6.png"} +def.drop = { + items = { + {items = {"ethereal:strawberry 1"}, rarity = 2}, + {items = {"ethereal:strawberry 2"}, rarity = 3} + } +} +minetest.register_node(":ethereal:strawberry_6", table.copy(def)) + +-- stage 7 +def.tiles = {"ethereal_strawberry_7.png"} +def.drop = { + items = { + {items = {"ethereal:strawberry 1"}, rarity = 1}, + {items = {"ethereal:strawberry 2"}, rarity = 3} + } +} +minetest.register_node(":ethereal:strawberry_7", table.copy(def)) + +-- stage 8 +def.tiles = {"ethereal_strawberry_8.png"} +def.groups.growing = nil +def.selection_box = farming.select_final +def.drop = { + items = { + {items = {"ethereal:strawberry 2"}, rarity = 1}, + {items = {"ethereal:strawberry 3"}, rarity = 3} + } +} +minetest.register_node(":ethereal:strawberry_8", table.copy(def)) + +-- add to registered_plants +farming.registered_plants["ethereal:strawberry"] = { + crop = "ethereal:strawberry", + seed = "ethereal:strawberry", + minlight = farming.min_light, + maxlight = farming.max_light, + steps = 8 +} + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.strawberry, + spread = {x = 100, y = 100, z = 100}, + seed = 143, + octaves = 3, + persist = 0.6 + }, + y_min = 20, + y_max = 55, + decoration = "ethereal:strawberry_7" +}) diff --git a/crops/sunflower.lua b/crops/sunflower.lua index 1a45054..c3cb6b1 100644 --- a/crops/sunflower.lua +++ b/crops/sunflower.lua @@ -8,12 +8,22 @@ minetest.register_craftitem("farming:sunflower", { }) -- sunflower seeds -minetest.register_craftitem("farming:seed_sunflower", { +minetest.register_node("farming:seed_sunflower", { description = S("Sunflower Seeds"), + tiles = {"farming_sunflower_seeds.png"}, inventory_image = "farming_sunflower_seeds.png", - groups = {seed = 2, food_sunflower_seeds = 1, flammable = 2}, + wield_image = "farming_sunflower_seeds.png", + drawtype = "signlike", + groups = {seed = 1, snappy = 3, attached_node = 1, growing = 1, + food_sunflower_seeds = 1, flammable = 2}, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = farming.select, + next_plant = "farming:sunflower_1", on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:sunflower_1") + return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_sunflower") end }) @@ -98,6 +108,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -137,6 +148,7 @@ minetest.register_node("farming:sunflower_7", table.copy(def)) -- stage 8 (final) def.tiles = {"farming_sunflower_8.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:sunflower"}, rarity = 1}, @@ -153,3 +165,21 @@ farming.registered_plants["farming:sunflower"] = { maxlight = farming.max_light, steps = 8 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.sunflower, + spread = {x = 100, y = 100, z = 100}, + seed = 254, + octaves = 3, + persist = 0.6 + }, + y_min = 10, + y_max = 40, + decoration = "farming:sunflower_8" +}) diff --git a/crops/tomato.lua b/crops/tomato.lua index 6eff7c6..5541067 100644 --- a/crops/tomato.lua +++ b/crops/tomato.lua @@ -43,6 +43,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -87,6 +88,7 @@ minetest.register_node("farming:tomato_7", table.copy(def)) -- stage 8 (final) def.tiles = {"farming_tomato_8.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:tomato 3"}, rarity = 1}, @@ -104,3 +106,21 @@ farming.registered_plants["farming:tomato"] = { maxlight = farming.max_light, steps = 8 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.tomato, + spread = {x = 100, y = 100, z = 100}, + seed = 365, + octaves = 3, + persist = 0.6 + }, + y_min = 5, + y_max = 25, + decoration = "farming:tomato_7" +}) diff --git a/crops/vanilla.lua b/crops/vanilla.lua index f014a8d..c5304e9 100644 --- a/crops/vanilla.lua +++ b/crops/vanilla.lua @@ -20,6 +20,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 2, plant = 1, attached_node = 1, @@ -102,6 +103,7 @@ minetest.register_node("farming:vanilla_7", table.copy(def)) -- stage 8 (final) def.tiles = {"farming_vanilla_8.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:vanilla 2"}, rarity = 1}, @@ -120,3 +122,21 @@ farming.registered_plants["farming:vanilla"] = { maxlight = farming.max_light, steps = 8 } + +-- mapgen +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = farming.vanilla, + spread = {x = 100, y = 100, z = 100}, + seed = 476, + octaves = 3, + persist = 0.6 + }, + y_min = 5, + y_max = 35, + decoration = "farming:vanilla_7" +}) diff --git a/crops/wheat.lua b/crops/wheat.lua index 1a7de8a..d59e7e0 100644 --- a/crops/wheat.lua +++ b/crops/wheat.lua @@ -8,14 +8,15 @@ minetest.register_node("farming:seed_wheat", { inventory_image = "farming_wheat_seed.png", wield_image = "farming_wheat_seed.png", drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4}, + groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4, growing = 1}, paramtype = "light", paramtype2 = "wallmounted", walkable = false, sunlight_propagates = true, selection_box = farming.select, + next_plant = "farming:wheat_1", on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1") + return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_wheat") end }) @@ -158,6 +159,7 @@ local def = { walkable = false, buildable_to = true, drop = "", + waving = 1, selection_box = farming.select, groups = { snappy = 3, flammable = 4, plant = 1, attached_node = 1, @@ -216,6 +218,7 @@ minetest.register_node("farming:wheat_7", table.copy(def)) -- stage 8 (final) def.tiles = {"farming_wheat_8.png"} def.groups.growing = nil +def.selection_box = farming.select_final def.drop = { items = { {items = {"farming:wheat"}, rarity = 1}, diff --git a/farming.conf_example b/farming.conf_example index 7f103cd..9840d7a 100644 --- a/farming.conf_example +++ b/farming.conf_example @@ -6,6 +6,9 @@ --]] -- true to enable crop/food in-game and on mapgen set spawn rarety +farming.asparagus = 0.002 +farming.eggplant = 0.002 +farming.spinach = 0.002 farming.carrot = 0.001 farming.potato = 0.001 farming.tomato = 0.001 @@ -38,12 +41,11 @@ farming.vanilla = 0.001 farming.artichoke = 0.001 farming.parsley = 0.002 farming.sunflower = 0.001 +farming.ginger = 0.002 +farming.strawberry = not minetest.get_modpath("ethereal") and 0.002 farming.grains = true -- true or false only farming.rice = true --- default rarety of crops on map (higher number = more crops) -farming.rarety = 0.002 - -- default minimum and maximum light levels crops need to grow farming.min_light = 12 farming.max_light = 15 diff --git a/food.lua b/food.lua index 07c1fce..ca1ed16 100644 --- a/food.lua +++ b/food.lua @@ -2,6 +2,7 @@ local S = farming.intllib --= filter sea water into river water + minetest.register_craft({ output = "bucket:bucket_river_water", recipe = { @@ -67,18 +68,40 @@ minetest.register_craft({ recipe = "default:papyrus" }) +minetest.register_node("farming:sugar_cube", { + description = S("Sugar Cube"), + tiles = {"farming_sugar_cube.png"}, + groups = {crumbly = 2}, + floodable = true, + sounds = default.node_sound_gravel_defaults() +}) + +minetest.register_craft({ + output = "farming:sugar_cube", + recipe = { + {"farming:sugar", "farming:sugar", "farming:sugar"}, + {"farming:sugar", "farming:sugar", "farming:sugar"}, + {"farming:sugar", "farming:sugar", "farming:sugar"} + } +}) + +minetest.register_craft({ + output = "farming:sugar 9", + recipe = {{"farming:sugar_cube"}} +}) + --= Sugar caramel minetest.register_craftitem("farming:caramel", { description = S("Caramel"), - inventory_image = "farming_caramel.png", + inventory_image = "farming_caramel.png" }) minetest.register_craft({ type = "cooking", cooktime = 6, output = "farming:caramel", - recipe = "group:food_sugar", + recipe = "group:food_sugar" }) --= Salt @@ -165,8 +188,9 @@ minetest.register_node("farming:salt_crystal", { selection_box = { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} - }, + } }) + minetest.register_craft({ output = "farming:salt 9", recipe = { @@ -233,6 +257,7 @@ minetest.register_craft({ {"group:food_sugar", "dye:pink", "group:food_sugar"} }, replacements = { + {"group:food_cornstarch", "farming:bowl"}, {"group:food_cornstarch", "farming:bowl"}, {"group:food_rose_water", "vessels:glass_bottle"} } @@ -338,7 +363,7 @@ minetest.register_craft({ {"farming:baking_tray", "farming:baking_tray"}, {"mobs:bucket_milk", "bucket:bucket_empty"}, {"mobs:wooden_bucket_milk", "wooden_bucket:bucket_wood_empty"}, - {"farming:soy_milk", "vessels:drining_glass"} + {"farming:soy_milk", "vessels:drinking_glass"} } }) @@ -367,13 +392,9 @@ minetest.register_craftitem("farming:cactus_juice", { groups = {vessel = 1, drink = 1}, on_use = function(itemstack, user, pointed_thing) if user then - if math.random(5) == 1 then - return minetest.do_item_eat(-1, "vessels:drinking_glass", - itemstack, user, pointed_thing) - else - return minetest.do_item_eat(2, "vessels:drinking_glass", - itemstack, user, pointed_thing) - end + local num = math.random(5) == 1 and -1 or 2 + return minetest.do_item_eat(num, "vessels:drinking_glass", + itemstack, user, pointed_thing) end end }) @@ -647,7 +668,7 @@ minetest.register_craft({ -- Onigiri minetest.register_craftitem("farming:onigiri", { - description = S("Onirigi"), + description = S("Onigiri"), inventory_image = "farming_onigiri.png", on_use = minetest.item_eat(2), groups = {flammable = 2} diff --git a/grass.lua b/grass.lua index a52ace9..86e7ac5 100644 --- a/grass.lua +++ b/grass.lua @@ -39,7 +39,7 @@ minetest.override_item("default:junglegrass", { max_items = 1, items = { {items = {"farming:seed_cotton"}, rarity = 8}, - {items = {"farming:rice"},rarity = 8}, + {items = {"farming:seed_rice"},rarity = 8}, {items = {"default:junglegrass"}} } } diff --git a/hoes.lua b/hoes.lua index 9340d55..f508b56 100644 --- a/hoes.lua +++ b/hoes.lua @@ -190,29 +190,29 @@ farming.register_hoe(":farming:hoe_diamond", { -- Toolranks support if tr then -minetest.override_item("farming:hoe_wood", { - original_description = "Wood Hoe", - description = toolranks.create_description("Wood Hoe")}) + minetest.override_item("farming:hoe_wood", { + original_description = S("Wood Hoe"), + description = toolranks.create_description(S("Wood Hoe"))}) -minetest.override_item("farming:hoe_stone", { - original_description = "Stone Hoe", - description = toolranks.create_description("Stone Hoe")}) + minetest.override_item("farming:hoe_stone", { + original_description = S("Stone Hoe"), + description = toolranks.create_description(S("Stone Hoe"))}) -minetest.override_item("farming:hoe_steel", { - original_description = "Steel Hoe", - description = toolranks.create_description("Steel Hoe")}) + minetest.override_item("farming:hoe_steel", { + original_description = S("Steel Hoe"), + description = toolranks.create_description(S("Steel Hoe"))}) -minetest.override_item("farming:hoe_bronze", { - original_description = "Bronze Hoe", - description = toolranks.create_description("Bronze Hoe")}) + minetest.override_item("farming:hoe_bronze", { + original_description = S("Bronze Hoe"), + description = toolranks.create_description(S("Bronze Hoe"))}) -minetest.override_item("farming:hoe_mese", { - original_description = "Mese Hoe", - description = toolranks.create_description("Mese Hoe")}) + minetest.override_item("farming:hoe_mese", { + original_description = S("Mese Hoe"), + description = toolranks.create_description(S("Mese Hoe"))}) -minetest.override_item("farming:hoe_diamond", { - original_description = "Diamond Hoe", - description = toolranks.create_description("Diamond Hoe")}) + minetest.override_item("farming:hoe_diamond", { + original_description = S("Diamond Hoe"), + description = toolranks.create_description(S("Diamond Hoe"))}) end @@ -314,13 +314,13 @@ local function throw_potion(itemstack, player) local dir = player:get_look_dir() local velocity = 20 - obj:setvelocity({ + obj:set_velocity({ x = dir.x * velocity, y = dir.y * velocity, z = dir.z * velocity }) - obj:setacceleration({ + obj:set_acceleration({ x = dir.x * -3, y = -9.5, z = dir.z * -3 @@ -386,15 +386,9 @@ minetest.register_tool("farming:scythe_mithril", { local def = minetest.registered_nodes[node.name] - if not def then - return - end - - if not def.drop then - return - end - - if not def.groups + if not def + or not def.drop + or not def.groups or not def.groups.plant then return end @@ -481,34 +475,4 @@ if minetest.get_modpath("moreores") then {"", "", "group:stick"} } }) ---[[ - farming.register_hoe(":moreores:hoe_silver", { - description = S("%s Hoe"):format(S("Silver")), - inventory_image = "moreores_tool_silverhoe.png", - max_uses = 300, - material = "moreores:silver_ingot" - }) - - farming.register_hoe(":moreores:hoe_mithril", { - description = S("%s Hoe"):format(S("Mithril")), - inventory_image = "moreores_tool_mithrilhoe.png", - max_uses = 1000, - material = "moreores:mithril_ingot" - }) - - -- Toolranks support - if tr then - - local desc = S("%s Hoe"):format(S("Silver")) - - minetest.override_item("moreores:hoe_silver", { - original_description = desc, - description = toolranks.create_description(desc)}) - - desc = S("%s Hoe"):format(S("Mithril")) - - minetest.override_item("moreores:hoe_mithril", { - original_description = desc, - description = toolranks.create_description(desc)}) - end]] end diff --git a/init.lua b/init.lua index 19ef3d1..37defca 100644 --- a/init.lua +++ b/init.lua @@ -7,15 +7,20 @@ farming = { mod = "redo", - version = "20220603", + version = "20230407", path = minetest.get_modpath("farming"), select = { type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} }, + select_final = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -2.5/16, 0.5} + }, registered_plants = {}, min_light = 12, - max_light = 15 + max_light = 15, + mapgen = minetest.get_mapgen_setting("mg_name") } @@ -103,7 +108,7 @@ end -- Growth Logic local STAGE_LENGTH_AVG = tonumber( - minetest.settings:get("farming_stage_length")) or 200 -- 160 + minetest.settings:get("farming_stage_length")) or 200 local STAGE_LENGTH_DEV = STAGE_LENGTH_AVG / 6 @@ -193,30 +198,30 @@ local function reg_plant_stages(plant_name, stage, force_last) local old_constr = node_def.on_construct local old_destr = node_def.on_destruct - minetest.override_item(node_name, - { - on_construct = function(pos) + minetest.override_item(node_name, { - if old_constr then - old_constr(pos) - end + on_construct = function(pos) - farming.handle_growth(pos) - end, + if old_constr then + old_constr(pos) + end - on_destruct = function(pos) + farming.handle_growth(pos) + end, - minetest.get_node_timer(pos):stop() + on_destruct = function(pos) - if old_destr then - old_destr(pos) - end - end, + minetest.get_node_timer(pos):stop() - on_timer = function(pos, elapsed) - return farming.plant_growth_timer(pos, elapsed, node_name) - end, - }) + if old_destr then + old_destr(pos) + end + end, + + on_timer = function(pos, elapsed) + return farming.plant_growth_timer(pos, elapsed, node_name) + end, + }) end elseif force_last then @@ -302,12 +307,32 @@ end) -- Just in case a growing type or added node is missed (also catches existing -- nodes added to map before timers were incorporated). minetest.register_abm({ + label = "Start crop timer", nodenames = {"group:growing"}, interval = 300, chance = 1, catch_up = false, action = function(pos, node) - farming.handle_growth(pos, node) + + -- check if group:growing node is a seed + local def = minetest.registered_nodes[node.name] + + if def and def.groups and def.groups.seed then + + local next_stage = def.next_plant + + def = minetest.registered_nodes[next_stage] + + -- change seed to stage_1 or crop + if def then + + local p2 = def.place_param2 or 1 + + minetest.set_node(pos, {name = next_stage, param2 = p2}) + end + else + farming.handle_growth(pos, node) + end end }) @@ -366,8 +391,8 @@ function farming.plant_growth_timer(pos, elapsed, node_name) growth = 1 else - local night_light = (minetest.get_node_light(light_pos, 0) or 0) - local day_light = (minetest.get_node_light(light_pos, 0.5) or 0) + local night_light = (minetest.get_node_light(light_pos, 0) or 0) + local day_light = (minetest.get_node_light(light_pos, 0.5) or 0) local night_growth = night_light >= MIN_LIGHT and night_light <= MAX_LIGHT local day_growth = day_light >= MIN_LIGHT and day_light <= MAX_LIGHT @@ -536,19 +561,19 @@ farming.register_plant = function(name, def) inventory_image = def.inventory_image, wield_image = def.inventory_image, drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 2}, + groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 2, growing = 1}, paramtype = "light", paramtype2 = "wallmounted", walkable = false, sunlight_propagates = true, selection_box = farming.select, - place_param2 = def.place_param2 or nil, + place_param2 = 1, -- place seed flat next_plant = mname .. ":" .. pname .. "_1", on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, - pointed_thing, mname .. ":" .. pname .. "_1") - end, + return farming.place_seed(itemstack, placer, pointed_thing, + mname .. ":seed_" .. pname) + end }) -- Register harvest @@ -574,13 +599,16 @@ farming.register_plant = function(name, def) } } + local sel = farming.select local g = { snappy = 3, flammable = 2, plant = 1, growing = 1, attached_node = 1, not_in_creative_inventory = 1, } -- Last step doesn't need growing=1 so Abm never has to check these + -- also increase selection box for visual indication plant has matured if i == def.steps then + sel = farming.select_final g.growing = 0 end @@ -603,7 +631,7 @@ farming.register_plant = function(name, def) buildable_to = true, sunlight_propagates = true, drop = drop, - selection_box = farming.select, + selection_box = sel, groups = g, sounds = default.node_sound_leaves_defaults(), minlight = def.minlight, @@ -627,6 +655,9 @@ end -- default settings +farming.asparagus = 0.002 +farming.eggplant = 0.002 +farming.spinach = 0.002 farming.carrot = 0.001 farming.potato = 0.001 farming.tomato = 0.001 @@ -659,9 +690,10 @@ farming.lettuce = 0.001 farming.artichoke = 0.001 farming.parsley = 0.002 farming.sunflower = 0.001 +farming.ginger = 0.002 +farming.strawberry = not minetest.get_modpath("ethereal") and 0.002 farming.grains = true farming.rice = true -farming.rarety = 0.002 -- Load new global settings if found inside mod folder @@ -734,10 +766,16 @@ ddoo("lettuce.lua", farming.lettuce) ddoo("artichoke.lua", farming.artichoke) ddoo("parsley.lua", farming.parsley) ddoo("sunflower.lua", farming.sunflower) +ddoo("strawberry.lua", farming.strawberry) +ddoo("asparagus.lua", farming.asparagus) +ddoo("eggplant.lua", farming.eggplant) +ddoo("spinach.lua", farming.eggplant) +ddoo("ginger.lua", farming.ginger) dofile(farming.path .. "/food.lua") -dofile(farming.path .. "/mapgen.lua") dofile(farming.path .. "/compatibility.lua") -- Farming Plus compatibility -dofile(farming.path .. "/lucky_block.lua") +if minetest.get_modpath("lucky_block") then + dofile(farming.path .. "/lucky_block.lua") +end -minetest.log("action", "[farming] loaded.") +print("[MOD] Farming Redo loaded") diff --git a/license.txt b/license.txt index ded3fee..a44cef2 100644 --- a/license.txt +++ b/license.txt @@ -23,6 +23,10 @@ THE SOFTWARE. License of media (textures): ---------------------------- + +Created by Shadall (CC0): + farming_burger.png + Created by PilzAdam (License: CC BY 3.0): farming_bread.png farming_soil.png @@ -63,10 +67,15 @@ Created by VanessaE (License: CC BY 3.0): farming_cotton_7.png farming_cotton_8.png -Created by 7eventy7 (https://www.planetminecraft.com/member/7eventy7/) +Created by alerikaisattera (License: CC-BY-SA 4.0) farming_melon_top.png farming_melon_side.png farming_melon_bottom.png + farming_pumpkin_bottom.png + farming_pumpkin_top.png + farming_pumpkin_side.png + farming_pumpkin_face_on.png + farming_pumpkin_face_off.png Created by Doc (License: CC BY 3.0): farming_cucumber.png @@ -131,7 +140,6 @@ Created by TenPlus1 (CC BY 3.0) farming_rhubarb_2.png farming_rhubarb_3.png farming_rhubarb.png - farming_rhubarb_pie.png farming_hemp*.png farming_tofu*.png @@ -157,7 +165,6 @@ Created by OgelGames (CC BY-SA 4.0) Created by Felfa (CC0) farming_blackberry*.png farming_lettuce*.png - farming_burger.png farming_soy*.png farming_vanilla*.png farming_artichoke*.png @@ -175,11 +182,37 @@ Created by sirrobzeroone (CC0) farming_gyoza.png farming_pineapple_ring.png -Created by TechM8 (https://www.deviantart.com/techm8) +Created by smoke_th (CC0 - https://opengameart.org/content/popcorn-icon) farming_popcorn.png -Created by RZR0 (CC-BY-NC-SA) - farming_blueberry_pie.png - Created by DMBuce (MIT - https://github.com/DMBuce/hatchling-snacks) farming_mac_and_cheese.png + +Created by XSSheep (CC BY-SA 4.0 - https://minecraft.curseforge.com/projects/pixel-perfection-freshly-updated) + farming_coffee_1.png + farming_coffee_2.png + farming_coffee_3.png + farming_coffee_4.png + farming_coffee_5.png + farming_coffee_beans.png + farming_apple_pie.png (edited by TenPlus1) + farming_blueberry_pie.png (edited by TenPlus1) + farming_rhubarb_pie.png (edited by TenPlus1) + +Copyright (C) 2021-2022: Atlante - AFL-1.1 +License for code: AFL-1.1 + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + farming_asparagus* + farming_eggplant* + farming_spinach* + farming_ginger* diff --git a/locale/farming.de.tr b/locale/farming.de.tr index 3fb935b..61f315d 100644 --- a/locale/farming.de.tr +++ b/locale/farming.de.tr @@ -38,7 +38,7 @@ Cornstarch=Speisestärke Cotton=Baumwolle Cotton Seed=Baumwollsamen Cucumber=Gurke -Cucumber and Potato Salad=Gurken und Tomatensalat +Cucumber and Potato Salad=Kartoffelsalat mit Gurke Cup of Coffee=Tasse Kaffee Cutting Board=Schneidebrett Diamond Hoe=Diamanthacke diff --git a/locale/farming.eo.tr b/locale/farming.eo.tr new file mode 100644 index 0000000..0098ae6 --- /dev/null +++ b/locale/farming.eo.tr @@ -0,0 +1,194 @@ +# Translation of the farming mod by TenPlus1 +# textdomain: farming +# author: Jolesh +# last update: 2022/11/04 + +###### folder . ###### + +### init.lua ### +Seed=Semo + +### compatibility.lua ### +Banana=Banano +Banana Leaves=Bananaj Folioj +Orange=Oranĝo +Strawberry=Frago + +### food.lua ### +Sugar=Sukero +Salt=Salo +Rose Water=Roza Akvo +Turkish Delight=Turka Delico +Garlic Bread=Ajla Pano +Donut=Benjeto +Chocolate Donut=Ĉokolada Benjeto +Apple Donut=Poma Benjeto +Porridge=Kaĉo +Jaffa Cake=Jafa Kuko + +### hoes.lua ### +Hoe=Sarkilo +Wooden Hoe=Ligna Sarkilo +Stone Hoe=Ŝtona Sarkilo +Steel Hoe=Ŝtala Sarkilo +Bronze Hoe=Bronza Sarkilo +Mese Hoe=Mesea Sarkilo +Diamond Hoe=Diamanta Sarkilo +# Surcharge du mod [Toolranks] à faire # +Hoe Bomb (use or throw on grassy areas to hoe land)= +Mithril Scythe (Right-click to harvest and replant crops)= +# Surcharge du mod [Toolranks] à faire # + +### soil.lua ### +Soil=Tero +Wet Soil=Malseka Tero + +### utensils.lua ### +Wooden Bowl=Ligna Bovlo +Saucepan=Kaserolo +Cooking Pot=Kuirpoto +Baking Tray=Baka Pleto +Skillet=Pato +Mortar and Pestle=Pistujo +Cutting Board=Tranĉa Tabulo +Juicer=Spremilo +Glass Mixing Bowl=Vitra Miksa Bovlo + + +###### folder ./crops ###### + +### barley.lua ### +Barley Seed=Hordea Semo +Barley=Hordeo + +### beans.lua ### +Green Beans=Verdaj Fazeoloj +Bean Pole (place on soil before planting beans)=Fazeola Poluso (metu sur grundo antaŭ planti fabojn) + +### beetroot.lua ### +Beetroot=Betoto +Beetroot Soup=Betota Supo + +### blueberry.lua ### +Blueberries=Mirtiloj +Blueberry Muffin=Mirtila Mufino +Blueberry Pie=Mirtila Torto + +### carrot.lua ## +Carrot=Karoto +Carrot Juice=Karota Suko +Golden Carrot=Ora Karoto + +### chili.lua ### +Chili Pepper=Kapsiketo +Bowl of Chili=Bovlo da Kapsiketo + +### cocoa.lua ### +Cocoa Beans=Kakaa Faboj +Cookie=Kuketo +Bar of Dark Chocolate=Stango de Malhela Ĉokolado +Chocolate Block=Bloko de Ĉokolado + +### coffee.lua ### +Coffee Beans=Kafaj Seboj +Cup of Coffee=Taso da Kafo + +### corn.lua ### +Corn=Maizo +Corn on the Cob=Maiza sur la Spadiko +Cornstarch=Maizamelo +Bottle of Ethanol=Botelo da Etanolo + +### cotton.lua ### +Cotton Seed=Kotona Semo +Cotton=Kotono +String=Ŝnuro + +### cucumber.lua ### +Cucumber=Kukumo + +### garlic.lua ### +Garlic clove=Ajlokloko +Garlic=Ajlo +Garlic Braid=Ajla Plektaĵo + +### grapes.lua ### +Grapes=Vinberoj +Trellis (place on soil before planting grapes)=Trellis (meti sur grundo antaŭ planti vinberojn) + +### hemp.lua ### +Hemp Seed=Kanaba Semo +Hemp Leaf=Kanaba Folio +Bottle of Hemp Oil=Botelo da Kanaba Oleo +Hemp Fibre=Kanaba Fibro +Hemp Block=Kanaba Bloko +Hemp Rope=Kanaba Ŝnuro + +### melon.lua ### +Melon Slice=Tranĉaĵo de Melono +Melon=Melono + +### onion.lua ### +Onion=Cepo + +### peas.lua ### +Pea Pod=Pizujo +Peas=Pizoj +Pea Soup=Piza Supo + +### pepper.lua ### +Peppercorn=Piprograjno +Pepper=Pipro +Ground Pepper=Muelita Pipro + +### pinapple.lua ### +Pineapple Top=Pinto de Ananaso +Pineapple=Ananaso +Pineapple Ring=Ananasa Ringo +Pineapple Juice=Ananasa Suko + +### potato.lua ### +Potato=Terpomo +Baked Potato=Bakita Terpomo +Cucumber and Potato Salad=Salato de Kukumo kaj Terpomo + +### pumpkin.lua ### +Pumpkin Slice=Tranĉaĵo de Kukurbo +Jack 'O Lantern (punch to turn on and off)=Kukurba Lanterno (punu por ŝalti kaj malŝalti) +Scarecrow Bottom=Birdotimigilo Fundo +Pumpkin Bread=Kukurba Pano +Pumpkin Dough=Kukurba Pasto +Pumpkin=Kukurbo + +### raspberry.lua ### +Raspberries=Framboj +Raspberry Smoothie=Fraba Glataĵo + +### rhubarb.lua ### +Rhubarb=Rabarbo +Rhubarb Pie=Rabarba Torto + +### ryeoatrice.lua ### +Rye=Sekalo +Rye seed=Sekala Semo +Oat=Aveno +Oat seed=Avena Semo +Rice=Rizo +Rice grains=Rizaj grajnoj +Rice Bread=Riza Pano +Rice Flour=Riza Faruno +Multigrain Flour=Multgrajna Faruno +Multigrain Bread=Multgrajna Pano + +### tomato.lua ### +Tomato=Tomato + +### wheat.lua ### +Wheat Seed=Tritika Semo +Wheat=Tritiko +Straw=Pajlo +Flour=Faruno +Bread=Pano +Sliced Bread=Tranĉita Pano +Toast=Toasto +Toast Sandwich=Toasta Sandviĉo diff --git a/lucky_block.lua b/lucky_block.lua index c6a2000..525ea36 100644 --- a/lucky_block.lua +++ b/lucky_block.lua @@ -1,79 +1,79 @@ - --- add lucky blocks - -if minetest.get_modpath("lucky_block") then - - lucky_block:add_blocks({ - {"dro", {"farming:corn"}, 5}, - {"dro", {"farming:coffee_cup_hot"}, 1}, - {"dro", {"farming:bread"}, 5}, - {"nod", "farming:jackolantern", 0}, - {"tro", "farming:jackolantern_on"}, - {"nod", "default:river_water_source", 1}, - {"tel"}, - {"dro", {"farming:trellis", "farming:grapes"}, 5}, - {"dro", {"farming:bottle_ethanol"}, 1}, - {"nod", "farming:melon", 0}, - {"dro", {"farming:donut", "farming:donut_chocolate", "farming:donut_apple"}, 5}, - {"dro", {"farming:hemp_leaf", "farming:hemp_fibre", "farming:seed_hemp"}, 10}, - {"nod", "fire:permanent_flame", 1}, - {"dro", {"farming:chili_pepper", "farming:chili_bowl"}, 5}, - {"dro", {"farming:bowl"}, 3}, - {"dro", {"farming:saucepan"}, 1}, - {"dro", {"farming:pot"}, 1}, - {"dro", {"farming:baking_tray"}, 1}, - {"dro", {"farming:skillet"}, 1}, - {"exp", 4}, - {"dro", {"farming:mortar_pestle"}, 1}, - {"dro", {"farming:cutting_board"}, 1}, - {"dro", {"farming:juicer"}, 1}, - {"dro", {"farming:mixing_bowl"}, 1}, - {"dro", {"farming:hoe_bronze"}, 1}, - {"dro", {"farming:hoe_mese"}, 1}, - {"dro", {"farming:hoe_diamond"}, 1}, - {"dro", {"farming:hoe_bomb"}, 10}, - {"dro", {"farming:turkish_delight"}, 5}, - {"lig"}, - {"dro", {"farming:scythe_mithril"}, 1}, - {"sch", "instafarm", 0, true, { - {"farming:wheat_8", "farming:carrot_8"}, - {"farming:cotton_8", "farming:rhubarb_3"}, - }}, - {"sch", "instafarm", 0, true, { - {"farming:wheat_8", "farming:pepper_5"}, - {"farming:cotton_8", "farming:onion_5"}, - }}, - {"sch", "instafarm", 0, true, { - {"farming:wheat_8", "farming:beetroot_5"}, - {"farming:cotton_8", "farming:barley_7"}, - }}, - {"sch", "instafarm", 0, true, { - {"farming:wheat_8", "farming:corn_8"}, - {"farming:cotton_8", "farming:grapes_8"}, - }}, - {"sch", "instafarm", 0, true, { - {"farming:wheat_8", "farming:pea_5"}, - {"farming:cotton_8", "farming:coffee_5"}, - }}, - {"sch", "instafarm", 0, true, { - {"farming:wheat_8", "farming:raspberry_4"}, - {"farming:cotton_8", "farming:tomato_8"}, - }}, - {"sch", "instafarm", 0, true, { - {"farming:wheat_8", "farming:chili_8"}, - {"farming:cotton_8", "farming:cucumber_4"}, - }}, - {"nod", "default:chest", 0, { - {name = "farming:seed_wheat", max = 15}, - {name = "farming:seed_barley", max = 15}, - {name = "farming:seed_barley", max = 15}, - {name = "farming:seed_hemp", max = 15}, - {name = "farming:seed_rye", max = 15}, - {name = "farming:seed_rice", max = 15}, - {name = "farming:seed_oat", max = 15}, - {name = "farming:soil_wet", max = 10}, - {name = "farming:cotton_wild", max = 5}, - {name = "farming:grapebush", max = 5}, - }}, - }) -end +lucky_block:add_blocks({ + {"dro", {"farming:corn"}, 5}, + {"dro", {"farming:coffee_cup_hot"}, 1}, + {"dro", {"farming:bread"}, 5}, + {"nod", "farming:jackolantern", 0}, + {"tro", "farming:jackolantern_on"}, + {"nod", "default:river_water_source", 1}, + {"tel"}, + {"dro", {"farming:trellis", "farming:grapes"}, 5}, + {"dro", {"farming:bottle_ethanol"}, 1}, + {"nod", "farming:melon", 0}, + {"dro", {"farming:donut", "farming:donut_chocolate", "farming:donut_apple"}, 5}, + {"dro", {"farming:hemp_leaf", "farming:hemp_fibre", "farming:seed_hemp"}, 10}, + {"nod", "fire:permanent_flame", 1}, + {"dro", {"farming:chili_pepper", "farming:chili_bowl"}, 5}, + {"dro", {"farming:bowl"}, 3}, + {"dro", {"farming:saucepan"}, 1}, + {"dro", {"farming:pot"}, 1}, + {"dro", {"farming:baking_tray"}, 1}, + {"dro", {"farming:skillet"}, 1}, + {"exp", 4}, + {"dro", {"farming:mortar_pestle"}, 1}, + {"dro", {"farming:cutting_board"}, 1}, + {"dro", {"farming:juicer"}, 1}, + {"dro", {"farming:mixing_bowl"}, 1}, + {"dro", {"farming:hoe_bronze"}, 1}, + {"dro", {"farming:hoe_mese"}, 1}, + {"dro", {"farming:hoe_diamond"}, 1}, + {"dro", {"farming:hoe_bomb"}, 10}, + {"dro", {"farming:turkish_delight"}, 5}, + {"lig"}, + {"dro", {"farming:scythe_mithril"}, 1}, + {"sch", "instafarm", 0, true, { + {"farming:wheat_8", "farming:carrot_8"}, + {"farming:cotton_8", "farming:rhubarb_3"}, + }}, + {"sch", "instafarm", 0, true, { + {"farming:wheat_8", "farming:pepper_5"}, + {"farming:cotton_8", "farming:onion_5"}, + }}, + {"sch", "instafarm", 0, true, { + {"farming:wheat_8", "farming:beetroot_5"}, + {"farming:cotton_8", "farming:barley_7"}, + }}, + {"sch", "instafarm", 0, true, { + {"farming:wheat_8", "farming:corn_8"}, + {"farming:cotton_8", "farming:grapes_8"}, + }}, + {"sch", "instafarm", 0, true, { + {"farming:wheat_8", "farming:pea_5"}, + {"farming:cotton_8", "farming:coffee_5"}, + }}, + {"sch", "instafarm", 0, true, { + {"farming:wheat_8", "farming:raspberry_4"}, + {"farming:cotton_8", "farming:tomato_8"}, + }}, + {"sch", "instafarm", 0, true, { + {"farming:wheat_8", "farming:chili_8"}, + {"farming:cotton_8", "farming:cucumber_4"}, + }}, + {"sch", "instafarm", 0, true, { + {"farming:wheat_8", "farming:spinach_4"}, + {"farming:cotton_8", "farming:eggplant_4"}, + }}, + {"nod", "default:chest", 0, { + {name = "farming:seed_wheat", max = 15}, + {name = "farming:seed_barley", max = 15}, + {name = "farming:seed_barley", max = 15}, + {name = "farming:seed_hemp", max = 15}, + {name = "farming:seed_rye", max = 15}, + {name = "farming:seed_rice", max = 15}, + {name = "farming:seed_oat", max = 15}, + {name = "farming:soil_wet", max = 10}, + {name = "farming:cotton_wild", max = 5}, + {name = "farming:grapebush", max = 5}, + {name = "farming:asparagus", max = 7} + }}, + {"dro", {"farming:chili_powder"}, 5} +}) diff --git a/mapgen.lua b/mapgen.lua deleted file mode 100644 index a30580b..0000000 --- a/mapgen.lua +++ /dev/null @@ -1,240 +0,0 @@ --- what mapgen are we using -local mg_name = minetest.get_mapgen_setting("mg_name") - --- temp vars -local tmp1, tmp2, tmp3 - --- decoration function -local function register_plant(name, min, max, spawnon, spawnby, num, rarety) - - -- do not place on mapgen if no value given (or not true) - if not rarety then - return - end - - -- set rarety value or default to farming.rarety if not a number - rarety = tonumber(rarety) or farming.rarety - - minetest.register_decoration({ - deco_type = "simple", - place_on = spawnon or {"default:dirt_with_grass"}, - sidelen = 16, - noise_params = { - offset = 0, - scale = rarety, - spread = {x = 100, y = 100, z = 100}, - seed = 329, - octaves = 3, - persist = 0.6 - }, - y_min = min, - y_max = max, - decoration = "farming:" .. name, - spawn_by = spawnby, - num_spawn_by = num - }) -end - - --- add crops to mapgen -register_plant("potato_3", 15, 40, nil, "", -1, farming.potato) -register_plant("tomato_7", 5, 20, nil, "", -1, farming.tomato) -register_plant("corn_7", 12, 22, nil, "", -1, nil) -register_plant("raspberry_4", 3, 10, nil, "", -1, farming.raspberry) -register_plant("rhubarb_3", 3, 15, nil, "", -1, farming.rhubarb) -register_plant("blueberry_4", 3, 10, nil, "", -1, farming.blueberry) -register_plant("beanbush", 18, 35, nil, "", -1, farming.beans) -register_plant("grapebush", 25, 45, nil, "", -1, farming.grapes) -register_plant("onion_5", 5, 22, nil, "", -1, farming.onion) -register_plant("garlic_5", 3, 30, nil, "group:tree", 1, farming.garlic) -register_plant("pea_5", 25, 50, nil, "", -1, farming.peas) -register_plant("beetroot_5", 1, 15, nil, "", -1, farming.beetroot) -register_plant("cabbage_6", 2, 10, nil, "", -1, farming.cabbage) -register_plant("lettuce_5", 5, 30, nil, "", -1, farming.lettuce) -register_plant("blackberry_4", 3, 10, nil, "", -1, farming.blackberry) -register_plant("vanilla_7", 5, 35, nil, "", -1, farming.vanilla) -register_plant("parsley_3", 10, 40, nil, "", -1, farming.parsley) -register_plant("sunflower_8", 10, 40, nil, "", -1, farming.sunflower) -register_plant("mint_4", 1, 75, { - "default:dirt_with_grass", "default:dirt_with_coniferous_litter"}, - "group:water", 1, farming.mint) - - --- v6 mapgen compatibility for specific crops -if mg_name == "v6" then - - register_plant("carrot_8", 1, 30, nil, "group:water", 1, farming.carrot) - register_plant("cucumber_4", 1, 20, nil, "group:water", 1, farming.cucumber) - register_plant("melon_8", 1, 20, nil, "group:water", 1, farming.melon) - register_plant("pumpkin_8", 1, 20, nil, "group:water", 1, farming.pumpkin) - register_plant("coffee_5", 20, 45, nil, "", -1, farming.coffee) - register_plant("soy_6", 20, 50, nil, "", -1, farming.soy) -else - -- v7 maps have a beach so plants growing near water is limited to 6 high - register_plant("carrot_8", 1, 15, nil, "", -1, nil) - register_plant("cucumber_4", 1, 10, nil, "", -1, farming.cucumber) - register_plant("melon_8", 1, 6, {"default:dirt_with_dry_grass", - "default:dirt_with_rainforest_litter"}, "", -1, farming.melon) - register_plant("pumpkin_8", 1, 6, nil, "", -1, farming.pumpkin) - register_plant("coffee_5", 20, 45, {"default:dirt_with_dry_grass", - "default:dirt_with_rainforest_litter", - "default:dry_dirt_with_dry_grass"}, "", -1, farming.coffee) - register_plant("soy_6", 20, 50, {"default:dirt_with_dry_grass", - "default:dirt_with_rainforest_litter", - "default:dry_dirt_with_dry_grass"}, "", -1, farming.soy) -end - - -if farming.hemp then -minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"}, - sidelen = 16, - noise_params = { - offset = 0, - scale = tonumber(farming.hemp) or farming.rarety, - spread = {x = 100, y = 100, z = 100}, - seed = 420, - octaves = 3, - persist = 0.6 - }, - y_min = 3, - y_max = 45, - decoration = "farming:hemp_7", - spawn_by = "group:tree", - num_spawn_by = 1 -}) -end - - -if farming.chili then -minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"}, - sidelen = 16, - noise_params = { - offset = 0, - scale = tonumber(farming.chili) or farming.rarety, - spread = {x = 100, y = 100, z = 100}, - seed = 760, - octaves = 3, - persist = 0.6 - }, - y_min = 5, - y_max = 35, - decoration = {"farming:chili_8"}, - spawn_by = "group:tree", - num_spawn_by = 1 -}) -end - - -if farming.artichoke then -minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:dirt_with_grass"}, - sidelen = 16, - noise_params = { - offset = 0, - scale = tonumber(farming.artichoke) or farming.rarety, - spread = {x = 100, y = 100, z = 100}, - seed = 448, - octaves = 3, - persist = 0.6 - }, - y_min = 1, - y_max = 13, - decoration = {"farming:artichoke_5"}, - spawn_by = "group:tree", - num_spawn_by = 1, -}) -end - - -if farming.pepper then - -local tmp1 = {"default:dirt_with_rainforest_litter"} -- v7 - -if mg_name == "v6" then - tmp1 = {"default:dirt_with_grass"} -- v6 -end - -minetest.register_decoration({ - deco_type = "simple", - place_on = tmp1, - sidelen = 16, - noise_params = { - offset = 0, - scale = tonumber(farming.pepper) or farming.rarety, - spread = {x = 100, y = 100, z = 100}, - seed = 933, - octaves = 3, - persist = 0.6 - }, - y_min = 5, - y_max = 35, - decoration = {"farming:pepper_5", "farming:pepper_6", "farming:pepper_7"}, - spawn_by = "group:tree", - num_spawn_by = 1 -}) -end - - -if farming.pineapple then - -tmp1 = {"default:dirt_with_dry_grass", "default:dry_dirt_with_dry_grass"} -tmp2 = nil -tmp3 = -1 - -if mg_name == "v6" then - tmp1 = {"default:dirt_with_grass"} - tmp2 = "default:desert_sand" - tmp3 = 1 -end - -minetest.register_decoration({ - deco_type = "simple", - place_on = tmp1, - sidelen = 16, - noise_params = { - offset = 0, - scale = tonumber(farming.pineapple) or farming.rarety, - spread = {x = 100, y = 100, z = 100}, - seed = 917, - octaves = 3, - persist = 0.6 - }, - y_min = 18, - y_max = 30, - decoration = {"farming:pineapple_8"}, - spawn_by = tmp2, - num_spawn_by = tmp3 -}) -end - -tmp1 = {"default:dry_dirt_with_dry_grass"} -tmp2 = {"savanna"} - -if mg_name == "v6" then - tmp1 = {"default:dirt_with_grass"} - tmp2 = {"jungle"} -end - -minetest.register_decoration({ - name = "farming:cotton_wild", - deco_type = "simple", - place_on = tmp1, - sidelen = 16, - noise_params = { - offset = -0.1, - scale = 0.1, - spread = {x = 50, y = 50, z = 50}, - seed = 4242, - octaves = 3, - persist = 0.7 - }, - biomes = tmp2, - y_max = 31000, - y_min = 1, - decoration = "farming:cotton_wild" -}) diff --git a/soil.lua b/soil.lua index ea23c29..ed557ee 100644 --- a/soil.lua +++ b/soil.lua @@ -144,6 +144,7 @@ minetest.register_alias("farming:desert_sand_soil_wet", dry_soil .. "_wet") -- if water near soil then change to wet soil minetest.register_abm({ + label = "Soil changes", nodenames = {"group:field"}, interval = 15, chance = 4, @@ -164,30 +165,34 @@ minetest.register_abm({ -- what's on top of soil, if solid/not plant change soil to dirt if minetest.registered_nodes[nn] and minetest.registered_nodes[nn].walkable - and minetest.get_item_group(nn, "plant") == 0 then + and minetest.get_item_group(nn, "plant") == 0 + and minetest.get_item_group(nn, "growing") == 0 then + minetest.set_node(pos, {name = ndef.soil.base}) + return end - -- if map around soil not loaded then skip until loaded - if minetest.find_node_near(pos, 3, {"ignore"}) then - return - end + -- check if water is within 3 nodes + if minetest.find_node_near(pos, 3, {"group:water"}) then - -- check if water is within 3 nodes horizontally and 1 below - if #minetest.find_nodes_in_area( - {x = pos.x + 3, y = pos.y - 1, z = pos.z + 3}, - {x = pos.x - 3, y = pos.y , z = pos.z - 3}, - {"group:water"}) > 0 then + -- only change if it's not already wet soil + if node.name ~= ndef.soil.wet then + minetest.set_node(pos, {name = ndef.soil.wet}) + end - minetest.set_node(pos, {name = ndef.soil.wet}) + -- only dry out soil if no unloaded blocks nearby, just incase + elseif not minetest.find_node_near(pos, 3, {"ignore"}) then - elseif node.name == ndef.soil.wet then - minetest.set_node(pos, {name = ndef.soil.dry}) + if node.name == ndef.soil.wet then + minetest.set_node(pos, {name = ndef.soil.dry}) - elseif node.name == ndef.soil.dry - and minetest.get_item_group(nn, "plant") == 0 then - minetest.set_node(pos, {name = ndef.soil.base}) + -- if crop or seed found don't turn to dry soil + elseif node.name == ndef.soil.dry + and minetest.get_item_group(nn, "plant") == 0 + and minetest.get_item_group(nn, "growing") == 0 then + minetest.set_node(pos, {name = ndef.soil.base}) + end end end }) diff --git a/statistics.lua b/statistics.lua index b892867..945d792 100644 --- a/statistics.lua +++ b/statistics.lua @@ -7,9 +7,9 @@ local ROOT_2 = math.sqrt(2.0) local erf local erf_inv -local A = 8 * (math.pi - 3.0)/(3.0 * math.pi * (4.0 - math.pi)) +local A = 8 * (math.pi - 3.0) / (3.0 * math.pi * (4.0 - math.pi)) local B = 4.0 / math.pi -local C = 2.0/(math.pi * A) +local C = 2.0 / (math.pi * A) local D = 1.0 / A diff --git a/textures/crops_onion.png b/textures/crops_onion.png index 2099c63..8a6dc54 100644 Binary files a/textures/crops_onion.png and b/textures/crops_onion.png differ diff --git a/textures/ethereal_strawberry.png b/textures/ethereal_strawberry.png new file mode 100644 index 0000000..5b43e6b Binary files /dev/null and b/textures/ethereal_strawberry.png differ diff --git a/textures/ethereal_strawberry_1.png b/textures/ethereal_strawberry_1.png new file mode 100644 index 0000000..3fa21ed Binary files /dev/null and b/textures/ethereal_strawberry_1.png differ diff --git a/textures/ethereal_strawberry_2.png b/textures/ethereal_strawberry_2.png new file mode 100644 index 0000000..751115e Binary files /dev/null and b/textures/ethereal_strawberry_2.png differ diff --git a/textures/ethereal_strawberry_3.png b/textures/ethereal_strawberry_3.png new file mode 100644 index 0000000..8b7a7b8 Binary files /dev/null and b/textures/ethereal_strawberry_3.png differ diff --git a/textures/ethereal_strawberry_4.png b/textures/ethereal_strawberry_4.png new file mode 100644 index 0000000..dcf0017 Binary files /dev/null and b/textures/ethereal_strawberry_4.png differ diff --git a/textures/ethereal_strawberry_5.png b/textures/ethereal_strawberry_5.png new file mode 100644 index 0000000..a2decaa Binary files /dev/null and b/textures/ethereal_strawberry_5.png differ diff --git a/textures/ethereal_strawberry_6.png b/textures/ethereal_strawberry_6.png new file mode 100644 index 0000000..a4d0d60 Binary files /dev/null and b/textures/ethereal_strawberry_6.png differ diff --git a/textures/ethereal_strawberry_7.png b/textures/ethereal_strawberry_7.png new file mode 100644 index 0000000..ace223c Binary files /dev/null and b/textures/ethereal_strawberry_7.png differ diff --git a/textures/ethereal_strawberry_8.png b/textures/ethereal_strawberry_8.png new file mode 100644 index 0000000..6d7280b Binary files /dev/null and b/textures/ethereal_strawberry_8.png differ diff --git a/textures/farming_apple_pie.png b/textures/farming_apple_pie.png index 0e4fdf4..a676135 100644 Binary files a/textures/farming_apple_pie.png and b/textures/farming_apple_pie.png differ diff --git a/textures/farming_asparagus.png b/textures/farming_asparagus.png new file mode 100644 index 0000000..4dbc1ec Binary files /dev/null and b/textures/farming_asparagus.png differ diff --git a/textures/farming_asparagus_1.png b/textures/farming_asparagus_1.png new file mode 100644 index 0000000..87444d1 Binary files /dev/null and b/textures/farming_asparagus_1.png differ diff --git a/textures/farming_asparagus_2.png b/textures/farming_asparagus_2.png new file mode 100644 index 0000000..cb8c6b4 Binary files /dev/null and b/textures/farming_asparagus_2.png differ diff --git a/textures/farming_asparagus_3.png b/textures/farming_asparagus_3.png new file mode 100644 index 0000000..904fb25 Binary files /dev/null and b/textures/farming_asparagus_3.png differ diff --git a/textures/farming_asparagus_4.png b/textures/farming_asparagus_4.png new file mode 100644 index 0000000..13c02ca Binary files /dev/null and b/textures/farming_asparagus_4.png differ diff --git a/textures/farming_asparagus_5.png b/textures/farming_asparagus_5.png new file mode 100644 index 0000000..1ed183e Binary files /dev/null and b/textures/farming_asparagus_5.png differ diff --git a/textures/farming_barley.png b/textures/farming_barley.png index ca929e0..c681954 100644 Binary files a/textures/farming_barley.png and b/textures/farming_barley.png differ diff --git a/textures/farming_barley_1.png b/textures/farming_barley_1.png index 4a458b1..177fbdf 100644 Binary files a/textures/farming_barley_1.png and b/textures/farming_barley_1.png differ diff --git a/textures/farming_barley_2.png b/textures/farming_barley_2.png index 96610c2..d5a5936 100644 Binary files a/textures/farming_barley_2.png and b/textures/farming_barley_2.png differ diff --git a/textures/farming_barley_3.png b/textures/farming_barley_3.png index ef14b5b..b456f43 100644 Binary files a/textures/farming_barley_3.png and b/textures/farming_barley_3.png differ diff --git a/textures/farming_barley_4.png b/textures/farming_barley_4.png index f7c9054..62905ef 100644 Binary files a/textures/farming_barley_4.png and b/textures/farming_barley_4.png differ diff --git a/textures/farming_barley_5.png b/textures/farming_barley_5.png index 68c0d68..cc1d66b 100644 Binary files a/textures/farming_barley_5.png and b/textures/farming_barley_5.png differ diff --git a/textures/farming_barley_6.png b/textures/farming_barley_6.png index 496a218..e72dd2e 100644 Binary files a/textures/farming_barley_6.png and b/textures/farming_barley_6.png differ diff --git a/textures/farming_barley_7.png b/textures/farming_barley_7.png index 1c636af..a37c517 100644 Binary files a/textures/farming_barley_7.png and b/textures/farming_barley_7.png differ diff --git a/textures/farming_barley_8.png b/textures/farming_barley_8.png new file mode 100644 index 0000000..a2a0765 Binary files /dev/null and b/textures/farming_barley_8.png differ diff --git a/textures/farming_blueberry_pie.png b/textures/farming_blueberry_pie.png index 2174686..1fa6b1c 100644 Binary files a/textures/farming_blueberry_pie.png and b/textures/farming_blueberry_pie.png differ diff --git a/textures/farming_burger.png b/textures/farming_burger.png index c39f7c0..43ab6d4 100644 Binary files a/textures/farming_burger.png and b/textures/farming_burger.png differ diff --git a/textures/farming_chili_powder.png b/textures/farming_chili_powder.png new file mode 100644 index 0000000..5c3e31e Binary files /dev/null and b/textures/farming_chili_powder.png differ diff --git a/textures/farming_coffee_1.png b/textures/farming_coffee_1.png index 97c207a..48d1b7f 100644 Binary files a/textures/farming_coffee_1.png and b/textures/farming_coffee_1.png differ diff --git a/textures/farming_coffee_2.png b/textures/farming_coffee_2.png index a659f85..e80d7be 100644 Binary files a/textures/farming_coffee_2.png and b/textures/farming_coffee_2.png differ diff --git a/textures/farming_coffee_3.png b/textures/farming_coffee_3.png index 93088c8..a057d04 100644 Binary files a/textures/farming_coffee_3.png and b/textures/farming_coffee_3.png differ diff --git a/textures/farming_coffee_4.png b/textures/farming_coffee_4.png index 37a609f..912c5f0 100644 Binary files a/textures/farming_coffee_4.png and b/textures/farming_coffee_4.png differ diff --git a/textures/farming_coffee_5.png b/textures/farming_coffee_5.png index e624fbe..47b11f2 100644 Binary files a/textures/farming_coffee_5.png and b/textures/farming_coffee_5.png differ diff --git a/textures/farming_coffee_beans.png b/textures/farming_coffee_beans.png index 0786f4e..88e9438 100644 Binary files a/textures/farming_coffee_beans.png and b/textures/farming_coffee_beans.png differ diff --git a/textures/farming_eggplant.png b/textures/farming_eggplant.png new file mode 100644 index 0000000..4315add Binary files /dev/null and b/textures/farming_eggplant.png differ diff --git a/textures/farming_eggplant_1.png b/textures/farming_eggplant_1.png new file mode 100644 index 0000000..7246860 Binary files /dev/null and b/textures/farming_eggplant_1.png differ diff --git a/textures/farming_eggplant_2.png b/textures/farming_eggplant_2.png new file mode 100644 index 0000000..bfaf363 Binary files /dev/null and b/textures/farming_eggplant_2.png differ diff --git a/textures/farming_eggplant_3.png b/textures/farming_eggplant_3.png new file mode 100644 index 0000000..c812200 Binary files /dev/null and b/textures/farming_eggplant_3.png differ diff --git a/textures/farming_eggplant_4.png b/textures/farming_eggplant_4.png new file mode 100644 index 0000000..7b32b1b Binary files /dev/null and b/textures/farming_eggplant_4.png differ diff --git a/textures/farming_ginger.png b/textures/farming_ginger.png new file mode 100644 index 0000000..22a48b5 Binary files /dev/null and b/textures/farming_ginger.png differ diff --git a/textures/farming_ginger_1.png b/textures/farming_ginger_1.png new file mode 100644 index 0000000..84d0d45 Binary files /dev/null and b/textures/farming_ginger_1.png differ diff --git a/textures/farming_ginger_2.png b/textures/farming_ginger_2.png new file mode 100644 index 0000000..c472d20 Binary files /dev/null and b/textures/farming_ginger_2.png differ diff --git a/textures/farming_ginger_3.png b/textures/farming_ginger_3.png new file mode 100644 index 0000000..96f75d7 Binary files /dev/null and b/textures/farming_ginger_3.png differ diff --git a/textures/farming_ginger_4.png b/textures/farming_ginger_4.png new file mode 100644 index 0000000..32f6de5 Binary files /dev/null and b/textures/farming_ginger_4.png differ diff --git a/textures/farming_melon_1.png b/textures/farming_melon_1.png index 3c6ea6d..f18f633 100644 Binary files a/textures/farming_melon_1.png and b/textures/farming_melon_1.png differ diff --git a/textures/farming_melon_2.png b/textures/farming_melon_2.png index 185ed82..d5d9413 100644 Binary files a/textures/farming_melon_2.png and b/textures/farming_melon_2.png differ diff --git a/textures/farming_melon_3.png b/textures/farming_melon_3.png index 6e661f9..07730e9 100644 Binary files a/textures/farming_melon_3.png and b/textures/farming_melon_3.png differ diff --git a/textures/farming_melon_4.png b/textures/farming_melon_4.png index d9199f3..9ff1e2f 100644 Binary files a/textures/farming_melon_4.png and b/textures/farming_melon_4.png differ diff --git a/textures/farming_melon_5.png b/textures/farming_melon_5.png index 755cbd3..c44afcd 100644 Binary files a/textures/farming_melon_5.png and b/textures/farming_melon_5.png differ diff --git a/textures/farming_melon_6.png b/textures/farming_melon_6.png index b31a5b4..f0b9c3d 100644 Binary files a/textures/farming_melon_6.png and b/textures/farming_melon_6.png differ diff --git a/textures/farming_melon_7.png b/textures/farming_melon_7.png index 3aebfdd..95a3c63 100644 Binary files a/textures/farming_melon_7.png and b/textures/farming_melon_7.png differ diff --git a/textures/farming_melon_bottom.png b/textures/farming_melon_bottom.png index 91d1e6c..471d6be 100644 Binary files a/textures/farming_melon_bottom.png and b/textures/farming_melon_bottom.png differ diff --git a/textures/farming_melon_side.png b/textures/farming_melon_side.png index 07afb25..7995ea5 100644 Binary files a/textures/farming_melon_side.png and b/textures/farming_melon_side.png differ diff --git a/textures/farming_melon_slice.png b/textures/farming_melon_slice.png index 6ee9775..8ae5dec 100644 Binary files a/textures/farming_melon_slice.png and b/textures/farming_melon_slice.png differ diff --git a/textures/farming_melon_top.png b/textures/farming_melon_top.png index 29ca92d..9309f37 100644 Binary files a/textures/farming_melon_top.png and b/textures/farming_melon_top.png differ diff --git a/textures/farming_onigiri.png b/textures/farming_onigiri.png index 86ee7c6..e1bf0bc 100644 Binary files a/textures/farming_onigiri.png and b/textures/farming_onigiri.png differ diff --git a/textures/farming_pea_1.png b/textures/farming_pea_1.png index eb48e36..aa98af7 100644 Binary files a/textures/farming_pea_1.png and b/textures/farming_pea_1.png differ diff --git a/textures/farming_pea_2.png b/textures/farming_pea_2.png index 4db7551..3a4ed62 100644 Binary files a/textures/farming_pea_2.png and b/textures/farming_pea_2.png differ diff --git a/textures/farming_pea_3.png b/textures/farming_pea_3.png index 980d6ea..5cfd90e 100644 Binary files a/textures/farming_pea_3.png and b/textures/farming_pea_3.png differ diff --git a/textures/farming_pea_4.png b/textures/farming_pea_4.png index 551eaf4..b14f301 100644 Binary files a/textures/farming_pea_4.png and b/textures/farming_pea_4.png differ diff --git a/textures/farming_pea_5.png b/textures/farming_pea_5.png index 907760d..ecd81c3 100644 Binary files a/textures/farming_pea_5.png and b/textures/farming_pea_5.png differ diff --git a/textures/farming_popcorn.png b/textures/farming_popcorn.png index 6a534b9..846399e 100644 Binary files a/textures/farming_popcorn.png and b/textures/farming_popcorn.png differ diff --git a/textures/farming_pumpkin_bottom.png b/textures/farming_pumpkin_bottom.png index b23d241..8c8f56e 100644 Binary files a/textures/farming_pumpkin_bottom.png and b/textures/farming_pumpkin_bottom.png differ diff --git a/textures/farming_pumpkin_face_off.png b/textures/farming_pumpkin_face_off.png index df70171..ed46e83 100644 Binary files a/textures/farming_pumpkin_face_off.png and b/textures/farming_pumpkin_face_off.png differ diff --git a/textures/farming_pumpkin_face_on.png b/textures/farming_pumpkin_face_on.png index fa71c9d..4708c9d 100644 Binary files a/textures/farming_pumpkin_face_on.png and b/textures/farming_pumpkin_face_on.png differ diff --git a/textures/farming_pumpkin_side.png b/textures/farming_pumpkin_side.png index 2d30f20..e29b732 100644 Binary files a/textures/farming_pumpkin_side.png and b/textures/farming_pumpkin_side.png differ diff --git a/textures/farming_pumpkin_top.png b/textures/farming_pumpkin_top.png index 7928345..6b8e91b 100644 Binary files a/textures/farming_pumpkin_top.png and b/textures/farming_pumpkin_top.png differ diff --git a/textures/farming_rhubarb_1.png b/textures/farming_rhubarb_1.png index 01585b1..5ebf116 100644 Binary files a/textures/farming_rhubarb_1.png and b/textures/farming_rhubarb_1.png differ diff --git a/textures/farming_rhubarb_2.png b/textures/farming_rhubarb_2.png index 71845c7..01585b1 100644 Binary files a/textures/farming_rhubarb_2.png and b/textures/farming_rhubarb_2.png differ diff --git a/textures/farming_rhubarb_3.png b/textures/farming_rhubarb_3.png index b412f7e..71845c7 100644 Binary files a/textures/farming_rhubarb_3.png and b/textures/farming_rhubarb_3.png differ diff --git a/textures/farming_rhubarb_4.png b/textures/farming_rhubarb_4.png new file mode 100644 index 0000000..b412f7e Binary files /dev/null and b/textures/farming_rhubarb_4.png differ diff --git a/textures/farming_rhubarb_pie.png b/textures/farming_rhubarb_pie.png index 1f77b53..d559326 100644 Binary files a/textures/farming_rhubarb_pie.png and b/textures/farming_rhubarb_pie.png differ diff --git a/textures/farming_rice.png b/textures/farming_rice.png index 3d64c7e..9b42a34 100644 Binary files a/textures/farming_rice.png and b/textures/farming_rice.png differ diff --git a/textures/farming_rice_seed.png b/textures/farming_rice_seed.png new file mode 100644 index 0000000..8a84f58 Binary files /dev/null and b/textures/farming_rice_seed.png differ diff --git a/textures/farming_spinach.png b/textures/farming_spinach.png new file mode 100644 index 0000000..2e7d519 Binary files /dev/null and b/textures/farming_spinach.png differ diff --git a/textures/farming_spinach_1.png b/textures/farming_spinach_1.png new file mode 100644 index 0000000..67c95f8 Binary files /dev/null and b/textures/farming_spinach_1.png differ diff --git a/textures/farming_spinach_2.png b/textures/farming_spinach_2.png new file mode 100644 index 0000000..52d976d Binary files /dev/null and b/textures/farming_spinach_2.png differ diff --git a/textures/farming_spinach_3.png b/textures/farming_spinach_3.png new file mode 100644 index 0000000..ef2e85f Binary files /dev/null and b/textures/farming_spinach_3.png differ diff --git a/textures/farming_spinach_4.png b/textures/farming_spinach_4.png new file mode 100644 index 0000000..9435bc6 Binary files /dev/null and b/textures/farming_spinach_4.png differ diff --git a/textures/farming_sugar_cube.png b/textures/farming_sugar_cube.png new file mode 100644 index 0000000..7c9b835 Binary files /dev/null and b/textures/farming_sugar_cube.png differ