Show achievement msg to achiever only (sett' add')

master
Wuzzy 2022-06-15 22:39:35 +02:00
parent a7ef7410a5
commit a56113ca14
2 changed files with 13 additions and 6 deletions

View File

@ -3,6 +3,7 @@
--
local COLOR_GOTTEN = "#00FF00"
local COLOR_GOTTEN_MSG = "#00FF00"
local S = minetest.get_translator("rp_achievements")
@ -175,22 +176,25 @@ local function check_achievement_gotten(player, aname)
minetest.after(
2.0,
function(name, aname)
if not minetest.is_singleplayer() then
local notify_all = minetest.settings:get_bool("rp_achievements_notify_all", false)
if notify_all and (not minetest.is_singleplayer()) then
-- Notify all players
minetest.chat_send_all(
minetest.colorize(
"#0f0",
COLOR_GOTTEN_MSG,
"*** " .. S("@1 has earned the achievement “@2”.",
name,
achievements.registered_achievements[aname].title)))
else
-- Only notify the player who got the achievement
minetest.chat_send_player(name,
minetest.colorize(
"#0f0",
COLOR_GOTTEN_MSG,
"*** " .. S("You have earned the achievement “@1”.",
achievements.registered_achievements[aname].title)))
end
minetest.log("action", "[rp_achievements] " .. name .. " got achievement '"..aname.."'")
end, name, aname)
minetest.log("action", "[rp_achievements] " .. name .. " got achievement '"..aname.."'")
end
if rp_formspec.current_page[name] == "rp_achievements:achievements" then

View File

@ -3,8 +3,6 @@
## Menu settings for this game
##
## Multiplayer settings
[Player]
# If enabled, players drop their items when they die.
drop_items_on_die (Drop items on death) bool true
@ -28,6 +26,11 @@ hunger_enable (Enable hunger) bool true
# which is really fast!
hunger_step (Hunger frequency) float 3.0 0.0
# If enabled, all players will get a notification in chat when a player
# earned an achievement. If disabled, only the achiever will get a
# notification.
rp_achievements_notify_all (Announce achievements to all) bool false
[World]
# If enabled, the weather will change from time to time.
weather_enable (Enable dynamic weather) bool true