Send chat-msg with unlock-count for new recipes

This commit is contained in:
Jaidyn Ann 2024-08-13 21:58:12 -05:00
parent ccc3ea7b5d
commit 4c3cb4fd6b
2 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -51,3 +51,5 @@ Click again to show recipes.=
No recipes.=
Click again to show usages.=
Recipes=
New recipe unlocked!=
@1 new recipes unlocked!=