tidy code, tweak recipes, simplify peas, soy, rice

This commit is contained in:
tenplus1 2021-12-04 14:06:18 +00:00
parent 4227d967e5
commit 273ce33bcd
15 changed files with 198 additions and 155 deletions

View File

@ -54,7 +54,7 @@ local function place_cocoa(itemstack, placer, pointed_thing, plantname)
minetest.after(0.20, minetest.after(0.20,
farming.refill_plant, farming.refill_plant,
placer, placer,
"farming:cocoa_beans", "farming:cocoa_beans_raw",
placer:get_wield_index() placer:get_wield_index()
) )
end end
@ -64,15 +64,28 @@ local function place_cocoa(itemstack, placer, pointed_thing, plantname)
end end
-- cocoa beans -- cocoa beans
minetest.register_craftitem("farming:cocoa_beans", { minetest.register_craftitem("farming:cocoa_beans_raw", {
description = S("Cocoa Beans"), description = S("Raw Cocoa Beans"),
inventory_image = "farming_cocoa_beans.png", inventory_image = "farming_cocoa_beans.png^[brighten",
groups = {seed = 2, food_cocoa = 1, flammable = 2}, groups = {seed = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return place_cocoa(itemstack, placer, pointed_thing, "farming:cocoa_1") return place_cocoa(itemstack, placer, pointed_thing, "farming:cocoa_1")
end end
}) })
minetest.register_craftitem("farming:cocoa_beans", {
description = S("Cocoa Beans"),
inventory_image = "farming_cocoa_beans.png",
groups = {food_cocoa = 1, flammable = 2}
})
minetest.register_craft({
type = "cooking",
cooktime = 5,
output = "farming:cocoa_beans",
recipe = "farming:cocoa_beans_raw"
})
minetest.register_craft( { minetest.register_craft( {
output = "dye:brown 2", output = "dye:brown 2",
recipe = {{"farming:cocoa_beans"}} recipe = {{"farming:cocoa_beans"}}
@ -166,7 +179,7 @@ minetest.register_node("farming:cocoa_2", table.copy(def))
def.tiles = {"farming_cocoa_3.png"} def.tiles = {"farming_cocoa_3.png"}
def.drop = { def.drop = {
items = { items = {
{items = {"farming:cocoa_beans 1"}, rarity = 1} {items = {"farming:cocoa_beans_raw 1"}, rarity = 1}
} }
} }
minetest.register_node("farming:cocoa_3", table.copy(def)) minetest.register_node("farming:cocoa_3", table.copy(def))
@ -177,9 +190,9 @@ def.groups.growing = nil
def.growth_check = nil def.growth_check = nil
def.drop = { def.drop = {
items = { items = {
{items = {"farming:cocoa_beans 2"}, rarity = 1}, {items = {"farming:cocoa_beans_raw 2"}, rarity = 1},
{items = {"farming:cocoa_beans 1"}, rarity = 2}, {items = {"farming:cocoa_beans_raw 1"}, rarity = 2},
{items = {"farming:cocoa_beans 1"}, rarity = 4} {items = {"farming:cocoa_beans_raw 1"}, rarity = 4}
} }
} }
minetest.register_node("farming:cocoa_4", table.copy(def)) minetest.register_node("farming:cocoa_4", table.copy(def))
@ -187,7 +200,7 @@ minetest.register_node("farming:cocoa_4", table.copy(def))
-- add to registered_plants -- add to registered_plants
farming.registered_plants["farming:cocoa_beans"] = { farming.registered_plants["farming:cocoa_beans"] = {
crop = "farming:cocoa", crop = "farming:cocoa",
seed = "farming:cocoa_beans", seed = "farming:cocoa_beans_raw",
minlight = farming.min_light, minlight = farming.min_light,
maxlight = farming.max_light, maxlight = farming.max_light,
steps = 4 steps = 4

View File

@ -35,28 +35,13 @@ minetest.register_alias("farming:drinking_cup", "vessels:drinking_glass")
minetest.register_craft( { minetest.register_craft( {
output = "farming:coffee_cup", output = "farming:coffee_cup",
recipe = { recipe = {
{"group:food_saucepan", "group:food_coffee", "group:water_bucket"}, {"group:food_saucepan", "group:food_coffee", "group:food_water_glass"}
{"", "vessels:drinking_glass", ""}
}, },
replacements = { replacements = {
{"group:water_bucket", "bucket:bucket_empty"},
{"group:food_saucepan", "farming:saucepan"} {"group:food_saucepan", "farming:saucepan"}
} }
}) })
if minetest.get_modpath("bucket_wooden") then
minetest.register_craft( {
output = "farming:coffee_cup",
recipe = {
{"group:food_saucepan", "group:food_coffee", "group:water_bucket_wooden"},
{"", "vessels:drinking_glass", ""}
},
replacements = {
{"group:water_bucket_wooden", "bucket_wooden:bucket_empty"},
{"group:food_saucepan", "farming:saucepan"}
}
})
end
-- coffee definition -- coffee definition
local def = { local def = {

View File

@ -31,27 +31,13 @@ minetest.register_craft({
output = "farming:mint_tea", output = "farming:mint_tea",
recipe = { recipe = {
{"group:food_mint", "group:food_mint", "group:food_mint"}, {"group:food_mint", "group:food_mint", "group:food_mint"},
{"group:water_bucket", "farming:juicer", "vessels:drinking_glass"} {"group:food_water_glass", "farming:juicer", ""}
}, },
replacements = { replacements = {
{"group:food_juicer", "farming:juicer"}, {"group:food_juicer", "farming:juicer"}
{"group:water_bucket", "bucket:bucket_empty"}
} }
}) })
if minetest.get_modpath("bucket_wooden") then
minetest.register_craft({
output = "farming:mint_tea",
recipe = {
{"group:food_mint", "group:food_mint", "group:food_mint"},
{"group:water_bucket_wooden", "farming:juicer", "vessels:drinking_glass"}
},
replacements = {
{"group:food_juicer", "farming:juicer"},
{"group:water_bucket_wooden", "bucket_wooden:bucket_empty"}
}
})
end
-- mint definition -- mint definition
local def = { local def = {

View File

@ -7,23 +7,15 @@ local S = farming.intllib
minetest.register_craftitem("farming:pea_pod", { minetest.register_craftitem("farming:pea_pod", {
description = S("Pea Pod"), description = S("Pea Pod"),
inventory_image = "farming_pea_pod.png", inventory_image = "farming_pea_pod.png",
groups = {seed = 2, food_pea_pod = 1, flammable = 2}, groups = {seed = 2, food_peas = 1, food_pea_pod = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pea_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:pea_1")
end end,
})
minetest.register_craftitem("farming:peas", {
description = S("Peas"),
inventory_image = "farming_pea_peas.png",
groups = {food_peas = 1, flammable = 2},
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
minetest.register_craft({ -- replacement for separate peas item that was removed
output = "farming:peas", minetest.register_alias("farming:peas", "farming:pea_pod")
recipe = {{"farming:pea_pod"}}
})
-- pea soup -- pea soup
minetest.register_craftitem("farming:pea_soup", { minetest.register_craftitem("farming:pea_soup", {
@ -91,7 +83,7 @@ minetest.register_node("farming:pea_5", table.copy(def))
-- add to registered_plants -- add to registered_plants
farming.registered_plants["farming:pea_pod"] = { farming.registered_plants["farming:pea_pod"] = {
crop = "farming:pea", crop = "farming:pea_pod",
seed = "farming:pea_pod", seed = "farming:pea_pod",
minlight = farming.min_light, minlight = farming.min_light,
maxlight = farming.max_light, maxlight = farming.max_light,

139
crops/rice.lua Normal file
View File

@ -0,0 +1,139 @@
local S = farming.intllib
-- rice
minetest.register_craftitem("farming:rice", {
description = S("Rice"),
inventory_image = "farming_rice.png",
groups = {seed = 2, food_rice = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:rice_1")
end
})
-- replacement for rice seeds that was removed
minetest.register_alias("farming:seed_rice", "farming:rice")
minetest.register_craftitem("farming:rice_bread", {
description = S("Rice Bread"),
inventory_image = "farming_rice_bread.png",
on_use = minetest.item_eat(5),
groups = {food_rice_bread = 1, flammable = 2}
})
minetest.register_craftitem("farming:rice_flour", {
description = S("Rice Flour"),
inventory_image = "farming_rice_flour.png",
groups = {food_rice_flour = 1, flammable = 1}
})
minetest.register_craft({
output = "farming:rice_flour",
recipe = {
{"farming:rice", "farming:rice", "farming:rice"},
{"farming:rice", "farming:mortar_pestle", ""}
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:rice_bread",
recipe = "farming:rice_flour"
})
-- rice definition
local def = {
drawtype = "plantlike",
tiles = {"farming_rice_1.png"},
paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 4, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:rice_1", table.copy(def))
-- stage 2
def.tiles = {"farming_rice_2.png"}
minetest.register_node("farming:rice_2", table.copy(def))
-- stage 3
def.tiles = {"farming_rice_3.png"}
minetest.register_node("farming:rice_3", table.copy(def))
-- stage 4
def.tiles = {"farming_rice_4.png"}
minetest.register_node("farming:rice_4", table.copy(def))
-- stage 5
def.tiles = {"farming_rice_5.png"}
def.drop = {
items = {
{items = {"farming:rice"}, rarity = 2}
}
}
minetest.register_node("farming:rice_5", table.copy(def))
-- stage 6
def.tiles = {"farming_rice_6.png"}
def.drop = {
items = {
{items = {"farming:rice"}, rarity = 2}
}
}
minetest.register_node("farming:rice_6", table.copy(def))
-- stage 7
def.tiles = {"farming_rice_7.png"}
def.drop = {
items = {
{items = {"farming:rice"}, rarity = 1},
{items = {"farming:rice"}, rarity = 3}
}
}
minetest.register_node("farming:rice_7", table.copy(def))
-- stage 8 (final)
def.tiles = {"farming_rice_8.png"}
def.groups.growing = nil
def.drop = {
items = {
{items = {"farming:rice 2"}, rarity = 1},
{items = {"farming:rice"}, rarity = 2}
}
}
minetest.register_node("farming:rice_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:rice"] = {
crop = "farming:rice",
seed = "farming:rice",
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 8
}
-- fuels
minetest.register_craft({
type = "fuel",
recipe = "farming:rice",
burntime = 1
})
minetest.register_craft({
type = "fuel",
recipe = "farming:rice_bread",
burntime = 1
})

View File

@ -59,54 +59,6 @@ minetest.register_craft({
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}} replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
}) })
-- Rice
farming.register_plant("farming:rice", {
description = S("Rice grains"),
paramtype2 = "meshoptions",
inventory_image = "farming_rice_seed.png",
steps = 8,
place_param2 = 3
})
minetest.override_item("farming:rice", {
description = S("Rice"),
groups = {food_rice = 1, flammable = 4}
})
minetest.override_item("farming:rice_1", {drop = {}})
minetest.override_item("farming:rice_2", {drop = {}})
minetest.override_item("farming:rice_3", {drop = {}})
minetest.register_craftitem("farming:rice_bread", {
description = S("Rice Bread"),
inventory_image = "farming_rice_bread.png",
on_use = minetest.item_eat(5),
groups = {food_rice_bread = 1, flammable = 2}
})
minetest.register_craftitem("farming:rice_flour", {
description = S("Rice Flour"),
inventory_image = "farming_rice_flour.png",
groups = {food_rice_flour = 1, flammable = 1}
})
minetest.register_craft({
output = "farming:rice_flour",
recipe = {
{"farming:rice", "farming:rice", "farming:rice"},
{"farming:rice", "farming:mortar_pestle", ""}
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:rice_bread",
recipe = "farming:rice_flour"
})
-- Multigrain flour -- Multigrain flour
minetest.register_craftitem("farming:flour_multigrain", { minetest.register_craftitem("farming:flour_multigrain", {
@ -143,12 +95,6 @@ minetest.register_craft({
-- Fuels -- Fuels
minetest.register_craft({
type = "fuel",
recipe = "farming:rice_bread",
burntime = 1
})
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "farming:bread_multigrain", recipe = "farming:bread_multigrain",
@ -166,9 +112,3 @@ minetest.register_craft({
recipe = "farming:oat", recipe = "farming:oat",
burntime = 1 burntime = 1
}) })
minetest.register_craft({
type = "fuel",
recipe = "farming:rice",
burntime = 1
})

View File

@ -5,23 +5,14 @@ local S = farming.intllib
minetest.register_craftitem("farming:soy_pod", { minetest.register_craftitem("farming:soy_pod", {
description = S("Soy Pod"), description = S("Soy Pod"),
inventory_image = "farming_soy_pod.png", inventory_image = "farming_soy_pod.png",
groups = {seed = 2, food_soy_pod = 1, flammable = 2}, groups = {seed = 2, food_soy = 1, food_soy_pod = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:soy_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:soy_1")
end end
}) })
minetest.register_craftitem("farming:soy_beans", { -- replacement for soy beans that was removed
description = S("Soy Beans"), minetest.register_alias("farming:soy_beans", "farming:soy_pod")
inventory_image = "farming_soy_beans.png",
groups = {food_soy = 1, flammable = 2},
on_use = minetest.item_eat(1)
})
minetest.register_craft({
output = "farming:soy_beans",
recipe = {{"farming:soy_pod"}}
})
-- soy sauce -- soy sauce
minetest.register_node("farming:soy_sauce", { minetest.register_node("farming:soy_sauce", {
@ -42,7 +33,6 @@ minetest.register_node("farming:soy_sauce", {
sounds = default.node_sound_glass_defaults() sounds = default.node_sound_glass_defaults()
}) })
-- soy sauce recipe -- soy sauce recipe
minetest.register_craft( { minetest.register_craft( {
output = "farming:soy_sauce", output = "farming:soy_sauce",
@ -173,7 +163,7 @@ def.drop = {
max_items = 3, items = { max_items = 3, items = {
{items = {"farming:soy_pod"}, rarity = 1}, {items = {"farming:soy_pod"}, rarity = 1},
{items = {"farming:soy_pod"}, rarity = 2}, {items = {"farming:soy_pod"}, rarity = 2},
{items = {"farming:soy_pod"}, rarity = 3}, {items = {"farming:soy_pod"}, rarity = 3}
} }
} }
minetest.register_node("farming:soy_6", table.copy(def)) minetest.register_node("farming:soy_6", table.copy(def))
@ -194,7 +184,7 @@ minetest.register_node("farming:soy_7", table.copy(def))
-- add to registered_plants -- add to registered_plants
farming.registered_plants["farming:soy_pod"] = { farming.registered_plants["farming:soy_pod"] = {
crop = "farming:soy", crop = "farming:soy_pod",
seed = "farming:soy_pod", seed = "farming:soy_pod",
minlight = farming.min_light, minlight = farming.min_light,
maxlight = farming.max_light, maxlight = farming.max_light,

View File

@ -50,10 +50,10 @@ minetest.register_craft( {
output = "farming:vanilla_extract", output = "farming:vanilla_extract",
recipe = { recipe = {
{"group:food_vanilla", "group:food_vanilla", "group:food_vanilla"}, {"group:food_vanilla", "group:food_vanilla", "group:food_vanilla"},
{"group:food_vanilla", "farming:bottle_ethanol", "bucket:bucket_water"}, {"group:food_vanilla", "farming:bottle_ethanol", "group:food_water_glass"},
}, },
replacements = { replacements = {
{"bucket:bucket_water", "bucket:bucket_empty"}, {"group:food_water_glass", "vessels:drinking_glass"}
} }
}) })

View File

@ -39,6 +39,7 @@ farming.artichoke = 0.001
farming.parsley = 0.002 farming.parsley = 0.002
farming.sunflower = 0.001 farming.sunflower = 0.001
farming.grains = true -- true or false only farming.grains = true -- true or false only
farming.rice = true
-- default rarety of crops on map (higher number = more crops) -- default rarety of crops on map (higher number = more crops)
farming.rarety = 0.002 farming.rarety = 0.002

View File

@ -39,6 +39,19 @@ minetest.register_craft({
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}} replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}}
}) })
if minetest.get_modpath("bucket_wooden") then
minetest.register_craft({
output = "farming:glass_water 4",
recipe = {
{"vessels:drinking_glass", "vessels:drinking_glass"},
{"vessels:drinking_glass", "vessels:drinking_glass"},
{"group:water_bucket_wooden", "farming:hemp_fibre"}
},
replacements = {{"group:water_bucket_wooden", "bucket_wooden:bucket_empty"}}
})
end
--= Sugar --= Sugar
minetest.register_craftitem("farming:sugar", { minetest.register_craftitem("farming:sugar", {
@ -155,7 +168,6 @@ minetest.register_node("farming:salt_crystal", {
}, },
}) })
minetest.register_craft({ minetest.register_craft({
-- type = "shapeless",
output = "farming:salt 9", output = "farming:salt 9",
recipe = { recipe = {
{"farming:salt_crystal", "farming:mortar_pestle"} {"farming:salt_crystal", "farming:mortar_pestle"}
@ -196,29 +208,14 @@ minetest.register_craft({
recipe = { recipe = {
{"flowers:rose", "flowers:rose", "flowers:rose"}, {"flowers:rose", "flowers:rose", "flowers:rose"},
{"flowers:rose", "flowers:rose", "flowers:rose"}, {"flowers:rose", "flowers:rose", "flowers:rose"},
{"group:water_bucket", "group:food_pot", "vessels:glass_bottle"} {"group:food_water_glass", "group:food_pot", "vessels:glass_bottle"}
}, },
replacements = { replacements = {
{"group:water_bucket", "bucket:bucket_empty"}, {"group:food_water_glass", "vessels:drinking_glass"},
{"group:food_pot", "farming:pot"} {"group:food_pot", "farming:pot"}
} }
}) })
if minetest.get_modpath("bucket_wooden") then
minetest.register_craft({
output = "farming:rose_water",
recipe = {
{"flowers:rose", "flowers:rose", "flowers:rose"},
{"flowers:rose", "flowers:rose", "flowers:rose"},
{"group:water_bucket_wooden", "group:food_pot", "vessels:glass_bottle"}
},
replacements = {
{"group:water_bucket_wooden", "bucket_wooden:bucket_empty"},
{"group:food_pot", "farming:pot"}
}
})
end
--= Turkish Delight --= Turkish Delight
minetest.register_craftitem("farming:turkish_delight", { minetest.register_craftitem("farming:turkish_delight", {
@ -251,7 +248,6 @@ minetest.register_craftitem("farming:garlic_bread", {
}) })
minetest.register_craft({ minetest.register_craft({
-- type = "shapeless",
output = "farming:garlic_bread", output = "farming:garlic_bread",
recipe = { recipe = {
{"group:food_toast", "group:food_garlic_clove", "group:food_garlic_clove"} {"group:food_toast", "group:food_garlic_clove", "group:food_garlic_clove"}
@ -312,7 +308,6 @@ minetest.register_craftitem("farming:porridge", {
}) })
minetest.register_craft({ minetest.register_craft({
-- type = "shapeless",
output = "farming:porridge", output = "farming:porridge",
recipe = { recipe = {
{"group:food_oats", "group:food_oats", "group:food_oats"}, {"group:food_oats", "group:food_oats", "group:food_oats"},
@ -333,7 +328,6 @@ minetest.register_craftitem("farming:jaffa_cake", {
}) })
minetest.register_craft({ minetest.register_craft({
-- type = "shapeless",
output = "farming:jaffa_cake", output = "farming:jaffa_cake",
recipe = { recipe = {
{"farming:baking_tray", "group:food_egg", "group:food_sugar"}, {"farming:baking_tray", "group:food_egg", "group:food_sugar"},
@ -342,7 +336,8 @@ minetest.register_craft({
}, },
replacements = { replacements = {
{"farming:baking_tray", "farming:baking_tray"}, {"farming:baking_tray", "farming:baking_tray"},
{"mobs:bucket_milk", "bucket:bucket_empty"} {"mobs:bucket_milk", "bucket:bucket_empty"},
{"farming:soy_milk", "vessels:drining_glass"}
} }
}) })

View File

@ -39,7 +39,7 @@ minetest.override_item("default:junglegrass", {
max_items = 1, max_items = 1,
items = { items = {
{items = {"farming:seed_cotton"}, rarity = 8}, {items = {"farming:seed_cotton"}, rarity = 8},
{items = {"farming:seed_rice"},rarity = 8}, {items = {"farming:rice"},rarity = 8},
{items = {"default:junglegrass"}} {items = {"default:junglegrass"}}
} }
} }

View File

@ -636,6 +636,7 @@ farming.artichoke = 0.001
farming.parsley = 0.002 farming.parsley = 0.002
farming.sunflower = 0.001 farming.sunflower = 0.001
farming.grains = true farming.grains = true
farming.rice = true
farming.rarety = 0.002 farming.rarety = 0.002
@ -699,6 +700,7 @@ ddoo("peas.lua", farming.peas)
ddoo("beetroot.lua", farming.beetroot) ddoo("beetroot.lua", farming.beetroot)
ddoo("chili.lua", farming.chili) ddoo("chili.lua", farming.chili)
ddoo("ryeoatrice.lua", farming.grains) ddoo("ryeoatrice.lua", farming.grains)
ddoo("rice.lua", farming.rice)
ddoo("mint.lua", farming.mint) ddoo("mint.lua", farming.mint)
ddoo("cabbage.lua", farming.cabbage) ddoo("cabbage.lua", farming.cabbage)
ddoo("blackberry.lua", farming.blackberry) ddoo("blackberry.lua", farming.blackberry)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 659 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 699 B