From 4c3cb4fd6b8c6b64a36d5cc691205438f9be636e Mon Sep 17 00:00:00 2001 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> Date: Tue, 13 Aug 2024 21:58:12 -0500 Subject: [PATCH] Send chat-msg with unlock-count for new recipes --- init.lua | 8 +++++++- locale/template.txt | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 0bbc7b5..89059ad 100644 --- a/init.lua +++ b/init.lua @@ -510,7 +510,9 @@ function update_known_items(player, item_name) end -- Mark items craftable with this (and other) items as known. + local new_recipes = 0 for _,out_item_name in pairs(known_crafting_outputs(data, item_name)) do + new_recipes = new_recipes + 1 data.known_items[out_item_name] = true end @@ -518,7 +520,11 @@ function update_known_items(player, item_name) data.items = visible_items(data) -- Notify the player. - minetest.chat_send_player(name, S("New recipes unlocked!")) + if new_recipes == 1 then + minetest.chat_send_player(name, S("New recipe unlocked!")) + elseif new_recipes > 1 then + minetest.chat_send_player(name, S("@1 new recipes unlocked!", new_recipes)) + end end end diff --git a/locale/template.txt b/locale/template.txt index e02a721..f98012f 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -51,3 +51,5 @@ Click again to show recipes.= No recipes.= Click again to show usages.= Recipes= +New recipe unlocked!= +@1 new recipes unlocked!=