diff options
69 files changed, 1389 insertions, 706 deletions
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/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/barley.lua b/farming/crops/barley.lua index 4005d2c..f509335 100644 --- a/farming/barley.lua +++ b/farming/crops/barley.lua @@ -34,7 +34,7 @@ minetest.register_craft({ "farming:barley", "farming:barley", "farming:barley", "farming:barley", "farming:mortar_pestle" }, - replacements = {{"farming:mortar_pestle", "farming:mortar_pestle"}}, + replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}, }) -- barley definition diff --git a/farming/beanpole.lua b/farming/crops/beans.lua index 1e81dac..a575956 100644 --- a/farming/beanpole.lua +++ b/farming/crops/beans.lua @@ -27,10 +27,18 @@ local function place_beans(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 + -- 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 @@ -41,7 +49,7 @@ local function place_beans(itemstack, placer, pointed_thing, plantname) minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0}) - if not farming.is_creative(placer:get_player_name()) then + if placer or not farming.is_creative(placer:get_player_name()) then itemstack:take_item() @@ -119,7 +127,7 @@ minetest.register_node("farming:beanpole", { return def.on_rightclick(pt.under, under, placer, itemstack) end - if minetest.is_protected(pt.under, placer:get_player_name()) then + if minetest.is_protected(pt.above, placer:get_player_name()) then return end diff --git a/farming/beetroot.lua b/farming/crops/beetroot.lua index 1510a76..e683a94 100644 --- a/farming/beetroot.lua +++ b/farming/crops/beetroot.lua @@ -50,7 +50,7 @@ local crop_def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, flora = 1, attached_node = 1, + snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, sounds = default.node_sound_leaves_defaults() diff --git a/farming/blueberry.lua b/farming/crops/blueberry.lua index f2f0147..9a30387 100644 --- a/farming/blueberry.lua +++ b/farming/crops/blueberry.lua @@ -5,7 +5,7 @@ local S = farming.intllib minetest.register_craftitem("farming:blueberries", { description = S("Blueberries"), inventory_image = "farming_blueberries.png", - groups = {food_blueberries = 1, flammable = 2}, + 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, @@ -27,6 +27,23 @@ minetest.register_craft({ } }) +-- 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", diff --git a/farming/carrot.lua b/farming/crops/carrot.lua index 0aefcfd..0aefcfd 100644 --- a/farming/carrot.lua +++ b/farming/crops/carrot.lua diff --git a/farming/chili.lua b/farming/crops/chili.lua index 9889162..9889162 100644 --- a/farming/chili.lua +++ b/farming/crops/chili.lua diff --git a/farming/cocoa.lua b/farming/crops/cocoa.lua index a8491ac..19e9c6b 100644 --- a/farming/cocoa.lua +++ b/farming/crops/cocoa.lua @@ -21,7 +21,7 @@ local function place_cocoa(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 @@ -31,12 +31,20 @@ local function place_cocoa(itemstack, placer, pointed_thing, plantname) 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 not farming.is_creative(placer:get_player_name()) then + if placer and not farming.is_creative(placer:get_player_name()) then itemstack:take_item() @@ -119,7 +127,13 @@ local crop_def = { snappy = 3, flammable = 2, plant = 1, growing = 1, not_in_creative_inventory=1, leafdecay = 1, leafdecay_drop = 1 }, - sounds = default.node_sound_leaves_defaults() + 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 @@ -141,6 +155,7 @@ 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}, diff --git a/farming/coffee.lua b/farming/crops/coffee.lua index ab93d06..f98694b 100644 --- a/farming/coffee.lua +++ b/farming/crops/coffee.lua @@ -11,36 +11,10 @@ minetest.register_craftitem("farming:coffee_beans", { 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", + 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", @@ -51,41 +25,22 @@ minetest.register_node("farming:coffee_cup", { 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"), + 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", - 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(), + 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 diff --git a/farming/corn.lua b/farming/crops/corn.lua index 8afa16a..4847903 100644 --- a/farming/corn.lua +++ b/farming/crops/corn.lua @@ -21,6 +21,7 @@ minetest.register_craftitem("farming:corn", { 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), }) @@ -31,6 +32,25 @@ minetest.register_craft({ 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"), diff --git a/farming/cotton.lua b/farming/crops/cotton.lua index 7f893ec..7f893ec 100644 --- a/farming/cotton.lua +++ b/farming/crops/cotton.lua diff --git a/farming/cucumber.lua b/farming/crops/cucumber.lua index 4e6981c..4e6981c 100644 --- a/farming/cucumber.lua +++ b/farming/crops/cucumber.lua diff --git a/farming/garlic.lua b/farming/crops/garlic.lua index 52ae25f..f2bb16d 100644 --- a/farming/garlic.lua +++ b/farming/crops/garlic.lua @@ -58,8 +58,7 @@ minetest.register_node("farming:garlic_braid", { node_box = { type = "fixed", fixed = { - {-0.13, -0.45, 0.5, 0.13, 0.45, 0.24, - }, + {-0.13, -0.45, 0.5, 0.13, 0.45, 0.24}, }, } }) @@ -93,7 +92,7 @@ local crop_def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 3, flora = 1, attached_node = 1, + snappy = 3, flammable = 3, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, sounds = default.node_sound_leaves_defaults() diff --git a/farming/grapes.lua b/farming/crops/grapes.lua index 9a6ab9e..d8c6c3f 100644 --- a/farming/grapes.lua +++ b/farming/crops/grapes.lua @@ -22,10 +22,18 @@ local function place_grapes(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 + -- 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 @@ -36,7 +44,7 @@ local function place_grapes(itemstack, placer, pointed_thing, plantname) minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0}) - if not farming.is_creative(placer:get_player_name()) then + if placer and not farming.is_creative(placer:get_player_name()) then itemstack:take_item() @@ -114,7 +122,7 @@ minetest.register_node("farming:trellis", { return def.on_rightclick(pt.under, under, placer, itemstack) end - if minetest.is_protected(pt.under, placer:get_player_name()) then + if minetest.is_protected(pt.above, placer:get_player_name()) then return end diff --git a/farming/hemp.lua b/farming/crops/hemp.lua index 34dd56d..eb522a9 100644 --- a/farming/hemp.lua +++ b/farming/crops/hemp.lua @@ -111,6 +111,27 @@ minetest.register_craft( { }, }) +-- 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", diff --git a/farming/melon.lua b/farming/crops/melon.lua index 2165558..2165558 100644 --- a/farming/melon.lua +++ b/farming/crops/melon.lua diff --git a/farming/onion.lua b/farming/crops/onion.lua index 21b5c2e..d9268f8 100644 --- a/farming/onion.lua +++ b/farming/crops/onion.lua @@ -32,7 +32,7 @@ local crop_def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 3, flora = 1, attached_node = 1, + snappy = 3, flammable = 3, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, sounds = default.node_sound_leaves_defaults() diff --git a/farming/pea.lua b/farming/crops/peas.lua index ef14dab..e50564e 100644 --- a/farming/pea.lua +++ b/farming/crops/peas.lua @@ -53,7 +53,7 @@ local crop_def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, flora = 1, attached_node = 1, + snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, sounds = default.node_sound_leaves_defaults() diff --git a/farming/pepper.lua b/farming/crops/pepper.lua index 4831952..498556e 100644 --- a/farming/pepper.lua +++ b/farming/crops/pepper.lua @@ -37,13 +37,14 @@ minetest.register_node("farming:pepper_ground", { 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_glass_defaults(), + sounds = default.node_sound_defaults(), selection_box = { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} @@ -54,7 +55,7 @@ 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"}}, + replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}, }) -- crop definition @@ -71,7 +72,7 @@ local crop_def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 3, flora = 1, attached_node = 1, + snappy = 3, flammable = 3, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, sounds = default.node_sound_leaves_defaults() diff --git a/farming/pineapple.lua b/farming/crops/pineapple.lua index 6376f2f..3525136 100644 --- a/farming/pineapple.lua +++ b/farming/crops/pineapple.lua @@ -56,16 +56,19 @@ minetest.register_craft({ "group:food_pineapple_ring", "group:food_pineapple_ring", "farming:juicer"}, replacements = { - {"farming:juicer", "farming:juicer"}, + {"group:food_juicer", "farming:juicer"}, }, }) minetest.register_craft({ output = "farming:pineapple_juice 2", type = "shapeless", - recipe = {"vessels:drinking_glass", "group:food_pineapple", "farming:juicer"}, + recipe = { + "vessels:drinking_glass", "vessels:drinking_glass", + "group:food_pineapple", "farming:juicer" + }, replacements = { - {"farming:juicer", "farming:juicer"}, + {"group:food_juicer", "farming:juicer"}, }, }) diff --git a/farming/potato.lua b/farming/crops/potato.lua index a922b11..a1512c2 100644 --- a/farming/potato.lua +++ b/farming/crops/potato.lua @@ -31,6 +31,22 @@ minetest.register_craft({ 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", diff --git a/farming/pumpkin.lua b/farming/crops/pumpkin.lua index d8e8ec6..d8e8ec6 100644 --- a/farming/pumpkin.lua +++ b/farming/crops/pumpkin.lua diff --git a/farming/raspberry.lua b/farming/crops/raspberry.lua index 931d2ae..713ea2f 100644 --- a/farming/raspberry.lua +++ b/farming/crops/raspberry.lua @@ -5,7 +5,7 @@ local S = farming.intllib minetest.register_craftitem("farming:raspberries", { description = S("Raspberries"), inventory_image = "farming_raspberries.png", - groups = {food_raspberries = 1, flammable = 2}, + 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, diff --git a/farming/rhubarb.lua b/farming/crops/rhubarb.lua index 1fa897f..90a2d8b 100644 --- a/farming/rhubarb.lua +++ b/farming/crops/rhubarb.lua @@ -26,7 +26,7 @@ minetest.register_craft({ {"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"}} + replacements = {{"group:food_baking_tray", "farming:baking_tray"}} }) -- rhubarb definition diff --git a/farming/tomato.lua b/farming/crops/tomato.lua index 53012a8..53012a8 100644 --- a/farming/tomato.lua +++ b/farming/crops/tomato.lua diff --git a/farming/wheat.lua b/farming/crops/wheat.lua index 1b22723..abf3ada 100644 --- a/farming/wheat.lua +++ b/farming/crops/wheat.lua @@ -51,6 +51,27 @@ minetest.register_craft({ } }) +-- 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"), @@ -65,7 +86,7 @@ minetest.register_craft({ "farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat", "farming:mortar_pestle" }, - replacements = {{"farming:mortar_pestle", "farming:mortar_pestle"}}, + replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}, }) -- bread @@ -95,7 +116,7 @@ minetest.register_craft({ type = "shapeless", output = "farming:bread_slice 5", recipe = {"farming:bread", "group:food_cutting_board"}, - replacements = {{"farming:cutting_board", "farming:cutting_board"}}, + replacements = {{"group:food_cutting_board", "farming:cutting_board"}}, }) -- toast 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/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/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 Binary files differnew file mode 100644 index 0000000..2174686 --- /dev/null +++ b/farming/textures/farming_blueberry_pie.png diff --git a/farming/textures/farming_coffee_cup_hot.png b/farming/textures/farming_coffee_cup_hot.png Binary files differdeleted file mode 100644 index f4fae90..0000000 --- a/farming/textures/farming_coffee_cup_hot.png +++ /dev/null diff --git a/farming/textures/farming_cornstarch.png b/farming/textures/farming_cornstarch.png Binary files differnew file mode 100644 index 0000000..d5f8218 --- /dev/null +++ b/farming/textures/farming_cornstarch.png diff --git a/farming/textures/farming_garlic_bread.png b/farming/textures/farming_garlic_bread.png Binary files differnew file mode 100644 index 0000000..b760004 --- /dev/null +++ b/farming/textures/farming_garlic_bread.png diff --git a/farming/textures/farming_potato_salad.png b/farming/textures/farming_potato_salad.png Binary files differnew file mode 100644 index 0000000..0028c91 --- /dev/null +++ b/farming/textures/farming_potato_salad.png diff --git a/farming/textures/farming_rose_water.png b/farming/textures/farming_rose_water.png Binary files differnew file mode 100644 index 0000000..96e546f --- /dev/null +++ b/farming/textures/farming_rose_water.png diff --git a/farming/textures/farming_salt.png b/farming/textures/farming_salt.png Binary files differindex 0aa733a..2b23e33 100644 --- a/farming/textures/farming_salt.png +++ b/farming/textures/farming_salt.png diff --git a/farming/textures/farming_turkish_delight.png b/farming/textures/farming_turkish_delight.png Binary files differnew file mode 100644 index 0000000..198ffc4 --- /dev/null +++ b/farming/textures/farming_turkish_delight.png 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/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 Binary files differnew file mode 100644 index 0000000..55986d0 --- /dev/null +++ b/trafficlight/textures/streets_pl_flashingwalk.png diff --git a/trafficlight/textures/streets_tl_flashgreen.png b/trafficlight/textures/streets_tl_flashgreen.png Binary files differnew file mode 100644 index 0000000..dd9cb78 --- /dev/null +++ b/trafficlight/textures/streets_tl_flashgreen.png diff --git a/trafficlight/textures/streets_tl_flashred_alt.png b/trafficlight/textures/streets_tl_flashred_alt.png Binary files differnew file mode 100644 index 0000000..5fc8371 --- /dev/null +++ b/trafficlight/textures/streets_tl_flashred_alt.png diff --git a/trafficlight/textures/streets_tl_left_flashgreen.png b/trafficlight/textures/streets_tl_left_flashgreen.png Binary files differnew file mode 100644 index 0000000..9cb8b60 --- /dev/null +++ b/trafficlight/textures/streets_tl_left_flashgreen.png diff --git a/trafficlight/textures/streets_tl_left_flashred_alt.png b/trafficlight/textures/streets_tl_left_flashred_alt.png Binary files differnew file mode 100644 index 0000000..2b11eeb --- /dev/null +++ b/trafficlight/textures/streets_tl_left_flashred_alt.png diff --git a/trafficlight/textures/streets_tl_left_redyellow.png b/trafficlight/textures/streets_tl_left_redyellow.png Binary files differnew file mode 100644 index 0000000..4b58d78 --- /dev/null +++ b/trafficlight/textures/streets_tl_left_redyellow.png diff --git a/trafficlight/textures/streets_tl_left_warn_alt.png b/trafficlight/textures/streets_tl_left_warn_alt.png Binary files differnew file mode 100644 index 0000000..4e36822 --- /dev/null +++ b/trafficlight/textures/streets_tl_left_warn_alt.png diff --git a/trafficlight/textures/streets_tl_redyellow.png b/trafficlight/textures/streets_tl_redyellow.png Binary files differnew file mode 100644 index 0000000..234d987 --- /dev/null +++ b/trafficlight/textures/streets_tl_redyellow.png diff --git a/trafficlight/textures/streets_tl_right_flashgreen.png b/trafficlight/textures/streets_tl_right_flashgreen.png Binary files differnew file mode 100644 index 0000000..8d21ac9 --- /dev/null +++ b/trafficlight/textures/streets_tl_right_flashgreen.png diff --git a/trafficlight/textures/streets_tl_right_flashred_alt.png b/trafficlight/textures/streets_tl_right_flashred_alt.png Binary files differnew file mode 100644 index 0000000..3a82b10 --- /dev/null +++ b/trafficlight/textures/streets_tl_right_flashred_alt.png diff --git a/trafficlight/textures/streets_tl_right_redyellow.png b/trafficlight/textures/streets_tl_right_redyellow.png Binary files differnew file mode 100644 index 0000000..e0fb8fa --- /dev/null +++ b/trafficlight/textures/streets_tl_right_redyellow.png diff --git a/trafficlight/textures/streets_tl_right_warn_alt.png b/trafficlight/textures/streets_tl_right_warn_alt.png Binary files differnew file mode 100644 index 0000000..7cadbc4 --- /dev/null +++ b/trafficlight/textures/streets_tl_right_warn_alt.png diff --git a/trafficlight/textures/streets_tl_warn_alt.png b/trafficlight/textures/streets_tl_warn_alt.png Binary files differnew file mode 100644 index 0000000..26b1387 --- /dev/null +++ b/trafficlight/textures/streets_tl_warn_alt.png diff --git a/trafficlight/textures/streets_tle_left_flashgreen.png b/trafficlight/textures/streets_tle_left_flashgreen.png Binary files differnew file mode 100644 index 0000000..8462064 --- /dev/null +++ b/trafficlight/textures/streets_tle_left_flashgreen.png diff --git a/trafficlight/textures/streets_tle_right_flashgreen.png b/trafficlight/textures/streets_tle_right_flashgreen.png Binary files differnew file mode 100644 index 0000000..59402e0 --- /dev/null +++ b/trafficlight/textures/streets_tle_right_flashgreen.png 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 |