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