From 648bae7517df709b68d420e3bf2cc9483307f1dd Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Fri, 26 Jul 2024 15:29:09 +0100 Subject: [PATCH] add {eatable} group to default apple, blueberries, mushrooms if found --- compatibility.lua | 24 ++++++++++++++++++++++++ mod.conf | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/compatibility.lua b/compatibility.lua index bd12fc9..7c117b5 100644 --- a/compatibility.lua +++ b/compatibility.lua @@ -8,6 +8,30 @@ local alias = function(orig, new) minetest.register_alias(orig, new) end +--= Add {eatable} group to default apple, blueberries and brown mushroom + +local function add_grp(item, hp) + + local def = minetest.registered_items[item] + + if def then + + def.groups.eatable = hp + def.description = def.description .. " (♥" .. hp .. ")" + + minetest.override_item(item, { + description = def.description, + groups = def.groups + }) + end +end + +add_grp("default:apple", 2) +add_grp("default:blueberries", 1) +add_grp("flowers:mushroom_brown", 1) +add_grp("flowers:mushroom_red", -5) + + --= Aliases -- Banana diff --git a/mod.conf b/mod.conf index 03a9990..bcaba21 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = farming description = Adds many new plants and food into Minetest. -optional_depends = default, mcl_core, mcl_sounds, mcl_farming, mcl_stairs, mcl_flowers, stairs, lucky_block, toolranks +optional_depends = default, flowers, mcl_core, mcl_sounds, mcl_farming, mcl_stairs, mcl_flowers, stairs, lucky_block, toolranks min_minetest_version = 5.0