summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-08-01 20:56:02 +0200
committerrubenwardy <rubenwardy@gmail.com>2016-08-01 23:46:49 +0100
commit9b6e93dd9a24306f28410d844e511387408030a9 (patch)
treee555e87221c5a70875959f87e00f25bee903bb78
parent49f251136e4de615f6d5cefe4a37a0dbb349c25a (diff)
Announce secret awards as secret awards
-rw-r--r--api.lua25
-rw-r--r--locale/template.txt5
2 files changed, 27 insertions, 3 deletions
diff --git a/api.lua b/api.lua
index 74f2d8e..c1cad60 100644
--- a/api.lua
+++ b/api.lua
@@ -222,7 +222,14 @@ function awards.unlock(name, award)
local desc = awdef.description or ""
local background = awdef.background or "awards_bg_default.png"
local icon = awdef.icon or "awards_unknown.png"
- local custom_announce = awdef.custom_announce or S("Achievement Unlocked:")
+ local custom_announce = awdef.custom_announce
+ if not custom_announce then
+ if awdef.secret then
+ custom_announce = S("Secret Achievement Unlocked:")
+ else
+ custom_announce = S("Achievement Unlocked:")
+ end
+ end
-- Do Notification
if awards.show_mode == "formspec" then
@@ -233,8 +240,14 @@ function awards.unlock(name, award)
"label[1.1,1;"..title.."]"..
"label[0.3,0.1;"..custom_announce.."]")
elseif awards.show_mode == "chat" then
+ local chat_announce
+ if awdef.secret == true then
+ chat_announce = S("Secret Achievement Unlocked: %s")
+ else
+ chat_announce = S("Achievement Unlocked: %s")
+ end
-- use the chat console to send it
- minetest.chat_send_player(name, S("Achievement Unlocked:")..title)
+ minetest.chat_send_player(name, string.format(chat_announce, title))
if desc~="" then
minetest.chat_send_player(name, desc)
end
@@ -249,12 +262,18 @@ function awards.unlock(name, award)
offset = {x = 0, y = 138},
alignment = {x = 0, y = -1}
})
+ local hud_announce
+ if awdef.secret == true then
+ hud_announce = S("Secret Achievement Unlocked!")
+ else
+ hud_announce = S("Achievement Unlocked!")
+ end
local two = player:hud_add({
hud_elem_type = "text",
name = "award_au",
number = 0xFFFFFF,
scale = {x = 100, y = 20},
- text = "Achievement Unlocked!",
+ text = hud_announce,
position = {x = 0.5, y = 0},
offset = {x = 0, y = 40},
alignment = {x = 0, y = -1}
diff --git a/locale/template.txt b/locale/template.txt
index cba9ce4..4035347 100644
--- a/locale/template.txt
+++ b/locale/template.txt
@@ -1,4 +1,9 @@
Achievement Unlocked: =
+Secret Achievement Unlocked: =
+Achievement Unlocked: %s =
+Secret Achievement Unlocked: %s =
+Achievement Unlocked! =
+Secret Achievement Unlocked! =
Light It Up =
Place 100 torches. =
Light ALL The Things! =