forked from nalc/awards
Replace all mentions of achievements with awards
This commit is contained in:
parent
a5768efbc0
commit
75c01a188a
@ -1,6 +1,6 @@
|
||||
# Awards
|
||||
|
||||
Adds achievements to Minetest (plus a very good API).
|
||||
Adds awards/achievements to Minetest (plus a very good API).
|
||||
|
||||
by [rubenwardy](https://rubenwardy.com), licensed under MIT.
|
||||
With thanks to Wuzzy, kaeza, and MrIbby.
|
||||
|
8
api.lua
8
api.lua
@ -412,9 +412,9 @@ function awards.unlock(name, award)
|
||||
if awards.show_mode == "chat" then
|
||||
local chat_announce
|
||||
if awdef.secret then
|
||||
chat_announce = S("Secret Achievement Unlocked: %s")
|
||||
chat_announce = S("Secret Award Unlocked: %s")
|
||||
else
|
||||
chat_announce = S("Achievement Unlocked: %s")
|
||||
chat_announce = S("Award Unlocked: %s")
|
||||
end
|
||||
-- use the chat console to send it
|
||||
minetest.chat_send_player(name, string.format(chat_announce, title))
|
||||
@ -434,9 +434,9 @@ function awards.unlock(name, award)
|
||||
})
|
||||
local hud_announce
|
||||
if awdef.secret then
|
||||
hud_announce = S("Secret Achievement Unlocked!")
|
||||
hud_announce = S("Secret Award Unlocked!")
|
||||
else
|
||||
hud_announce = S("Achievement Unlocked!")
|
||||
hud_announce = S("Award Unlocked!")
|
||||
end
|
||||
local two = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
|
@ -4,7 +4,7 @@ local S = awards.gettext
|
||||
|
||||
minetest.register_chatcommand("awards", {
|
||||
params = S("[c|clear|disable|enable]"),
|
||||
description = S("Show, clear, disable or enable your achievements"),
|
||||
description = S("Show, clear, disable or enable your awards"),
|
||||
func = function(name, param)
|
||||
if param == "clear" then
|
||||
awards.clear_player(name)
|
||||
@ -12,10 +12,10 @@ minetest.register_chatcommand("awards", {
|
||||
S("All your awards and statistics have been cleared. You can now start again."))
|
||||
elseif param == "disable" then
|
||||
awards.disable(name)
|
||||
minetest.chat_send_player(name, S("You have disabled achievements."))
|
||||
minetest.chat_send_player(name, S("You have disabled awards."))
|
||||
elseif param == "enable" then
|
||||
awards.enable(name)
|
||||
minetest.chat_send_player(name, S("You have enabled achievements."))
|
||||
minetest.chat_send_player(name, S("You have enabled awards."))
|
||||
elseif param == "c" then
|
||||
awards.show_to(name, name, nil, true)
|
||||
else
|
||||
@ -32,14 +32,14 @@ minetest.register_chatcommand("awards", {
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("awd", {
|
||||
params = S("<achievement ID>"),
|
||||
description = S("Show details of an achievement"),
|
||||
params = S("<award ID>"),
|
||||
description = S("Show details of an award"),
|
||||
func = function(name, param)
|
||||
local def = awards.registered_awards[param]
|
||||
if def then
|
||||
minetest.chat_send_player(name, string.format(S("%s: %s"), def.title, def.description))
|
||||
else
|
||||
minetest.chat_send_player(name, S("Achievement not found."))
|
||||
minetest.chat_send_player(name, S("Award not found."))
|
||||
end
|
||||
end
|
||||
})
|
||||
@ -49,7 +49,7 @@ minetest.register_chatcommand("awpl", {
|
||||
server = true
|
||||
},
|
||||
params = S("<name>"),
|
||||
description = S("Get the achievements statistics for the given player or yourself"),
|
||||
description = S("Get the awards statistics for the given player or yourself"),
|
||||
func = function(name, param)
|
||||
if not param or param == "" then
|
||||
param = name
|
||||
|
18
gui.lua
18
gui.lua
@ -79,12 +79,12 @@ function awards.get_formspec(name, to, sid)
|
||||
|
||||
if def and def.secret and not item.unlocked then
|
||||
formspec = formspec .. "label[1,2.75;"..
|
||||
minetest.formspec_escape(S("(Secret Achievement)")).."]"..
|
||||
minetest.formspec_escape(S("(Secret Award)")).."]"..
|
||||
"image[1,0;3,3;awards_unknown.png]"
|
||||
if def and def.description then
|
||||
formspec = formspec .. "textarea[0.25,3.25;4.8,1.7;;"..
|
||||
minetest.formspec_escape(
|
||||
S("Unlock this achievement to find out what it is."))..";]"
|
||||
S("Unlock this award to find out what it is."))..";]"
|
||||
end
|
||||
else
|
||||
local title = item.name
|
||||
@ -139,7 +139,7 @@ function awards.get_formspec(name, to, sid)
|
||||
first = false
|
||||
|
||||
if def.secret and not award.unlocked then
|
||||
formspec = formspec .. "#707070"..minetest.formspec_escape(S("(Secret Achievement)"))
|
||||
formspec = formspec .. "#707070"..minetest.formspec_escape(S("(Secret Award)"))
|
||||
else
|
||||
local title = award.name
|
||||
if def and def.title then
|
||||
@ -166,19 +166,19 @@ function awards.show_to(name, to, sid, text)
|
||||
end
|
||||
local data = awards.player(to)
|
||||
if name == to and data.disabled then
|
||||
minetest.chat_send_player(name, S("You've disabled achievements. Type /awards enable to reenable."))
|
||||
minetest.chat_send_player(name, S("You've disabled awards. Type /awards enable to reenable."))
|
||||
return
|
||||
end
|
||||
if text then
|
||||
local awards_list = order_awards(name)
|
||||
if #awards_list == 0 then
|
||||
minetest.chat_send_player(to, S("Error: No achievement available."))
|
||||
minetest.chat_send_player(to, S("Error: No award available."))
|
||||
return
|
||||
elseif not data or not data.unlocked then
|
||||
minetest.chat_send_player(to, S("You have not unlocked any achievements."))
|
||||
minetest.chat_send_player(to, S("You have not unlocked any awards."))
|
||||
return
|
||||
end
|
||||
minetest.chat_send_player(to, string.format(S("%s’s achievements:"), name))
|
||||
minetest.chat_send_player(to, string.format(S("%s’s awards:"), name))
|
||||
|
||||
for str, _ in pairs(data.unlocked) do
|
||||
local def = awards.registered_awards[str]
|
||||
@ -211,7 +211,7 @@ end
|
||||
|
||||
if minetest.get_modpath("sfinv") then
|
||||
sfinv.register_page("awards:awards", {
|
||||
title = S("Achievements"),
|
||||
title = S("Awards"),
|
||||
on_enter = function(self, player, context)
|
||||
context.awards_idx = 1
|
||||
end,
|
||||
@ -241,7 +241,7 @@ if minetest.get_modpath("unified_inventory") ~= nil then
|
||||
unified_inventory.register_button("awards", {
|
||||
type = "image",
|
||||
image = "awards_ui_icon.png",
|
||||
tooltip = S("Achievements"),
|
||||
tooltip = S("Awards"),
|
||||
action = function(player)
|
||||
local name = player:get_player_name()
|
||||
awards.show_to(name, name, nil, false)
|
||||
|
Loading…
Reference in New Issue
Block a user