summaryrefslogtreecommitdiff
path: root/crops
diff options
context:
space:
mode:
authorroot <root@linux-forks.de>2018-07-19 19:44:13 +0200
committerroot <root@linux-forks.de>2018-07-19 19:44:13 +0200
commitaaf20dcc464966c3565d5ceef23c1170b9c430b0 (patch)
treed1d6b84237d0f64261e83513c24e364f87922eef /crops
parent48422e26c9f7bc50eb2d70601230172c842410ea (diff)
parent8606b41c95b36973f0e8901cd0868290aedc018f (diff)
Merge https://notabug.org/TenPlus1/Farming
Diffstat (limited to 'crops')
-rw-r--r--crops/beans.lua9
-rw-r--r--crops/beetroot.lua2
-rw-r--r--crops/cocoa.lua9
-rw-r--r--crops/coffee.lua71
-rw-r--r--crops/garlic.lua5
-rw-r--r--crops/grapes.lua9
-rw-r--r--crops/onion.lua2
-rw-r--r--crops/peas.lua2
-rw-r--r--crops/pepper.lua2
9 files changed, 37 insertions, 74 deletions
diff --git a/crops/beans.lua b/crops/beans.lua
index 888a0a1..a575956 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 and 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/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/cocoa.lua b/crops/cocoa.lua
index 1510b3a..19e9c6b 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 and 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/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
diff --git a/crops/garlic.lua b/crops/garlic.lua
index 52ae25f..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},
},
}
})
@@ -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/crops/grapes.lua b/crops/grapes.lua
index 8b0ae2a..d8c6c3f 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 and 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()
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()