From 83ef1cebb24d9862f18dac7a35f4b02765e94794 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Thu, 14 Jun 2018 09:12:02 +0100 Subject: stairs no longer dependency, will use only when found --- crops/hemp.lua | 33 ++++++++++++++++++--------------- crops/wheat.lua | 34 +++++++++++++++++++--------------- 2 files changed, 37 insertions(+), 30 deletions(-) (limited to 'crops') diff --git a/crops/hemp.lua b/crops/hemp.lua index dd49134..e3278f9 100644 --- a/crops/hemp.lua +++ b/crops/hemp.lua @@ -111,21 +111,24 @@ minetest.register_craft( { }, }) --- register stairs -if stairs and 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", - default.node_sound_leaves_defaults()) +-- 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", + default.node_sound_leaves_defaults()) + end end -- paper diff --git a/crops/wheat.lua b/crops/wheat.lua index d53c33e..abf3ada 100644 --- a/crops/wheat.lua +++ b/crops/wheat.lua @@ -51,21 +51,25 @@ minetest.register_craft({ } }) -if stairs and 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()) +-- 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 -- cgit v1.2.3 From 9d6728053aa2138e1fc77938ec4c34f89ba29542 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Thu, 14 Jun 2018 09:20:30 +0100 Subject: fix hemp block stair naming --- crops/hemp.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'crops') diff --git a/crops/hemp.lua b/crops/hemp.lua index e3278f9..eb522a9 100644 --- a/crops/hemp.lua +++ b/crops/hemp.lua @@ -126,7 +126,8 @@ if minetest.global_exists("stairs") then stairs.register_stair_and_slab("hemp_block", "farming:hemp_block", {snappy = 1, flammable = 2}, {"farming_hemp_block.png"}, - "Hemp Block", + "Hemp Block Stair", + "Hemp Block Slab", default.node_sound_leaves_defaults()) end end -- cgit v1.2.3 From 8a4ca846d90abf5732b436c1f31b72c6b52e61dc Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Sun, 17 Jun 2018 09:55:26 +0100 Subject: added growth_check(pos, nodename) function --- crops/cocoa.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'crops') diff --git a/crops/cocoa.lua b/crops/cocoa.lua index 71d038e..1510b3a 100644 --- a/crops/cocoa.lua +++ b/crops/cocoa.lua @@ -124,7 +124,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 @@ -146,6 +152,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}, -- cgit v1.2.3 From 1018a558d2b92eb5cdba657c0f6367243c1b85a8 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Tue, 19 Jun 2018 18:36:00 +0100 Subject: added player checks for crop placement --- crops/beans.lua | 9 ++++++--- crops/cocoa.lua | 9 ++++++--- crops/grapes.lua | 9 ++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) (limited to 'crops') diff --git a/crops/beans.lua b/crops/beans.lua index 888a0a1..61b195b 100644 --- a/crops/beans.lua +++ b/crops/beans.lua @@ -27,12 +27,15 @@ 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:get_player_name() or "" + -- check for protection - if minetest.is_protected(pt.under, placer:get_player_name()) then + if minetest.is_protected(pt.under, name) then return end @@ -46,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() diff --git a/crops/cocoa.lua b/crops/cocoa.lua index 1510b3a..8424db4 100644 --- a/crops/cocoa.lua +++ b/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,8 +31,11 @@ local function place_cocoa(itemstack, placer, pointed_thing, plantname) return end + -- is player planting crop? + local name = placer:get_player_name() or "" + -- check for protection - if minetest.is_protected(pt.above, placer:get_player_name()) then + if minetest.is_protected(pt.above, name) then return end @@ -41,7 +44,7 @@ local function place_cocoa(itemstack, placer, pointed_thing, 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() diff --git a/crops/grapes.lua b/crops/grapes.lua index 8b0ae2a..8781ece 100644 --- a/crops/grapes.lua +++ b/crops/grapes.lua @@ -22,12 +22,15 @@ 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:get_player_name() or "" + -- check for protection - if minetest.is_protected(pt.under, placer:get_player_name()) then + if minetest.is_protected(pt.under, name) then return end @@ -41,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() -- cgit v1.2.3 From 10abb996c10c310f8cea66e7e085b852897a0a23 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Tue, 19 Jun 2018 18:42:13 +0100 Subject: nil check --- crops/beans.lua | 2 +- crops/cocoa.lua | 2 +- crops/grapes.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crops') diff --git a/crops/beans.lua b/crops/beans.lua index 61b195b..a575956 100644 --- a/crops/beans.lua +++ b/crops/beans.lua @@ -32,7 +32,7 @@ local function place_beans(itemstack, placer, pointed_thing, plantname) end -- is player planting crop? - local name = placer:get_player_name() or "" + local name = placer and placer:get_player_name() or "" -- check for protection if minetest.is_protected(pt.under, name) then diff --git a/crops/cocoa.lua b/crops/cocoa.lua index 8424db4..19e9c6b 100644 --- a/crops/cocoa.lua +++ b/crops/cocoa.lua @@ -32,7 +32,7 @@ local function place_cocoa(itemstack, placer, pointed_thing, plantname) end -- is player planting crop? - local name = placer:get_player_name() or "" + local name = placer and placer:get_player_name() or "" -- check for protection if minetest.is_protected(pt.above, name) then diff --git a/crops/grapes.lua b/crops/grapes.lua index 8781ece..d8c6c3f 100644 --- a/crops/grapes.lua +++ b/crops/grapes.lua @@ -27,7 +27,7 @@ local function place_grapes(itemstack, placer, pointed_thing, plantname) end -- is player planting seed? - local name = placer:get_player_name() or "" + local name = placer and placer:get_player_name() or "" -- check for protection if minetest.is_protected(pt.under, name) then -- cgit v1.2.3 From b6a970b5bdd7862ad50f342ed8e2c365736cb938 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Thu, 21 Jun 2018 08:57:06 +0100 Subject: removed drinking_cup, changed coffee recipe, recycle mixing bowl recipe --- crops/coffee.lua | 71 +++++++++++--------------------------------------------- 1 file changed, 13 insertions(+), 58 deletions(-) (limited to 'crops') diff --git a/crops/coffee.lua b/crops/coffee.lua index ab93d06..f98694b 100644 --- a/crops/coffee.lua +++ b/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 -- cgit v1.2.3 From d21559a1fd2e86fa1a69cd2f848d6bdbb1f4761b Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Mon, 9 Jul 2018 20:46:58 +0100 Subject: remove flora groups from certain crops, mistake --- crops/beetroot.lua | 2 +- crops/garlic.lua | 2 +- crops/onion.lua | 2 +- crops/peas.lua | 2 +- crops/pepper.lua | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'crops') diff --git a/crops/beetroot.lua b/crops/beetroot.lua index 1510a76..e683a94 100644 --- a/crops/beetroot.lua +++ b/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/crops/garlic.lua b/crops/garlic.lua index 52ae25f..0363708 100644 --- a/crops/garlic.lua +++ b/crops/garlic.lua @@ -93,7 +93,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/crops/onion.lua b/crops/onion.lua index 21b5c2e..d9268f8 100644 --- a/crops/onion.lua +++ b/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/crops/peas.lua b/crops/peas.lua index ef14dab..e50564e 100644 --- a/crops/peas.lua +++ b/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/crops/pepper.lua b/crops/pepper.lua index f700e35..498556e 100644 --- a/crops/pepper.lua +++ b/crops/pepper.lua @@ -72,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() -- cgit v1.2.3 From 8606b41c95b36973f0e8901cd0868290aedc018f Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Fri, 13 Jul 2018 17:29:49 +0100 Subject: code tidy --- crops/garlic.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'crops') diff --git a/crops/garlic.lua b/crops/garlic.lua index 0363708..f2bb16d 100644 --- a/crops/garlic.lua +++ b/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}, }, } }) -- cgit v1.2.3