From 34b06df758bd5d4f01e0a24e77cf4a8df44d078b Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Tue, 23 Mar 2021 17:09:26 +0000 Subject: [PATCH] add ability to follow group: items --- api.lua | 12 ++++++++++-- api.txt | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/api.lua b/api.lua index 6011479..a3a75c6 100644 --- a/api.lua +++ b/api.lua @@ -8,7 +8,7 @@ local use_cmi = minetest.global_exists("cmi") mobs = { mod = "redo", - version = "20210318", + version = "20210323", intllib = S, invis = minetest.global_exists("invisibility") and invisibility or {} } @@ -251,9 +251,17 @@ local check_for = function(look_for, look_inside) for _, str in pairs(look_inside) do if str == look_for then - return true end + + if str:find("group:") then + + local group = str:split(":")[2] + + if minetest.get_item_group(look_for, group) ~= 0 then + return true + end + end end end diff --git a/api.txt b/api.txt index 2b3351c..08214a6 100644 --- a/api.txt +++ b/api.txt @@ -76,7 +76,7 @@ functions needed for the mob to work properly which contains the following: 'floats' when set to 1 mob will float in water, 0 has them sink. 'follow' mobs follow player when holding any of the items which appear on this table, the same items can be fed to a mob to tame or - breed e.g. {"farming:wheat", "default:apple"} + breed e.g. {"farming:wheat", "default:apple", "group:fish"} 'reach' is how far the mob can attack player when standing nearby, default is 3 nodes.