From 1adee001dd438172cd4ff7e3c6e9ca168b0bdd58 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Mon, 13 Aug 2018 09:48:45 -0400 Subject: update plantlife, digistuff, farming-redo, roads, unified inventory, and fixed a few obsolete "overrides" in the misc-overrides package. --- bushes_classic/cooking.lua | 93 ++--- digistuff/init.lua | 45 +-- digistuff/nbsounds.lua | 166 +++++++++ farming/README.md | 61 ++++ farming/README.txt | 170 --------- farming/api.txt | 53 +++ farming/barley.lua | 105 ------ farming/beanpole.lua | 241 ------------- farming/beetroot.lua | 85 ----- farming/blueberry.lua | 68 ---- farming/carrot.lua | 96 ----- farming/chili.lua | 92 ----- farming/cocoa.lua | 195 ---------- farming/coffee.lua | 133 ------- farming/compatibility.lua | 15 +- farming/corn.lua | 129 ------- farming/cotton.lua | 151 -------- farming/crops/barley.lua | 105 ++++++ farming/crops/beans.lua | 249 +++++++++++++ farming/crops/beetroot.lua | 85 +++++ farming/crops/blueberry.lua | 85 +++++ farming/crops/carrot.lua | 96 +++++ farming/crops/chili.lua | 92 +++++ farming/crops/cocoa.lua | 210 +++++++++++ farming/crops/coffee.lua | 88 +++++ farming/crops/corn.lua | 149 ++++++++ farming/crops/cotton.lua | 151 ++++++++ farming/crops/cucumber.lua | 56 +++ farming/crops/garlic.lua | 128 +++++++ farming/crops/grapes.lua | 256 +++++++++++++ farming/crops/hemp.lua | 251 +++++++++++++ farming/crops/melon.lua | 86 +++++ farming/crops/onion.lua | 68 ++++ farming/crops/peas.lua | 89 +++++ farming/crops/pepper.lua | 106 ++++++ farming/crops/pineapple.lua | 129 +++++++ farming/crops/potato.lua | 94 +++++ farming/crops/pumpkin.lua | 211 +++++++++++ farming/crops/raspberry.lua | 69 ++++ farming/crops/rhubarb.lua | 66 ++++ farming/crops/tomato.lua | 79 +++++ farming/crops/wheat.lua | 244 +++++++++++++ farming/cucumber.lua | 56 --- farming/depends.txt | 1 + farming/donut.lua | 76 ---- farming/farming.conf_example | 2 - farming/food.lua | 188 ++++++++++ farming/garlic.lua | 129 ------- farming/grapes.lua | 248 ------------- farming/hemp.lua | 230 ------------ farming/hoebomb.lua | 149 -------- farming/hoes.lua | 138 +++++++ farming/init.lua | 109 +++--- farming/license.txt | 109 ++++++ farming/lucky_block.lua | 2 + farming/melon.lua | 86 ----- farming/onion.lua | 68 ---- farming/pea.lua | 89 ----- farming/pepper.lua | 105 ------ farming/pineapple.lua | 126 ------- farming/potato.lua | 78 ---- farming/pumpkin.lua | 211 ----------- farming/raspberry.lua | 69 ---- farming/rhubarb.lua | 66 ---- farming/sugar.lua | 44 --- farming/textures/farming_blueberry_pie.png | Bin 0 -> 195 bytes farming/textures/farming_coffee_cup_hot.png | Bin 183 -> 0 bytes farming/textures/farming_cornstarch.png | Bin 0 -> 176 bytes farming/textures/farming_garlic_bread.png | Bin 0 -> 188 bytes farming/textures/farming_potato_salad.png | Bin 0 -> 325 bytes farming/textures/farming_rose_water.png | Bin 0 -> 178 bytes farming/textures/farming_salt.png | Bin 254 -> 248 bytes farming/textures/farming_turkish_delight.png | Bin 0 -> 156 bytes farming/tomato.lua | 79 ----- farming/utensils.lua | 16 +- farming/wheat.lua | 223 ------------ misc_overrides/init.lua | 7 - trafficlight/init.lua | 395 +++++++++++++++++++-- trafficlight/textures/streets_pl_flashingwalk.png | Bin 0 -> 2701 bytes trafficlight/textures/streets_tl_flashgreen.png | Bin 0 -> 2975 bytes trafficlight/textures/streets_tl_flashred_alt.png | Bin 0 -> 2795 bytes .../textures/streets_tl_left_flashgreen.png | Bin 0 -> 2886 bytes .../textures/streets_tl_left_flashred_alt.png | Bin 0 -> 2914 bytes .../textures/streets_tl_left_redyellow.png | Bin 0 -> 3142 bytes trafficlight/textures/streets_tl_left_warn_alt.png | Bin 0 -> 2933 bytes trafficlight/textures/streets_tl_redyellow.png | Bin 0 -> 3178 bytes .../textures/streets_tl_right_flashgreen.png | Bin 0 -> 2862 bytes .../textures/streets_tl_right_flashred_alt.png | Bin 0 -> 2890 bytes .../textures/streets_tl_right_redyellow.png | Bin 0 -> 3162 bytes .../textures/streets_tl_right_warn_alt.png | Bin 0 -> 3009 bytes trafficlight/textures/streets_tl_warn_alt.png | Bin 0 -> 2929 bytes .../textures/streets_tle_left_flashgreen.png | Bin 0 -> 3004 bytes .../textures/streets_tle_right_flashgreen.png | Bin 0 -> 2961 bytes unified_inventory/bags.lua | 2 + 94 files changed, 4462 insertions(+), 3779 deletions(-) create mode 100644 digistuff/nbsounds.lua create mode 100644 farming/README.md delete mode 100644 farming/README.txt create mode 100644 farming/api.txt delete mode 100644 farming/barley.lua delete mode 100644 farming/beanpole.lua delete mode 100644 farming/beetroot.lua delete mode 100644 farming/blueberry.lua delete mode 100644 farming/carrot.lua delete mode 100644 farming/chili.lua delete mode 100644 farming/cocoa.lua delete mode 100644 farming/coffee.lua delete mode 100644 farming/corn.lua delete mode 100644 farming/cotton.lua create mode 100644 farming/crops/barley.lua create mode 100644 farming/crops/beans.lua create mode 100644 farming/crops/beetroot.lua create mode 100644 farming/crops/blueberry.lua create mode 100644 farming/crops/carrot.lua create mode 100644 farming/crops/chili.lua create mode 100644 farming/crops/cocoa.lua create mode 100644 farming/crops/coffee.lua create mode 100644 farming/crops/corn.lua create mode 100644 farming/crops/cotton.lua create mode 100644 farming/crops/cucumber.lua create mode 100644 farming/crops/garlic.lua create mode 100644 farming/crops/grapes.lua create mode 100644 farming/crops/hemp.lua create mode 100644 farming/crops/melon.lua create mode 100644 farming/crops/onion.lua create mode 100644 farming/crops/peas.lua create mode 100644 farming/crops/pepper.lua create mode 100644 farming/crops/pineapple.lua create mode 100644 farming/crops/potato.lua create mode 100644 farming/crops/pumpkin.lua create mode 100644 farming/crops/raspberry.lua create mode 100644 farming/crops/rhubarb.lua create mode 100644 farming/crops/tomato.lua create mode 100644 farming/crops/wheat.lua delete mode 100644 farming/cucumber.lua delete mode 100644 farming/donut.lua create mode 100644 farming/food.lua delete mode 100644 farming/garlic.lua delete mode 100644 farming/grapes.lua delete mode 100644 farming/hemp.lua delete mode 100644 farming/hoebomb.lua delete mode 100644 farming/melon.lua delete mode 100644 farming/onion.lua delete mode 100644 farming/pea.lua delete mode 100644 farming/pepper.lua delete mode 100644 farming/pineapple.lua delete mode 100644 farming/potato.lua delete mode 100644 farming/pumpkin.lua delete mode 100644 farming/raspberry.lua delete mode 100644 farming/rhubarb.lua delete mode 100644 farming/sugar.lua create mode 100644 farming/textures/farming_blueberry_pie.png delete mode 100644 farming/textures/farming_coffee_cup_hot.png create mode 100644 farming/textures/farming_cornstarch.png create mode 100644 farming/textures/farming_garlic_bread.png create mode 100644 farming/textures/farming_potato_salad.png create mode 100644 farming/textures/farming_rose_water.png create mode 100644 farming/textures/farming_turkish_delight.png delete mode 100644 farming/tomato.lua delete mode 100644 farming/wheat.lua create mode 100644 trafficlight/textures/streets_pl_flashingwalk.png create mode 100644 trafficlight/textures/streets_tl_flashgreen.png create mode 100644 trafficlight/textures/streets_tl_flashred_alt.png create mode 100644 trafficlight/textures/streets_tl_left_flashgreen.png create mode 100644 trafficlight/textures/streets_tl_left_flashred_alt.png create mode 100644 trafficlight/textures/streets_tl_left_redyellow.png create mode 100644 trafficlight/textures/streets_tl_left_warn_alt.png create mode 100644 trafficlight/textures/streets_tl_redyellow.png create mode 100644 trafficlight/textures/streets_tl_right_flashgreen.png create mode 100644 trafficlight/textures/streets_tl_right_flashred_alt.png create mode 100644 trafficlight/textures/streets_tl_right_redyellow.png create mode 100644 trafficlight/textures/streets_tl_right_warn_alt.png create mode 100644 trafficlight/textures/streets_tl_warn_alt.png create mode 100644 trafficlight/textures/streets_tle_left_flashgreen.png create mode 100644 trafficlight/textures/streets_tle_right_flashgreen.png diff --git a/bushes_classic/cooking.lua b/bushes_classic/cooking.lua index e084852..9e32c25 100644 --- a/bushes_classic/cooking.lua +++ b/bushes_classic/cooking.lua @@ -17,7 +17,7 @@ minetest.register_craftitem(":bushes:sugar", { description = S("Sugar"), inventory_image = "bushes_sugar.png", on_use = minetest.item_eat(1), - groups = {food_sugar=1} + groups = {food_sugar=1, flammable = 2} }) minetest.register_craft({ @@ -27,8 +27,33 @@ minetest.register_craft({ }, }) +-- override farming_plus strawberry and add food_ group +if minetest.get_modpath("farming_plus") then + + minetest.override_item("farming_plus:strawberry_item", { + groups = {food_strawberry = 1, food_berry = 1, flammable = 2}, + }) +end + + for i, berry in ipairs(bushes_classic.bushes) do + local groups = {food_berry = 1, flammable = 2} + + if berry ~= "mixed_berry" then + + groups["food_" .. berry] = 1 + + -- Berry + minetest.register_craftitem(":bushes:"..berry, { + description = bushes_classic.bushes_descriptions[i][1], + inventory_image = "bushes_"..berry..".png", + groups = groups, + on_use = minetest.item_eat(1), + }) + end + + -- Raw pie minetest.register_craftitem(":bushes:"..berry.."_pie_raw", { description = bushes_classic.bushes_descriptions[i][2], inventory_image = "bushes_"..berry.."_pie_raw.png", @@ -37,58 +62,25 @@ for i, berry in ipairs(bushes_classic.bushes) do if berry ~= "mixed_berry" then - -- Special case for strawberries, blueberries and raspberries - -- when farming_plus or farming redo is in use. Use items - -- from these mods, but redefine there so they has the right - -- groups and does't look so ugly! - - if berry == "strawberry" and minetest.registered_nodes["farming_plus:strawberry"] then - minetest.register_craftitem(":farming_plus:strawberry_item", { - description = bushes_classic.bushes_descriptions[i][1], - inventory_image = "bushes_"..berry..".png", - on_use = minetest.item_eat(2), - groups = {berry=1, strawberry=1} - }) - minetest.register_alias("bushes:strawberry", "farming_plus:strawberry_item") - - elseif berry == "blueberry" and minetest.registered_items["farming:blueberries"] then - minetest.register_craftitem(":farming:blueberries", { - description = bushes_classic.bushes_descriptions[i][1], - inventory_image = "bushes_"..berry..".png", - on_use = minetest.item_eat(1), - groups = {berry=1, blueberry=1} - }) - minetest.register_alias("bushes:blueberry", "farming:blueberries") - - elseif berry == "raspberry" and minetest.registered_items["farming:raspberries"] then - minetest.register_craftitem(":farming:raspberries", { - description = bushes_classic.bushes_descriptions[i][1], - inventory_image = "bushes_"..berry..".png", - on_use = minetest.item_eat(1), - groups = {berry=1, raspberry=1} - }) - minetest.register_alias("bushes:raspberry", "farming:raspberries") - - else - minetest.register_craftitem(":bushes:"..berry, { - description = bushes_classic.bushes_descriptions[i][1], - inventory_image = "bushes_"..berry..".png", - groups = {berry = 1, [berry] = 1}, - on_use = minetest.item_eat(1), - }) - end - minetest.register_craft({ output = "bushes:"..berry.."_pie_raw 1", recipe = { { "group:food_sugar", "farming:flour", "group:food_sugar" }, - { "group:"..berry, "group:"..berry, "group:"..berry }, + { "group:food_"..berry, "group:food_"..berry, "group:food_"..berry }, + }, + }) + else + minetest.register_craft({ + output = "bushes:mixed_berry_pie_raw 2", + recipe = { + { "group:food_sugar", "farming:flour", "group:food_sugar" }, + { "group:food_berry", "group:food_berry", "group:food_berry" }, + { "group:food_berry", "group:food_berry", "group:food_berry" }, }, }) end -- Cooked pie - minetest.register_craftitem(":bushes:"..berry.."_pie_cooked", { description = bushes_classic.bushes_descriptions[i][3], inventory_image = "bushes_"..berry.."_pie_cooked.png", @@ -102,8 +94,7 @@ for i, berry in ipairs(bushes_classic.bushes) do cooktime = 30, }) - -- slice of pie - + -- Slice of pie minetest.register_craftitem(":bushes:"..berry.."_pie_slice", { description = bushes_classic.bushes_descriptions[i][4], inventory_image = "bushes_"..berry.."_pie_slice.png", @@ -118,7 +109,6 @@ for i, berry in ipairs(bushes_classic.bushes) do }) -- Basket with pies - minetest.register_craft({ output = "bushes:basket_"..berry.." 1", recipe = { @@ -127,12 +117,3 @@ for i, berry in ipairs(bushes_classic.bushes) do }, }) end - -minetest.register_craft({ - output = "bushes:mixed_berry_pie_raw 2", - recipe = { - { "group:food_sugar", "farming:flour", "group:food_sugar" }, - { "group:berry", "group:berry", "group:berry" }, - { "group:berry", "group:berry", "group:berry" }, - }, -}) diff --git a/digistuff/init.lua b/digistuff/init.lua index b35cb1b..351fb6b 100644 --- a/digistuff/init.lua +++ b/digistuff/init.lua @@ -930,6 +930,7 @@ minetest.register_craft({ }) if minetest.get_modpath("mesecons_noteblock") then + local validnbsounds = dofile(minetest.get_modpath("digistuff")..DIR_DELIM.."nbsounds.lua") minetest.register_node("digistuff:noteblock", { description = "Digilines Noteblock", groups = {cracky=3}, @@ -961,48 +962,22 @@ if minetest.get_modpath("mesecons_noteblock") then receptor = {}, effector = { action = function(pos,node,channel,msg) + if msg == "get_sounds" then + local soundnames = {} + for i in pairs(validnbsounds) do + table.insert(soundnames,i) + end + digiline:receptor_send(pos, digiline.rules.default, channel, soundnames) + end local meta = minetest.get_meta(pos) local setchan = meta:get_string("channel") if channel ~= setchan then return end - local valid_sounds = { - csharp = "mesecons_noteblock_csharp", - d = "mesecons_noteblock_d", - dsharp = "mesecons_noteblock_dsharp", - e = "mesecons_noteblock_e", - f = "mesecons_noteblock_f", - fsharp = "mesecons_noteblock_fsharp", - g = "mesecons_noteblock_g", - gsharp = "mesecons_noteblock_gsharp", - a = "mesecons_noteblock_a", - asharp = "mesecons_noteblock_asharp", - b = "mesecons_noteblock_b", - c = "mesecons_noteblock_c", - csharp2 = "mesecons_noteblock_csharp2", - d2 = "mesecons_noteblock_d2", - dsharp2 = "mesecons_noteblock_dsharp2", - e2 = "mesecons_noteblock_e2", - f2 = "mesecons_noteblock_f2", - fsharp2 = "mesecons_noteblock_fsharp2", - g2 = "mesecons_noteblock_g2", - gsharp2 = "mesecons_noteblock_gsharp2", - a2 = "mesecons_noteblock_a2", - asharp2 = "mesecons_noteblock_asharp2", - b2 = "mesecons_noteblock_b2", - c2 = "mesecons_noteblock_c2", - hihat = "mesecons_noteblock_hihat", - kick = "mesecons_noteblock_kick", - snare = "mesecons_noteblock_snare", - crash = "mesecons_noteblock_crash", - litecrash = "mesecons_noteblock_litecrash", - fire = "fire_large", - explosion = "tnt_explode" - } if type(msg) == "string" then - local sound = valid_sounds[msg] + local sound = validnbsounds[msg] if sound then minetest.sound_play(sound,{pos=pos}) end elseif type(msg) == "table" then if type(msg.sound) ~= "string" then return end - local sound = valid_sounds[msg.sound] + local sound = validnbsounds[msg.sound] local volume = 1 if type(msg.volume) == "number" then volume = math.max(0,math.min(1,msg.volume)) diff --git a/digistuff/nbsounds.lua b/digistuff/nbsounds.lua new file mode 100644 index 0000000..33952bf --- /dev/null +++ b/digistuff/nbsounds.lua @@ -0,0 +1,166 @@ +local valid_sounds = { + csharp = "mesecons_noteblock_csharp", + d = "mesecons_noteblock_d", + dsharp = "mesecons_noteblock_dsharp", + e = "mesecons_noteblock_e", + f = "mesecons_noteblock_f", + fsharp = "mesecons_noteblock_fsharp", + g = "mesecons_noteblock_g", + gsharp = "mesecons_noteblock_gsharp", + a = "mesecons_noteblock_a", + asharp = "mesecons_noteblock_asharp", + b = "mesecons_noteblock_b", + c = "mesecons_noteblock_c", + csharp2 = "mesecons_noteblock_csharp2", + d2 = "mesecons_noteblock_d2", + dsharp2 = "mesecons_noteblock_dsharp2", + e2 = "mesecons_noteblock_e2", + f2 = "mesecons_noteblock_f2", + fsharp2 = "mesecons_noteblock_fsharp2", + g2 = "mesecons_noteblock_g2", + gsharp2 = "mesecons_noteblock_gsharp2", + a2 = "mesecons_noteblock_a2", + asharp2 = "mesecons_noteblock_asharp2", + b2 = "mesecons_noteblock_b2", + c2 = "mesecons_noteblock_c2", + hihat = "mesecons_noteblock_hihat", + kick = "mesecons_noteblock_kick", + snare = "mesecons_noteblock_snare", + crash = "mesecons_noteblock_crash", + litecrash = "mesecons_noteblock_litecrash", + fire = "fire_large", + explosion = "tnt_explode", + digistuff_piezo_short = "digistuff_piezo_short_single", + digistuff_piezo_long = "digistuff_piezo_long_single" +} + +local mod_sounds = { + pbj_pup = { + pbj_pup_barks = "pbj_pup_barks", + pbj_pup_howl = "pbj_pup_howl" + }, + anvil = { + anvil_clang = "anvil_clang" + }, + bees = { + bees = "bees" + }, + bobblocks = { + bobblocks_glass_block = "bobblocks_glassblock", + bobblocks_health = "bobblocks_health", + bobblocks_trap = "bobblocks_trap_fall", + bobblocks_trap_large = "bobblocks_trap_fall_major" + }, + fake_fire = { + fake_fire_extinguish = "fire_extinguish" + }, + homedecor = { + homedecor_book_close = "homedecor_book_close", + homedecor_doorbell = "homedecor_doorbell", + homedecor_door_close = "homedecor_door_close", + homedecor_door_open = "homedecor_door_open", + homedecor_faucet = "homedecor_faucet", + homedecor_gate = "homedecor_gate_open_close", + homedecor_shower = "homedecor_shower", + homedecor_telephone = "homedecor_telephone_ringing", + homedecor_toilet = "homedecor_toilet_flush", + homedecor_trash = "homedecor_trash_all", + homedecor_insert_coin = "insert_coin", + homedecor_toaster = "toaster" + }, + infrastructure = { + infrastructure_emergency_phone = "infrastructure_emergency_phone" + }, + item_tweaks = { + item_drop = "item_drop", + item_pickup = "item_drop_pickup" + }, + mesecons_button = { + mesecons_button_push = "mesecons_button_push", + mesecons_button_pop = "mesecons_button_pop", + }, + mesecons_pistons = { + mesecons_piston_extend = "piston_extend", + mesecons_piston_retract = "piston_retract" + }, + mesecons_walllever = { + mesecons_lever = "mesecons_lever" + }, + technic = { + technic_chainsaw = "chainsaw", + technic_mining_drill = "mining_drill", + technic_laser_mk1 = "technic_laser_mk1", + technic_laser_mk2 = "technic_laser_mk2", + technic_laser_mk3 = "technic_laser_mk3", + technic_prospector_hit = "technic_prospector_hit", + technic_prospector_miss = "technic_prospector_miss" + }, + teleport_request = { + teleport_request_accept = "whoosh" + }, + unified_inventory = { + unified_inventory_day = "birds", + unified_inventory_click = "click", + unified_inventory_sethome = "dingdong", + unified_inventory_refill = "electricity", + unified_inventory_night = "owl", + unified_inventory_turn_page_1 = "paperflip1", + unified_inventory_turn_page_2 = "paperflip2", + unified_inventory_home = "teleport", + unified_inventory_trash = "trash", + unified_inventory_clear = "trash_all" + }, + carts = { + carts_cart_moving = "carts_cart_moving" + }, + default = { + default_break_glass = "default_break_glass", + default_chest_close = "default_chest_close", + default_chest_open = "default_chest_open", + default_cool_lava = "default_cool_lava", + default_dig_choppy = "default_dig_choppy", + default_dig_cracky = "default_dig_cracky", + default_dig_crumbly = "default_dig_crumbly", + default_dig_dig_immediate = "default_dig_dig_immediate", + default_dig_metal = "default_dig_metal", + default_dig_oddly_breakable_by_hand = "default_dig_oddly_breakable_by_hand", + default_dig_snappy = "default_dig_snappy", + default_dirt_footstep = "default_dirt_footstep", + default_dug_metal = "default_dug_metal", + default_dug_node = "default_dug_node", + default_glass_footstep = "default_glass_footstep", + default_grass_footstep = "default_grass_footstep", + default_gravel_footstep = "default_gravel_footstep", + default_hard_footstep = "default_hard_footstep", + default_item_smoke = "default_item_smoke", + default_metal_footstep = "default_metal_footstep", + default_place_node = "default_place_node", + default_place_node_hard = "default_place_node_hard", + default_place_node_metal = "default_place_node_metal", + default_sand_footstep = "default_sand_footstep", + default_snow_footstep = "default_snow_footstep", + default_tool_breaks = "default_tool_breaks", + default_water_footstep = "default_water_footstep", + default_wood_footstep = "default_wood_footstep" + }, + doors = { + doors_door_open = "doors_door_open", + doors_door_close = "doors_door_close", + doors_gate_open = "doors_fencegate_open", + doors_gate_close = "doors_fencegate_close", + doors_glass_door_open = "doors_glass_door_open", + doors_glass_door_close = "doors_glass_door_close", + doors_steel_door_open = "doors_steel_door_open", + doors_steel_door_close = "doors_steel_door_close", + } +} + +for mod,sounds in pairs(mod_sounds) do + if minetest.get_modpath(mod) then + for name,file in pairs(sounds) do + valid_sounds[name] = file + end + end +end + +return valid_sounds diff --git a/farming/README.md b/farming/README.md new file mode 100644 index 0000000..99ac101 --- /dev/null +++ b/farming/README.md @@ -0,0 +1,61 @@ +# Farming Redo Mod +### by TenPlus1 + +https://forum.minetest.net/viewtopic.php?id=9019 + +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. + +"farming:cotton_1" through to "farming:cotton_8" +"farming:wheat_1" through to "farming:wheat_8" +"farming:cucumber_4" through to "farming:cucumber_4" + +### Changelog: + +- 1.37 - Added custom 'growth_check(pos, nodename) function for crop nodes to use (check cocoa.lua for example) +- 1.36 - Added Beetroot, Beetroot Soup (6x beetroot, 1x bowl), fix register_plant() issue, add new recipes +- 1.35 - Deprecated bronze/mese/diamond hoe's, added hoe bomb and deprecated hoe's as lucky block prizes +- 1.34 - Added scarecrow Base (5x sticks in a cross shape) +- 1.33 - Added cooking utensils (wooden bowl, saucepan, cooking pot, baking tray, skillet, cutting board, mortar & pestle, juicer, glass mixing bowl) for easier food crafts. +- 1.32 - Added Pea plant (textures by Andrey01) - also added Wooden Bowl and Pea Soup crafts +- 1.31 - Added Pineapple which can be found growing in savannah areas (place pineapple in crafting to obtain 5x rings to eat and a top for re-planting), also Salt which is made from cooking a bucket of water, added food groups so it's more compatible with Ruben's food mods. +- 1.30 - Added Garlic, Pepper and Onions thanks to Grizzly Adam for sharing textures +- 1.29 - Updating functions so requires Minetest 0.4.16 and above to run +- 1.28 - Added chili peppers and bowl of chili, optimized code and fixed a few bugs, added porridge +- 1.27 - Added meshoptions to api and wheat plants, added farming.rarity setting to spawn more/less crops on map, have separate cotton/string items (4x cotton = 1x wool, 2x cotton = 2x string) +- 1.26 - Added support for [toolranks] mod when using hoe's +- 1.25 - Added check for farming.conf setting file to disable specific crops globally (inside mod folder) or world specific (inside world folder) +- 1.24 - Added Hemp which can be crafted into fibre, paper, string, rope and oil. +- 1.23 - Huge code tweak and tidy done and added barley seeds to be found in dry grass, barley can make flour for bread also. +- 1.22 - Added grape bushes at high climates which can be cultivated into grape vines using trellis (9 sticks). +- 1.21 - Added auto-refill code for planting crops (thanks crabman77), also fixed a few bugs +- 1.20b - Tidied code, made api compatible with new 0.4.13 changes and changed to soil texture overlays +- 1.20 - NEW growing routine added that allows crops to grow while player is away doing other things (thanks prestidigitator) +- 1.14 - Added Green Beans from Crops mod (thanks sofar), little bushels in the wild but need to be grown using beanpoles crafted with 4 sticks (2 either side) +- 1.13 - Fixed seed double-placement glitch. Mapgen now uses 0.4.12+ for plant generation +- 1.12 - Player cannot place seeds in protected area, also growing speeds changed to match defaults +- 1.11 - Added Straw Bale, streamlined growing abm a little, fixed melon rotation bug with screwdriver +- 1.10 - Added Blueberry Bush and Blueberry Muffins, also Pumpkin/Melon easier to pick up, added check for unloaded map +- 1.09 - Corn now uses single nodes instead of 1 ontop of the other, Ethanol recipe is more expensive (requires 5 corn) and some code cleanup. +- 1.08 - Added Farming Plus compatibility, plus can be removed and no more missing nodes +- 1.07 - Added Rhubarb and Rhubarb Pie +- 1.06 - register_hoe and register_plant added for compatibility with default farming mod, although any plants registered will use farming redo to grow +- 1.05 - Added Raspberry Bushels and Raspberry Smoothie +- 1.04 - Added Donuts... normal, chocolate and apple... and a few code cleanups and now compatible with jungletree's from MoreTrees mod +- 1.03 - Bug fixes and more compatibility as drop-in replacement for built-in farming mod +- 1.02 - Added farming.mod string to help other mods identify which farming mod is running, if it returns "redo" then you're using this one, "" empty is built-in mod +- 1.01 - Crafting coffee or ethanol returns empty bucket/bottle, also Cocoa spawns a little rarer +- 1.0 - Added Cocoa which randomly grows on jungle tree's, pods give cocoa beans which can be used to farm more pods on a jungle trunk or make Cookies which have been added (or other treats) +- 0.9 - Added Pumpkin, Jack 'O Lantern, Pumpkin Slice and Sugar (a huge thanks to painterly.net for allowing me to use their textures) +- 0.8 - Added Watermelon and Melon Slice +- 0.7 - Added Coffee, Coffee Beans, Drinking Cup, Cold and Hot Cup of Coffee +- 0.6 - Added Corn, Corn on the Cob... Also reworked Abm +- 0.5 - Added Carrot, Cucumber, Potato (and Baked Potato), Tomato +- 0.4 - Checks for Protection, also performance changes +- 0.3 - Added Diamond and Mese hoe +- 0.2 - Fixed check for wet soil +- 0.1 - Fixed growing bug +- 0.0 - Initial release + +### Lucky Blocks: 30 diff --git a/farming/README.txt b/farming/README.txt deleted file mode 100644 index 211367c..0000000 --- a/farming/README.txt +++ /dev/null @@ -1,170 +0,0 @@ -Farming Redo Mod -by TenPlus1 - -https://forum.minetest.net/viewtopic.php?id=9019 - -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. - -"farming:cotton_1" through to "farming:cotton_8" -"farming:wheat_1" through to "farming:wheat_8" -"farming:cucumber_4" through to "farming:cucumber_4" - -Changelog: - -1.36 - Added Beetroot, Beetroot Soup (6x beetroot, 1x bowl) -1.35 - Deprecated bronze/mese/diamond hoe's, added hoe bomb and deprecated hoe's as lucky block prizes -1.34 - Added scarecrow Base (5x sticks in a cross shape) -1.33 - Added cooking utensils (wooden bowl, saucepan, cooking pot, baking tray, skillet, cutting board, mortar & pestle, juicer, glass mixing bowl) for easier food crafts. -1.32 - Added Pea plant (textures by Andrey01) - also added Wooden Bowl and Pea Soup crafts -1.31 - Added Pineapple which can be found growing in savannah areas (place pineapple in crafting to obtain 5x rings to eat and a top for re-planting), also Salt which is made from cooking a bucket of water, added food groups so it's more compatible with Ruben's food mods. -1.30 - Added Garlic, Pepper and Onions thanks to Grizzly Adam for sharing textures -1.29 - Updating functions so requires Minetest 0.4.16 and above to run -1.28 - Added chili peppers and bowl of chili, optimized code and fixed a few bugs, added porridge -1.27 - Added meshoptions to api and wheat plants, added farming.rarity setting to spawn more/less crops on map, have separate cotton/string items (4x cotton = 1x wool, 2x cotton = 2x string) -1.26 - Added support for [toolranks] mod when using hoe's -1.25 - Added check for farming.conf setting file to disable specific crops globally (inside mod folder) or world specific (inside world folder) -1.24 - Added Hemp which can be crafted into fibre, paper, string, rope and oil. -1.23 - Huge code tweak and tidy done and added barley seeds to be found in dry grass, barley can make flour for bread also. -1.22 - Added grape bushes at high climates which can be cultivated into grape vines using trellis (9 sticks). -1.21 - Added auto-refill code for planting crops (thanks crabman77), also fixed a few bugs -1.20b- Tidied code, made api compatible with new 0.4.13 changes and changed to soil texture overlays -1.20 - NEW growing routine added that allows crops to grow while player is away doing other things (thanks prestidigitator) -1.14 - Added Green Beans from Crops mod (thanks sofar), little bushels in the wild but need to be grown using beanpoles crafted with 4 sticks (2 either side) -1.13 - Fixed seed double-placement glitch. Mapgen now uses 0.4.12+ for plant generation -1.12 - Player cannot place seeds in protected area, also growing speeds changed to match defaults -1.11 - Added Straw Bale, streamlined growing abm a little, fixed melon rotation bug with screwdriver -1.10 - Added Blueberry Bush and Blueberry Muffins, also Pumpkin/Melon easier to pick up, added check for unloaded map -1.09 - Corn now uses single nodes instead of 1 ontop of the other, Ethanol recipe is more expensive (requires 5 corn) and some code cleanup. -1.08 - Added Farming Plus compatibility, plus can be removed and no more missing nodes -1.07 - Added Rhubarb and Rhubarb Pie -1.06 - register_hoe and register_plant added for compatibility with default farming mod, although any plants registered will use farming redo to grow -1.05 - Added Raspberry Bushels and Raspberry Smoothie -1.04 - Added Donuts... normal, chocolate and apple... and a few code cleanups and now compatible with jungletree's from MoreTrees mod -1.03 - Bug fixes and more compatibility as drop-in replacement for built-in farming mod -1.02 - Added farming.mod string to help other mods identify which farming mod is running, if it returns "redo" then you're using this one, "" empty is built-in mod -1.01 - Crafting coffee or ethanol returns empty bucket/bottle, also Cocoa spawns a little rarer -1.0 - Added Cocoa which randomly grows on jungle tree's, pods give cocoa beans which can be used to farm more pods on a jungle trunk or make Cookies which have been added (or other treats) -0.9 - Added Pumpkin, Jack 'O Lantern, Pumpkin Slice and Sugar -(a huge thanks to painterly.net for allowing me to use their textures) -0.8 - Added Watermelon and Melon Slice -0.7 - Added Coffee, Coffee Beans, Drinking Cup, Cold and Hot Cup of Coffee -0.6 - Added Corn, Corn on the Cob... Also reworked Abm -0.5 - Added Carrot, Cucumber, Potato (and Baked Potato), Tomato -0.4 - Checks for Protection, also performance changes -0.3 - Added Diamond and Mese hoe -0.2 - Fixed check for wet soil -0.1 - Fixed growing bug -0.0 - Initial release - -Lucky Blocks: 28 - - -License of media (textures): ----------------------------- -Created by PilzAdam (License: WTFPL): - farming_bread.png - farming_soil.png - farming_soil_wet.png - farming_soil_wet_side.png - farming_string.png - -Created by Napiophelios (CC BY-SA 3.0): - farming_cotton.png - -Created by Calinou (License: CC BY-SA): - farming_tool_bronzehoe.png - farming_tool_steelhoe.png - farming_tool_stonehoe.png - farming_tool_woodhoe.png - farming_tool_mesehoe.png - farming_tool_diamondhoe.png - -Created by VanessaE (License: WTFPL): - farming_cotton_seed.png - farming_wheat_seed.png - farming_flour.png - farming_wheat.png - farming_wheat_1.png - farming_wheat_2.png - farming_wheat_3.png - farming_wheat_4.png - farming_wheat_5.png - farming_wheat_5.png - farming_wheat_7.png - farming_wheat_8.png - farming_cotton_1.png - farming_cotton_2.png - farming_cotton_3.png - farming_cotton_4.png - farming_cotton_5.png - farming_cotton_6.png - farming_cotton_7.png - farming_cotton_8.png - -Created by Doc (License: WTFPL): - farming_cucumber.png - farming_cucumber_1.png - farming_cucumber_2.png - farming_cucumber_3.png - farming_cucumber_4.png - farming_potato.png - farming_potato_1.png - farming_potato_2.png - farming_potato_3.png - farming_potato_4.png - farming_raspberries.png - farming_raspberry_1.png - farming_raspberry_2.png - farming_raspberry_3.png - farming_raspberry_4.png - -Created by Gambit: - default_junglegrass.png - farming_carrot.png - farming_carrot_1.png - farming_carrot_2.png - farming_carrot_3.png - farming_carrot_4.png - farming_carrot_5.png - farming_carrot_6.png - farming_carrot_7.png - farming_carrot_8.png - -Created by JoseTheCrafter and edited by TenPlus1: - farming_tomato.png - farming_tomato_1.png - farming_tomato_2.png - farming_tomato_3.png - farming_tomato_4.png - farming_tomato_5.png - farming_tomato_6.png - farming_tomato_7.png - farming_tomato_8.png - -Created by GeMinecraft and edited by TenPlus1: - farming_corn.png - farming_corn_cob.png - farming_corn_1.png - farming_corn_2.png - farming_corn_3.png - farming_corn_4.png - farming_corn_5.png - farming_corn_6.png - farming_corn_7.png - farming_corn_8.png - -Created by TenPlus1 - farming_cocoa_1.png - farming_cocoa_2.png - farming_cocoa_3.png - farming_cocoa_beans.png - farming_cookie.png - farming_raspberry_smoothie.png - farming_rhubarb_1.png - farming_rhubarb_2.png - farming_rhubarb_3.png - farming_rhubarb.png - farming_rhubarb_pie.png - farming_hemp*.png diff --git a/farming/api.txt b/farming/api.txt new file mode 100644 index 0000000..eda1289 --- /dev/null +++ b/farming/api.txt @@ -0,0 +1,53 @@ +Farming API +----------- + +The farming API allows you to easily register plants and hoes. + +`farming.register_hoe(name, hoe definition)` + * Register a new hoe, see [#hoe definition] + +`farming.register_plant(name, Plant definition)` + * Register a new growing plant, see [#Plant definition] + +`farming.registered_plants[name] = definition` + * Table of registered plants, indexed by plant name + +### Hoe Definition + + + { + description = "", -- Description for tooltip + inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image + max_uses = 30, -- Uses until destroyed + material = "", -- Material for recipes + recipe = { -- Craft recipe, if material isn't used + {"air", "air", "air"}, + {"", "group:stick"}, + {"", "group:stick"}, + } + } + +### Plant definition + + { + description = "", -- Description of seed item + inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image + steps = 8, -- How many steps the plant has to grow, until it can be harvested + -- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber) + minlight = 13, -- Minimum light to grow + maxlight = default.LIGHT_MAX -- Maximum light to grow + } + +Note: Any crops registered with the above function will use the new growing routines, also if crops are manually added with the {growing=1} group they will also grow. + +### Crop functions + +If a mod registers nodes to be used as crops using the {growing=1} group then an additional function can be used for custom growth checks instead of the standard 'are we above wet soil'. + +growth_check = function(pos, node_name) + -- check surrounding for jungle tree + if minetest.find_node_near(pos, 1, {"default:jungletree"}) then + return false -- place next growth stage + end + return true -- condition not met, skip next growth stage until next check +end, diff --git a/farming/barley.lua b/farming/barley.lua deleted file mode 100644 index 4005d2c..0000000 --- a/farming/barley.lua +++ /dev/null @@ -1,105 +0,0 @@ - -local S = farming.intllib - --- barley seeds -minetest.register_node("farming:seed_barley", { - description = S("Barley Seed"), - tiles = {"farming_barley_seed.png"}, - inventory_image = "farming_barley_seed.png", - wield_image = "farming_barley_seed.png", - drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1}, - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - sunlight_propagates = true, - selection_box = farming.select, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:barley_1") - end, -}) - --- harvested barley -minetest.register_craftitem("farming:barley", { - description = S("Barley"), - inventory_image = "farming_barley.png", - groups = {food_barley = 1, flammable = 2}, -}) - --- flour -minetest.register_craft({ - type = "shapeless", - output = "farming:flour", - recipe = { - "farming:barley", "farming:barley", "farming:barley", - "farming:barley", "farming:mortar_pestle" - }, - replacements = {{"farming:mortar_pestle", "farming:mortar_pestle"}}, -}) - --- barley definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_barley_1.png"}, - paramtype = "light", - paramtype2 = "meshoptions", - place_param2 = 3, - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:barley_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_barley_2.png"} -minetest.register_node("farming:barley_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_barley_3.png"} -minetest.register_node("farming:barley_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_barley_4.png"} -minetest.register_node("farming:barley_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"farming_barley_5.png"} -crop_def.drop = { - items = { - {items = {'farming:barley'}, rarity = 2}, - {items = {'farming:seed_barley'}, rarity = 2}, - } -} -minetest.register_node("farming:barley_5", table.copy(crop_def)) - --- stage 6 -crop_def.tiles = {"farming_barley_6.png"} -crop_def.drop = { - items = { - {items = {'farming:barley'}, rarity = 2}, - {items = {'farming:seed_barley'}, rarity = 1}, - } -} -minetest.register_node("farming:barley_6", table.copy(crop_def)) - --- stage 7 (final) -crop_def.tiles = {"farming_barley_7.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:barley'}, rarity = 1}, - {items = {'farming:barley'}, rarity = 3}, - {items = {'farming:seed_barley'}, rarity = 1}, - {items = {'farming:seed_barley'}, rarity = 3}, - } -} -minetest.register_node("farming:barley_7", table.copy(crop_def)) diff --git a/farming/beanpole.lua b/farming/beanpole.lua deleted file mode 100644 index 1e81dac..0000000 --- a/farming/beanpole.lua +++ /dev/null @@ -1,241 +0,0 @@ ---[[ - All textures by - (C) Auke Kok - CC-BY-SA-3.0 -]] - -local S = farming.intllib - --- place beans -local function place_beans(itemstack, placer, pointed_thing, plantname) - - local pt = pointed_thing - - -- check if pointing at a node - if not pt or pt.type ~= "node" then - - return - end - - local under = minetest.get_node(pt.under) - - -- return if any of the nodes are not registered - if not minetest.registered_nodes[under.name] then - return - end - - -- am I right-clicking on something that has a custom on_place set? - -- thanks to Krock for helping with this issue :) - local def = minetest.registered_nodes[under.name] - if def and def.on_rightclick then - return def.on_rightclick(pt.under, under, placer, itemstack) - end - - -- check if pointing at bean pole - if under.name ~= "farming:beanpole" then - return - end - - -- add the node and remove 1 item from the itemstack - minetest.set_node(pt.under, {name = plantname}) - - minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0}) - - if not farming.is_creative(placer:get_player_name()) then - - itemstack:take_item() - - -- check for refill - if itemstack:get_count() == 0 then - - minetest.after(0.20, - farming.refill_plant, - placer, - "farming:beans", - placer:get_wield_index() - ) - end - end - - return itemstack -end - --- beans -minetest.register_craftitem("farming:beans", { - description = S("Green Beans"), - inventory_image = "farming_beans.png", - groups = {food_beans = 1, flammable = 2}, - on_use = minetest.item_eat(1), - - on_place = function(itemstack, placer, pointed_thing) - return place_beans(itemstack, placer, pointed_thing, "farming:beanpole_1") - end, -}) - --- beans can be used for green dye -minetest.register_craft({ - output = "dye:green", - recipe = { - {'farming:beans'}, - } -}) - --- beanpole -minetest.register_node("farming:beanpole", { - description = S("Bean Pole (place on soil before planting beans)"), - drawtype = "plantlike", - tiles = {"farming_beanpole.png"}, - inventory_image = "farming_beanpole.png", - visual_scale = 1.90, -- 1.45, - paramtype = "light", - walkable = false, - buildable_to = true, - sunlight_propagates = true, - drop = "farming:beanpole", - selection_box = farming.select, - groups = {snappy = 3, flammable = 2, attached_node = 1}, - sounds = default.node_sound_leaves_defaults(), - - on_place = function(itemstack, placer, pointed_thing) - - local pt = pointed_thing - - -- check if pointing at a node - if not pt or pt.type ~= "node" then - return - end - - local under = minetest.get_node(pt.under) - - -- return if any of the nodes are not registered - if not minetest.registered_nodes[under.name] then - return - end - - -- am I right-clicking on something that has a custom on_place set? - -- thanks to Krock for helping with this issue :) - local def = minetest.registered_nodes[under.name] - if def and def.on_rightclick then - return def.on_rightclick(pt.under, under, placer, itemstack) - end - - if minetest.is_protected(pt.under, placer:get_player_name()) then - return - end - - local nodename = under.name - - if minetest.get_item_group(nodename, "soil") < 2 then - return - end - - local top = { - x = pointed_thing.above.x, - y = pointed_thing.above.y + 1, - z = pointed_thing.above.z - } - - nodename = minetest.get_node(top).name - - if nodename ~= "air" then - return - end - - minetest.set_node(pointed_thing.above, {name = "farming:beanpole"}) - - if not farming.is_creative(placer:get_player_name()) then - itemstack:take_item() - end - - return itemstack - end -}) - -minetest.register_craft({ - output = "farming:beanpole", - recipe = { - {'', '', ''}, - {'default:stick', '', 'default:stick'}, - {'default:stick', '', 'default:stick'}, - } -}) - -minetest.register_craft({ - type = "fuel", - recipe = "farming:beanpole", - burntime = 10, -}) - --- green bean definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_beanpole_1.png"}, - visual_scale = 1.90, -- 1.45, - paramtype = "light", - walkable = false, - buildable_to = true, - sunlight_propagates = true, - drop = { - items = { - {items = {'farming:beanpole'}, rarity = 1}, - } - }, - selection_box = farming.select, - groups = { - snappy = 3, flammable = 3, not_in_creative_inventory = 1, - attached_node = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:beanpole_1", table.copy(crop_def)) - --- stage2 -crop_def.tiles = {"farming_beanpole_2.png"} -minetest.register_node("farming:beanpole_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_beanpole_3.png"} -minetest.register_node("farming:beanpole_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_beanpole_4.png"} -minetest.register_node("farming:beanpole_4", table.copy(crop_def)) - --- stage 5 (final) -crop_def.tiles = {"farming_beanpole_5.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:beanpole'}, rarity = 1}, - {items = {'farming:beans 3'}, rarity = 1}, - {items = {'farming:beans 2'}, rarity = 2}, - {items = {'farming:beans 2'}, rarity = 3}, - } -} -minetest.register_node("farming:beanpole_5", table.copy(crop_def)) - --- wild green bean bush (this is what you find on the map) -minetest.register_node("farming:beanbush", { - drawtype = "plantlike", - tiles = {"farming_beanbush.png"}, - paramtype = "light", - waving = 1, - walkable = false, - buildable_to = true, - sunlight_propagates = true, - drop = { - items = { - {items = {'farming:beans 1'}, rarity = 1}, - {items = {'farming:beans 1'}, rarity = 2}, - {items = {'farming:beans 1'}, rarity = 3}, - } - }, - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory=1 - }, - sounds = default.node_sound_leaves_defaults(), -}) diff --git a/farming/beetroot.lua b/farming/beetroot.lua deleted file mode 100644 index 1510a76..0000000 --- a/farming/beetroot.lua +++ /dev/null @@ -1,85 +0,0 @@ - -local S = farming.intllib - --- beetroot -minetest.register_craftitem("farming:beetroot", { - description = S("Beetroot"), - inventory_image = "farming_beetroot.png", - groups = {food_beetroot = 1, flammable = 2}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:beetroot_1") - end, - on_use = minetest.item_eat(1), -}) - --- beetroot soup -minetest.register_craftitem("farming:beetroot_soup", { - description = S("Beetroot Soup"), - inventory_image = "farming_beetroot_soup.png", - groups = {flammable = 2}, - on_use = minetest.item_eat(6, "farming:bowl"), -}) - -minetest.register_craft({ - type = "shapeless", - output = "farming:beetroot_soup", - recipe = { - "group:food_beetroot", "group:food_beetroot", - "group:food_beetroot", "group:food_beetroot", - "group:food_beetroot", "group:food_beetroot","group:food_bowl" - } -}) - --- red dye -minetest.register_craft({ - type = "shapeless", - output = "dye:red", - recipe = {"group:food_beetroot"}, -}) - -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_beetroot_1.png"}, - paramtype = "light", --- paramtype2 = "meshoptions", --- place_param2 = 3, - sunlight_propagates = true, - waving = 1, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, flora = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:beetroot_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_beetroot_2.png"} -minetest.register_node("farming:beetroot_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_beetroot_3.png"} -minetest.register_node("farming:beetroot_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_beetroot_4.png"} -minetest.register_node("farming:beetroot_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"farming_beetroot_5.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - max_items = 4, items = { - {items = {'farming:beetroot'}, rarity = 1}, - {items = {'farming:beetroot'}, rarity = 2}, - {items = {'farming:beetroot'}, rarity = 3}, - {items = {'farming:beetroot'}, rarity = 4}, - } -} -minetest.register_node("farming:beetroot_5", table.copy(crop_def)) diff --git a/farming/blueberry.lua b/farming/blueberry.lua deleted file mode 100644 index f2f0147..0000000 --- a/farming/blueberry.lua +++ /dev/null @@ -1,68 +0,0 @@ - -local S = farming.intllib - --- blueberries -minetest.register_craftitem("farming:blueberries", { - description = S("Blueberries"), - inventory_image = "farming_blueberries.png", - groups = {food_blueberries = 1, flammable = 2}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:blueberry_1") - end, - on_use = minetest.item_eat(1), -}) - --- blueberry muffin (thanks to sosogirl123 @ deviantart.com for muffin image) - -minetest.register_craftitem("farming:muffin_blueberry", { - description = S("Blueberry Muffin"), - inventory_image = "farming_blueberry_muffin.png", - on_use = minetest.item_eat(2), -}) - -minetest.register_craft({ - output = "farming:muffin_blueberry 2", - recipe = { - {"group:food_blueberries", "group:food_bread", "group:food_blueberries"}, - } -}) - --- blueberry definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_blueberry_1.png"}, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:blueberry_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_blueberry_2.png"} -minetest.register_node("farming:blueberry_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_blueberry_3.png"} -minetest.register_node("farming:blueberry_3", table.copy(crop_def)) - --- stage 4 (final) -crop_def.tiles = {"farming_blueberry_4.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:blueberries 2'}, rarity = 1}, - {items = {'farming:blueberries'}, rarity = 2}, - {items = {'farming:blueberries'}, rarity = 3}, - } -} -minetest.register_node("farming:blueberry_4", table.copy(crop_def)) diff --git a/farming/carrot.lua b/farming/carrot.lua deleted file mode 100644 index 0aefcfd..0000000 --- a/farming/carrot.lua +++ /dev/null @@ -1,96 +0,0 @@ - ---[[ - Original textures from PixelBox texture pack - https://forum.minetest.net/viewtopic.php?id=4990 -]] - -local S = farming.intllib - --- carrot -minetest.register_craftitem("farming:carrot", { - description = S("Carrot"), - inventory_image = "farming_carrot.png", - groups = {food_carrot = 1, flammable = 2}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:carrot_1") - end, - on_use = minetest.item_eat(4), -}) - --- golden carrot -minetest.register_craftitem("farming:carrot_gold", { - description = S("Golden Carrot"), - inventory_image = "farming_carrot_gold.png", - on_use = minetest.item_eat(6), -}) - -minetest.register_craft({ - output = "farming:carrot_gold", - recipe = { - {"", "default:gold_lump", ""}, - {"default:gold_lump", "group:food_carrot", "default:gold_lump"}, - {"", "default:gold_lump", ""}, - } -}) - --- carrot definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_carrot_1.png"}, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - - --- stage 1 -minetest.register_node("farming:carrot_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_carrot_2.png"} -minetest.register_node("farming:carrot_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_carrot_3.png"} -minetest.register_node("farming:carrot_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_carrot_4.png"} -minetest.register_node("farming:carrot_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"farming_carrot_5.png"} -minetest.register_node("farming:carrot_5", table.copy(crop_def)) - --- stage 6 -crop_def.tiles = {"farming_carrot_6.png"} -minetest.register_node("farming:carrot_6", table.copy(crop_def)) - --- stage 7 -crop_def.tiles = {"farming_carrot_7.png"} -crop_def.drop = { - items = { - {items = {'farming:carrot'}, rarity = 1}, - {items = {'farming:carrot 2'}, rarity = 3}, - } -} -minetest.register_node("farming:carrot_7", table.copy(crop_def)) - --- stage 8 (final) -crop_def.tiles = {"farming_carrot_8.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:carrot 2'}, rarity = 1}, - {items = {'farming:carrot 3'}, rarity = 2}, - } -} -minetest.register_node("farming:carrot_8", table.copy(crop_def)) diff --git a/farming/chili.lua b/farming/chili.lua deleted file mode 100644 index 9889162..0000000 --- a/farming/chili.lua +++ /dev/null @@ -1,92 +0,0 @@ - -local S = farming.intllib - --- chili pepper -minetest.register_craftitem("farming:chili_pepper", { - description = S("Chili Pepper"), - inventory_image = "farming_chili_pepper.png", - groups = {food_chili_pepper = 1, flammable = 4}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:chili_1") - end, - on_use = minetest.item_eat(2), -}) - --- bowl of chili -minetest.register_craftitem("farming:chili_bowl", { - description = S("Bowl of Chili"), - inventory_image = "farming_chili_bowl.png", - on_use = minetest.item_eat(8, "farming:bowl"), -}) - -minetest.register_craft({ - type = "shapeless", - output = "farming:chili_bowl", - recipe = { - "group:food_chili_pepper", "group:food_barley", - "group:food_tomato", "group:food_beans", "group:food_bowl" - }, -}) - --- chili can be used for red dye -minetest.register_craft({ - output = "dye:red", - recipe = { - {'farming:chili_pepper'}, - } -}) - --- chili definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_chili_1.png"}, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 4, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:chili_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_chili_2.png"} -minetest.register_node("farming:chili_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_chili_3.png"} -minetest.register_node("farming:chili_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_chili_4.png"} -minetest.register_node("farming:chili_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"farming_chili_5.png"} -minetest.register_node("farming:chili_5", table.copy(crop_def)) - --- stage 6 -crop_def.tiles = {"farming_chili_6.png"} -minetest.register_node("farming:chili_6", table.copy(crop_def)) - --- stage 7 -crop_def.tiles = {"farming_chili_7.png"} -minetest.register_node("farming:chili_7", table.copy(crop_def)) - --- stage 8 (final) -crop_def.tiles = {"farming_chili_8.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:chili_pepper 3'}, rarity = 1}, - {items = {'farming:chili_pepper 2'}, rarity = 2}, - } -} -minetest.register_node("farming:chili_8", table.copy(crop_def)) diff --git a/farming/cocoa.lua b/farming/cocoa.lua deleted file mode 100644 index a8491ac..0000000 --- a/farming/cocoa.lua +++ /dev/null @@ -1,195 +0,0 @@ - -local S = farming.intllib - --- place cocoa -local function place_cocoa(itemstack, placer, pointed_thing, plantname) - - local pt = pointed_thing - - -- check if pointing at a node - if not pt or pt.type ~= "node" then - return - end - - local under = minetest.get_node(pt.under) - - -- return if any of the nodes are not registered - if not minetest.registered_nodes[under.name] then - return - end - - -- am I right-clicking on something that has a custom on_place set? - -- thanks to Krock for helping with this issue :) - local def = minetest.registered_nodes[under.name] - if def and def.on_rightclick then - return def.on_rightclick(pt.under, under, placer, itemstack) - end - - -- check if pointing at jungletree - if under.name ~= "default:jungletree" - or minetest.get_node(pt.above).name ~= "air" then - return - end - - -- add the node and remove 1 item from the itemstack - minetest.set_node(pt.above, {name = plantname}) - - minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0}) - - if not farming.is_creative(placer:get_player_name()) then - - itemstack:take_item() - - -- check for refill - if itemstack:get_count() == 0 then - - minetest.after(0.20, - farming.refill_plant, - placer, - "farming:cocoa_beans", - placer:get_wield_index() - ) - end - end - - return itemstack -end - --- cocoa beans -minetest.register_craftitem("farming:cocoa_beans", { - description = S("Cocoa Beans"), - inventory_image = "farming_cocoa_beans.png", - groups = {food_cocoa = 1, flammable = 2}, - on_place = function(itemstack, placer, pointed_thing) - return place_cocoa(itemstack, placer, pointed_thing, "farming:cocoa_1") - end, -}) - -minetest.register_craft( { - output = "dye:brown 2", - recipe = { - { "farming:cocoa_beans" }, - } -}) - --- chocolate cookie -minetest.register_craftitem("farming:cookie", { - description = S("Cookie"), - inventory_image = "farming_cookie.png", - on_use = minetest.item_eat(2), -}) - -minetest.register_craft( { - output = "farming:cookie 8", - recipe = { - {"group:food_wheat", "group:food_cocoa", "group:food_wheat" }, - } -}) - --- bar of dark chocolate (thanks to Ice Pandora for her deviantart.com chocolate tutorial) -minetest.register_craftitem("farming:chocolate_dark", { - description = S("Bar of Dark Chocolate"), - inventory_image = "farming_chocolate_dark.png", - on_use = minetest.item_eat(3), -}) - -minetest.register_craft( { - output = "farming:chocolate_dark", - recipe = { - {"group:food_cocoa", "group:food_cocoa", "group:food_cocoa"}, - } -}) - --- cocoa definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_cocoa_1.png"}, - paramtype = "light", - walkable = true, - drop = { - items = { - {items = {'farming:cocoa_beans 1'}, rarity = 2}, - } - }, - selection_box = { - type = "fixed", - fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} - }, - groups = { - snappy = 3, flammable = 2, plant = 1, growing = 1, - not_in_creative_inventory=1, leafdecay = 1, leafdecay_drop = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:cocoa_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_cocoa_2.png"} -minetest.register_node("farming:cocoa_2", table.copy(crop_def)) - --- stage3 -crop_def.tiles = {"farming_cocoa_3.png"} -crop_def.drop = { - items = { - {items = {'farming:cocoa_beans 1'}, rarity = 1}, - } -} -minetest.register_node("farming:cocoa_3", table.copy(crop_def)) - --- stage 4 (final) -crop_def.tiles = {"farming_cocoa_4.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:cocoa_beans 2'}, rarity = 1}, - {items = {'farming:cocoa_beans 1'}, rarity = 2}, - {items = {'farming:cocoa_beans 1'}, rarity = 4}, - } -} -minetest.register_node("farming:cocoa_4", table.copy(crop_def)) - --- add random cocoa pods to jungle tree's -minetest.register_on_generated(function(minp, maxp) - - if maxp.y < 0 then - return - end - - local pos, dir - local cocoa = minetest.find_nodes_in_area(minp, maxp, "default:jungletree") - - for n = 1, #cocoa do - - pos = cocoa[n] - - if minetest.find_node_near(pos, 1, - {"default:jungleleaves", "moretrees:jungletree_leaves_green"}) then - - dir = math.random(1, 80) - - if dir == 1 then - pos.x = pos.x + 1 - elseif dir == 2 then - pos.x = pos.x - 1 - elseif dir == 3 then - pos.z = pos.z + 1 - elseif dir == 4 then - pos.z = pos.z -1 - end - - if dir < 5 - and minetest.get_node(pos).name == "air" - and minetest.get_node_light(pos) > 12 then - - --print ("Cocoa Pod added at " .. minetest.pos_to_string(pos)) - - minetest.swap_node(pos, { - name = "farming:cocoa_" .. tostring(math.random(1, 4)) - }) - end - - end - end -end) diff --git a/farming/coffee.lua b/farming/coffee.lua deleted file mode 100644 index ab93d06..0000000 --- a/farming/coffee.lua +++ /dev/null @@ -1,133 +0,0 @@ - -local S = farming.intllib - --- coffee -minetest.register_craftitem("farming:coffee_beans", { - description = S("Coffee Beans"), - inventory_image = "farming_coffee_beans.png", - groups = {food_coffee = 1, flammable = 2}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:coffee_1") - end, -}) - - --- drinking cup -minetest.register_node("farming:drinking_cup", { - description = S("Drinking Cup (empty)"), - drawtype = "plantlike", - tiles = {"vessels_drinking_cup.png"}, - inventory_image = "vessels_drinking_cup.png", - wield_image = "vessels_drinking_cup.png", - paramtype = "light", - walkable = false, - selection_box = { - type = "fixed", - fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25} - }, - groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, - sounds = default.node_sound_glass_defaults(), -}) - -minetest.register_craft( { - output = "farming:drinking_cup 5", - recipe = { - { "default:glass", "", "default:glass" }, - {"", "default:glass",""}, - } -}) - --- cold cup of coffee -minetest.register_node("farming:coffee_cup", { - description = S("Cold Cup of Coffee"), - drawtype = "plantlike", - tiles = {"farming_coffee_cup.png"}, - inventory_image = "farming_coffee_cup.png", - wield_image = "farming_coffee_cup.png", - paramtype = "light", - walkable = false, - selection_box = { - type = "fixed", - fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25} - }, - groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, - on_use = minetest.item_eat(2, "farming:drinking_cup"), - sounds = default.node_sound_glass_defaults(), -}) - -minetest.register_craft( { - output = "farming:coffee_cup", - recipe = { - {"farming:drinking_cup", "group:food_coffee","bucket:bucket_water"}, - }, - replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}} -}) - -minetest.register_craft({ - type = "cooking", - cooktime = 5, - output = "farming:coffee_cup_hot", - recipe = "farming:coffee_cup" -}) - --- hot cup of coffee -minetest.register_node("farming:coffee_cup_hot", { - description = S("Hot Cup of Coffee"), - drawtype = "plantlike", - tiles = {"farming_coffee_cup_hot.png"}, - inventory_image = "farming_coffee_cup_hot.png", - wield_image = "farming_coffee_cup_hot.png", - paramtype = "light", - walkable = false, - selection_box = { - type = "fixed", - fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25} - }, - groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, - on_use = minetest.item_eat(3, "farming:drinking_cup"), - sounds = default.node_sound_glass_defaults(), -}) - --- coffee definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_coffee_1.png"}, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:coffee_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_coffee_2.png"} -minetest.register_node("farming:coffee_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_coffee_3.png"} -minetest.register_node("farming:coffee_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_coffee_4.png"} -minetest.register_node("farming:coffee_4", table.copy(crop_def)) - --- stage 5 (final) -crop_def.tiles = {"farming_coffee_5.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:coffee_beans 2'}, rarity = 1}, - {items = {'farming:coffee_beans 2'}, rarity = 2}, - {items = {'farming:coffee_beans 2'}, rarity = 3}, - } -} -minetest.register_node("farming:coffee_5", table.copy(crop_def)) diff --git a/farming/compatibility.lua b/farming/compatibility.lua index ccc46a5..afa98d6 100644 --- a/farming/compatibility.lua +++ b/farming/compatibility.lua @@ -1,3 +1,7 @@ + +-- wait until mods are finished loading +minetest.after(0, function() + -- add food group to default apple and brown mushroom minetest.override_item("default:apple", { groups = {food_apple = 1, fleshy = 3, dig_immediate = 3, flammable = 2, @@ -12,7 +16,7 @@ minetest.override_item("flowers:mushroom_brown", { end -- is Ethereal mod installed? -local eth = minetest.get_modpath("ethereal") or nil +local eth = minetest.get_modpath("ethereal") -- Banana if eth then @@ -140,9 +144,11 @@ else minetest.register_alias("farming_plus:strawberry_2", "farming:raspberry_2") minetest.register_alias("farming_plus:strawberry_3", "farming:raspberry_3") minetest.register_alias("farming_plus:strawberry", "farming:raspberry_4") - end +minetest.register_alias("bushes:strawberry", "ethereal:strawberry") + + -- Tomato minetest.register_alias("farming_plus:tomato_seed", "farming:tomato") minetest.register_alias("farming_plus:tomato_item", "farming:tomato") @@ -154,7 +160,7 @@ minetest.register_alias("farming_plus:tomato", "farming:tomato_8") -- Weed minetest.register_alias("farming:weed", "default:grass_2") --- Classic Bushes compatibility +--[[ Classic Bushes compatibility if minetest.get_modpath("bushes_classic") then if eth then @@ -165,5 +171,6 @@ if minetest.get_modpath("bushes_classic") then minetest.register_alias("bushes:blueberry", "farming:blueberries") minetest.register_alias("bushes:raspberry", "farming:raspberries") +end]] -end \ No newline at end of file +end) diff --git a/farming/corn.lua b/farming/corn.lua deleted file mode 100644 index 8afa16a..0000000 --- a/farming/corn.lua +++ /dev/null @@ -1,129 +0,0 @@ - ---[[ - Original textures from GeMinecraft - http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1440575-1-2-5-generation-minecraft-beta-1-2-farming-and -]] - -local S = farming.intllib - --- corn -minetest.register_craftitem("farming:corn", { - description = S("Corn"), - inventory_image = "farming_corn.png", - groups = {food_corn = 1, flammable = 2}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:corn_1") - end, - on_use = minetest.item_eat(3), -}) - --- corn on the cob (texture by TenPlus1) -minetest.register_craftitem("farming:corn_cob", { - description = S("Corn on the Cob"), - inventory_image = "farming_corn_cob.png", - on_use = minetest.item_eat(5), -}) - -minetest.register_craft({ - type = "cooking", - cooktime = 10, - output = "farming:corn_cob", - recipe = "group:food_corn" -}) - --- ethanol (thanks to JKMurray for this idea) -minetest.register_node("farming:bottle_ethanol", { - description = S("Bottle of Ethanol"), - drawtype = "plantlike", - tiles = {"farming_bottle_ethanol.png"}, - inventory_image = "farming_bottle_ethanol.png", - wield_image = "farming_bottle_ethanol.png", - paramtype = "light", - is_ground_content = false, - walkable = false, - selection_box = { - type = "fixed", - fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} - }, - groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, - sounds = default.node_sound_glass_defaults(), -}) - -minetest.register_craft( { - output = "farming:bottle_ethanol", - recipe = { - { "vessels:glass_bottle", "group:food_corn", "group:food_corn"}, - { "group:food_corn", "group:food_corn", "group:food_corn"}, - } -}) - -minetest.register_craft({ - type = "fuel", - recipe = "farming:bottle_ethanol", - burntime = 80, --240, - replacements = {{ "farming:bottle_ethanol", "vessels:glass_bottle"}} -}) - --- corn definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_corn_1.png"}, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:corn_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_corn_2.png"} -minetest.register_node("farming:corn_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_corn_3.png"} -minetest.register_node("farming:corn_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_corn_4.png"} -minetest.register_node("farming:corn_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"farming_corn_5.png"} -minetest.register_node("farming:corn_5", table.copy(crop_def)) - --- stage 6 -crop_def.tiles = {"farming_corn_6.png"} -crop_def.visual_scale = 1.9 -- 1.45 -minetest.register_node("farming:corn_6", table.copy(crop_def)) - --- stage 7 -crop_def.tiles = {"farming_corn_7.png"} -crop_def.drop = { - items = { - {items = {'farming:corn'}, rarity = 1}, - {items = {'farming:corn'}, rarity = 2}, - {items = {'farming:corn'}, rarity = 3}, - } -} -minetest.register_node("farming:corn_7", table.copy(crop_def)) - --- stage 8 (final) -crop_def.tiles = {"farming_corn_8.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:corn 2'}, rarity = 1}, - {items = {'farming:corn 2'}, rarity = 2}, - {items = {'farming:corn 2'}, rarity = 2}, - } -} -minetest.register_node("farming:corn_8", table.copy(crop_def)) diff --git a/farming/cotton.lua b/farming/cotton.lua deleted file mode 100644 index 7f893ec..0000000 --- a/farming/cotton.lua +++ /dev/null @@ -1,151 +0,0 @@ - -local S = farming.intllib - --- cotton seeds -minetest.register_node("farming:seed_cotton", { - description = S("Cotton Seed"), - tiles = {"farming_cotton_seed.png"}, - inventory_image = "farming_cotton_seed.png", - wield_image = "farming_cotton_seed.png", - drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4}, - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - sunlight_propagates = true, - selection_box = farming.select, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_1") - end, -}) - --- cotton / string - -minetest.register_craftitem("farming:cotton", { - description = S("Cotton"), - inventory_image = "farming_cotton.png", - groups = {flammable = 4}, -}) - -minetest.register_craftitem("farming:string", { - description = S("String"), - inventory_image = "farming_string.png", - groups = {flammable = 2}, -}) - --- cotton to wool -minetest.register_craft({ - output = "wool:white", - recipe = { - {"farming:cotton", "farming:cotton"}, - {"farming:cotton", "farming:cotton"}, - } -}) - --- cotton to string -minetest.register_craft({ - output = "farming:string 2", - recipe = { - {"farming:cotton"}, - {"farming:cotton"}, - } -}) - --- can be used as fuel -minetest.register_craft({ - type = "fuel", - recipe = "farming:string", - burntime = 1, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "farming:cotton", - burntime = 1, -}) - --- cotton definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_cotton_1.png"}, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 4, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:cotton_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_cotton_2.png"} -minetest.register_node("farming:cotton_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_cotton_3.png"} -minetest.register_node("farming:cotton_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_cotton_4.png"} -minetest.register_node("farming:cotton_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"farming_cotton_5.png"} -crop_def.drop = { - items = { - {items = {"farming:seed_cotton"}, rarity = 1}, - } -} -minetest.register_node("farming:cotton_5", table.copy(crop_def)) - --- stage 6 -crop_def.tiles = {"farming_cotton_6.png"} -crop_def.drop = { - items = { - {items = {"farming:cotton"}, rarity = 1}, - {items = {"farming:cotton"}, rarity = 2}, - } -} -minetest.register_node("farming:cotton_6", table.copy(crop_def)) - --- stage 7 -crop_def.tiles = {"farming_cotton_7.png"} -crop_def.drop = { - items = { - {items = {"farming:cotton"}, rarity = 1}, - {items = {"farming:cotton"}, rarity = 2}, - {items = {"farming:seed_cotton"}, rarity = 1}, - {items = {"farming:seed_cotton"}, rarity = 2}, - } -} -minetest.register_node("farming:cotton_7", table.copy(crop_def)) - --- stage 8 (final) -crop_def.tiles = {"farming_cotton_8.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {"farming:cotton"}, rarity = 1}, - {items = {"farming:cotton"}, rarity = 2}, - {items = {"farming:cotton"}, rarity = 3}, - {items = {"farming:seed_cotton"}, rarity = 1}, - {items = {"farming:seed_cotton"}, rarity = 2}, - {items = {"farming:seed_cotton"}, rarity = 3}, - } -} -minetest.register_node("farming:cotton_8", table.copy(crop_def)) - ---[[ Cotton (example, is already registered in cotton.lua) -farming.register_plant("farming:cotton", { - description = "Cotton seed", - inventory_image = "farming_cotton_seed.png", - groups = {flammable = 2}, - steps = 8, -})]] diff --git a/farming/crops/barley.lua b/farming/crops/barley.lua new file mode 100644 index 0000000..f509335 --- /dev/null +++ b/farming/crops/barley.lua @@ -0,0 +1,105 @@ + +local S = farming.intllib + +-- barley seeds +minetest.register_node("farming:seed_barley", { + description = S("Barley Seed"), + tiles = {"farming_barley_seed.png"}, + inventory_image = "farming_barley_seed.png", + wield_image = "farming_barley_seed.png", + drawtype = "signlike", + groups = {seed = 1, snappy = 3, attached_node = 1}, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = farming.select, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:barley_1") + end, +}) + +-- harvested barley +minetest.register_craftitem("farming:barley", { + description = S("Barley"), + inventory_image = "farming_barley.png", + groups = {food_barley = 1, flammable = 2}, +}) + +-- flour +minetest.register_craft({ + type = "shapeless", + output = "farming:flour", + recipe = { + "farming:barley", "farming:barley", "farming:barley", + "farming:barley", "farming:mortar_pestle" + }, + replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}, +}) + +-- barley definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_barley_1.png"}, + paramtype = "light", + paramtype2 = "meshoptions", + place_param2 = 3, + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:barley_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_barley_2.png"} +minetest.register_node("farming:barley_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_barley_3.png"} +minetest.register_node("farming:barley_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_barley_4.png"} +minetest.register_node("farming:barley_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_barley_5.png"} +crop_def.drop = { + items = { + {items = {'farming:barley'}, rarity = 2}, + {items = {'farming:seed_barley'}, rarity = 2}, + } +} +minetest.register_node("farming:barley_5", table.copy(crop_def)) + +-- stage 6 +crop_def.tiles = {"farming_barley_6.png"} +crop_def.drop = { + items = { + {items = {'farming:barley'}, rarity = 2}, + {items = {'farming:seed_barley'}, rarity = 1}, + } +} +minetest.register_node("farming:barley_6", table.copy(crop_def)) + +-- stage 7 (final) +crop_def.tiles = {"farming_barley_7.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:barley'}, rarity = 1}, + {items = {'farming:barley'}, rarity = 3}, + {items = {'farming:seed_barley'}, rarity = 1}, + {items = {'farming:seed_barley'}, rarity = 3}, + } +} +minetest.register_node("farming:barley_7", table.copy(crop_def)) diff --git a/farming/crops/beans.lua b/farming/crops/beans.lua new file mode 100644 index 0000000..a575956 --- /dev/null +++ b/farming/crops/beans.lua @@ -0,0 +1,249 @@ +--[[ + All textures by + (C) Auke Kok + CC-BY-SA-3.0 +]] + +local S = farming.intllib + +-- place beans +local function place_beans(itemstack, placer, pointed_thing, plantname) + + local pt = pointed_thing + + -- check if pointing at a node + if not pt or pt.type ~= "node" then + + return + end + + local under = minetest.get_node(pt.under) + + -- return if any of the nodes are not registered + if not minetest.registered_nodes[under.name] then + return + end + + -- am I right-clicking on something that has a custom on_place set? + -- thanks to Krock for helping with this issue :) + local def = minetest.registered_nodes[under.name] + if placer and def and def.on_rightclick then + return def.on_rightclick(pt.under, under, placer, itemstack) + end + + -- is player planting crop? + local name = placer and placer:get_player_name() or "" + + -- check for protection + if minetest.is_protected(pt.under, name) then + return + end + + -- check if pointing at bean pole + if under.name ~= "farming:beanpole" then + return + end + + -- add the node and remove 1 item from the itemstack + minetest.set_node(pt.under, {name = plantname}) + + minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0}) + + if placer or not farming.is_creative(placer:get_player_name()) then + + itemstack:take_item() + + -- check for refill + if itemstack:get_count() == 0 then + + minetest.after(0.20, + farming.refill_plant, + placer, + "farming:beans", + placer:get_wield_index() + ) + end + end + + return itemstack +end + +-- beans +minetest.register_craftitem("farming:beans", { + description = S("Green Beans"), + inventory_image = "farming_beans.png", + groups = {food_beans = 1, flammable = 2}, + on_use = minetest.item_eat(1), + + on_place = function(itemstack, placer, pointed_thing) + return place_beans(itemstack, placer, pointed_thing, "farming:beanpole_1") + end, +}) + +-- beans can be used for green dye +minetest.register_craft({ + output = "dye:green", + recipe = { + {'farming:beans'}, + } +}) + +-- beanpole +minetest.register_node("farming:beanpole", { + description = S("Bean Pole (place on soil before planting beans)"), + drawtype = "plantlike", + tiles = {"farming_beanpole.png"}, + inventory_image = "farming_beanpole.png", + visual_scale = 1.90, -- 1.45, + paramtype = "light", + walkable = false, + buildable_to = true, + sunlight_propagates = true, + drop = "farming:beanpole", + selection_box = farming.select, + groups = {snappy = 3, flammable = 2, attached_node = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_place = function(itemstack, placer, pointed_thing) + + local pt = pointed_thing + + -- check if pointing at a node + if not pt or pt.type ~= "node" then + return + end + + local under = minetest.get_node(pt.under) + + -- return if any of the nodes are not registered + if not minetest.registered_nodes[under.name] then + return + end + + -- am I right-clicking on something that has a custom on_place set? + -- thanks to Krock for helping with this issue :) + local def = minetest.registered_nodes[under.name] + if def and def.on_rightclick then + return def.on_rightclick(pt.under, under, placer, itemstack) + end + + if minetest.is_protected(pt.above, placer:get_player_name()) then + return + end + + local nodename = under.name + + if minetest.get_item_group(nodename, "soil") < 2 then + return + end + + local top = { + x = pointed_thing.above.x, + y = pointed_thing.above.y + 1, + z = pointed_thing.above.z + } + + nodename = minetest.get_node(top).name + + if nodename ~= "air" then + return + end + + minetest.set_node(pointed_thing.above, {name = "farming:beanpole"}) + + if not farming.is_creative(placer:get_player_name()) then + itemstack:take_item() + end + + return itemstack + end +}) + +minetest.register_craft({ + output = "farming:beanpole", + recipe = { + {'', '', ''}, + {'default:stick', '', 'default:stick'}, + {'default:stick', '', 'default:stick'}, + } +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:beanpole", + burntime = 10, +}) + +-- green bean definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_beanpole_1.png"}, + visual_scale = 1.90, -- 1.45, + paramtype = "light", + walkable = false, + buildable_to = true, + sunlight_propagates = true, + drop = { + items = { + {items = {'farming:beanpole'}, rarity = 1}, + } + }, + selection_box = farming.select, + groups = { + snappy = 3, flammable = 3, not_in_creative_inventory = 1, + attached_node = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:beanpole_1", table.copy(crop_def)) + +-- stage2 +crop_def.tiles = {"farming_beanpole_2.png"} +minetest.register_node("farming:beanpole_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_beanpole_3.png"} +minetest.register_node("farming:beanpole_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_beanpole_4.png"} +minetest.register_node("farming:beanpole_4", table.copy(crop_def)) + +-- stage 5 (final) +crop_def.tiles = {"farming_beanpole_5.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:beanpole'}, rarity = 1}, + {items = {'farming:beans 3'}, rarity = 1}, + {items = {'farming:beans 2'}, rarity = 2}, + {items = {'farming:beans 2'}, rarity = 3}, + } +} +minetest.register_node("farming:beanpole_5", table.copy(crop_def)) + +-- wild green bean bush (this is what you find on the map) +minetest.register_node("farming:beanbush", { + drawtype = "plantlike", + tiles = {"farming_beanbush.png"}, + paramtype = "light", + waving = 1, + walkable = false, + buildable_to = true, + sunlight_propagates = true, + drop = { + items = { + {items = {'farming:beans 1'}, rarity = 1}, + {items = {'farming:beans 1'}, rarity = 2}, + {items = {'farming:beans 1'}, rarity = 3}, + } + }, + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory=1 + }, + sounds = default.node_sound_leaves_defaults(), +}) diff --git a/farming/crops/beetroot.lua b/farming/crops/beetroot.lua new file mode 100644 index 0000000..e683a94 --- /dev/null +++ b/farming/crops/beetroot.lua @@ -0,0 +1,85 @@ + +local S = farming.intllib + +-- beetroot +minetest.register_craftitem("farming:beetroot", { + description = S("Beetroot"), + inventory_image = "farming_beetroot.png", + groups = {food_beetroot = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:beetroot_1") + end, + on_use = minetest.item_eat(1), +}) + +-- beetroot soup +minetest.register_craftitem("farming:beetroot_soup", { + description = S("Beetroot Soup"), + inventory_image = "farming_beetroot_soup.png", + groups = {flammable = 2}, + on_use = minetest.item_eat(6, "farming:bowl"), +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:beetroot_soup", + recipe = { + "group:food_beetroot", "group:food_beetroot", + "group:food_beetroot", "group:food_beetroot", + "group:food_beetroot", "group:food_beetroot","group:food_bowl" + } +}) + +-- red dye +minetest.register_craft({ + type = "shapeless", + output = "dye:red", + recipe = {"group:food_beetroot"}, +}) + +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_beetroot_1.png"}, + paramtype = "light", +-- paramtype2 = "meshoptions", +-- place_param2 = 3, + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 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:beetroot_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_beetroot_2.png"} +minetest.register_node("farming:beetroot_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_beetroot_3.png"} +minetest.register_node("farming:beetroot_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_beetroot_4.png"} +minetest.register_node("farming:beetroot_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_beetroot_5.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + max_items = 4, items = { + {items = {'farming:beetroot'}, rarity = 1}, + {items = {'farming:beetroot'}, rarity = 2}, + {items = {'farming:beetroot'}, rarity = 3}, + {items = {'farming:beetroot'}, rarity = 4}, + } +} +minetest.register_node("farming:beetroot_5", table.copy(crop_def)) diff --git a/farming/crops/blueberry.lua b/farming/crops/blueberry.lua new file mode 100644 index 0000000..9a30387 --- /dev/null +++ b/farming/crops/blueberry.lua @@ -0,0 +1,85 @@ + +local S = farming.intllib + +-- blueberries +minetest.register_craftitem("farming:blueberries", { + description = S("Blueberries"), + inventory_image = "farming_blueberries.png", + groups = {food_blueberries = 1, food_blueberry = 1, food_berry = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:blueberry_1") + end, + on_use = minetest.item_eat(1), +}) + +-- blueberry muffin (thanks to sosogirl123 @ deviantart.com for muffin image) + +minetest.register_craftitem("farming:muffin_blueberry", { + description = S("Blueberry Muffin"), + inventory_image = "farming_blueberry_muffin.png", + on_use = minetest.item_eat(2), +}) + +minetest.register_craft({ + output = "farming:muffin_blueberry 2", + recipe = { + {"group:food_blueberries", "group:food_bread", "group:food_blueberries"}, + } +}) + +-- Blueberry Pie + +minetest.register_craftitem("farming:blueberry_pie", { + description = S("Blueberry Pie"), + inventory_image = "farming_blueberry_pie.png", + on_use = minetest.item_eat(6), +}) + +minetest.register_craft({ + output = "farming:blueberry_pie", + type = "shapeless", + recipe = { + "group:food_flour", "group:food_sugar", + "group:food_blueberries", "group:food_baking_tray" + }, +}) + +-- blueberry definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_blueberry_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:blueberry_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_blueberry_2.png"} +minetest.register_node("farming:blueberry_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_blueberry_3.png"} +minetest.register_node("farming:blueberry_3", table.copy(crop_def)) + +-- stage 4 (final) +crop_def.tiles = {"farming_blueberry_4.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:blueberries 2'}, rarity = 1}, + {items = {'farming:blueberries'}, rarity = 2}, + {items = {'farming:blueberries'}, rarity = 3}, + } +} +minetest.register_node("farming:blueberry_4", table.copy(crop_def)) diff --git a/farming/crops/carrot.lua b/farming/crops/carrot.lua new file mode 100644 index 0000000..0aefcfd --- /dev/null +++ b/farming/crops/carrot.lua @@ -0,0 +1,96 @@ + +--[[ + Original textures from PixelBox texture pack + https://forum.minetest.net/viewtopic.php?id=4990 +]] + +local S = farming.intllib + +-- carrot +minetest.register_craftitem("farming:carrot", { + description = S("Carrot"), + inventory_image = "farming_carrot.png", + groups = {food_carrot = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:carrot_1") + end, + on_use = minetest.item_eat(4), +}) + +-- golden carrot +minetest.register_craftitem("farming:carrot_gold", { + description = S("Golden Carrot"), + inventory_image = "farming_carrot_gold.png", + on_use = minetest.item_eat(6), +}) + +minetest.register_craft({ + output = "farming:carrot_gold", + recipe = { + {"", "default:gold_lump", ""}, + {"default:gold_lump", "group:food_carrot", "default:gold_lump"}, + {"", "default:gold_lump", ""}, + } +}) + +-- carrot definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_carrot_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + + +-- stage 1 +minetest.register_node("farming:carrot_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_carrot_2.png"} +minetest.register_node("farming:carrot_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_carrot_3.png"} +minetest.register_node("farming:carrot_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_carrot_4.png"} +minetest.register_node("farming:carrot_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_carrot_5.png"} +minetest.register_node("farming:carrot_5", table.copy(crop_def)) + +-- stage 6 +crop_def.tiles = {"farming_carrot_6.png"} +minetest.register_node("farming:carrot_6", table.copy(crop_def)) + +-- stage 7 +crop_def.tiles = {"farming_carrot_7.png"} +crop_def.drop = { + items = { + {items = {'farming:carrot'}, rarity = 1}, + {items = {'farming:carrot 2'}, rarity = 3}, + } +} +minetest.register_node("farming:carrot_7", table.copy(crop_def)) + +-- stage 8 (final) +crop_def.tiles = {"farming_carrot_8.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:carrot 2'}, rarity = 1}, + {items = {'farming:carrot 3'}, rarity = 2}, + } +} +minetest.register_node("farming:carrot_8", table.copy(crop_def)) diff --git a/farming/crops/chili.lua b/farming/crops/chili.lua new file mode 100644 index 0000000..9889162 --- /dev/null +++ b/farming/crops/chili.lua @@ -0,0 +1,92 @@ + +local S = farming.intllib + +-- chili pepper +minetest.register_craftitem("farming:chili_pepper", { + description = S("Chili Pepper"), + inventory_image = "farming_chili_pepper.png", + groups = {food_chili_pepper = 1, flammable = 4}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:chili_1") + end, + on_use = minetest.item_eat(2), +}) + +-- bowl of chili +minetest.register_craftitem("farming:chili_bowl", { + description = S("Bowl of Chili"), + inventory_image = "farming_chili_bowl.png", + on_use = minetest.item_eat(8, "farming:bowl"), +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:chili_bowl", + recipe = { + "group:food_chili_pepper", "group:food_barley", + "group:food_tomato", "group:food_beans", "group:food_bowl" + }, +}) + +-- chili can be used for red dye +minetest.register_craft({ + output = "dye:red", + recipe = { + {'farming:chili_pepper'}, + } +}) + +-- chili definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_chili_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 4, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:chili_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_chili_2.png"} +minetest.register_node("farming:chili_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_chili_3.png"} +minetest.register_node("farming:chili_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_chili_4.png"} +minetest.register_node("farming:chili_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_chili_5.png"} +minetest.register_node("farming:chili_5", table.copy(crop_def)) + +-- stage 6 +crop_def.tiles = {"farming_chili_6.png"} +minetest.register_node("farming:chili_6", table.copy(crop_def)) + +-- stage 7 +crop_def.tiles = {"farming_chili_7.png"} +minetest.register_node("farming:chili_7", table.copy(crop_def)) + +-- stage 8 (final) +crop_def.tiles = {"farming_chili_8.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:chili_pepper 3'}, rarity = 1}, + {items = {'farming:chili_pepper 2'}, rarity = 2}, + } +} +minetest.register_node("farming:chili_8", table.copy(crop_def)) diff --git a/farming/crops/cocoa.lua b/farming/crops/cocoa.lua new file mode 100644 index 0000000..19e9c6b --- /dev/null +++ b/farming/crops/cocoa.lua @@ -0,0 +1,210 @@ + +local S = farming.intllib + +-- place cocoa +local function place_cocoa(itemstack, placer, pointed_thing, plantname) + + local pt = pointed_thing + + -- check if pointing at a node + if not pt or pt.type ~= "node" then + return + end + + local under = minetest.get_node(pt.under) + + -- return if any of the nodes are not registered + if not minetest.registered_nodes[under.name] then + return + end + + -- am I right-clicking on something that has a custom on_place set? + -- thanks to Krock for helping with this issue :) + local def = minetest.registered_nodes[under.name] + if placer and def and def.on_rightclick then + return def.on_rightclick(pt.under, under, placer, itemstack) + end + + -- check if pointing at jungletree + if under.name ~= "default:jungletree" + or minetest.get_node(pt.above).name ~= "air" then + return + end + + -- is player planting crop? + local name = placer and placer:get_player_name() or "" + + -- check for protection + if minetest.is_protected(pt.above, name) then + return + end + + -- add the node and remove 1 item from the itemstack + minetest.set_node(pt.above, {name = plantname}) + + minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0}) + + if placer and not farming.is_creative(placer:get_player_name()) then + + itemstack:take_item() + + -- check for refill + if itemstack:get_count() == 0 then + + minetest.after(0.20, + farming.refill_plant, + placer, + "farming:cocoa_beans", + placer:get_wield_index() + ) + end + end + + return itemstack +end + +-- cocoa beans +minetest.register_craftitem("farming:cocoa_beans", { + description = S("Cocoa Beans"), + inventory_image = "farming_cocoa_beans.png", + groups = {food_cocoa = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return place_cocoa(itemstack, placer, pointed_thing, "farming:cocoa_1") + end, +}) + +minetest.register_craft( { + output = "dye:brown 2", + recipe = { + { "farming:cocoa_beans" }, + } +}) + +-- chocolate cookie +minetest.register_craftitem("farming:cookie", { + description = S("Cookie"), + inventory_image = "farming_cookie.png", + on_use = minetest.item_eat(2), +}) + +minetest.register_craft( { + output = "farming:cookie 8", + recipe = { + {"group:food_wheat", "group:food_cocoa", "group:food_wheat" }, + } +}) + +-- bar of dark chocolate (thanks to Ice Pandora for her deviantart.com chocolate tutorial) +minetest.register_craftitem("farming:chocolate_dark", { + description = S("Bar of Dark Chocolate"), + inventory_image = "farming_chocolate_dark.png", + on_use = minetest.item_eat(3), +}) + +minetest.register_craft( { + output = "farming:chocolate_dark", + recipe = { + {"group:food_cocoa", "group:food_cocoa", "group:food_cocoa"}, + } +}) + +-- cocoa definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_cocoa_1.png"}, + paramtype = "light", + walkable = true, + drop = { + items = { + {items = {'farming:cocoa_beans 1'}, rarity = 2}, + } + }, + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} + }, + groups = { + snappy = 3, flammable = 2, plant = 1, growing = 1, + not_in_creative_inventory=1, leafdecay = 1, leafdecay_drop = 1 + }, + sounds = default.node_sound_leaves_defaults(), + growth_check = function(pos, node_name) + if minetest.find_node_near(pos, 1, {"default:jungletree"}) then + return false + end + return true + end, +} + +-- stage 1 +minetest.register_node("farming:cocoa_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_cocoa_2.png"} +minetest.register_node("farming:cocoa_2", table.copy(crop_def)) + +-- stage3 +crop_def.tiles = {"farming_cocoa_3.png"} +crop_def.drop = { + items = { + {items = {'farming:cocoa_beans 1'}, rarity = 1}, + } +} +minetest.register_node("farming:cocoa_3", table.copy(crop_def)) + +-- stage 4 (final) +crop_def.tiles = {"farming_cocoa_4.png"} +crop_def.groups.growing = 0 +crop_def.growth_check = nil +crop_def.drop = { + items = { + {items = {'farming:cocoa_beans 2'}, rarity = 1}, + {items = {'farming:cocoa_beans 1'}, rarity = 2}, + {items = {'farming:cocoa_beans 1'}, rarity = 4}, + } +} +minetest.register_node("farming:cocoa_4", table.copy(crop_def)) + +-- add random cocoa pods to jungle tree's +minetest.register_on_generated(function(minp, maxp) + + if maxp.y < 0 then + return + end + + local pos, dir + local cocoa = minetest.find_nodes_in_area(minp, maxp, "default:jungletree") + + for n = 1, #cocoa do + + pos = cocoa[n] + + if minetest.find_node_near(pos, 1, + {"default:jungleleaves", "moretrees:jungletree_leaves_green"}) then + + dir = math.random(1, 80) + + if dir == 1 then + pos.x = pos.x + 1 + elseif dir == 2 then + pos.x = pos.x - 1 + elseif dir == 3 then + pos.z = pos.z + 1 + elseif dir == 4 then + pos.z = pos.z -1 + end + + if dir < 5 + and minetest.get_node(pos).name == "air" + and minetest.get_node_light(pos) > 12 then + + --print ("Cocoa Pod added at " .. minetest.pos_to_string(pos)) + + minetest.swap_node(pos, { + name = "farming:cocoa_" .. tostring(math.random(1, 4)) + }) + end + + end + end +end) diff --git a/farming/crops/coffee.lua b/farming/crops/coffee.lua new file mode 100644 index 0000000..f98694b --- /dev/null +++ b/farming/crops/coffee.lua @@ -0,0 +1,88 @@ + +local S = farming.intllib + +-- coffee +minetest.register_craftitem("farming:coffee_beans", { + description = S("Coffee Beans"), + inventory_image = "farming_coffee_beans.png", + groups = {food_coffee = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:coffee_1") + end, +}) + +-- cold cup of coffee +minetest.register_node("farming:coffee_cup", { + description = S("Cup of Coffee"), + drawtype = "torchlike", --"plantlike", + tiles = {"farming_coffee_cup.png"}, + inventory_image = "farming_coffee_cup.png", + wield_image = "farming_coffee_cup.png", + paramtype = "light", + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25} + }, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + on_use = minetest.item_eat(2, "vessels:drinking_glass"), + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_alias("farming:coffee_cup_hot", "farming:coffee_cup") +minetest.register_alias("farming:drinking_cup", "vessels:drinking_glass") + +minetest.register_craft( { + output = "farming:coffee_cup", + type = "shapeless", + recipe = {"vessels:drinking_glass", "group:food_coffee", + "bucket:bucket_water", "group:food_saucepan"}, + replacements = { + {"bucket:bucket_water", "bucket:bucket_empty"}, + {"group:food_saucepan", "farming:saucepan"}, + } +}) + +-- coffee definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_coffee_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:coffee_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_coffee_2.png"} +minetest.register_node("farming:coffee_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_coffee_3.png"} +minetest.register_node("farming:coffee_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_coffee_4.png"} +minetest.register_node("farming:coffee_4", table.copy(crop_def)) + +-- stage 5 (final) +crop_def.tiles = {"farming_coffee_5.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:coffee_beans 2'}, rarity = 1}, + {items = {'farming:coffee_beans 2'}, rarity = 2}, + {items = {'farming:coffee_beans 2'}, rarity = 3}, + } +} +minetest.register_node("farming:coffee_5", table.copy(crop_def)) diff --git a/farming/crops/corn.lua b/farming/crops/corn.lua new file mode 100644 index 0000000..4847903 --- /dev/null +++ b/farming/crops/corn.lua @@ -0,0 +1,149 @@ + +--[[ + Original textures from GeMinecraft + http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1440575-1-2-5-generation-minecraft-beta-1-2-farming-and +]] + +local S = farming.intllib + +-- corn +minetest.register_craftitem("farming:corn", { + description = S("Corn"), + inventory_image = "farming_corn.png", + groups = {food_corn = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:corn_1") + end, + on_use = minetest.item_eat(3), +}) + +-- corn on the cob (texture by TenPlus1) +minetest.register_craftitem("farming:corn_cob", { + description = S("Corn on the Cob"), + inventory_image = "farming_corn_cob.png", + groups = {food_corn_cooked = 1, flammable = 2}, + on_use = minetest.item_eat(5), +}) + +minetest.register_craft({ + type = "cooking", + cooktime = 10, + output = "farming:corn_cob", + recipe = "group:food_corn" +}) + +-- cornstarch +minetest.register_craftitem("farming:cornstarch", { + description = S("Cornstarch"), + inventory_image = "farming_cornstarch.png", + groups = {food_cornstarch = 1, flammable = 2}, +}) + +minetest.register_craft({ + output = "farming:cornstarch", + recipe = { + {"group:food_mortar_pestle", "group:food_corn_cooked", "group:food_baking_tray"}, + {"", "group:food_bowl", ""}, + }, + replacements = { + {"group:food_mortar_pestle", "farming:mortar_pestle"}, + {"group:food_baking_tray", "farming:baking_tray"}, + } +}) + +-- ethanol (thanks to JKMurray for this idea) +minetest.register_node("farming:bottle_ethanol", { + description = S("Bottle of Ethanol"), + drawtype = "plantlike", + tiles = {"farming_bottle_ethanol.png"}, + inventory_image = "farming_bottle_ethanol.png", + wield_image = "farming_bottle_ethanol.png", + paramtype = "light", + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_craft( { + output = "farming:bottle_ethanol", + recipe = { + { "vessels:glass_bottle", "group:food_corn", "group:food_corn"}, + { "group:food_corn", "group:food_corn", "group:food_corn"}, + } +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:bottle_ethanol", + burntime = 80, --240, + replacements = {{ "farming:bottle_ethanol", "vessels:glass_bottle"}} +}) + +-- corn definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_corn_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:corn_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_corn_2.png"} +minetest.register_node("farming:corn_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_corn_3.png"} +minetest.register_node("farming:corn_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_corn_4.png"} +minetest.register_node("farming:corn_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_corn_5.png"} +minetest.register_node("farming:corn_5", table.copy(crop_def)) + +-- stage 6 +crop_def.tiles = {"farming_corn_6.png"} +crop_def.visual_scale = 1.9 -- 1.45 +minetest.register_node("farming:corn_6", table.copy(crop_def)) + +-- stage 7 +crop_def.tiles = {"farming_corn_7.png"} +crop_def.drop = { + items = { + {items = {'farming:corn'}, rarity = 1}, + {items = {'farming:corn'}, rarity = 2}, + {items = {'farming:corn'}, rarity = 3}, + } +} +minetest.register_node("farming:corn_7", table.copy(crop_def)) + +-- stage 8 (final) +crop_def.tiles = {"farming_corn_8.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:corn 2'}, rarity = 1}, + {items = {'farming:corn 2'}, rarity = 2}, + {items = {'farming:corn 2'}, rarity = 2}, + } +} +minetest.register_node("farming:corn_8", table.copy(crop_def)) diff --git a/farming/crops/cotton.lua b/farming/crops/cotton.lua new file mode 100644 index 0000000..7f893ec --- /dev/null +++ b/farming/crops/cotton.lua @@ -0,0 +1,151 @@ + +local S = farming.intllib + +-- cotton seeds +minetest.register_node("farming:seed_cotton", { + description = S("Cotton Seed"), + tiles = {"farming_cotton_seed.png"}, + inventory_image = "farming_cotton_seed.png", + wield_image = "farming_cotton_seed.png", + drawtype = "signlike", + groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4}, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = farming.select, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_1") + end, +}) + +-- cotton / string + +minetest.register_craftitem("farming:cotton", { + description = S("Cotton"), + inventory_image = "farming_cotton.png", + groups = {flammable = 4}, +}) + +minetest.register_craftitem("farming:string", { + description = S("String"), + inventory_image = "farming_string.png", + groups = {flammable = 2}, +}) + +-- cotton to wool +minetest.register_craft({ + output = "wool:white", + recipe = { + {"farming:cotton", "farming:cotton"}, + {"farming:cotton", "farming:cotton"}, + } +}) + +-- cotton to string +minetest.register_craft({ + output = "farming:string 2", + recipe = { + {"farming:cotton"}, + {"farming:cotton"}, + } +}) + +-- can be used as fuel +minetest.register_craft({ + type = "fuel", + recipe = "farming:string", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:cotton", + burntime = 1, +}) + +-- cotton definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_cotton_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 4, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:cotton_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_cotton_2.png"} +minetest.register_node("farming:cotton_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_cotton_3.png"} +minetest.register_node("farming:cotton_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_cotton_4.png"} +minetest.register_node("farming:cotton_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_cotton_5.png"} +crop_def.drop = { + items = { + {items = {"farming:seed_cotton"}, rarity = 1}, + } +} +minetest.register_node("farming:cotton_5", table.copy(crop_def)) + +-- stage 6 +crop_def.tiles = {"farming_cotton_6.png"} +crop_def.drop = { + items = { + {items = {"farming:cotton"}, rarity = 1}, + {items = {"farming:cotton"}, rarity = 2}, + } +} +minetest.register_node("farming:cotton_6", table.copy(crop_def)) + +-- stage 7 +crop_def.tiles = {"farming_cotton_7.png"} +crop_def.drop = { + items = { + {items = {"farming:cotton"}, rarity = 1}, + {items = {"farming:cotton"}, rarity = 2}, + {items = {"farming:seed_cotton"}, rarity = 1}, + {items = {"farming:seed_cotton"}, rarity = 2}, + } +} +minetest.register_node("farming:cotton_7", table.copy(crop_def)) + +-- stage 8 (final) +crop_def.tiles = {"farming_cotton_8.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {"farming:cotton"}, rarity = 1}, + {items = {"farming:cotton"}, rarity = 2}, + {items = {"farming:cotton"}, rarity = 3}, + {items = {"farming:seed_cotton"}, rarity = 1}, + {items = {"farming:seed_cotton"}, rarity = 2}, + {items = {"farming:seed_cotton"}, rarity = 3}, + } +} +minetest.register_node("farming:cotton_8", table.copy(crop_def)) + +--[[ Cotton (example, is already registered in cotton.lua) +farming.register_plant("farming:cotton", { + description = "Cotton seed", + inventory_image = "farming_cotton_seed.png", + groups = {flammable = 2}, + steps = 8, +})]] diff --git a/farming/crops/cucumber.lua b/farming/crops/cucumber.lua new file mode 100644 index 0000000..4e6981c --- /dev/null +++ b/farming/crops/cucumber.lua @@ -0,0 +1,56 @@ + +--[[ + Original textures from DocFarming mod + https://forum.minetest.net/viewtopic.php?id=3948 +]] + +local S = farming.intllib + +-- cucumber +minetest.register_craftitem("farming:cucumber", { + description = S("Cucumber"), + inventory_image = "farming_cucumber.png", + groups = {food_cucumber = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1") + end, + on_use = minetest.item_eat(4), +}) + +-- cucumber definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_cucumber_1.png"}, + paramtype = "light", + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:cucumber_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_cucumber_2.png"} +minetest.register_node("farming:cucumber_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_cucumber_3.png"} +minetest.register_node("farming:cucumber_3", table.copy(crop_def)) + +-- stage 4 (final) +crop_def.tiles = {"farming_cucumber_4.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:cucumber 2'}, rarity = 1}, + {items = {'farming:cucumber 2'}, rarity = 2}, + } +} +minetest.register_node("farming:cucumber_4", table.copy(crop_def)) diff --git a/farming/crops/garlic.lua b/farming/crops/garlic.lua new file mode 100644 index 0000000..f2bb16d --- /dev/null +++ b/farming/crops/garlic.lua @@ -0,0 +1,128 @@ + +--[[ + Original textures from Crops Plus mod + Copyright (C) 2018 Grizzly Adam + https://forum.minetest.net/viewtopic.php?f=9&t=19488 +]] + +local S = farming.intllib + +-- potato +minetest.register_craftitem("farming:garlic_clove", { + description = S("Garlic clove"), + inventory_image = "crops_garlic_clove.png", + groups = {food_garlic_clove = 1, flammable = 3}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:garlic_1") + end, +}) + +-- garlic bulb +minetest.register_craftitem("farming:garlic", { + description = S("Garlic"), + inventory_image = "crops_garlic.png", + on_use = minetest.item_eat(1), + groups = {food_garlic = 1, flammable = 3}, +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:garlic_clove 9", + recipe = { "farming:garlic" } +}) + +minetest.register_craft({ + output = "farming:garlic", + recipe = { + {"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"}, + {"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"}, + {"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"} + } +}) + +-- garlic braid +minetest.register_node("farming:garlic_braid", { + description = S("Garlic Braid"), + inventory_image = "crops_garlic_braid.png", + wield_image = "crops_garlic_braid.png", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = { + "crops_garlic_braid_side.png","crops_garlic_braid.png", + "crops_garlic_braid_side.png^[transformFx","crops_garlic_braid_side.png", + "crops_garlic_braid.png","crops_garlic_braid.png" + }, + groups = {vessel = 1, dig_immediate = 3, flammable = 3}, + sounds = default.node_sound_leaves_defaults(), + node_box = { + type = "fixed", + fixed = { + {-0.13, -0.45, 0.5, 0.13, 0.45, 0.24}, + }, + } +}) + +minetest.register_craft({ + output = "farming:garlic_braid", + recipe = { + {"farming:garlic", "farming:garlic", "farming:garlic"}, + {"farming:garlic", "farming:garlic", "farming:garlic"}, + {"farming:garlic", "farming:garlic", "farming:garlic"} + } +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:garlic 9", + recipe = { "farming:garlic_braid" } +}) + +-- crop definition +local crop_def = { + drawtype = "plantlike", + tiles = {"crops_garlic_plant_1.png"}, + paramtype = "light", + paramtype2 = "meshoptions", + place_param2 = 3, + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 3, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:garlic_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"crops_garlic_plant_2.png"} +minetest.register_node("farming:garlic_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"crops_garlic_plant_3.png"} +minetest.register_node("farming:garlic_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"crops_garlic_plant_4.png"} +minetest.register_node("farming:garlic_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"crops_garlic_plant_5.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + max_items = 5, items = { + {items = {'farming:garlic'}, rarity = 1}, + {items = {'farming:garlic'}, rarity = 1}, + {items = {'farming:garlic'}, rarity = 1}, + {items = {'farming:garlic'}, rarity = 2}, + {items = {'farming:garlic'}, rarity = 5}, + } +} +minetest.register_node("farming:garlic_5", table.copy(crop_def)) diff --git a/farming/crops/grapes.lua b/farming/crops/grapes.lua new file mode 100644 index 0000000..d8c6c3f --- /dev/null +++ b/farming/crops/grapes.lua @@ -0,0 +1,256 @@ + +local S = farming.intllib + +-- place trellis +local function place_grapes(itemstack, placer, pointed_thing, plantname) + + local pt = pointed_thing + + -- check if pointing at a node + if not pt or pt.type ~= "node" then + + return + end + + local under = minetest.get_node(pt.under) + + -- return if any of the nodes are not registered + if not minetest.registered_nodes[under.name] then + return + end + + -- am I right-clicking on something that has a custom on_place set? + -- thanks to Krock for helping with this issue :) + local def = minetest.registered_nodes[under.name] + if placer and def and def.on_rightclick then + return def.on_rightclick(pt.under, under, placer, itemstack) + end + + -- is player planting seed? + local name = placer and placer:get_player_name() or "" + + -- check for protection + if minetest.is_protected(pt.under, name) then + return + end + + -- check if pointing at trellis + if under.name ~= "farming:trellis" then + return + end + + -- add the node and remove 1 item from the itemstack + minetest.set_node(pt.under, {name = plantname}) + + minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0}) + + if placer and not farming.is_creative(placer:get_player_name()) then + + itemstack:take_item() + + -- check for refill + if itemstack:get_count() == 0 then + + minetest.after(0.20, + farming.refill_plant, + placer, + "farming:grapes", + placer:get_wield_index() + ) + end + end + + return itemstack +end + +-- grapes +minetest.register_craftitem("farming:grapes", { + description = S("Grapes"), + inventory_image = "farming_grapes.png", + on_use = minetest.item_eat(2), + groups = {food_grapes = 1, flammable = 3}, + + on_place = function(itemstack, placer, pointed_thing) + return place_grapes(itemstack, placer, pointed_thing, "farming:grapes_1") + end, +}) + +-- grapes can be used for violet dye +minetest.register_craft({ + output = "dye:violet", + recipe = { + {'farming:grapes'}, + } +}) + +-- trellis +minetest.register_node("farming:trellis", { + description = S("Trellis (place on soil before planting grapes)"), + drawtype = "plantlike", + tiles = {"farming_trellis.png"}, + inventory_image = "farming_trellis.png", + visual_scale = 1.9, -- 1.45, + paramtype = "light", + walkable = false, + buildable_to = true, + sunlight_propagates = true, + drop = "farming:trellis", + selection_box = farming.select, + groups = {snappy = 3, flammable = 2, attached_node = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_place = function(itemstack, placer, pointed_thing) + + local pt = pointed_thing + + -- check if pointing at a node + if not pt or pt.type ~= "node" then + return + end + + local under = minetest.get_node(pt.under) + + -- return if any of the nodes are not registered + if not minetest.registered_nodes[under.name] then + return + end + + -- am I right-clicking on something that has a custom on_place set? + -- thanks to Krock for helping with this issue :) + local def = minetest.registered_nodes[under.name] + if def and def.on_rightclick then + return def.on_rightclick(pt.under, under, placer, itemstack) + end + + if minetest.is_protected(pt.above, placer:get_player_name()) then + return + end + + local nodename = under.name + + if minetest.get_item_group(nodename, "soil") < 2 then + return + end + + local top = { + x = pointed_thing.above.x, + y = pointed_thing.above.y + 1, + z = pointed_thing.above.z + } + + nodename = minetest.get_node(top).name + + if nodename ~= "air" then + return + end + + minetest.set_node(pointed_thing.above, {name = "farming:trellis"}) + + if not farming.is_creative(placer:get_player_name()) then + itemstack:take_item() + end + + return itemstack + end +}) + +minetest.register_craft({ + output = "farming:trellis", + recipe = { + {'default:stick', 'default:stick', 'default:stick'}, + {'default:stick', 'default:stick', 'default:stick'}, + {'default:stick', 'default:stick', 'default:stick'}, + } +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:trellis", + burntime = 15, +}) + +-- grapes definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_grapes_1.png"}, + visual_scale = 1.9, -- 1.45, + paramtype = "light", + walkable = false, + buildable_to = true, + sunlight_propagates = true, + drop = { + items = { + {items = {'farming:trellis'}, rarity = 1}, + } + }, + selection_box = farming.select, + groups = { + snappy = 3, flammable = 3, not_in_creative_inventory = 1, + attached_node = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:grapes_1", table.copy(crop_def)) + +-- stage2 +crop_def.tiles = {"farming_grapes_2.png"} +minetest.register_node("farming:grapes_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_grapes_3.png"} +minetest.register_node("farming:grapes_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_grapes_4.png"} +minetest.register_node("farming:grapes_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_grapes_5.png"} +minetest.register_node("farming:grapes_5", table.copy(crop_def)) + +-- stage 6 +crop_def.tiles = {"farming_grapes_6.png"} +minetest.register_node("farming:grapes_6", table.copy(crop_def)) + +-- stage 7 +crop_def.tiles = {"farming_grapes_7.png"} +minetest.register_node("farming:grapes_7", table.copy(crop_def)) + +-- stage 8 (final) +crop_def.tiles = {"farming_grapes_8.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:trellis'}, rarity = 1}, + {items = {'farming:grapes 3'}, rarity = 1}, + {items = {'farming:grapes 1'}, rarity = 2}, + {items = {'farming:grapes 1'}, rarity = 3}, + } +} +minetest.register_node("farming:grapes_8", table.copy(crop_def)) + +-- wild grape vine (this is what you find on the map) +minetest.register_node("farming:grapebush", { + drawtype = "plantlike", + tiles = {"farming_grapebush.png"}, + paramtype = "light", + waving = 1, + walkable = false, + buildable_to = true, + sunlight_propagates = true, + drop = { + items = { + {items = {'farming:grapes 1'}, rarity = 1}, + {items = {'farming:grapes 1'}, rarity = 2}, + {items = {'farming:grapes 1'}, rarity = 3}, + } + }, + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory=1 + }, + sounds = default.node_sound_leaves_defaults(), +}) diff --git a/farming/crops/hemp.lua b/farming/crops/hemp.lua new file mode 100644 index 0000000..eb522a9 --- /dev/null +++ b/farming/crops/hemp.lua @@ -0,0 +1,251 @@ + +local S = farming.intllib + +-- hemp seeds +minetest.register_node("farming:seed_hemp", { + description = S("Hemp Seed"), + tiles = {"farming_hemp_seed.png"}, + inventory_image = "farming_hemp_seed.png", + wield_image = "farming_hemp_seed.png", + drawtype = "signlike", + groups = {seed = 1, snappy = 3, attached_node = 1}, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = farming.select, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:hemp_1") + end, +}) + +-- harvested hemp +minetest.register_craftitem("farming:hemp_leaf", { + description = S("Hemp Leaf"), + inventory_image = "farming_hemp_leaf.png", +}) + +-- hemp oil +minetest.register_node("farming:hemp_oil", { + description = S("Bottle of Hemp Oil"), + drawtype = "plantlike", + tiles = {"farming_hemp_oil.png"}, + inventory_image = "farming_hemp_oil.png", + wield_image = "farming_hemp_oil.png", + paramtype = "light", + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + groups = {food_oil = 1, vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_craft( { + output = "farming:hemp_oil", + recipe = { + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"", "vessels:glass_bottle", ""} + } +}) + +minetest.register_craft( { + output = "farming:hemp_oil", + recipe = { + {"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"}, + {"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"}, + {"farming:seed_hemp", "vessels:glass_bottle", "farming:seed_hemp"} + } +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:hemp_oil", + burntime = 20, + replacements = {{ "farming:hemp_oil", "vessels:glass_bottle"}} +}) + +-- hemp fibre +minetest.register_craftitem("farming:hemp_fibre", { + description = S("Hemp Fibre"), + inventory_image = "farming_hemp_fibre.png", +}) + +minetest.register_craft( { + output = "farming:hemp_fibre 8", + recipe = { + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "bucket:bucket_water", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"} + }, + replacements = {{ "bucket:bucket_water", "bucket:bucket_empty"}} +}) + +minetest.register_craft( { + output = "farming:hemp_fibre 8", + recipe = { + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "bucket:bucket_river_water", "farming:hemp_leaf"}, + {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"} + }, + replacements = {{ "bucket:bucket_river_water", "bucket:bucket_empty"}} +}) + +-- hemp block +minetest.register_node("farming:hemp_block", { + description = S("Hemp Block"), + tiles = {"farming_hemp_block.png"}, + paramtype = "light", + groups = {snappy = 1, oddly_breakable_by_hand = 1, flammable = 2} +}) + +minetest.register_craft( { + output = "farming:hemp_block", + recipe = { + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"} + }, +}) + +-- check and register stairs +if minetest.global_exists("stairs") then + + if stairs.mod and stairs.mod == "redo" then + + stairs.register_all("hemp_block", "farming:hemp_block", + {snappy = 1, flammable = 2}, + {"farming_hemp_block.png"}, + "Hemp Block", + default.node_sound_leaves_defaults()) + else + + stairs.register_stair_and_slab("hemp_block", "farming:hemp_block", + {snappy = 1, flammable = 2}, + {"farming_hemp_block.png"}, + "Hemp Block Stair", + "Hemp Block Slab", + default.node_sound_leaves_defaults()) + end +end + +-- paper +minetest.register_craft( { + output = "default:paper", + recipe = { + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, + } +}) + +-- string +minetest.register_craft( { + output = "farming:cotton", + recipe = { + {"farming:hemp_fibre"}, + {"farming:hemp_fibre"}, + {"farming:hemp_fibre"}, + } +}) + +-- hemp rope +minetest.register_node("farming:hemp_rope", { + description = S("Hemp Rope"), + walkable = false, + climbable = true, + sunlight_propagates = true, + paramtype = "light", + tiles = {"farming_hemp_rope.png"}, + wield_image = "farming_hemp_rope.png", + inventory_image = "farming_hemp_rope.png", + drawtype = "plantlike", + groups = {flammable = 2, choppy = 3, oddly_breakable_by_hand = 3}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, + }, +}) + +-- string +minetest.register_craft( { + output = "farming:hemp_rope 6", + recipe = { + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, + {"farming:cotton", "farming:cotton", "farming:cotton"}, + {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, + } +}) + +-- hemp definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_hemp_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:hemp_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_hemp_2.png"} +minetest.register_node("farming:hemp_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_hemp_3.png"} +minetest.register_node("farming:hemp_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_hemp_4.png"} +minetest.register_node("farming:hemp_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_hemp_5.png"} +minetest.register_node("farming:hemp_5", table.copy(crop_def)) + +-- stage 6 +crop_def.tiles = {"farming_hemp_6.png"} +crop_def.drop = { + items = { + {items = {'farming:hemp_leaf'}, rarity = 2}, + {items = {'farming:seed_hemp'}, rarity = 1}, + } +} +minetest.register_node("farming:hemp_6", table.copy(crop_def)) + +-- stage 7 +crop_def.tiles = {"farming_hemp_7.png"} +crop_def.drop = { + items = { + {items = {'farming:hemp_leaf'}, rarity = 1}, + {items = {'farming:hemp_leaf'}, rarity = 3}, + {items = {'farming:seed_hemp'}, rarity = 1}, + {items = {'farming:seed_hemp'}, rarity = 3}, + } +} +minetest.register_node("farming:hemp_7", table.copy(crop_def)) + +-- stage 8 (final) +crop_def.tiles = {"farming_hemp_8.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:hemp_leaf 2'}, rarity = 1}, + {items = {'farming:hemp_leaf'}, rarity = 2}, + {items = {'farming:seed_hemp'}, rarity = 1}, + {items = {'farming:seed_hemp'}, rarity = 2}, + } +} +minetest.register_node("farming:hemp_8", table.copy(crop_def)) diff --git a/farming/crops/melon.lua b/farming/crops/melon.lua new file mode 100644 index 0000000..2165558 --- /dev/null +++ b/farming/crops/melon.lua @@ -0,0 +1,86 @@ + +local S = farming.intllib + +-- melon +minetest.register_craftitem("farming:melon_slice", { + description = S("Melon Slice"), + inventory_image = "farming_melon_slice.png", + groups = {food_melon_slice = 1, flammable = 3}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:melon_1") + end, + on_use = minetest.item_eat(2), +}) + +minetest.register_craft({ + output = "farming:melon_8", + recipe = { + {"farming:melon_slice", "farming:melon_slice", "farming:melon_slice"}, + {"farming:melon_slice", "farming:melon_slice", "farming:melon_slice"}, + {"farming:melon_slice", "farming:melon_slice", "farming:melon_slice"}, + } +}) + +minetest.register_craft({ + output = "farming:melon_slice 9", + recipe = { + {"", "farming:melon_8", ""}, + } +}) + +-- melon definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_melon_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:melon_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_melon_2.png"} +minetest.register_node("farming:melon_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_melon_3.png"} +minetest.register_node("farming:melon_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_melon_4.png"} +minetest.register_node("farming:melon_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_melon_5.png"} +minetest.register_node("farming:melon_5", table.copy(crop_def)) + +-- stage 6 +crop_def.tiles = {"farming_melon_6.png"} +minetest.register_node("farming:melon_6", table.copy(crop_def)) + +-- stage 7 +crop_def.tiles = {"farming_melon_7.png"} +minetest.register_node("farming:melon_7", table.copy(crop_def)) + +-- stage 8 (final) +crop_def.drawtype = "nodebox" +crop_def.description = S("Melon") +crop_def.tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"} +crop_def.selection_box = {-.5, -.5, -.5, .5, .5, .5} +crop_def.walkable = true +crop_def.groups = { + food_melon = 1, snappy = 1, oddly_breakable_by_hand = 1, + flammable = 2, plant = 1 +} +crop_def.drop = "farming:melon_slice 9" +minetest.register_node("farming:melon_8", table.copy(crop_def)) diff --git a/farming/crops/onion.lua b/farming/crops/onion.lua new file mode 100644 index 0000000..d9268f8 --- /dev/null +++ b/farming/crops/onion.lua @@ -0,0 +1,68 @@ + +--[[ + Original textures from Crops Plus mod + Copyright (C) 2018 Grizzly Adam + https://forum.minetest.net/viewtopic.php?f=9&t=19488 +]] + +local S = farming.intllib + +-- potato +minetest.register_craftitem("farming:onion", { + description = S("Onion"), + inventory_image = "crops_onion.png", + groups = {food_onion = 1, flammable = 3}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:onion_1") + end, + on_use = minetest.item_eat(1), +}) + +-- crop definition +local crop_def = { + drawtype = "plantlike", + tiles = {"crops_onion_plant_1.png"}, + paramtype = "light", + paramtype2 = "meshoptions", + place_param2 = 3, + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 3, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:onion_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"crops_onion_plant_2.png"} +minetest.register_node("farming:onion_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"crops_onion_plant_3.png"} +minetest.register_node("farming:onion_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"crops_onion_plant_4.png"} +minetest.register_node("farming:onion_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"crops_onion_plant_5.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + max_items = 5, items = { + {items = {'farming:onion'}, rarity = 1}, + {items = {'farming:onion'}, rarity = 1}, + {items = {'farming:onion'}, rarity = 2}, + {items = {'farming:onion'}, rarity = 2}, + {items = {'farming:onion'}, rarity = 5}, + } +} +minetest.register_node("farming:onion_5", table.copy(crop_def)) diff --git a/farming/crops/peas.lua b/farming/crops/peas.lua new file mode 100644 index 0000000..e50564e --- /dev/null +++ b/farming/crops/peas.lua @@ -0,0 +1,89 @@ + +local S = farming.intllib + +-- Textures for Pea crop and Peas were done by Andrey01 + +-- pea pod +minetest.register_craftitem("farming:pea_pod", { + description = S("Pea Pod"), + inventory_image = "farming_pea_pod.png", + groups = {food_pea_pod = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:pea_1") + end +}) + +minetest.register_craftitem("farming:peas", { + description = S("Peas"), + inventory_image = "farming_pea_peas.png", + groups = {food_peas = 1, flammable = 2}, + on_use = minetest.item_eat(1) +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:peas", + recipe = {"farming:pea_pod"} +}) + +-- pea soup +minetest.register_craftitem("farming:pea_soup", { + description = S("Pea Soup"), + inventory_image = "farming_pea_soup.png", + groups = {flammable = 2}, + on_use = minetest.item_eat(4, "farming:bowl"), +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:pea_soup", + recipe = {"group:food_peas", "group:food_peas", "group:food_bowl"} +}) + +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_pea_1.png"}, + paramtype = "light", + paramtype2 = "meshoptions", + place_param2 = 3, + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 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:pea_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_pea_2.png"} +minetest.register_node("farming:pea_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_pea_3.png"} +minetest.register_node("farming:pea_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_pea_4.png"} +minetest.register_node("farming:pea_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_pea_5.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + max_items = 5, items = { + {items = {'farming:pea_pod'}, rarity = 1}, + {items = {'farming:pea_pod'}, rarity = 2}, + {items = {'farming:pea_pod'}, rarity = 3}, + {items = {'farming:pea_pod'}, rarity = 4}, + {items = {'farming:pea_pod'}, rarity = 5}, + } +} +minetest.register_node("farming:pea_5", table.copy(crop_def)) diff --git a/farming/crops/pepper.lua b/farming/crops/pepper.lua new file mode 100644 index 0000000..498556e --- /dev/null +++ b/farming/crops/pepper.lua @@ -0,0 +1,106 @@ + +--[[ + Original textures from Crops Plus mod + Copyright (C) 2018 Grizzly Adam + https://forum.minetest.net/viewtopic.php?f=9&t=19488 +]] + +local S = farming.intllib + +-- peppercorn (seed) +minetest.register_craftitem("farming:peppercorn", { + description = S("Peppercorn"), + inventory_image = "crops_peppercorn.png", + groups = {food_peppercorn = 1, flammable = 3}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:pepper_1") + end, +}) + +-- green pepper +minetest.register_craftitem("farming:pepper", { + description = S("Pepper"), + inventory_image = "crops_pepper.png", + on_use = minetest.item_eat(2), + groups = {food_pepper = 1, flammable = 3}, +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:peppercorn", + recipe = {"farming:pepper"} +}) + +-- ground pepper +minetest.register_node("farming:pepper_ground", { + description = ("Ground Pepper"), + inventory_image = "crops_pepper_ground.png", + wield_image = "crops_pepper_ground.png", + drawtype = "plantlike", + visual_scale = 0.8, + paramtype = "light", + tiles = {"crops_pepper_ground.png"}, + groups = { + vessel = 1, food_pepper_ground = 1, + dig_immediate = 3, attached_node = 1 + }, + sounds = default.node_sound_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, +}) + +minetest.register_craft( { + output = "farming:pepper_ground", + type = "shapeless", + recipe = {"group:food_peppercorn", "vessels:glass_bottle", "farming:mortar_pestle"}, + replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}, +}) + +-- crop definition +local crop_def = { + drawtype = "plantlike", + tiles = {"crops_pepper_plant_1.png"}, + paramtype = "light", + paramtype2 = "meshoptions", + place_param2 = 1, + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 3, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:pepper_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"crops_pepper_plant_2.png"} +minetest.register_node("farming:pepper_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"crops_pepper_plant_3.png"} +minetest.register_node("farming:pepper_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"crops_pepper_plant_4.png"} +minetest.register_node("farming:pepper_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"crops_pepper_plant_5.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + max_items = 2, items = { + {items = {'farming:pepper 2'}, rarity = 1}, + {items = {'farming:pepper'}, rarity = 2}, + {items = {'farming:pepper'}, rarity = 3}, + } +} +minetest.register_node("farming:pepper_5", table.copy(crop_def)) diff --git a/farming/crops/pineapple.lua b/farming/crops/pineapple.lua new file mode 100644 index 0000000..3525136 --- /dev/null +++ b/farming/crops/pineapple.lua @@ -0,0 +1,129 @@ + +local S = farming.intllib + +-- pineapple top +minetest.register_craftitem("farming:pineapple_top", { + description = S("Pineapple Top"), + inventory_image = "farming_pineapple_top.png", + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:pineapple_1") + end, +}) + +-- pineapple +minetest.register_node("farming:pineapple", { + description = S("Pineapple"), + drawtype = "plantlike", + tiles = {"farming_pineapple.png"}, + inventory_image = "farming_pineapple.png", + wield_image = "farming_pineapple.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.27, -0.37, -0.27, 0.27, 0.44, 0.27} + }, + groups = {food_pineapple = 1, fleshy = 3, dig_immediate = 3, flammable = 2}, +}) + +-- pineapple +minetest.register_craftitem("farming:pineapple_ring", { + description = S("Pineapple Ring"), + inventory_image = "farming_pineapple_ring.png", + groups = {food_pineapple_ring = 1, flammable = 2}, + on_use = minetest.item_eat(1), +}) + +minetest.register_craft( { + output = "farming:pineapple_ring 5", + type = "shapeless", + recipe = {"group:food_pineapple"}, + replacements = {{"farming:pineapple", "farming:pineapple_top"}} +}) + +-- pineapple juice +minetest.register_craftitem("farming:pineapple_juice", { + description = S("Pineapple Juice"), + inventory_image = "farming_pineapple_juice.png", + on_use = minetest.item_eat(4, "vessels:drinking_glass"), +}) + +minetest.register_craft({ + output = "farming:pineapple_juice", + type = "shapeless", + recipe = {"vessels:drinking_glass", "group:food_pineapple_ring", + "group:food_pineapple_ring", "group:food_pineapple_ring", + "farming:juicer"}, + replacements = { + {"group:food_juicer", "farming:juicer"}, + }, +}) + +minetest.register_craft({ + output = "farming:pineapple_juice 2", + type = "shapeless", + recipe = { + "vessels:drinking_glass", "vessels:drinking_glass", + "group:food_pineapple", "farming:juicer" + }, + replacements = { + {"group:food_juicer", "farming:juicer"}, + }, +}) + +-- crop definition +local crop_def = { + drawtype = "plantlike", + visual_scale = 1.5, + tiles = {"farming_pineapple_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:pineapple_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_pineapple_2.png"} +minetest.register_node("farming:pineapple_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_pineapple_3.png"} +minetest.register_node("farming:pineapple_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_pineapple_4.png"} +minetest.register_node("farming:pineapple_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_pineapple_5.png"} +minetest.register_node("farming:pineapple_5", table.copy(crop_def)) + +-- stage 6 +crop_def.tiles = {"farming_pineapple_6.png"} +minetest.register_node("farming:pineapple_6", table.copy(crop_def)) + +-- stage 7 +crop_def.tiles = {"farming_pineapple_7.png"} +minetest.register_node("farming:pineapple_7", table.copy(crop_def)) + +-- stage 8 (final) +crop_def.tiles = {"farming_pineapple_8.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:pineapple'}, rarity = 1}, + {items = {'farming:pineapple'}, rarity = 15}, + } +} +minetest.register_node("farming:pineapple_8", table.copy(crop_def)) diff --git a/farming/crops/potato.lua b/farming/crops/potato.lua new file mode 100644 index 0000000..a1512c2 --- /dev/null +++ b/farming/crops/potato.lua @@ -0,0 +1,94 @@ + +--[[ + Original textures from DocFarming mod + https://forum.minetest.net/viewtopic.php?id=3948 +]] + +local S = farming.intllib + +-- potato +minetest.register_craftitem("farming:potato", { + description = S("Potato"), + inventory_image = "farming_potato.png", + groups = {food_potato = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:potato_1") + end, + on_use = minetest.item_eat(1), +}) + +-- baked potato +minetest.register_craftitem("farming:baked_potato", { + description = S("Baked Potato"), + inventory_image = "farming_baked_potato.png", + on_use = minetest.item_eat(6), +}) + +minetest.register_craft({ + type = "cooking", + cooktime = 10, + output = "farming:baked_potato", + recipe = "group:food_potato" +}) + +-- Potato and cucumber Salad +minetest.register_craftitem("farming:potato_salad", { + description = S("Cucumber and Potato Salad"), + inventory_image = "farming_potato_salad.png", + on_use = minetest.item_eat(10, "farming:bowl"), +}) + +minetest.register_craft({ + output = "farming:potato_salad", + recipe = { + {"group:food_cucumber"}, + {"farming:baked_potato"}, + {"group:food_bowl"}, + } +}) + +-- potato definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_potato_1.png"}, + paramtype = "light", + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:potato_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_potato_2.png"} +minetest.register_node("farming:potato_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_potato_3.png"} +crop_def.drop = { + items = { + {items = {'farming:potato'}, rarity = 1}, + {items = {'farming:potato'}, rarity = 3}, + } +} +minetest.register_node("farming:potato_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_potato_4.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:potato 2'}, rarity = 1}, + {items = {'farming:potato 3'}, rarity = 2}, + } +} +minetest.register_node("farming:potato_4", table.copy(crop_def)) diff --git a/farming/crops/pumpkin.lua b/farming/crops/pumpkin.lua new file mode 100644 index 0000000..d8e8ec6 --- /dev/null +++ b/farming/crops/pumpkin.lua @@ -0,0 +1,211 @@ + +--[[ + Big thanks to PainterlyPack.net for allowing me to use these textures +]] + +local S = farming.intllib + +-- pumpkin +minetest.register_node("farming:pumpkin", { + description = S("Pumpkin"), + tiles = { + "farming_pumpkin_top.png", + "farming_pumpkin_top.png", + "farming_pumpkin_side.png" + }, + groups = { + food_pumpkin = 1, choppy = 1, oddly_breakable_by_hand = 1, + flammable = 2, plant = 1 + }, + drop = { + items = { + {items = {'farming:pumpkin_slice 9'}, rarity = 1}, + } + }, + sounds = default.node_sound_wood_defaults(), +}) + +-- pumpkin slice +minetest.register_craftitem("farming:pumpkin_slice", { + description = S("Pumpkin Slice"), + inventory_image = "farming_pumpkin_slice.png", + groups = {food_pumpkin_slice = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1") + end, + on_use = minetest.item_eat(2), +}) + +minetest.register_craft({ + output = "farming:pumpkin", + recipe = { + {"farming:pumpkin_slice", "farming:pumpkin_slice", "farming:pumpkin_slice"}, + {"farming:pumpkin_slice", "farming:pumpkin_slice", "farming:pumpkin_slice"}, + {"farming:pumpkin_slice", "farming:pumpkin_slice", "farming:pumpkin_slice"}, + } +}) + +minetest.register_craft({ + output = "farming:pumpkin_slice 9", + recipe = { + {"", "farming:pumpkin", ""}, + } +}) + +-- jack 'o lantern +minetest.register_node("farming:jackolantern", { + description = S("Jack 'O Lantern (punch to turn on and off)"), + tiles = { + "farming_pumpkin_top.png", + "farming_pumpkin_top.png", + "farming_pumpkin_side.png", + "farming_pumpkin_side.png", + "farming_pumpkin_side.png", + "farming_pumpkin_face_off.png" + }, + paramtype2 = "facedir", + groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + on_punch = function(pos, node, puncher) + node.name = "farming:jackolantern_on" + minetest.swap_node(pos, node) + end, +}) + +minetest.register_node("farming:jackolantern_on", { + tiles = { + "farming_pumpkin_top.png", + "farming_pumpkin_top.png", + "farming_pumpkin_side.png", + "farming_pumpkin_side.png", + "farming_pumpkin_side.png", + "farming_pumpkin_face_on.png" + }, + light_source = default.LIGHT_MAX - 1, + paramtype2 = "facedir", + groups = { + choppy = 1, oddly_breakable_by_hand = 1, flammable = 2, + not_in_creative_inventory = 1 + }, + sounds = default.node_sound_wood_defaults(), + drop = "farming:jackolantern", + on_punch = function(pos, node, puncher) + node.name = "farming:jackolantern" + minetest.swap_node(pos, node) + end, +}) + +minetest.register_craft({ + output = "farming:jackolantern", + recipe = { + {"default:torch"}, + {"group:food_pumpkin"}, + } +}) + +--- wooden scarecrow base +minetest.register_node("farming:scarecrow_bottom", { + paramtype = "light", + sunlight_propagates = true, + paramtype2 = "facedir", + tiles = {"default_wood.png"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-1/16, -8/16, -1/16, 1/16, 8/16, 1/16}, + {-12/16, 4/16, -1/16, 12/16, 2/16, 1/16}, + }, + }, + groups = {snappy = 3, flammable = 2}, +}) + +minetest.register_craft({ + output = "farming:scarecrow_bottom", + recipe = { + {"", "group:stick", "",}, + {"group:stick", "group:stick", "group:stick",}, + {"", "group:stick", "",} + } +}) + +-- pumpkin bread +minetest.register_craftitem("farming:pumpkin_bread", { + description = S("Pumpkin Bread"), + inventory_image = "farming_pumpkin_bread.png", + on_use = minetest.item_eat(8), + groups = {food_bread = 1, flammable = 2}, +}) + +minetest.register_craftitem("farming:pumpkin_dough", { + description = S("Pumpkin Dough"), + inventory_image = "farming_pumpkin_dough.png", +}) + +minetest.register_craft({ + output = "farming:pumpkin_dough", + type = "shapeless", + recipe = {"group:food_flour", "group:food_pumpkin_slice", "group:food_pumpkin_slice"} +}) + +minetest.register_craft({ + type = "cooking", + output = "farming:pumpkin_bread", + recipe = "farming:pumpkin_dough", + cooktime = 10 +}) + +-- pumpkin definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_pumpkin_1.png"}, + paramtype = "light", + sunlight_propagates = true, + waving = 1, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:pumpkin_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_pumpkin_2.png"} +minetest.register_node("farming:pumpkin_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_pumpkin_3.png"} +minetest.register_node("farming:pumpkin_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_pumpkin_4.png"} +minetest.register_node("farming:pumpkin_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_pumpkin_5.png"} +minetest.register_node("farming:pumpkin_5", table.copy(crop_def)) + +-- stage 6 +crop_def.tiles = {"farming_pumpkin_6.png"} +minetest.register_node("farming:pumpkin_6", table.copy(crop_def)) + +-- stage 7 +crop_def.tiles = {"farming_pumpkin_7.png"} +minetest.register_node("farming:pumpkin_7", table.copy(crop_def)) + +-- stage 8 (final) +crop_def.tiles = {"farming_pumpkin_8.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:pumpkin_slice 9'}, rarity = 1}, + } +} +minetest.register_node("farming:pumpkin_8", table.copy(crop_def)) diff --git a/farming/crops/raspberry.lua b/farming/crops/raspberry.lua new file mode 100644 index 0000000..713ea2f --- /dev/null +++ b/farming/crops/raspberry.lua @@ -0,0 +1,69 @@ + +local S = farming.intllib + +-- raspberries +minetest.register_craftitem("farming:raspberries", { + description = S("Raspberries"), + inventory_image = "farming_raspberries.png", + groups = {food_raspberries = 1, food_raspberry = 1, food_berry = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:raspberry_1") + end, + on_use = minetest.item_eat(1), +}) + +-- raspberry smoothie +minetest.register_craftitem("farming:smoothie_raspberry", { + description = S("Raspberry Smoothie"), + inventory_image = "farming_raspberry_smoothie.png", + on_use = minetest.item_eat(2, "vessels:drinking_glass"), +}) + +minetest.register_craft({ + output = "farming:smoothie_raspberry", + recipe = { + {"default:snow"}, + {"group:food_raspberries"}, + {"vessels:drinking_glass"}, + } +}) + +-- raspberries definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_raspberry_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:raspberry_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_raspberry_2.png"} +minetest.register_node("farming:raspberry_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_raspberry_3.png"} +minetest.register_node("farming:raspberry_3", table.copy(crop_def)) + +-- stage 4 (final) +crop_def.tiles = {"farming_raspberry_4.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:raspberries 2'}, rarity = 1}, + {items = {'farming:raspberries'}, rarity = 2}, + {items = {'farming:raspberries'}, rarity = 3}, + } +} +minetest.register_node("farming:raspberry_4", table.copy(crop_def)) diff --git a/farming/crops/rhubarb.lua b/farming/crops/rhubarb.lua new file mode 100644 index 0000000..90a2d8b --- /dev/null +++ b/farming/crops/rhubarb.lua @@ -0,0 +1,66 @@ + +local S = farming.intllib + +-- rhubarb +minetest.register_craftitem("farming:rhubarb", { + description = S("Rhubarb"), + inventory_image = "farming_rhubarb.png", + groups = {food_rhubarb = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:rhubarb_1") + end, + on_use = minetest.item_eat(1), +}) + +-- rhubarb pie +minetest.register_craftitem("farming:rhubarb_pie", { + description = S("Rhubarb Pie"), + inventory_image = "farming_rhubarb_pie.png", + on_use = minetest.item_eat(6), +}) + +minetest.register_craft({ + output = "farming:rhubarb_pie", + recipe = { + {"farming:baking_tray", "group:food_sugar", ""}, + {"group:food_rhubarb", "group:food_rhubarb", "group:food_rhubarb"}, + {"group:food_wheat", "group:food_wheat", "group:food_wheat"}, + }, + replacements = {{"group:food_baking_tray", "farming:baking_tray"}} +}) + +-- rhubarb definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_rhubarb_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:rhubarb_1", table.copy(crop_def)) + +-- stage2 +crop_def.tiles = {"farming_rhubarb_2.png"} +minetest.register_node("farming:rhubarb_2", table.copy(crop_def)) + +-- stage 3 (final) +crop_def.tiles = {"farming_rhubarb_3.png"} +crop_def.groups.growing = 0 +crop_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(crop_def)) diff --git a/farming/crops/tomato.lua b/farming/crops/tomato.lua new file mode 100644 index 0000000..53012a8 --- /dev/null +++ b/farming/crops/tomato.lua @@ -0,0 +1,79 @@ + +--[[ + Textures edited from: + http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1288375-food-plus-mod-more-food-than-you-can-imagine-v2-9) +]] + +local S = farming.intllib + +-- tomato +minetest.register_craftitem("farming:tomato", { + description = S("Tomato"), + inventory_image = "farming_tomato.png", + groups = {food_tomato = 1, flammable = 2}, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:tomato_1") + end, + on_use = minetest.item_eat(4), +}) + +-- tomato definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_tomato_1.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 2, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:tomato_1", table.copy(crop_def)) + +-- stage2 +crop_def.tiles = {"farming_tomato_2.png"} +minetest.register_node("farming:tomato_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_tomato_3.png"} +minetest.register_node("farming:tomato_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_tomato_4.png"} +minetest.register_node("farming:tomato_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_tomato_5.png"} +minetest.register_node("farming:tomato_5", table.copy(crop_def)) + +-- stage 6 +crop_def.tiles = {"farming_tomato_6.png"} +minetest.register_node("farming:tomato_6", table.copy(crop_def)) + +-- stage 7 +crop_def.tiles = {"farming_tomato_7.png"} +crop_def.drop = { + items = { + {items = {'farming:tomato'}, rarity = 1}, + {items = {'farming:tomato'}, rarity = 3}, + } +} +minetest.register_node("farming:tomato_7", table.copy(crop_def)) + +-- stage 8 (final) +crop_def.tiles = {"farming_tomato_8.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:tomato 3'}, rarity = 1}, + {items = {'farming:tomato 3'}, rarity = 2}, + } +} +minetest.register_node("farming:tomato_8", table.copy(crop_def)) diff --git a/farming/crops/wheat.lua b/farming/crops/wheat.lua new file mode 100644 index 0000000..abf3ada --- /dev/null +++ b/farming/crops/wheat.lua @@ -0,0 +1,244 @@ + +local S = farming.intllib + +-- wheat seeds +minetest.register_node("farming:seed_wheat", { + description = S("Wheat Seed"), + tiles = {"farming_wheat_seed.png"}, + inventory_image = "farming_wheat_seed.png", + wield_image = "farming_wheat_seed.png", + drawtype = "signlike", + groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4}, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = farming.select, + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1") + end, +}) + +-- harvested wheat +minetest.register_craftitem("farming:wheat", { + description = S("Wheat"), + inventory_image = "farming_wheat.png", + groups = {food_wheat = 1, flammable = 4}, +}) + +-- straw +minetest.register_node("farming:straw", { + description = S("Straw"), + tiles = {"farming_straw.png"}, + is_ground_content = false, + groups = {snappy = 3, flammable = 4, fall_damage_add_percent = -30}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_craft({ + output = "farming:straw 3", + recipe = { + {"farming:wheat", "farming:wheat", "farming:wheat"}, + {"farming:wheat", "farming:wheat", "farming:wheat"}, + {"farming:wheat", "farming:wheat", "farming:wheat"}, + } +}) + +minetest.register_craft({ + output = "farming:wheat 3", + recipe = { + {"farming:straw"}, + } +}) + +-- check and register stairs +if minetest.global_exists("stairs") then + + if stairs.mod and stairs.mod == "redo" then + + stairs.register_all("straw", "farming:straw", + {snappy = 3, flammable = 4}, + {"farming_straw.png"}, + "Straw", + default.node_sound_leaves_defaults()) + else + + stairs.register_stair_and_slab("straw", "farming:straw", + {snappy = 3, flammable = 4}, + {"farming_straw.png"}, + "Straw Stair", + "Straw Slab", + default.node_sound_leaves_defaults()) + end +end + +-- flour +minetest.register_craftitem("farming:flour", { + description = S("Flour"), + inventory_image = "farming_flour.png", + groups = {food_flour = 1, flammable = 1}, +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:flour", + recipe = { + "farming:wheat", "farming:wheat", "farming:wheat", + "farming:wheat", "farming:mortar_pestle" + }, + replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}, +}) + +-- bread +minetest.register_craftitem("farming:bread", { + description = S("Bread"), + inventory_image = "farming_bread.png", + on_use = minetest.item_eat(5), + groups = {food_bread = 1, flammable = 2}, +}) + +minetest.register_craft({ + type = "cooking", + cooktime = 15, + output = "farming:bread", + recipe = "farming:flour" +}) + +-- sliced bread +minetest.register_craftitem("farming:bread_slice", { + description = S("Sliced Bread"), + inventory_image = "farming_bread_slice.png", + on_use = minetest.item_eat(1), + groups = {food_bread_slice = 1, flammable = 2}, +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:bread_slice 5", + recipe = {"farming:bread", "group:food_cutting_board"}, + replacements = {{"group:food_cutting_board", "farming:cutting_board"}}, +}) + +-- toast +minetest.register_craftitem("farming:toast", { + description = S("Toast"), + inventory_image = "farming_toast.png", + on_use = minetest.item_eat(1), + groups = {food_toast = 1, flammable = 2}, +}) + +minetest.register_craft({ + type = "cooking", + cooktime = 3, + output = "farming:toast", + recipe = "farming:bread_slice" +}) + +-- toast sandwich +minetest.register_craftitem("farming:toast_sandwich", { + description = S("Toast Sandwich"), + inventory_image = "farming_toast_sandwich.png", + on_use = minetest.item_eat(4), + groups = {flammable = 2}, +}) + +minetest.register_craft({ + output = "farming:toast_sandwich", + recipe = { + {"farming:bread_slice"}, + {"farming:toast"}, + {"farming:bread_slice"}, + } +}) + +-- wheat definition +local crop_def = { + drawtype = "plantlike", + tiles = {"farming_wheat_1.png"}, + paramtype = "light", + paramtype2 = "meshoptions", + place_param2 = 3, + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "", + selection_box = farming.select, + groups = { + snappy = 3, flammable = 4, plant = 1, attached_node = 1, + not_in_creative_inventory = 1, growing = 1 + }, + sounds = default.node_sound_leaves_defaults() +} + +-- stage 1 +minetest.register_node("farming:wheat_1", table.copy(crop_def)) + +-- stage 2 +crop_def.tiles = {"farming_wheat_2.png"} +minetest.register_node("farming:wheat_2", table.copy(crop_def)) + +-- stage 3 +crop_def.tiles = {"farming_wheat_3.png"} +minetest.register_node("farming:wheat_3", table.copy(crop_def)) + +-- stage 4 +crop_def.tiles = {"farming_wheat_4.png"} +minetest.register_node("farming:wheat_4", table.copy(crop_def)) + +-- stage 5 +crop_def.tiles = {"farming_wheat_5.png"} +crop_def.drop = { + items = { + {items = {'farming:wheat'}, rarity = 2}, + {items = {'farming:seed_wheat'}, rarity = 2}, + } +} +minetest.register_node("farming:wheat_5", table.copy(crop_def)) + +-- stage 6 +crop_def.tiles = {"farming_wheat_6.png"} +crop_def.drop = { + items = { + {items = {'farming:wheat'}, rarity = 2}, + {items = {'farming:seed_wheat'}, rarity = 1}, + } +} +minetest.register_node("farming:wheat_6", table.copy(crop_def)) + +-- stage 7 +crop_def.tiles = {"farming_wheat_7.png"} +crop_def.drop = { + items = { + {items = {'farming:wheat'}, rarity = 1}, + {items = {'farming:wheat'}, rarity = 3}, + {items = {'farming:seed_wheat'}, rarity = 1}, + {items = {'farming:seed_wheat'}, rarity = 3}, + } +} +minetest.register_node("farming:wheat_7", table.copy(crop_def)) + +-- stage 8 (final) +crop_def.tiles = {"farming_wheat_8.png"} +crop_def.groups.growing = 0 +crop_def.drop = { + items = { + {items = {'farming:wheat'}, rarity = 1}, + {items = {'farming:wheat'}, rarity = 3}, + {items = {'farming:seed_wheat'}, rarity = 1}, + {items = {'farming:seed_wheat'}, rarity = 3}, + } +} +minetest.register_node("farming:wheat_8", table.copy(crop_def)) + +-- fuels +minetest.register_craft({ + type = "fuel", + recipe = "farming:straw", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:wheat", + burntime = 1, +}) diff --git a/farming/cucumber.lua b/farming/cucumber.lua deleted file mode 100644 index 4e6981c..0000000 --- a/farming/cucumber.lua +++ /dev/null @@ -1,56 +0,0 @@ - ---[[ - Original textures from DocFarming mod - https://forum.minetest.net/viewtopic.php?id=3948 -]] - -local S = farming.intllib - --- cucumber -minetest.register_craftitem("farming:cucumber", { - description = S("Cucumber"), - inventory_image = "farming_cucumber.png", - groups = {food_cucumber = 1, flammable = 2}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1") - end, - on_use = minetest.item_eat(4), -}) - --- cucumber definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_cucumber_1.png"}, - paramtype = "light", - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:cucumber_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_cucumber_2.png"} -minetest.register_node("farming:cucumber_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_cucumber_3.png"} -minetest.register_node("farming:cucumber_3", table.copy(crop_def)) - --- stage 4 (final) -crop_def.tiles = {"farming_cucumber_4.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:cucumber 2'}, rarity = 1}, - {items = {'farming:cucumber 2'}, rarity = 2}, - } -} -minetest.register_node("farming:cucumber_4", table.copy(crop_def)) diff --git a/farming/depends.txt b/farming/depends.txt index 9a747d1..650885b 100644 --- a/farming/depends.txt +++ b/farming/depends.txt @@ -1,4 +1,5 @@ default +stairs? intllib? lucky_block? toolranks? diff --git a/farming/donut.lua b/farming/donut.lua deleted file mode 100644 index 9b29d27..0000000 --- a/farming/donut.lua +++ /dev/null @@ -1,76 +0,0 @@ - -local S = farming.intllib - --- Donut (thanks to Bockwurst for making the donut images) -minetest.register_craftitem("farming:donut", { - description = S("Donut"), - inventory_image = "farming_donut.png", - on_use = minetest.item_eat(4), -}) - -minetest.register_craft({ - output = "farming:donut 3", - recipe = { - {"", "group:food_wheat", ""}, - {"group:food_wheat", "group:food_sugar", "group:food_wheat"}, - {"", "group:food_wheat", ""}, - } -}) - --- Chocolate Donut -minetest.register_craftitem("farming:donut_chocolate", { - description = S("Chocolate Donut"), - inventory_image = "farming_donut_chocolate.png", - on_use = minetest.item_eat(6), -}) - -minetest.register_craft({ - output = "farming:donut_chocolate", - recipe = { - {'group:food_cocoa'}, - {'farming:donut'}, - } -}) - --- Apple Donut -minetest.register_craftitem("farming:donut_apple", { - description = S("Apple Donut"), - inventory_image = "farming_donut_apple.png", - on_use = minetest.item_eat(6), -}) - -minetest.register_craft({ - output = "farming:donut_apple", - recipe = { - {'default:apple'}, - {'farming:donut'}, - } -}) - --- Porridge Oats -minetest.register_craftitem("farming:porridge", { - description = S("Porridge"), - inventory_image = "farming_porridge.png", - on_use = minetest.item_eat(6, "farming:bowl"), -}) - -minetest.after(0, function() - - local fluid = "bucket:bucket_water" - local fluid_return = "bucket:bucket_water" - - if minetest.get_modpath("mobs") and mobs and mobs.mod == "redo" then - fluid = "group:food_milk" - fluid_return = "mobs:bucket_milk" - end - - minetest.register_craft({ - type = "shapeless", - output = "farming:porridge", - recipe = { - "group:food_barley", "group:food_barley", "group:food_wheat", - "group:food_wheat", "group:food_bowl", fluid - }, - replacements = {{fluid_return, "bucket:bucket_empty"}} - }) -end) diff --git a/farming/farming.conf_example b/farming/farming.conf_example index 2505054..f652e9c 100644 --- a/farming/farming.conf_example +++ b/farming/farming.conf_example @@ -13,7 +13,6 @@ farming.cucumber = true farming.corn = true farming.coffee = true farming.melon = true -farming.sugar = true farming.pumpkin = true farming.cocoa = true farming.raspberry = true @@ -30,7 +29,6 @@ farming.pepper = true farming.pineapple = true farming.peas = true farming.beetroot = true -farming.donuts = true -- rarety of crops on map, default is 0.001 (higher number = more crops) farming.rarety = 0.002 diff --git a/farming/food.lua b/farming/food.lua new file mode 100644 index 0000000..f099e53 --- /dev/null +++ b/farming/food.lua @@ -0,0 +1,188 @@ + +local S = farming.intllib + +--= Sugar + +minetest.register_craftitem("farming:sugar", { + description = S("Sugar"), + inventory_image = "farming_sugar.png", + groups = {food_sugar = 1, flammable = 3}, +}) + +minetest.register_craft({ + type = "cooking", + cooktime = 3, + output = "farming:sugar 2", + recipe = "default:papyrus", +}) + + +--= Salt + +minetest.register_node("farming:salt", { + description = ("Salt"), + inventory_image = "farming_salt.png", + wield_image = "farming_salt.png", + drawtype = "plantlike", + visual_scale = 0.8, + paramtype = "light", + tiles = {"farming_salt.png"}, + groups = {food_salt = 1, vessel = 1, dig_immediate = 3, + attached_node = 1}, + sounds = default.node_sound_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, +}) + +minetest.register_craft({ + type = "cooking", + cooktime = 15, + output = "farming:salt", + recipe = "bucket:bucket_water", + replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}} +}) + +--= Rose Water + +minetest.register_node("farming:rose_water", { + description = ("Rose Water"), + inventory_image = "farming_rose_water.png", + wield_image = "farming_rose_water.png", + drawtype = "plantlike", + visual_scale = 0.8, + paramtype = "light", + tiles = {"farming_rose_water.png"}, + groups = {food_rose_water = 1, vessel = 1, dig_immediate = 3, + attached_node = 1}, + sounds = default.node_sound_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, +}) + +minetest.register_craft({ + output = "farming:rose_water", + recipe = { + {"flowers:rose", "flowers:rose", "flowers:rose"}, + {"flowers:rose", "flowers:rose", "flowers:rose"}, + {"bucket:bucket_water", "group:food_pot", "vessels:glass_bottle"}, + }, + replacements = { + {"bucket:bucket_water", "bucket:bucket_empty"}, + {"group:food_pot", "farming:pot"}, + } +}) + +--= Turkish Delight + +minetest.register_craftitem("farming:turkish_delight", { + description = S("Turkish Delight"), + inventory_image = "farming_turkish_delight.png", + groups = {flammable = 3}, + on_use = minetest.item_eat(2), +}) + +minetest.register_craft({ + output = "farming:turkish_delight 4", + recipe = { + {"group:food_gelatin", "group:food_sugar", "group:food_gelatin"}, + {"group:food_sugar", "group:food_rose_water", "group:food_sugar"}, + {"group:food_cornstarch", "group:food_sugar", "dye:pink"}, + }, + replacements = { + {"group:food_cornstarch", "farming:bowl"}, + {"group:food_rose_water", "vessels:glass_bottle"}, + }, +}) + +--= Garlic Bread + +minetest.register_craftitem("farming:garlic_bread", { + description = S("Garlic Bread"), + inventory_image = "farming_garlic_bread.png", + groups = {flammable = 3}, + on_use = minetest.item_eat(2), +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:garlic_bread", + recipe = {"group:food_toast", "group:food_garlic_clove", "group:food_garlic_clove"}, +}) + +--= Donuts (thanks to Bockwurst for making the donut images) + +minetest.register_craftitem("farming:donut", { + description = S("Donut"), + inventory_image = "farming_donut.png", + on_use = minetest.item_eat(4), +}) + +minetest.register_craft({ + output = "farming:donut 3", + recipe = { + {"", "group:food_wheat", ""}, + {"group:food_wheat", "group:food_sugar", "group:food_wheat"}, + {"", "group:food_wheat", ""}, + } +}) + +minetest.register_craftitem("farming:donut_chocolate", { + description = S("Chocolate Donut"), + inventory_image = "farming_donut_chocolate.png", + on_use = minetest.item_eat(6), +}) + +minetest.register_craft({ + output = "farming:donut_chocolate", + recipe = { + {'group:food_cocoa'}, + {'farming:donut'}, + } +}) + +minetest.register_craftitem("farming:donut_apple", { + description = S("Apple Donut"), + inventory_image = "farming_donut_apple.png", + on_use = minetest.item_eat(6), +}) + +minetest.register_craft({ + output = "farming:donut_apple", + recipe = { + {'default:apple'}, + {'farming:donut'}, + } +}) + +--= Porridge Oats + +minetest.register_craftitem("farming:porridge", { + description = S("Porridge"), + inventory_image = "farming_porridge.png", + on_use = minetest.item_eat(6, "farming:bowl"), +}) + +minetest.after(0, function() + + local fluid = "bucket:bucket_water" + local fluid_return = "bucket:bucket_water" + + if minetest.get_modpath("mobs") and mobs and mobs.mod == "redo" then + fluid = "group:food_milk" + fluid_return = "mobs:bucket_milk" + end + + minetest.register_craft({ + type = "shapeless", + output = "farming:porridge", + recipe = { + "group:food_barley", "group:food_barley", "group:food_wheat", + "group:food_wheat", "group:food_bowl", fluid + }, + replacements = {{fluid_return, "bucket:bucket_empty"}} + }) +end) diff --git a/farming/garlic.lua b/farming/garlic.lua deleted file mode 100644 index 52ae25f..0000000 --- a/farming/garlic.lua +++ /dev/null @@ -1,129 +0,0 @@ - ---[[ - Original textures from Crops Plus mod - Copyright (C) 2018 Grizzly Adam - https://forum.minetest.net/viewtopic.php?f=9&t=19488 -]] - -local S = farming.intllib - --- potato -minetest.register_craftitem("farming:garlic_clove", { - description = S("Garlic clove"), - inventory_image = "crops_garlic_clove.png", - groups = {food_garlic_clove = 1, flammable = 3}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:garlic_1") - end, -}) - --- garlic bulb -minetest.register_craftitem("farming:garlic", { - description = S("Garlic"), - inventory_image = "crops_garlic.png", - on_use = minetest.item_eat(1), - groups = {food_garlic = 1, flammable = 3}, -}) - -minetest.register_craft({ - type = "shapeless", - output = "farming:garlic_clove 9", - recipe = { "farming:garlic" } -}) - -minetest.register_craft({ - output = "farming:garlic", - recipe = { - {"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"}, - {"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"}, - {"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"} - } -}) - --- garlic braid -minetest.register_node("farming:garlic_braid", { - description = S("Garlic Braid"), - inventory_image = "crops_garlic_braid.png", - wield_image = "crops_garlic_braid.png", - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - tiles = { - "crops_garlic_braid_side.png","crops_garlic_braid.png", - "crops_garlic_braid_side.png^[transformFx","crops_garlic_braid_side.png", - "crops_garlic_braid.png","crops_garlic_braid.png" - }, - groups = {vessel = 1, dig_immediate = 3, flammable = 3}, - sounds = default.node_sound_leaves_defaults(), - node_box = { - type = "fixed", - fixed = { - {-0.13, -0.45, 0.5, 0.13, 0.45, 0.24, - }, - }, - } -}) - -minetest.register_craft({ - output = "farming:garlic_braid", - recipe = { - {"farming:garlic", "farming:garlic", "farming:garlic"}, - {"farming:garlic", "farming:garlic", "farming:garlic"}, - {"farming:garlic", "farming:garlic", "farming:garlic"} - } -}) - -minetest.register_craft({ - type = "shapeless", - output = "farming:garlic 9", - recipe = { "farming:garlic_braid" } -}) - --- crop definition -local crop_def = { - drawtype = "plantlike", - tiles = {"crops_garlic_plant_1.png"}, - paramtype = "light", - paramtype2 = "meshoptions", - place_param2 = 3, - sunlight_propagates = true, - waving = 1, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 3, flora = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:garlic_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"crops_garlic_plant_2.png"} -minetest.register_node("farming:garlic_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"crops_garlic_plant_3.png"} -minetest.register_node("farming:garlic_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"crops_garlic_plant_4.png"} -minetest.register_node("farming:garlic_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"crops_garlic_plant_5.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - max_items = 5, items = { - {items = {'farming:garlic'}, rarity = 1}, - {items = {'farming:garlic'}, rarity = 1}, - {items = {'farming:garlic'}, rarity = 1}, - {items = {'farming:garlic'}, rarity = 2}, - {items = {'farming:garlic'}, rarity = 5}, - } -} -minetest.register_node("farming:garlic_5", table.copy(crop_def)) diff --git a/farming/grapes.lua b/farming/grapes.lua deleted file mode 100644 index 9a6ab9e..0000000 --- a/farming/grapes.lua +++ /dev/null @@ -1,248 +0,0 @@ - -local S = farming.intllib - --- place trellis -local function place_grapes(itemstack, placer, pointed_thing, plantname) - - local pt = pointed_thing - - -- check if pointing at a node - if not pt or pt.type ~= "node" then - - return - end - - local under = minetest.get_node(pt.under) - - -- return if any of the nodes are not registered - if not minetest.registered_nodes[under.name] then - return - end - - -- am I right-clicking on something that has a custom on_place set? - -- thanks to Krock for helping with this issue :) - local def = minetest.registered_nodes[under.name] - if def and def.on_rightclick then - return def.on_rightclick(pt.under, under, placer, itemstack) - end - - -- check if pointing at trellis - if under.name ~= "farming:trellis" then - return - end - - -- add the node and remove 1 item from the itemstack - minetest.set_node(pt.under, {name = plantname}) - - minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0}) - - if not farming.is_creative(placer:get_player_name()) then - - itemstack:take_item() - - -- check for refill - if itemstack:get_count() == 0 then - - minetest.after(0.20, - farming.refill_plant, - placer, - "farming:grapes", - placer:get_wield_index() - ) - end - end - - return itemstack -end - --- grapes -minetest.register_craftitem("farming:grapes", { - description = S("Grapes"), - inventory_image = "farming_grapes.png", - on_use = minetest.item_eat(2), - groups = {food_grapes = 1, flammable = 3}, - - on_place = function(itemstack, placer, pointed_thing) - return place_grapes(itemstack, placer, pointed_thing, "farming:grapes_1") - end, -}) - --- grapes can be used for violet dye -minetest.register_craft({ - output = "dye:violet", - recipe = { - {'farming:grapes'}, - } -}) - --- trellis -minetest.register_node("farming:trellis", { - description = S("Trellis (place on soil before planting grapes)"), - drawtype = "plantlike", - tiles = {"farming_trellis.png"}, - inventory_image = "farming_trellis.png", - visual_scale = 1.9, -- 1.45, - paramtype = "light", - walkable = false, - buildable_to = true, - sunlight_propagates = true, - drop = "farming:trellis", - selection_box = farming.select, - groups = {snappy = 3, flammable = 2, attached_node = 1}, - sounds = default.node_sound_leaves_defaults(), - - on_place = function(itemstack, placer, pointed_thing) - - local pt = pointed_thing - - -- check if pointing at a node - if not pt or pt.type ~= "node" then - return - end - - local under = minetest.get_node(pt.under) - - -- return if any of the nodes are not registered - if not minetest.registered_nodes[under.name] then - return - end - - -- am I right-clicking on something that has a custom on_place set? - -- thanks to Krock for helping with this issue :) - local def = minetest.registered_nodes[under.name] - if def and def.on_rightclick then - return def.on_rightclick(pt.under, under, placer, itemstack) - end - - if minetest.is_protected(pt.under, placer:get_player_name()) then - return - end - - local nodename = under.name - - if minetest.get_item_group(nodename, "soil") < 2 then - return - end - - local top = { - x = pointed_thing.above.x, - y = pointed_thing.above.y + 1, - z = pointed_thing.above.z - } - - nodename = minetest.get_node(top).name - - if nodename ~= "air" then - return - end - - minetest.set_node(pointed_thing.above, {name = "farming:trellis"}) - - if not farming.is_creative(placer:get_player_name()) then - itemstack:take_item() - end - - return itemstack - end -}) - -minetest.register_craft({ - output = "farming:trellis", - recipe = { - {'default:stick', 'default:stick', 'default:stick'}, - {'default:stick', 'default:stick', 'default:stick'}, - {'default:stick', 'default:stick', 'default:stick'}, - } -}) - -minetest.register_craft({ - type = "fuel", - recipe = "farming:trellis", - burntime = 15, -}) - --- grapes definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_grapes_1.png"}, - visual_scale = 1.9, -- 1.45, - paramtype = "light", - walkable = false, - buildable_to = true, - sunlight_propagates = true, - drop = { - items = { - {items = {'farming:trellis'}, rarity = 1}, - } - }, - selection_box = farming.select, - groups = { - snappy = 3, flammable = 3, not_in_creative_inventory = 1, - attached_node = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:grapes_1", table.copy(crop_def)) - --- stage2 -crop_def.tiles = {"farming_grapes_2.png"} -minetest.register_node("farming:grapes_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_grapes_3.png"} -minetest.register_node("farming:grapes_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_grapes_4.png"} -minetest.register_node("farming:grapes_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"farming_grapes_5.png"} -minetest.register_node("farming:grapes_5", table.copy(crop_def)) - --- stage 6 -crop_def.tiles = {"farming_grapes_6.png"} -minetest.register_node("farming:grapes_6", table.copy(crop_def)) - --- stage 7 -crop_def.tiles = {"farming_grapes_7.png"} -minetest.register_node("farming:grapes_7", table.copy(crop_def)) - --- stage 8 (final) -crop_def.tiles = {"farming_grapes_8.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:trellis'}, rarity = 1}, - {items = {'farming:grapes 3'}, rarity = 1}, - {items = {'farming:grapes 1'}, rarity = 2}, - {items = {'farming:grapes 1'}, rarity = 3}, - } -} -minetest.register_node("farming:grapes_8", table.copy(crop_def)) - --- wild grape vine (this is what you find on the map) -minetest.register_node("farming:grapebush", { - drawtype = "plantlike", - tiles = {"farming_grapebush.png"}, - paramtype = "light", - waving = 1, - walkable = false, - buildable_to = true, - sunlight_propagates = true, - drop = { - items = { - {items = {'farming:grapes 1'}, rarity = 1}, - {items = {'farming:grapes 1'}, rarity = 2}, - {items = {'farming:grapes 1'}, rarity = 3}, - } - }, - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory=1 - }, - sounds = default.node_sound_leaves_defaults(), -}) diff --git a/farming/hemp.lua b/farming/hemp.lua deleted file mode 100644 index 34dd56d..0000000 --- a/farming/hemp.lua +++ /dev/null @@ -1,230 +0,0 @@ - -local S = farming.intllib - --- hemp seeds -minetest.register_node("farming:seed_hemp", { - description = S("Hemp Seed"), - tiles = {"farming_hemp_seed.png"}, - inventory_image = "farming_hemp_seed.png", - wield_image = "farming_hemp_seed.png", - drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1}, - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - sunlight_propagates = true, - selection_box = farming.select, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:hemp_1") - end, -}) - --- harvested hemp -minetest.register_craftitem("farming:hemp_leaf", { - description = S("Hemp Leaf"), - inventory_image = "farming_hemp_leaf.png", -}) - --- hemp oil -minetest.register_node("farming:hemp_oil", { - description = S("Bottle of Hemp Oil"), - drawtype = "plantlike", - tiles = {"farming_hemp_oil.png"}, - inventory_image = "farming_hemp_oil.png", - wield_image = "farming_hemp_oil.png", - paramtype = "light", - is_ground_content = false, - walkable = false, - selection_box = { - type = "fixed", - fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} - }, - groups = {food_oil = 1, vessel = 1, dig_immediate = 3, attached_node = 1}, - sounds = default.node_sound_glass_defaults(), -}) - -minetest.register_craft( { - output = "farming:hemp_oil", - recipe = { - {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, - {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, - {"", "vessels:glass_bottle", ""} - } -}) - -minetest.register_craft( { - output = "farming:hemp_oil", - recipe = { - {"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"}, - {"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"}, - {"farming:seed_hemp", "vessels:glass_bottle", "farming:seed_hemp"} - } -}) - -minetest.register_craft({ - type = "fuel", - recipe = "farming:hemp_oil", - burntime = 20, - replacements = {{ "farming:hemp_oil", "vessels:glass_bottle"}} -}) - --- hemp fibre -minetest.register_craftitem("farming:hemp_fibre", { - description = S("Hemp Fibre"), - inventory_image = "farming_hemp_fibre.png", -}) - -minetest.register_craft( { - output = "farming:hemp_fibre 8", - recipe = { - {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, - {"farming:hemp_leaf", "bucket:bucket_water", "farming:hemp_leaf"}, - {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"} - }, - replacements = {{ "bucket:bucket_water", "bucket:bucket_empty"}} -}) - -minetest.register_craft( { - output = "farming:hemp_fibre 8", - recipe = { - {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}, - {"farming:hemp_leaf", "bucket:bucket_river_water", "farming:hemp_leaf"}, - {"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"} - }, - replacements = {{ "bucket:bucket_river_water", "bucket:bucket_empty"}} -}) - --- hemp block -minetest.register_node("farming:hemp_block", { - description = S("Hemp Block"), - tiles = {"farming_hemp_block.png"}, - paramtype = "light", - groups = {snappy = 1, oddly_breakable_by_hand = 1, flammable = 2} -}) - -minetest.register_craft( { - output = "farming:hemp_block", - recipe = { - {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, - {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, - {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"} - }, -}) - --- paper -minetest.register_craft( { - output = "default:paper", - recipe = { - {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, - } -}) - --- string -minetest.register_craft( { - output = "farming:cotton", - recipe = { - {"farming:hemp_fibre"}, - {"farming:hemp_fibre"}, - {"farming:hemp_fibre"}, - } -}) - --- hemp rope -minetest.register_node("farming:hemp_rope", { - description = S("Hemp Rope"), - walkable = false, - climbable = true, - sunlight_propagates = true, - paramtype = "light", - tiles = {"farming_hemp_rope.png"}, - wield_image = "farming_hemp_rope.png", - inventory_image = "farming_hemp_rope.png", - drawtype = "plantlike", - groups = {flammable = 2, choppy = 3, oddly_breakable_by_hand = 3}, - sounds = default.node_sound_leaves_defaults(), - selection_box = { - type = "fixed", - fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, - }, -}) - --- string -minetest.register_craft( { - output = "farming:hemp_rope 6", - recipe = { - {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, - {"farming:cotton", "farming:cotton", "farming:cotton"}, - {"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}, - } -}) - --- hemp definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_hemp_1.png"}, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:hemp_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_hemp_2.png"} -minetest.register_node("farming:hemp_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_hemp_3.png"} -minetest.register_node("farming:hemp_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_hemp_4.png"} -minetest.register_node("farming:hemp_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"farming_hemp_5.png"} -minetest.register_node("farming:hemp_5", table.copy(crop_def)) - --- stage 6 -crop_def.tiles = {"farming_hemp_6.png"} -crop_def.drop = { - items = { - {items = {'farming:hemp_leaf'}, rarity = 2}, - {items = {'farming:seed_hemp'}, rarity = 1}, - } -} -minetest.register_node("farming:hemp_6", table.copy(crop_def)) - --- stage 7 -crop_def.tiles = {"farming_hemp_7.png"} -crop_def.drop = { - items = { - {items = {'farming:hemp_leaf'}, rarity = 1}, - {items = {'farming:hemp_leaf'}, rarity = 3}, - {items = {'farming:seed_hemp'}, rarity = 1}, - {items = {'farming:seed_hemp'}, rarity = 3}, - } -} -minetest.register_node("farming:hemp_7", table.copy(crop_def)) - --- stage 8 (final) -crop_def.tiles = {"farming_hemp_8.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:hemp_leaf 2'}, rarity = 1}, - {items = {'farming:hemp_leaf'}, rarity = 2}, - {items = {'farming:seed_hemp'}, rarity = 1}, - {items = {'farming:seed_hemp'}, rarity = 2}, - } -} -minetest.register_node("farming:hemp_8", table.copy(crop_def)) diff --git a/farming/hoebomb.lua b/farming/hoebomb.lua deleted file mode 100644 index 05e939b..0000000 --- a/farming/hoebomb.lua +++ /dev/null @@ -1,149 +0,0 @@ - --- load support for intllib. -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") - - --- creative check -local creative_mode_cache = minetest.settings:get_bool("creative_mode") -function is_creative(name) - return creative_mode_cache or minetest.check_player_privs(name, {creative = true}) -end - - --- hoe bomb function -local function hoe_area(pos, player) - - -- check for protection - if minetest.is_protected(pos, player:get_player_name()) then - minetest.record_protection_violation(pos, player:get_player_name()) - return - end - - local r = 5 -- radius - - -- remove flora (grass, flowers etc.) - local res = minetest.find_nodes_in_area( - {x = pos.x - r, y = pos.y - 1, z = pos.z - r}, - {x = pos.x + r, y = pos.y + 2, z = pos.z + r}, - {"group:flora"}) - - for n = 1, #res do - minetest.swap_node(res[n], {name = "air"}) - end - - -- replace dirt with tilled soil - res = nil - res = minetest.find_nodes_in_area_under_air( - {x = pos.x - r, y = pos.y - 1, z = pos.z - r}, - {x = pos.x + r, y = pos.y + 2, z = pos.z + r}, - {"group:soil"}) - - for n = 1, #res do - minetest.swap_node(res[n], {name = "farming:soil"}) - end -end - - --- throwable hoe bomb -minetest.register_entity("farming:hoebomb_entity", { - physical = true, - visual = "sprite", - visual_size = {x = 1.0, y = 1.0}, - textures = {"farming_hoe_bomb.png"}, - collisionbox = {0,0,0,0,0,0}, - lastpos = {}, - player = "", - - on_step = function(self, dtime) - - if not self.player then - - self.object:remove() - - return - end - - local pos = self.object:get_pos() - - if self.lastpos.x ~= nil then - - local vel = self.object:getvelocity() - - -- only when potion hits something physical - if vel.x == 0 - or vel.y == 0 - or vel.z == 0 then - - if self.player ~= "" then - - -- round up coords to fix glitching through doors - self.lastpos = vector.round(self.lastpos) - - hoe_area(self.lastpos, self.player) - end - - self.object:remove() - - return - - end - end - - self.lastpos = pos - end -}) - - --- actual throwing function -local function throw_potion(itemstack, player) - - local playerpos = player:get_pos() - - local obj = minetest.add_entity({ - x = playerpos.x, - y = playerpos.y + 1.5, - z = playerpos.z - }, "farming:hoebomb_entity") - - local dir = player:get_look_dir() - local velocity = 20 - - obj:setvelocity({ - x = dir.x * velocity, - y = dir.y * velocity, - z = dir.z * velocity - }) - - obj:setacceleration({ - x = dir.x * -3, - y = -9.5, - z = dir.z * -3 - }) - - obj:setyaw(player:get_look_yaw() + math.pi) - obj:get_luaentity().player = player -end - - --- hoe bomb item -minetest.register_craftitem("farming:hoe_bomb", { - description = S("Hoe Bomb (use or throw on grassy areas to hoe land"), - inventory_image = "farming_hoe_bomb.png", - groups = {flammable = 2, not_in_creative_inventory = 1}, - on_use = function(itemstack, user, pointed_thing) - - if pointed_thing.type == "node" then - hoe_area(pointed_thing.above, user) - else - throw_potion(itemstack, user) - - if not is_creative(user:get_player_name()) then - - itemstack:take_item() - - return itemstack - end - end - end, -}) diff --git a/farming/hoes.lua b/farming/hoes.lua index eaacb29..633e6f0 100644 --- a/farming/hoes.lua +++ b/farming/hoes.lua @@ -192,3 +192,141 @@ minetest.override_item("farming:hoe_diamond", { original_description = "Diamond Hoe", description = toolranks.create_description("Diamond Hoe")}) end + + +-- hoe bomb function +local function hoe_area(pos, player) + + -- check for protection + if minetest.is_protected(pos, player:get_player_name()) then + minetest.record_protection_violation(pos, player:get_player_name()) + return + end + + local r = 5 -- radius + + -- remove flora (grass, flowers etc.) + local res = minetest.find_nodes_in_area( + {x = pos.x - r, y = pos.y - 1, z = pos.z - r}, + {x = pos.x + r, y = pos.y + 2, z = pos.z + r}, + {"group:flora"}) + + for n = 1, #res do + minetest.swap_node(res[n], {name = "air"}) + end + + -- replace dirt with tilled soil + res = nil + res = minetest.find_nodes_in_area_under_air( + {x = pos.x - r, y = pos.y - 1, z = pos.z - r}, + {x = pos.x + r, y = pos.y + 2, z = pos.z + r}, + {"group:soil"}) + + for n = 1, #res do + minetest.swap_node(res[n], {name = "farming:soil"}) + end +end + + +-- throwable hoe bomb +minetest.register_entity("farming:hoebomb_entity", { + physical = true, + visual = "sprite", + visual_size = {x = 1.0, y = 1.0}, + textures = {"farming_hoe_bomb.png"}, + collisionbox = {0,0,0,0,0,0}, + lastpos = {}, + player = "", + + on_step = function(self, dtime) + + if not self.player then + + self.object:remove() + + return + end + + local pos = self.object:get_pos() + + if self.lastpos.x ~= nil then + + local vel = self.object:getvelocity() + + -- only when potion hits something physical + if vel.x == 0 + or vel.y == 0 + or vel.z == 0 then + + if self.player ~= "" then + + -- round up coords to fix glitching through doors + self.lastpos = vector.round(self.lastpos) + + hoe_area(self.lastpos, self.player) + end + + self.object:remove() + + return + + end + end + + self.lastpos = pos + end +}) + + +-- actual throwing function +local function throw_potion(itemstack, player) + + local playerpos = player:get_pos() + + local obj = minetest.add_entity({ + x = playerpos.x, + y = playerpos.y + 1.5, + z = playerpos.z + }, "farming:hoebomb_entity") + + local dir = player:get_look_dir() + local velocity = 20 + + obj:setvelocity({ + x = dir.x * velocity, + y = dir.y * velocity, + z = dir.z * velocity + }) + + obj:setacceleration({ + x = dir.x * -3, + y = -9.5, + z = dir.z * -3 + }) + + obj:setyaw(player:get_look_yaw() + math.pi) + obj:get_luaentity().player = player +end + + +-- hoe bomb item +minetest.register_craftitem("farming:hoe_bomb", { + description = S("Hoe Bomb (use or throw on grassy areas to hoe land"), + inventory_image = "farming_hoe_bomb.png", + groups = {flammable = 2, not_in_creative_inventory = 1}, + on_use = function(itemstack, user, pointed_thing) + + if pointed_thing.type == "node" then + hoe_area(pointed_thing.above, user) + else + throw_potion(itemstack, user) + + if not farming.is_creative(user:get_player_name()) then + + itemstack:take_item() + + return itemstack + end + end + end, +}) diff --git a/farming/init.lua b/farming/init.lua index 33a9ca7..038ba6d 100644 --- a/farming/init.lua +++ b/farming/init.lua @@ -7,7 +7,7 @@ farming = {} farming.mod = "redo" -farming.version = "1.33" +farming.version = "20180617" farming.path = minetest.get_modpath("farming") farming.select = { type = "fixed", @@ -22,16 +22,16 @@ function farming.is_creative(name) end -local statistics = dofile(farming.path.."/statistics.lua") +local statistics = dofile(farming.path .. "/statistics.lua") -- Intllib -local S = dofile(farming.path.."/intllib.lua") +local S = dofile(farming.path .. "/intllib.lua") farming.intllib = S -- Utility Function local time_speed = tonumber(minetest.settings:get("time_speed")) or 72 -local SECS_PER_CYCLE = (time_speed > 0 and 24 * 60 * 60 / time_speed) or 0 +local SECS_PER_CYCLE = (time_speed > 0 and (24 * 60 * 60) / time_speed) or 0 local function clamp(x, min, max) return (x < min and min) or (x > max and max) or x end @@ -273,15 +273,16 @@ minetest.after(0, function() end) -local abm_func = farming.handle_growth - -- 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({ nodenames = { "group:growing" }, interval = 300, chance = 1, - action = abm_func + catch_up = false, + action = function(pos, node) + farming.handle_growth(pos, node) + end }) @@ -300,11 +301,16 @@ function farming.plant_growth_timer(pos, elapsed, node_name) return false end - if stages.plant_name == "farming:cocoa" then + -- custom growth check + local chk = minetest.registered_nodes[node_name].growth_check + + if chk then - if not minetest.find_node_near(pos, 1, {"default:jungletree"}) then + if chk(pos, node_name) then return true end + + -- otherwise check for wet soil beneath crop else local under = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z }) @@ -413,7 +419,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname) -- am I right-clicking on something that has a custom on_place set? -- thanks to Krock for helping with this issue :) local def = minetest.registered_nodes[under.name] - if def and def.on_rightclick then + if placer and def and def.on_rightclick then return def.on_rightclick(pt.under, under, placer, itemstack) end @@ -438,16 +444,21 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname) return end + -- is player planting seed? + local name = placer and placer:get_player_name() or "" + -- if not protected then add node and remove 1 item from the itemstack - if not minetest.is_protected(pt.above, placer:get_player_name()) then + if not minetest.is_protected(pt.above, name) then local p2 = minetest.registered_nodes[plantname].place_param2 or 1 minetest.set_node(pt.above, {name = plantname, param2 = p2}) +--minetest.get_node_timer(pt.above):start(1) + minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0}) - if not placer or not farming.is_creative(placer:get_player_name()) then + if placer and not farming.is_creative(placer:get_player_name()) then local name = itemstack:get_name() @@ -494,7 +505,7 @@ 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}, + groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 2}, paramtype = "light", paramtype2 = "wallmounted", walkable = false, @@ -559,6 +570,7 @@ farming.register_plant = function(name, def) place_param2 = def.place_param2, walkable = false, buildable_to = true, + sunlight_propagates = true, drop = drop, selection_box = farming.select, groups = g, @@ -567,8 +579,6 @@ farming.register_plant = function(name, def) maxlight = def.maxlight, next_plant = next_plant, }) - - register_plant_node(node_name) end -- Return info @@ -584,7 +594,6 @@ farming.cucumber = true farming.corn = true farming.coffee = true farming.melon = true -farming.sugar = true farming.pumpkin = true farming.cocoa = true farming.raspberry = true @@ -601,7 +610,6 @@ farming.pepper = true farming.pineapple = true farming.peas = true farming.beetroot = true -farming.donuts = true farming.rarety = 0.002 -- 0.006 @@ -630,37 +638,44 @@ dofile(farming.path.."/grass.lua") dofile(farming.path.."/utensils.lua") -- default crops -dofile(farming.path.."/wheat.lua") -dofile(farming.path.."/cotton.lua") - --- additional crops and food (if enabled) -if farming.carrot then dofile(farming.path.."/carrot.lua") end -if farming.potato then dofile(farming.path.."/potato.lua") end -if farming.tomato then dofile(farming.path.."/tomato.lua") end -if farming.cucumber then dofile(farming.path.."/cucumber.lua") end -if farming.corn then dofile(farming.path.."/corn.lua") end -if farming.coffee then dofile(farming.path.."/coffee.lua") end -if farming.melon then dofile(farming.path.."/melon.lua") end -if farming.sugar then dofile(farming.path.."/sugar.lua") end -if farming.pumpkin then dofile(farming.path.."/pumpkin.lua") end -if farming.cocoa then dofile(farming.path.."/cocoa.lua") end -if farming.raspberry then dofile(farming.path.."/raspberry.lua") end -if farming.blueberry then dofile(farming.path.."/blueberry.lua") end -if farming.rhubarb then dofile(farming.path.."/rhubarb.lua") end -if farming.beans then dofile(farming.path.."/beanpole.lua") end -if farming.grapes then dofile(farming.path.."/grapes.lua") end -if farming.barley then dofile(farming.path.."/barley.lua") end -if farming.hemp then dofile(farming.path.."/hemp.lua") end -if farming.garlic then dofile(farming.path.."/garlic.lua") end -if farming.onion then dofile(farming.path.."/onion.lua") end -if farming.pepper then dofile(farming.path.."/pepper.lua") end -if farming.pineapple then dofile(farming.path.."/pineapple.lua") end -if farming.peas then dofile(farming.path.."/pea.lua") end -if farming.beetroot then dofile(farming.path.."/beetroot.lua") end -if farming.chili then dofile(farming.path.."/chili.lua") end -if farming.donuts then dofile(farming.path.."/donut.lua") end +dofile(farming.path.."/crops/wheat.lua") +dofile(farming.path.."/crops/cotton.lua") + + +-- helper function +local function ddoo(file, check) + + if check then + dofile(farming.path .. "/crops/" .. file) + end +end +-- add additional crops and food (if enabled) +ddoo("carrot.lua", farming.carrot) +ddoo("potato.lua", farming.potato) +ddoo("tomato.lua", farming.tomato) +ddoo("cucumber.lua", farming.cucumber) +ddoo("corn.lua", farming.corn) +ddoo("coffee.lua", farming.coffee) +ddoo("melon.lua", farming.melon) +ddoo("pumpkin.lua", farming.pumpkin) +ddoo("cocoa.lua", farming.cocoa) +ddoo("raspberry.lua", farming.raspberry) +ddoo("blueberry.lua", farming.blueberry) +ddoo("rhubarb.lua", farming.rhubarb) +ddoo("beans.lua", farming.beans) +ddoo("grapes.lua", farming.grapes) +ddoo("barley.lua", farming.barley) +ddoo("hemp.lua", farming.hemp) +ddoo("garlic.lua", farming.garlic) +ddoo("onion.lua", farming.onion) +ddoo("pepper.lua", farming.pepper) +ddoo("pineapple.lua", farming.pineapple) +ddoo("peas.lua", farming.peas) +ddoo("beetroot.lua", farming.beetroot) +ddoo("chili.lua", farming.chili) + +dofile(farming.path.."/food.lua") dofile(farming.path.."/mapgen.lua") dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility -dofile(farming.path.."/hoebomb.lua") dofile(farming.path.."/lucky_block.lua") diff --git a/farming/license.txt b/farming/license.txt index fec6f6a..b7bb7a9 100644 --- a/farming/license.txt +++ b/farming/license.txt @@ -19,3 +19,112 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +License of media (textures): +---------------------------- +Created by PilzAdam (License: WTFPL): + farming_bread.png + farming_soil.png + farming_soil_wet.png + farming_soil_wet_side.png + farming_string.png + +Created by Napiophelios (CC BY-SA 3.0): + farming_cotton.png + +Created by Calinou (License: CC BY-SA): + farming_tool_bronzehoe.png + farming_tool_steelhoe.png + farming_tool_stonehoe.png + farming_tool_woodhoe.png + farming_tool_mesehoe.png + farming_tool_diamondhoe.png + +Created by VanessaE (License: WTFPL): + farming_cotton_seed.png + farming_wheat_seed.png + farming_flour.png + farming_wheat.png + farming_wheat_1.png + farming_wheat_2.png + farming_wheat_3.png + farming_wheat_4.png + farming_wheat_5.png + farming_wheat_5.png + farming_wheat_7.png + farming_wheat_8.png + farming_cotton_1.png + farming_cotton_2.png + farming_cotton_3.png + farming_cotton_4.png + farming_cotton_5.png + farming_cotton_6.png + farming_cotton_7.png + farming_cotton_8.png + +Created by Doc (License: WTFPL): + farming_cucumber.png + farming_cucumber_1.png + farming_cucumber_2.png + farming_cucumber_3.png + farming_cucumber_4.png + farming_potato.png + farming_potato_1.png + farming_potato_2.png + farming_potato_3.png + farming_potato_4.png + farming_raspberries.png + farming_raspberry_1.png + farming_raspberry_2.png + farming_raspberry_3.png + farming_raspberry_4.png + +Created by Gambit: + default_junglegrass.png + farming_carrot.png + farming_carrot_1.png + farming_carrot_2.png + farming_carrot_3.png + farming_carrot_4.png + farming_carrot_5.png + farming_carrot_6.png + farming_carrot_7.png + farming_carrot_8.png + +Created by JoseTheCrafter and edited by TenPlus1: + farming_tomato.png + farming_tomato_1.png + farming_tomato_2.png + farming_tomato_3.png + farming_tomato_4.png + farming_tomato_5.png + farming_tomato_6.png + farming_tomato_7.png + farming_tomato_8.png + +Created by GeMinecraft and edited by TenPlus1: + farming_corn.png + farming_corn_cob.png + farming_corn_1.png + farming_corn_2.png + farming_corn_3.png + farming_corn_4.png + farming_corn_5.png + farming_corn_6.png + farming_corn_7.png + farming_corn_8.png + +Created by TenPlus1 + farming_cocoa_1.png + farming_cocoa_2.png + farming_cocoa_3.png + farming_cocoa_beans.png + farming_cookie.png + farming_raspberry_smoothie.png + farming_rhubarb_1.png + farming_rhubarb_2.png + farming_rhubarb_3.png + farming_rhubarb.png + farming_rhubarb_pie.png + farming_hemp*.png diff --git a/farming/lucky_block.lua b/farming/lucky_block.lua index 087cc2e..b24ed32 100644 --- a/farming/lucky_block.lua +++ b/farming/lucky_block.lua @@ -32,5 +32,7 @@ if minetest.get_modpath("lucky_block") then {"dro", {"farming:hoe_mese"}, 1}, {"dro", {"farming:hoe_diamond"}, 1}, {"dro", {"farming:hoe_bomb"}, 10}, + {"dro", {"farming:turkish_delight"}, 5}, + {"lig"}, }) end diff --git a/farming/melon.lua b/farming/melon.lua deleted file mode 100644 index 2165558..0000000 --- a/farming/melon.lua +++ /dev/null @@ -1,86 +0,0 @@ - -local S = farming.intllib - --- melon -minetest.register_craftitem("farming:melon_slice", { - description = S("Melon Slice"), - inventory_image = "farming_melon_slice.png", - groups = {food_melon_slice = 1, flammable = 3}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:melon_1") - end, - on_use = minetest.item_eat(2), -}) - -minetest.register_craft({ - output = "farming:melon_8", - recipe = { - {"farming:melon_slice", "farming:melon_slice", "farming:melon_slice"}, - {"farming:melon_slice", "farming:melon_slice", "farming:melon_slice"}, - {"farming:melon_slice", "farming:melon_slice", "farming:melon_slice"}, - } -}) - -minetest.register_craft({ - output = "farming:melon_slice 9", - recipe = { - {"", "farming:melon_8", ""}, - } -}) - --- melon definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_melon_1.png"}, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:melon_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_melon_2.png"} -minetest.register_node("farming:melon_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_melon_3.png"} -minetest.register_node("farming:melon_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_melon_4.png"} -minetest.register_node("farming:melon_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"farming_melon_5.png"} -minetest.register_node("farming:melon_5", table.copy(crop_def)) - --- stage 6 -crop_def.tiles = {"farming_melon_6.png"} -minetest.register_node("farming:melon_6", table.copy(crop_def)) - --- stage 7 -crop_def.tiles = {"farming_melon_7.png"} -minetest.register_node("farming:melon_7", table.copy(crop_def)) - --- stage 8 (final) -crop_def.drawtype = "nodebox" -crop_def.description = S("Melon") -crop_def.tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"} -crop_def.selection_box = {-.5, -.5, -.5, .5, .5, .5} -crop_def.walkable = true -crop_def.groups = { - food_melon = 1, snappy = 1, oddly_breakable_by_hand = 1, - flammable = 2, plant = 1 -} -crop_def.drop = "farming:melon_slice 9" -minetest.register_node("farming:melon_8", table.copy(crop_def)) diff --git a/farming/onion.lua b/farming/onion.lua deleted file mode 100644 index 21b5c2e..0000000 --- a/farming/onion.lua +++ /dev/null @@ -1,68 +0,0 @@ - ---[[ - Original textures from Crops Plus mod - Copyright (C) 2018 Grizzly Adam - https://forum.minetest.net/viewtopic.php?f=9&t=19488 -]] - -local S = farming.intllib - --- potato -minetest.register_craftitem("farming:onion", { - description = S("Onion"), - inventory_image = "crops_onion.png", - groups = {food_onion = 1, flammable = 3}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:onion_1") - end, - on_use = minetest.item_eat(1), -}) - --- crop definition -local crop_def = { - drawtype = "plantlike", - tiles = {"crops_onion_plant_1.png"}, - paramtype = "light", - paramtype2 = "meshoptions", - place_param2 = 3, - sunlight_propagates = true, - waving = 1, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 3, flora = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:onion_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"crops_onion_plant_2.png"} -minetest.register_node("farming:onion_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"crops_onion_plant_3.png"} -minetest.register_node("farming:onion_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"crops_onion_plant_4.png"} -minetest.register_node("farming:onion_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"crops_onion_plant_5.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - max_items = 5, items = { - {items = {'farming:onion'}, rarity = 1}, - {items = {'farming:onion'}, rarity = 1}, - {items = {'farming:onion'}, rarity = 2}, - {items = {'farming:onion'}, rarity = 2}, - {items = {'farming:onion'}, rarity = 5}, - } -} -minetest.register_node("farming:onion_5", table.copy(crop_def)) diff --git a/farming/pea.lua b/farming/pea.lua deleted file mode 100644 index ef14dab..0000000 --- a/farming/pea.lua +++ /dev/null @@ -1,89 +0,0 @@ - -local S = farming.intllib - --- Textures for Pea crop and Peas were done by Andrey01 - --- pea pod -minetest.register_craftitem("farming:pea_pod", { - description = S("Pea Pod"), - inventory_image = "farming_pea_pod.png", - groups = {food_pea_pod = 1, flammable = 2}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:pea_1") - end -}) - -minetest.register_craftitem("farming:peas", { - description = S("Peas"), - inventory_image = "farming_pea_peas.png", - groups = {food_peas = 1, flammable = 2}, - on_use = minetest.item_eat(1) -}) - -minetest.register_craft({ - type = "shapeless", - output = "farming:peas", - recipe = {"farming:pea_pod"} -}) - --- pea soup -minetest.register_craftitem("farming:pea_soup", { - description = S("Pea Soup"), - inventory_image = "farming_pea_soup.png", - groups = {flammable = 2}, - on_use = minetest.item_eat(4, "farming:bowl"), -}) - -minetest.register_craft({ - type = "shapeless", - output = "farming:pea_soup", - recipe = {"group:food_peas", "group:food_peas", "group:food_bowl"} -}) - -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_pea_1.png"}, - paramtype = "light", - paramtype2 = "meshoptions", - place_param2 = 3, - sunlight_propagates = true, - waving = 1, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, flora = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:pea_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_pea_2.png"} -minetest.register_node("farming:pea_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_pea_3.png"} -minetest.register_node("farming:pea_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_pea_4.png"} -minetest.register_node("farming:pea_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"farming_pea_5.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - max_items = 5, items = { - {items = {'farming:pea_pod'}, rarity = 1}, - {items = {'farming:pea_pod'}, rarity = 2}, - {items = {'farming:pea_pod'}, rarity = 3}, - {items = {'farming:pea_pod'}, rarity = 4}, - {items = {'farming:pea_pod'}, rarity = 5}, - } -} -minetest.register_node("farming:pea_5", table.copy(crop_def)) diff --git a/farming/pepper.lua b/farming/pepper.lua deleted file mode 100644 index 4831952..0000000 --- a/farming/pepper.lua +++ /dev/null @@ -1,105 +0,0 @@ - ---[[ - Original textures from Crops Plus mod - Copyright (C) 2018 Grizzly Adam - https://forum.minetest.net/viewtopic.php?f=9&t=19488 -]] - -local S = farming.intllib - --- peppercorn (seed) -minetest.register_craftitem("farming:peppercorn", { - description = S("Peppercorn"), - inventory_image = "crops_peppercorn.png", - groups = {food_peppercorn = 1, flammable = 3}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:pepper_1") - end, -}) - --- green pepper -minetest.register_craftitem("farming:pepper", { - description = S("Pepper"), - inventory_image = "crops_pepper.png", - on_use = minetest.item_eat(2), - groups = {food_pepper = 1, flammable = 3}, -}) - -minetest.register_craft({ - type = "shapeless", - output = "farming:peppercorn", - recipe = {"farming:pepper"} -}) - --- ground pepper -minetest.register_node("farming:pepper_ground", { - description = ("Ground Pepper"), - inventory_image = "crops_pepper_ground.png", - wield_image = "crops_pepper_ground.png", - drawtype = "plantlike", - paramtype = "light", - tiles = {"crops_pepper_ground.png"}, - groups = { - vessel = 1, food_pepper_ground = 1, - dig_immediate = 3, attached_node = 1 - }, - sounds = default.node_sound_glass_defaults(), - selection_box = { - type = "fixed", - fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} - }, -}) - -minetest.register_craft( { - output = "farming:pepper_ground", - type = "shapeless", - recipe = {"group:food_peppercorn", "vessels:glass_bottle", "farming:mortar_pestle"}, - replacements = {{"farming:mortar_pestle", "farming:mortar_pestle"}}, -}) - --- crop definition -local crop_def = { - drawtype = "plantlike", - tiles = {"crops_pepper_plant_1.png"}, - paramtype = "light", - paramtype2 = "meshoptions", - place_param2 = 1, - sunlight_propagates = true, - waving = 1, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 3, flora = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:pepper_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"crops_pepper_plant_2.png"} -minetest.register_node("farming:pepper_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"crops_pepper_plant_3.png"} -minetest.register_node("farming:pepper_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"crops_pepper_plant_4.png"} -minetest.register_node("farming:pepper_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"crops_pepper_plant_5.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - max_items = 2, items = { - {items = {'farming:pepper 2'}, rarity = 1}, - {items = {'farming:pepper'}, rarity = 2}, - {items = {'farming:pepper'}, rarity = 3}, - } -} -minetest.register_node("farming:pepper_5", table.copy(crop_def)) diff --git a/farming/pineapple.lua b/farming/pineapple.lua deleted file mode 100644 index 6376f2f..0000000 --- a/farming/pineapple.lua +++ /dev/null @@ -1,126 +0,0 @@ - -local S = farming.intllib - --- pineapple top -minetest.register_craftitem("farming:pineapple_top", { - description = S("Pineapple Top"), - inventory_image = "farming_pineapple_top.png", - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:pineapple_1") - end, -}) - --- pineapple -minetest.register_node("farming:pineapple", { - description = S("Pineapple"), - drawtype = "plantlike", - tiles = {"farming_pineapple.png"}, - inventory_image = "farming_pineapple.png", - wield_image = "farming_pineapple.png", - paramtype = "light", - sunlight_propagates = true, - walkable = false, - selection_box = { - type = "fixed", - fixed = {-0.27, -0.37, -0.27, 0.27, 0.44, 0.27} - }, - groups = {food_pineapple = 1, fleshy = 3, dig_immediate = 3, flammable = 2}, -}) - --- pineapple -minetest.register_craftitem("farming:pineapple_ring", { - description = S("Pineapple Ring"), - inventory_image = "farming_pineapple_ring.png", - groups = {food_pineapple_ring = 1, flammable = 2}, - on_use = minetest.item_eat(1), -}) - -minetest.register_craft( { - output = "farming:pineapple_ring 5", - type = "shapeless", - recipe = {"group:food_pineapple"}, - replacements = {{"farming:pineapple", "farming:pineapple_top"}} -}) - --- pineapple juice -minetest.register_craftitem("farming:pineapple_juice", { - description = S("Pineapple Juice"), - inventory_image = "farming_pineapple_juice.png", - on_use = minetest.item_eat(4, "vessels:drinking_glass"), -}) - -minetest.register_craft({ - output = "farming:pineapple_juice", - type = "shapeless", - recipe = {"vessels:drinking_glass", "group:food_pineapple_ring", - "group:food_pineapple_ring", "group:food_pineapple_ring", - "farming:juicer"}, - replacements = { - {"farming:juicer", "farming:juicer"}, - }, -}) - -minetest.register_craft({ - output = "farming:pineapple_juice 2", - type = "shapeless", - recipe = {"vessels:drinking_glass", "group:food_pineapple", "farming:juicer"}, - replacements = { - {"farming:juicer", "farming:juicer"}, - }, -}) - --- crop definition -local crop_def = { - drawtype = "plantlike", - visual_scale = 1.5, - tiles = {"farming_pineapple_1.png"}, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:pineapple_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_pineapple_2.png"} -minetest.register_node("farming:pineapple_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_pineapple_3.png"} -minetest.register_node("farming:pineapple_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_pineapple_4.png"} -minetest.register_node("farming:pineapple_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"farming_pineapple_5.png"} -minetest.register_node("farming:pineapple_5", table.copy(crop_def)) - --- stage 6 -crop_def.tiles = {"farming_pineapple_6.png"} -minetest.register_node("farming:pineapple_6", table.copy(crop_def)) - --- stage 7 -crop_def.tiles = {"farming_pineapple_7.png"} -minetest.register_node("farming:pineapple_7", table.copy(crop_def)) - --- stage 8 (final) -crop_def.tiles = {"farming_pineapple_8.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:pineapple'}, rarity = 1}, - {items = {'farming:pineapple'}, rarity = 15}, - } -} -minetest.register_node("farming:pineapple_8", table.copy(crop_def)) diff --git a/farming/potato.lua b/farming/potato.lua deleted file mode 100644 index a922b11..0000000 --- a/farming/potato.lua +++ /dev/null @@ -1,78 +0,0 @@ - ---[[ - Original textures from DocFarming mod - https://forum.minetest.net/viewtopic.php?id=3948 -]] - -local S = farming.intllib - --- potato -minetest.register_craftitem("farming:potato", { - description = S("Potato"), - inventory_image = "farming_potato.png", - groups = {food_potato = 1, flammable = 2}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:potato_1") - end, - on_use = minetest.item_eat(1), -}) - --- baked potato -minetest.register_craftitem("farming:baked_potato", { - description = S("Baked Potato"), - inventory_image = "farming_baked_potato.png", - on_use = minetest.item_eat(6), -}) - -minetest.register_craft({ - type = "cooking", - cooktime = 10, - output = "farming:baked_potato", - recipe = "group:food_potato" -}) - --- potato definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_potato_1.png"}, - paramtype = "light", - sunlight_propagates = true, - waving = 1, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:potato_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_potato_2.png"} -minetest.register_node("farming:potato_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_potato_3.png"} -crop_def.drop = { - items = { - {items = {'farming:potato'}, rarity = 1}, - {items = {'farming:potato'}, rarity = 3}, - } -} -minetest.register_node("farming:potato_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_potato_4.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:potato 2'}, rarity = 1}, - {items = {'farming:potato 3'}, rarity = 2}, - } -} -minetest.register_node("farming:potato_4", table.copy(crop_def)) diff --git a/farming/pumpkin.lua b/farming/pumpkin.lua deleted file mode 100644 index d8e8ec6..0000000 --- a/farming/pumpkin.lua +++ /dev/null @@ -1,211 +0,0 @@ - ---[[ - Big thanks to PainterlyPack.net for allowing me to use these textures -]] - -local S = farming.intllib - --- pumpkin -minetest.register_node("farming:pumpkin", { - description = S("Pumpkin"), - tiles = { - "farming_pumpkin_top.png", - "farming_pumpkin_top.png", - "farming_pumpkin_side.png" - }, - groups = { - food_pumpkin = 1, choppy = 1, oddly_breakable_by_hand = 1, - flammable = 2, plant = 1 - }, - drop = { - items = { - {items = {'farming:pumpkin_slice 9'}, rarity = 1}, - } - }, - sounds = default.node_sound_wood_defaults(), -}) - --- pumpkin slice -minetest.register_craftitem("farming:pumpkin_slice", { - description = S("Pumpkin Slice"), - inventory_image = "farming_pumpkin_slice.png", - groups = {food_pumpkin_slice = 1, flammable = 2}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1") - end, - on_use = minetest.item_eat(2), -}) - -minetest.register_craft({ - output = "farming:pumpkin", - recipe = { - {"farming:pumpkin_slice", "farming:pumpkin_slice", "farming:pumpkin_slice"}, - {"farming:pumpkin_slice", "farming:pumpkin_slice", "farming:pumpkin_slice"}, - {"farming:pumpkin_slice", "farming:pumpkin_slice", "farming:pumpkin_slice"}, - } -}) - -minetest.register_craft({ - output = "farming:pumpkin_slice 9", - recipe = { - {"", "farming:pumpkin", ""}, - } -}) - --- jack 'o lantern -minetest.register_node("farming:jackolantern", { - description = S("Jack 'O Lantern (punch to turn on and off)"), - tiles = { - "farming_pumpkin_top.png", - "farming_pumpkin_top.png", - "farming_pumpkin_side.png", - "farming_pumpkin_side.png", - "farming_pumpkin_side.png", - "farming_pumpkin_face_off.png" - }, - paramtype2 = "facedir", - groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2}, - sounds = default.node_sound_wood_defaults(), - on_punch = function(pos, node, puncher) - node.name = "farming:jackolantern_on" - minetest.swap_node(pos, node) - end, -}) - -minetest.register_node("farming:jackolantern_on", { - tiles = { - "farming_pumpkin_top.png", - "farming_pumpkin_top.png", - "farming_pumpkin_side.png", - "farming_pumpkin_side.png", - "farming_pumpkin_side.png", - "farming_pumpkin_face_on.png" - }, - light_source = default.LIGHT_MAX - 1, - paramtype2 = "facedir", - groups = { - choppy = 1, oddly_breakable_by_hand = 1, flammable = 2, - not_in_creative_inventory = 1 - }, - sounds = default.node_sound_wood_defaults(), - drop = "farming:jackolantern", - on_punch = function(pos, node, puncher) - node.name = "farming:jackolantern" - minetest.swap_node(pos, node) - end, -}) - -minetest.register_craft({ - output = "farming:jackolantern", - recipe = { - {"default:torch"}, - {"group:food_pumpkin"}, - } -}) - ---- wooden scarecrow base -minetest.register_node("farming:scarecrow_bottom", { - paramtype = "light", - sunlight_propagates = true, - paramtype2 = "facedir", - tiles = {"default_wood.png"}, - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - {-1/16, -8/16, -1/16, 1/16, 8/16, 1/16}, - {-12/16, 4/16, -1/16, 12/16, 2/16, 1/16}, - }, - }, - groups = {snappy = 3, flammable = 2}, -}) - -minetest.register_craft({ - output = "farming:scarecrow_bottom", - recipe = { - {"", "group:stick", "",}, - {"group:stick", "group:stick", "group:stick",}, - {"", "group:stick", "",} - } -}) - --- pumpkin bread -minetest.register_craftitem("farming:pumpkin_bread", { - description = S("Pumpkin Bread"), - inventory_image = "farming_pumpkin_bread.png", - on_use = minetest.item_eat(8), - groups = {food_bread = 1, flammable = 2}, -}) - -minetest.register_craftitem("farming:pumpkin_dough", { - description = S("Pumpkin Dough"), - inventory_image = "farming_pumpkin_dough.png", -}) - -minetest.register_craft({ - output = "farming:pumpkin_dough", - type = "shapeless", - recipe = {"group:food_flour", "group:food_pumpkin_slice", "group:food_pumpkin_slice"} -}) - -minetest.register_craft({ - type = "cooking", - output = "farming:pumpkin_bread", - recipe = "farming:pumpkin_dough", - cooktime = 10 -}) - --- pumpkin definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_pumpkin_1.png"}, - paramtype = "light", - sunlight_propagates = true, - waving = 1, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:pumpkin_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_pumpkin_2.png"} -minetest.register_node("farming:pumpkin_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_pumpkin_3.png"} -minetest.register_node("farming:pumpkin_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_pumpkin_4.png"} -minetest.register_node("farming:pumpkin_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"farming_pumpkin_5.png"} -minetest.register_node("farming:pumpkin_5", table.copy(crop_def)) - --- stage 6 -crop_def.tiles = {"farming_pumpkin_6.png"} -minetest.register_node("farming:pumpkin_6", table.copy(crop_def)) - --- stage 7 -crop_def.tiles = {"farming_pumpkin_7.png"} -minetest.register_node("farming:pumpkin_7", table.copy(crop_def)) - --- stage 8 (final) -crop_def.tiles = {"farming_pumpkin_8.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:pumpkin_slice 9'}, rarity = 1}, - } -} -minetest.register_node("farming:pumpkin_8", table.copy(crop_def)) diff --git a/farming/raspberry.lua b/farming/raspberry.lua deleted file mode 100644 index 931d2ae..0000000 --- a/farming/raspberry.lua +++ /dev/null @@ -1,69 +0,0 @@ - -local S = farming.intllib - --- raspberries -minetest.register_craftitem("farming:raspberries", { - description = S("Raspberries"), - inventory_image = "farming_raspberries.png", - groups = {food_raspberries = 1, flammable = 2}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:raspberry_1") - end, - on_use = minetest.item_eat(1), -}) - --- raspberry smoothie -minetest.register_craftitem("farming:smoothie_raspberry", { - description = S("Raspberry Smoothie"), - inventory_image = "farming_raspberry_smoothie.png", - on_use = minetest.item_eat(2, "vessels:drinking_glass"), -}) - -minetest.register_craft({ - output = "farming:smoothie_raspberry", - recipe = { - {"default:snow"}, - {"group:food_raspberries"}, - {"vessels:drinking_glass"}, - } -}) - --- raspberries definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_raspberry_1.png"}, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:raspberry_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_raspberry_2.png"} -minetest.register_node("farming:raspberry_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_raspberry_3.png"} -minetest.register_node("farming:raspberry_3", table.copy(crop_def)) - --- stage 4 (final) -crop_def.tiles = {"farming_raspberry_4.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:raspberries 2'}, rarity = 1}, - {items = {'farming:raspberries'}, rarity = 2}, - {items = {'farming:raspberries'}, rarity = 3}, - } -} -minetest.register_node("farming:raspberry_4", table.copy(crop_def)) diff --git a/farming/rhubarb.lua b/farming/rhubarb.lua deleted file mode 100644 index 1fa897f..0000000 --- a/farming/rhubarb.lua +++ /dev/null @@ -1,66 +0,0 @@ - -local S = farming.intllib - --- rhubarb -minetest.register_craftitem("farming:rhubarb", { - description = S("Rhubarb"), - inventory_image = "farming_rhubarb.png", - groups = {food_rhubarb = 1, flammable = 2}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:rhubarb_1") - end, - on_use = minetest.item_eat(1), -}) - --- rhubarb pie -minetest.register_craftitem("farming:rhubarb_pie", { - description = S("Rhubarb Pie"), - inventory_image = "farming_rhubarb_pie.png", - on_use = minetest.item_eat(6), -}) - -minetest.register_craft({ - output = "farming:rhubarb_pie", - recipe = { - {"farming:baking_tray", "group:food_sugar", ""}, - {"group:food_rhubarb", "group:food_rhubarb", "group:food_rhubarb"}, - {"group:food_wheat", "group:food_wheat", "group:food_wheat"}, - }, - replacements = {{"farming:baking_tray", "farming:baking_tray"}} -}) - --- rhubarb definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_rhubarb_1.png"}, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:rhubarb_1", table.copy(crop_def)) - --- stage2 -crop_def.tiles = {"farming_rhubarb_2.png"} -minetest.register_node("farming:rhubarb_2", table.copy(crop_def)) - --- stage 3 (final) -crop_def.tiles = {"farming_rhubarb_3.png"} -crop_def.groups.growing = 0 -crop_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(crop_def)) diff --git a/farming/sugar.lua b/farming/sugar.lua deleted file mode 100644 index bdaf698..0000000 --- a/farming/sugar.lua +++ /dev/null @@ -1,44 +0,0 @@ - -local S = farming.intllib - ---= Sugar - -minetest.register_craftitem("farming:sugar", { - description = S("Sugar"), - inventory_image = "farming_sugar.png", - groups = {food_sugar = 1, flammable = 3}, -}) - -minetest.register_craft({ - type = "cooking", - cooktime = 3, - output = "farming:sugar 2", - recipe = "default:papyrus", -}) - - ---= Salt - -minetest.register_node("farming:salt", { - description = ("Salt"), - inventory_image = "farming_salt.png", - wield_image = "farming_salt.png", - drawtype = "plantlike", - paramtype = "light", - tiles = {"farming_salt.png"}, - groups = {food_salt = 1, vessel = 1, dig_immediate = 3, - attached_node = 1}, - sounds = default.node_sound_glass_defaults(), - selection_box = { - type = "fixed", - fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} - }, -}) - -minetest.register_craft({ - type = "cooking", - cooktime = 15, - output = "farming:salt", - recipe = "bucket:bucket_water", - replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}} -}) diff --git a/farming/textures/farming_blueberry_pie.png b/farming/textures/farming_blueberry_pie.png new file mode 100644 index 0000000..2174686 Binary files /dev/null and b/farming/textures/farming_blueberry_pie.png differ diff --git a/farming/textures/farming_coffee_cup_hot.png b/farming/textures/farming_coffee_cup_hot.png deleted file mode 100644 index f4fae90..0000000 Binary files a/farming/textures/farming_coffee_cup_hot.png and /dev/null differ diff --git a/farming/textures/farming_cornstarch.png b/farming/textures/farming_cornstarch.png new file mode 100644 index 0000000..d5f8218 Binary files /dev/null and b/farming/textures/farming_cornstarch.png differ diff --git a/farming/textures/farming_garlic_bread.png b/farming/textures/farming_garlic_bread.png new file mode 100644 index 0000000..b760004 Binary files /dev/null and b/farming/textures/farming_garlic_bread.png differ diff --git a/farming/textures/farming_potato_salad.png b/farming/textures/farming_potato_salad.png new file mode 100644 index 0000000..0028c91 Binary files /dev/null and b/farming/textures/farming_potato_salad.png differ diff --git a/farming/textures/farming_rose_water.png b/farming/textures/farming_rose_water.png new file mode 100644 index 0000000..96e546f Binary files /dev/null and b/farming/textures/farming_rose_water.png differ diff --git a/farming/textures/farming_salt.png b/farming/textures/farming_salt.png index 0aa733a..2b23e33 100644 Binary files a/farming/textures/farming_salt.png and b/farming/textures/farming_salt.png differ diff --git a/farming/textures/farming_turkish_delight.png b/farming/textures/farming_turkish_delight.png new file mode 100644 index 0000000..198ffc4 Binary files /dev/null and b/farming/textures/farming_turkish_delight.png differ diff --git a/farming/tomato.lua b/farming/tomato.lua deleted file mode 100644 index 53012a8..0000000 --- a/farming/tomato.lua +++ /dev/null @@ -1,79 +0,0 @@ - ---[[ - Textures edited from: - http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1288375-food-plus-mod-more-food-than-you-can-imagine-v2-9) -]] - -local S = farming.intllib - --- tomato -minetest.register_craftitem("farming:tomato", { - description = S("Tomato"), - inventory_image = "farming_tomato.png", - groups = {food_tomato = 1, flammable = 2}, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:tomato_1") - end, - on_use = minetest.item_eat(4), -}) - --- tomato definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_tomato_1.png"}, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:tomato_1", table.copy(crop_def)) - --- stage2 -crop_def.tiles = {"farming_tomato_2.png"} -minetest.register_node("farming:tomato_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_tomato_3.png"} -minetest.register_node("farming:tomato_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_tomato_4.png"} -minetest.register_node("farming:tomato_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"farming_tomato_5.png"} -minetest.register_node("farming:tomato_5", table.copy(crop_def)) - --- stage 6 -crop_def.tiles = {"farming_tomato_6.png"} -minetest.register_node("farming:tomato_6", table.copy(crop_def)) - --- stage 7 -crop_def.tiles = {"farming_tomato_7.png"} -crop_def.drop = { - items = { - {items = {'farming:tomato'}, rarity = 1}, - {items = {'farming:tomato'}, rarity = 3}, - } -} -minetest.register_node("farming:tomato_7", table.copy(crop_def)) - --- stage 8 (final) -crop_def.tiles = {"farming_tomato_8.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:tomato 3'}, rarity = 1}, - {items = {'farming:tomato 3'}, rarity = 2}, - } -} -minetest.register_node("farming:tomato_8", table.copy(crop_def)) diff --git a/farming/utensils.lua b/farming/utensils.lua index 63a7de3..4a15298 100644 --- a/farming/utensils.lua +++ b/farming/utensils.lua @@ -17,6 +17,12 @@ minetest.register_craft({ } }) +minetest.register_craft({ + type = "fuel", + recipe = "farming:bowl", + burntime = 10, +}) + -- saucepan minetest.register_craftitem("farming:saucepan", { @@ -71,7 +77,7 @@ minetest.register_craft({ minetest.register_craftitem("farming:skillet", { description = S("Skillet"), inventory_image = "farming_skillet.png", - groups = {food_baking_tray = 1, flammable = 2}, + groups = {food_skillet = 1, flammable = 2}, }) minetest.register_craft({ @@ -147,3 +153,11 @@ minetest.register_craft({ {"", "default:glass", ""}, } }) + +minetest.register_craft( { + type = "shapeless", + output = "vessels:glass_fragments", + recipe = { + "farming:mixing_bowl", + }, +}) diff --git a/farming/wheat.lua b/farming/wheat.lua deleted file mode 100644 index 1b22723..0000000 --- a/farming/wheat.lua +++ /dev/null @@ -1,223 +0,0 @@ - -local S = farming.intllib - --- wheat seeds -minetest.register_node("farming:seed_wheat", { - description = S("Wheat Seed"), - tiles = {"farming_wheat_seed.png"}, - inventory_image = "farming_wheat_seed.png", - wield_image = "farming_wheat_seed.png", - drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4}, - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - sunlight_propagates = true, - selection_box = farming.select, - on_place = function(itemstack, placer, pointed_thing) - return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1") - end, -}) - --- harvested wheat -minetest.register_craftitem("farming:wheat", { - description = S("Wheat"), - inventory_image = "farming_wheat.png", - groups = {food_wheat = 1, flammable = 4}, -}) - --- straw -minetest.register_node("farming:straw", { - description = S("Straw"), - tiles = {"farming_straw.png"}, - is_ground_content = false, - groups = {snappy = 3, flammable = 4, fall_damage_add_percent = -30}, - sounds = default.node_sound_leaves_defaults(), -}) - -minetest.register_craft({ - output = "farming:straw 3", - recipe = { - {"farming:wheat", "farming:wheat", "farming:wheat"}, - {"farming:wheat", "farming:wheat", "farming:wheat"}, - {"farming:wheat", "farming:wheat", "farming:wheat"}, - } -}) - -minetest.register_craft({ - output = "farming:wheat 3", - recipe = { - {"farming:straw"}, - } -}) - --- flour -minetest.register_craftitem("farming:flour", { - description = S("Flour"), - inventory_image = "farming_flour.png", - groups = {food_flour = 1, flammable = 1}, -}) - -minetest.register_craft({ - type = "shapeless", - output = "farming:flour", - recipe = { - "farming:wheat", "farming:wheat", "farming:wheat", - "farming:wheat", "farming:mortar_pestle" - }, - replacements = {{"farming:mortar_pestle", "farming:mortar_pestle"}}, -}) - --- bread -minetest.register_craftitem("farming:bread", { - description = S("Bread"), - inventory_image = "farming_bread.png", - on_use = minetest.item_eat(5), - groups = {food_bread = 1, flammable = 2}, -}) - -minetest.register_craft({ - type = "cooking", - cooktime = 15, - output = "farming:bread", - recipe = "farming:flour" -}) - --- sliced bread -minetest.register_craftitem("farming:bread_slice", { - description = S("Sliced Bread"), - inventory_image = "farming_bread_slice.png", - on_use = minetest.item_eat(1), - groups = {food_bread_slice = 1, flammable = 2}, -}) - -minetest.register_craft({ - type = "shapeless", - output = "farming:bread_slice 5", - recipe = {"farming:bread", "group:food_cutting_board"}, - replacements = {{"farming:cutting_board", "farming:cutting_board"}}, -}) - --- toast -minetest.register_craftitem("farming:toast", { - description = S("Toast"), - inventory_image = "farming_toast.png", - on_use = minetest.item_eat(1), - groups = {food_toast = 1, flammable = 2}, -}) - -minetest.register_craft({ - type = "cooking", - cooktime = 3, - output = "farming:toast", - recipe = "farming:bread_slice" -}) - --- toast sandwich -minetest.register_craftitem("farming:toast_sandwich", { - description = S("Toast Sandwich"), - inventory_image = "farming_toast_sandwich.png", - on_use = minetest.item_eat(4), - groups = {flammable = 2}, -}) - -minetest.register_craft({ - output = "farming:toast_sandwich", - recipe = { - {"farming:bread_slice"}, - {"farming:toast"}, - {"farming:bread_slice"}, - } -}) - --- wheat definition -local crop_def = { - drawtype = "plantlike", - tiles = {"farming_wheat_1.png"}, - paramtype = "light", - paramtype2 = "meshoptions", - place_param2 = 3, - sunlight_propagates = true, - walkable = false, - buildable_to = true, - drop = "", - selection_box = farming.select, - groups = { - snappy = 3, flammable = 4, plant = 1, attached_node = 1, - not_in_creative_inventory = 1, growing = 1 - }, - sounds = default.node_sound_leaves_defaults() -} - --- stage 1 -minetest.register_node("farming:wheat_1", table.copy(crop_def)) - --- stage 2 -crop_def.tiles = {"farming_wheat_2.png"} -minetest.register_node("farming:wheat_2", table.copy(crop_def)) - --- stage 3 -crop_def.tiles = {"farming_wheat_3.png"} -minetest.register_node("farming:wheat_3", table.copy(crop_def)) - --- stage 4 -crop_def.tiles = {"farming_wheat_4.png"} -minetest.register_node("farming:wheat_4", table.copy(crop_def)) - --- stage 5 -crop_def.tiles = {"farming_wheat_5.png"} -crop_def.drop = { - items = { - {items = {'farming:wheat'}, rarity = 2}, - {items = {'farming:seed_wheat'}, rarity = 2}, - } -} -minetest.register_node("farming:wheat_5", table.copy(crop_def)) - --- stage 6 -crop_def.tiles = {"farming_wheat_6.png"} -crop_def.drop = { - items = { - {items = {'farming:wheat'}, rarity = 2}, - {items = {'farming:seed_wheat'}, rarity = 1}, - } -} -minetest.register_node("farming:wheat_6", table.copy(crop_def)) - --- stage 7 -crop_def.tiles = {"farming_wheat_7.png"} -crop_def.drop = { - items = { - {items = {'farming:wheat'}, rarity = 1}, - {items = {'farming:wheat'}, rarity = 3}, - {items = {'farming:seed_wheat'}, rarity = 1}, - {items = {'farming:seed_wheat'}, rarity = 3}, - } -} -minetest.register_node("farming:wheat_7", table.copy(crop_def)) - --- stage 8 (final) -crop_def.tiles = {"farming_wheat_8.png"} -crop_def.groups.growing = 0 -crop_def.drop = { - items = { - {items = {'farming:wheat'}, rarity = 1}, - {items = {'farming:wheat'}, rarity = 3}, - {items = {'farming:seed_wheat'}, rarity = 1}, - {items = {'farming:seed_wheat'}, rarity = 3}, - } -} -minetest.register_node("farming:wheat_8", table.copy(crop_def)) - --- fuels -minetest.register_craft({ - type = "fuel", - recipe = "farming:straw", - burntime = 3, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "farming:wheat", - burntime = 1, -}) diff --git a/misc_overrides/init.lua b/misc_overrides/init.lua index c3dd0a5..cbce073 100644 --- a/misc_overrides/init.lua +++ b/misc_overrides/init.lua @@ -18,8 +18,6 @@ for i = 1, 8 do minetest.override_item("farming:cotton_"..i, { waving = 1 }) end -minetest.override_item("farming:weed", { waving = 1 }) - -- Undergrowth modpack minetest.override_item("youngtrees:youngtree_top", { waving = 1 }) @@ -40,8 +38,3 @@ minetest.override_item("dryplants:reedmace_height_3_spikes", { waving = 1 }) minetest.override_item("dryplants:juncus", { waving = 1 }) minetest.override_item("dryplants:juncus_02", { waving = 1 }) --- Farming plus - -minetest.override_item("farming_plus:banana_leaves", { waving = 1 }) -minetest.override_item("farming_plus:cocoa_leaves", { waving = 1 }) - diff --git a/trafficlight/init.lua b/trafficlight/init.lua index 4a1e24d..f099128 100644 --- a/trafficlight/init.lua +++ b/trafficlight/init.lua @@ -135,6 +135,7 @@ streets.on_digiline_receive = function(pos, node, channel, msg) end -- Tl states local name = minetest.get_node(pos).name + local althalfhz = minetest.get_node(pos).param2 % 2 == 1 if msg == "OFF" then if name:find("pedlight") then if name == "streets:pedlight_top_flashingdontwalk" then @@ -181,66 +182,82 @@ streets.on_digiline_receive = function(pos, node, channel, msg) else streets.tlSwitch(pos,"streets:trafficlight_top_green") end - elseif msg == "RED" then + elseif msg == "FLASHGREEN" then if name:find("pedlight") then if name == "streets:pedlight_top_flashingdontwalk" then - ped_on_flash_end(pos,true) + ped_on_flash_end(pos,false) end - streets.tlSwitch(pos,"streets:pedlight_top_dontwalk") + streets.tlSwitch(pos,"streets:pedlight_top_flashingwalk") elseif name:find("extender_left") then - streets.tlSwitch(pos,"streets:trafficlight_top_extender_left_off") + streets.tlSwitch(pos,"streets:trafficlight_top_extender_left_flashgreen") elseif name:find("extender_right") then - streets.tlSwitch(pos,"streets:trafficlight_top_extender_right_off") + streets.tlSwitch(pos,"streets:trafficlight_top_extender_right_flashgreen") elseif name:find("left") then - streets.tlSwitch(pos,"streets:trafficlight_top_left_red") + streets.tlSwitch(pos,"streets:trafficlight_top_left_flashgreen") elseif name:find("right") then - streets.tlSwitch(pos,"streets:trafficlight_top_right_red") + streets.tlSwitch(pos,"streets:trafficlight_top_right_flashgreen") elseif name:find("beacon_hybrid") then - streets.tlSwitch(pos,"streets:beacon_hybrid_red") + --Not Supported elseif name:find("beacon") then - streets.tlSwitch(pos,"streets:beacon_red") + --Not Supported elseif name:find("rrfb") then --Not Supported else - streets.tlSwitch(pos,"streets:trafficlight_top_red") + streets.tlSwitch(pos,"streets:trafficlight_top_flashgreen") end - elseif msg == "WARN" then + elseif msg == "RED" then if name:find("pedlight") then - if name ~= "streets:pedlight_top_flashingdontwalk" then - ped_on_flash_start(pos) + if name == "streets:pedlight_top_flashingdontwalk" then + ped_on_flash_end(pos,true) end - streets.tlSwitch(pos,"streets:pedlight_top_flashingdontwalk") + streets.tlSwitch(pos,"streets:pedlight_top_dontwalk") elseif name:find("extender_left") then streets.tlSwitch(pos,"streets:trafficlight_top_extender_left_off") elseif name:find("extender_right") then streets.tlSwitch(pos,"streets:trafficlight_top_extender_right_off") elseif name:find("left") then - streets.tlSwitch(pos,"streets:trafficlight_top_left_warn") + streets.tlSwitch(pos,"streets:trafficlight_top_left_red") elseif name:find("right") then - streets.tlSwitch(pos,"streets:trafficlight_top_right_warn") + streets.tlSwitch(pos,"streets:trafficlight_top_right_red") elseif name:find("beacon_hybrid") then - streets.tlSwitch(pos,"streets:beacon_hybrid_flashyellow") + streets.tlSwitch(pos,"streets:beacon_hybrid_red") elseif name:find("beacon") then - streets.tlSwitch(pos,"streets:beacon_flashyellow") + streets.tlSwitch(pos,"streets:beacon_red") elseif name:find("rrfb") then - streets.tlSwitch(pos,"streets:trafficlight_rrfb_on") + --Not Supported else - streets.tlSwitch(pos,"streets:trafficlight_top_warn") + streets.tlSwitch(pos,"streets:trafficlight_top_red") end - elseif msg == "FLASHYELLOW" then + elseif msg == "WARN" or msg == "FLASHYELLOW" then if name:find("pedlight") then if name ~= "streets:pedlight_top_flashingdontwalk" then ped_on_flash_start(pos) end streets.tlSwitch(pos,"streets:pedlight_top_flashingdontwalk") elseif name:find("extender_left") then - streets.tlSwitch(pos,"streets:trafficlight_top_extender_left_flashyellow") + if althalfhz then + streets.tlSwitch(pos,"streets:trafficlight_top_extender_left_flashyellow_alt") + else + streets.tlSwitch(pos,"streets:trafficlight_top_extender_left_flashyellow") + end elseif name:find("extender_right") then - streets.tlSwitch(pos,"streets:trafficlight_top_extender_right_flashyellow") + if althalfhz then + streets.tlSwitch(pos,"streets:trafficlight_top_extender_right_flashyellow_alt") + else + streets.tlSwitch(pos,"streets:trafficlight_top_extender_right_flashyellow") + end elseif name:find("left") then - streets.tlSwitch(pos,"streets:trafficlight_top_left_warn") + if althalfhz then + streets.tlSwitch(pos,"streets:trafficlight_top_left_warn_alt") + else + streets.tlSwitch(pos,"streets:trafficlight_top_left_warn") + end elseif name:find("right") then - streets.tlSwitch(pos,"streets:trafficlight_top_right_warn") + if althalfhz then + streets.tlSwitch(pos,"streets:trafficlight_top_right_warn_alt") + else + streets.tlSwitch(pos,"streets:trafficlight_top_right_warn") + end elseif name:find("beacon_hybrid") then streets.tlSwitch(pos,"streets:beacon_hybrid_flashyellow") elseif name:find("beacon") then @@ -248,7 +265,11 @@ streets.on_digiline_receive = function(pos, node, channel, msg) elseif name:find("rrfb") then streets.tlSwitch(pos,"streets:trafficlight_rrfb_on") else - streets.tlSwitch(pos,"streets:trafficlight_top_warn") + if althalfhz then + streets.tlSwitch(pos,"streets:trafficlight_top_warn_alt") + else + streets.tlSwitch(pos,"streets:trafficlight_top_warn") + end end elseif msg == "YELLOW" then if name:find("pedlight") then @@ -273,6 +294,26 @@ streets.on_digiline_receive = function(pos, node, channel, msg) else streets.tlSwitch(pos,"streets:trafficlight_top_yellow") end + elseif msg == "REDYELLOW" then + if name:find("pedlight") then + --Not Supported + elseif name:find("extender_left") then + --Not Supported + elseif name:find("extender_right") then + --Not Supported + elseif name:find("left") then + streets.tlSwitch(pos,"streets:trafficlight_top_left_redyellow") + elseif name:find("right") then + streets.tlSwitch(pos,"streets:trafficlight_top_right_redyellow") + elseif name:find("beacon_hybrid") then + --Not Supported + elseif name:find("beacon") then + --Not Supported + elseif name:find("rrfb") then + --Not Supported + else + streets.tlSwitch(pos,"streets:trafficlight_top_redyellow") + end elseif msg == "FLASHRED" then if name:find("pedlight") then if name ~= "streets:pedlight_top_flashingdontwalk" then @@ -284,9 +325,17 @@ streets.on_digiline_receive = function(pos, node, channel, msg) elseif name:find("extender_right") then streets.tlSwitch(pos,"streets:trafficlight_top_extender_right_off") elseif name:find("left") then - streets.tlSwitch(pos,"streets:trafficlight_top_left_flashred") + if althalfhz then + streets.tlSwitch(pos,"streets:trafficlight_top_left_flashred_alt") + else + streets.tlSwitch(pos,"streets:trafficlight_top_left_flashred") + end elseif name:find("right") then - streets.tlSwitch(pos,"streets:trafficlight_top_right_flashred") + if althalfhz then + streets.tlSwitch(pos,"streets:trafficlight_top_right_flashred_alt") + else + streets.tlSwitch(pos,"streets:trafficlight_top_right_flashred") + end elseif name:find("beacon_hybrid") then streets.tlSwitch(pos,"streets:beacon_hybrid_flashred") elseif name:find("beacon") then @@ -294,7 +343,11 @@ streets.on_digiline_receive = function(pos, node, channel, msg) elseif name:find("rrfb") then --Not Supported else - streets.tlSwitch(pos,"streets:trafficlight_top_flashred") + if althalfhz then + streets.tlSwitch(pos,"streets:trafficlight_top_flashred_alt") + else + streets.tlSwitch(pos,"streets:trafficlight_top_flashred") + end end end end @@ -787,6 +840,82 @@ minetest.register_node(":streets:trafficlight_top_extender_left_flashyellow",{ end, }) +minetest.register_node(":streets:trafficlight_top_extender_left_flashyellow_alt",{ + drop = "streets:trafficlight_top_extender_left_off", + description = streets.S("Traffic Light Left-Turn Module"), + drawtype="nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky = 1, level = 2, not_in_creative_inventory = 1}, + light_source = 11, + sunlight_propagates = true, + node_box = { + type = "fixed", + fixed = streets.tleBox + }, + tiles = {"streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png",{ + name="streets_tl_left_warn_alt.png", + animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=1.2}, + }}, + digiline = { + receptor = {}, + wire = {rules=streets.tlDigilineRules}, + effector = { + action = function(pos, node, channel, msg) + streets.on_digiline_receive(pos, node, channel, msg) + end + } + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "field[channel;Channel;${channel}]") + end, + on_receive_fields = function(pos, formname, fields, sender) + if (fields.channel) then + minetest.get_meta(pos):set_string("channel", fields.channel) + minetest.get_meta(pos):set_string("state", "Off") + end + end, +}) + +minetest.register_node(":streets:trafficlight_top_extender_left_flashgreen",{ + drop = "streets:trafficlight_top_extender_left_off", + description = streets.S("Traffic Light Left-Turn Module"), + drawtype="nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky = 1, level = 2, not_in_creative_inventory = 1}, + light_source = 11, + sunlight_propagates = true, + node_box = { + type = "fixed", + fixed = streets.tleBox + }, + tiles = {"streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png",{ + name="streets_tle_left_flashgreen.png", + animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=1.2}, + }}, + digiline = { + receptor = {}, + wire = {rules=streets.tlDigilineRules}, + effector = { + action = function(pos, node, channel, msg) + streets.on_digiline_receive(pos, node, channel, msg) + end + } + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "field[channel;Channel;${channel}]") + end, + on_receive_fields = function(pos, formname, fields, sender) + if (fields.channel) then + minetest.get_meta(pos):set_string("channel", fields.channel) + minetest.get_meta(pos):set_string("state", "Off") + end + end, +}) + minetest.register_node(":streets:trafficlight_top_extender_left_green",{ drop = "streets:trafficlight_top_extender_left_off", description = streets.S("Traffic Light Left-Turn Module"), @@ -930,6 +1059,82 @@ minetest.register_node(":streets:trafficlight_top_extender_right_flashyellow",{ end, }) +minetest.register_node(":streets:trafficlight_top_extender_right_flashyellow_alt",{ + drop = "streets:trafficlight_top_extender_right_off", + description = streets.S("Traffic Light Right-Turn Module"), + drawtype="nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky = 1, level = 2, not_in_creative_inventory = 1}, + light_source = 11, + sunlight_propagates = true, + node_box = { + type = "fixed", + fixed = streets.tleBox + }, + tiles = {"streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png",{ + name="streets_tl_right_warn_alt.png", + animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=1.2}, + }}, + digiline = { + receptor = {}, + wire = {rules=streets.tlDigilineRules}, + effector = { + action = function(pos, node, channel, msg) + streets.on_digiline_receive(pos, node, channel, msg) + end + } + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "field[channel;Channel;${channel}]") + end, + on_receive_fields = function(pos, formname, fields, sender) + if (fields.channel) then + minetest.get_meta(pos):set_string("channel", fields.channel) + minetest.get_meta(pos):set_string("state", "Off") + end + end, +}) + +minetest.register_node(":streets:trafficlight_top_extender_right_flashgreen",{ + drop = "streets:trafficlight_top_extender_right_off", + description = streets.S("Traffic Light Right-Turn Module"), + drawtype="nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky = 1, level = 2, not_in_creative_inventory = 1}, + light_source = 11, + sunlight_propagates = true, + node_box = { + type = "fixed", + fixed = streets.tleBox + }, + tiles = {"streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png",{ + name="streets_tle_right_flashgreen.png", + animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=1.2}, + }}, + digiline = { + receptor = {}, + wire = {rules=streets.tlDigilineRules}, + effector = { + action = function(pos, node, channel, msg) + streets.on_digiline_receive(pos, node, channel, msg) + end + } + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "field[channel;Channel;${channel}]") + end, + on_receive_fields = function(pos, formname, fields, sender) + if (fields.channel) then + minetest.get_meta(pos):set_string("channel", fields.channel) + minetest.get_meta(pos):set_string("state", "Off") + end + end, +}) + minetest.register_node(":streets:trafficlight_top_extender_right_green",{ drop = "streets:trafficlight_top_extender_left_off", description = streets.S("Traffic Light Right-Turn Module"), @@ -1077,6 +1282,33 @@ minetest.register_node(":streets:pedlight_top_flashingdontwalk",{ }, }) +minetest.register_node(":streets:pedlight_top_flashingwalk",{ + drop = "streets:pedlight_top_off", + groups = {cracky = 1, not_in_creative_inventory = 1}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + drawtype = "nodebox", + tiles = {"streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png",{ + name="streets_pl_flashingwalk.png", + animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=1.2}, + }}, + node_box = { + type = "fixed", + fixed = streets.plBox + }, + light_source = 6, + digiline = { + receptor = {}, + wire = {rules=streets.tlDigilineRules}, + effector = { + action = function(pos, node, channel, msg) + streets.on_digiline_receive(pos, node, channel, msg) + end + } + }, +}) + minetest.register_entity(":streets:pedcountdown",{ physical = false, collisionbox = {0,0,0,0,0,0}, @@ -1209,7 +1441,29 @@ for _,i in pairs({"","_left","_right"}) do }, }) - minetest.register_alias("streets:trafficlight_top"..i.."_redyellow","streets:trafficlight_top"..i.."_green") + minetest.register_node(":streets:trafficlight_top"..i.."_redyellow",{ + drop = "streets:trafficlight_top"..i.."_off", + groups = {cracky = 1, not_in_creative_inventory = 1}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + drawtype = "nodebox", + tiles = {"streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl"..i.."_redyellow.png"}, + node_box = { + type = "fixed", + fixed = streets.tlBox + }, + light_source = 6, + digiline = { + receptor = {}, + wire = {rules=streets.tlDigilineRules}, + effector = { + action = function(pos, node, channel, msg) + streets.on_digiline_receive(pos, node, channel, msg) + end + } + }, + }) minetest.register_node(":streets:trafficlight_top"..i.."_green",{ drop = "streets:trafficlight_top"..i.."_off", @@ -1288,6 +1542,87 @@ for _,i in pairs({"","_left","_right"}) do } }, }) + + minetest.register_node(":streets:trafficlight_top"..i.."_warn_alt",{ + drop = "streets:trafficlight_top"..i.."_off", + groups = {cracky = 1, not_in_creative_inventory = 1}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + drawtype = "nodebox", + tiles = {"streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png",{ + name="streets_tl"..i.."_warn_alt.png", + animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=1.2}, + }}, + node_box = { + type = "fixed", + fixed = streets.tlBox + }, + light_source = 6, + digiline = { + receptor = {}, + wire = {rules=streets.tlDigilineRules}, + effector = { + action = function(pos, node, channel, msg) + streets.on_digiline_receive(pos, node, channel, msg) + end + } + }, + }) + + minetest.register_node(":streets:trafficlight_top"..i.."_flashred_alt",{ + drop = "streets:trafficlight_top"..i.."_off", + groups = {cracky = 1, not_in_creative_inventory = 1}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + drawtype = "nodebox", + tiles = {"streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png",{ + name="streets_tl"..i.."_flashred_alt.png", + animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=1.2}, + }}, + node_box = { + type = "fixed", + fixed = streets.tlBox + }, + light_source = 6, + digiline = { + receptor = {}, + wire = {rules=streets.tlDigilineRules}, + effector = { + action = function(pos, node, channel, msg) + streets.on_digiline_receive(pos, node, channel, msg) + end + } + }, + }) + + minetest.register_node(":streets:trafficlight_top"..i.."_flashgreen",{ + drop = "streets:trafficlight_top"..i.."_off", + groups = {cracky = 1, not_in_creative_inventory = 1}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + drawtype = "nodebox", + tiles = {"streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png","streets_tl_bg.png",{ + name="streets_tl"..i.."_flashgreen.png", + animation={type="vertical_frames", aspect_w=64, aspect_h=64, length=1.2}, + }}, + node_box = { + type = "fixed", + fixed = streets.tlBox + }, + light_source = 6, + digiline = { + receptor = {}, + wire = {rules=streets.tlDigilineRules}, + effector = { + action = function(pos, node, channel, msg) + streets.on_digiline_receive(pos, node, channel, msg) + end + } + }, + }) end minetest.register_node(":streets:trafficlight_rrfb_off",{ diff --git a/trafficlight/textures/streets_pl_flashingwalk.png b/trafficlight/textures/streets_pl_flashingwalk.png new file mode 100644 index 0000000..55986d0 Binary files /dev/null and b/trafficlight/textures/streets_pl_flashingwalk.png differ diff --git a/trafficlight/textures/streets_tl_flashgreen.png b/trafficlight/textures/streets_tl_flashgreen.png new file mode 100644 index 0000000..dd9cb78 Binary files /dev/null and b/trafficlight/textures/streets_tl_flashgreen.png differ diff --git a/trafficlight/textures/streets_tl_flashred_alt.png b/trafficlight/textures/streets_tl_flashred_alt.png new file mode 100644 index 0000000..5fc8371 Binary files /dev/null and b/trafficlight/textures/streets_tl_flashred_alt.png differ diff --git a/trafficlight/textures/streets_tl_left_flashgreen.png b/trafficlight/textures/streets_tl_left_flashgreen.png new file mode 100644 index 0000000..9cb8b60 Binary files /dev/null and b/trafficlight/textures/streets_tl_left_flashgreen.png differ diff --git a/trafficlight/textures/streets_tl_left_flashred_alt.png b/trafficlight/textures/streets_tl_left_flashred_alt.png new file mode 100644 index 0000000..2b11eeb Binary files /dev/null and b/trafficlight/textures/streets_tl_left_flashred_alt.png differ diff --git a/trafficlight/textures/streets_tl_left_redyellow.png b/trafficlight/textures/streets_tl_left_redyellow.png new file mode 100644 index 0000000..4b58d78 Binary files /dev/null and b/trafficlight/textures/streets_tl_left_redyellow.png differ diff --git a/trafficlight/textures/streets_tl_left_warn_alt.png b/trafficlight/textures/streets_tl_left_warn_alt.png new file mode 100644 index 0000000..4e36822 Binary files /dev/null and b/trafficlight/textures/streets_tl_left_warn_alt.png differ diff --git a/trafficlight/textures/streets_tl_redyellow.png b/trafficlight/textures/streets_tl_redyellow.png new file mode 100644 index 0000000..234d987 Binary files /dev/null and b/trafficlight/textures/streets_tl_redyellow.png differ diff --git a/trafficlight/textures/streets_tl_right_flashgreen.png b/trafficlight/textures/streets_tl_right_flashgreen.png new file mode 100644 index 0000000..8d21ac9 Binary files /dev/null and b/trafficlight/textures/streets_tl_right_flashgreen.png differ diff --git a/trafficlight/textures/streets_tl_right_flashred_alt.png b/trafficlight/textures/streets_tl_right_flashred_alt.png new file mode 100644 index 0000000..3a82b10 Binary files /dev/null and b/trafficlight/textures/streets_tl_right_flashred_alt.png differ diff --git a/trafficlight/textures/streets_tl_right_redyellow.png b/trafficlight/textures/streets_tl_right_redyellow.png new file mode 100644 index 0000000..e0fb8fa Binary files /dev/null and b/trafficlight/textures/streets_tl_right_redyellow.png differ diff --git a/trafficlight/textures/streets_tl_right_warn_alt.png b/trafficlight/textures/streets_tl_right_warn_alt.png new file mode 100644 index 0000000..7cadbc4 Binary files /dev/null and b/trafficlight/textures/streets_tl_right_warn_alt.png differ diff --git a/trafficlight/textures/streets_tl_warn_alt.png b/trafficlight/textures/streets_tl_warn_alt.png new file mode 100644 index 0000000..26b1387 Binary files /dev/null and b/trafficlight/textures/streets_tl_warn_alt.png differ diff --git a/trafficlight/textures/streets_tle_left_flashgreen.png b/trafficlight/textures/streets_tle_left_flashgreen.png new file mode 100644 index 0000000..8462064 Binary files /dev/null and b/trafficlight/textures/streets_tle_left_flashgreen.png differ diff --git a/trafficlight/textures/streets_tle_right_flashgreen.png b/trafficlight/textures/streets_tle_right_flashgreen.png new file mode 100644 index 0000000..59402e0 Binary files /dev/null and b/trafficlight/textures/streets_tle_right_flashgreen.png differ diff --git a/unified_inventory/bags.lua b/unified_inventory/bags.lua index a946cb0..6f07314 100644 --- a/unified_inventory/bags.lua +++ b/unified_inventory/bags.lua @@ -200,6 +200,8 @@ minetest.register_on_joinplayer(function(player) end return 1 end + -- New bag is smaller: Disallow inserting + return 0 end, allow_take = function(inv, listname, index, stack, player) if player:get_inventory():is_empty(listname.."contents") then -- cgit v1.2.3