Send chat-msg with unlock-count for new recipes
This commit is contained in:
parent
ccc3ea7b5d
commit
4c3cb4fd6b
8
init.lua
8
init.lua
|
@ -510,7 +510,9 @@ function update_known_items(player, item_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Mark items craftable with this (and other) items as known.
|
-- 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
|
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
|
data.known_items[out_item_name] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -518,7 +520,11 @@ function update_known_items(player, item_name)
|
||||||
data.items = visible_items(data)
|
data.items = visible_items(data)
|
||||||
|
|
||||||
-- Notify the player.
|
-- 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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -51,3 +51,5 @@ Click again to show recipes.=
|
||||||
No recipes.=
|
No recipes.=
|
||||||
Click again to show usages.=
|
Click again to show usages.=
|
||||||
Recipes=
|
Recipes=
|
||||||
|
New recipe unlocked!=
|
||||||
|
@1 new recipes unlocked!=
|
||||||
|
|
Ŝarĝante…
Reference in New Issue