forked from mtcontrib/awards
Show error messages when there are no awards
This commit is contained in:
parent
a04f3df1e2
commit
ae01ea01dd
18
api.lua
18
api.lua
@ -341,10 +341,17 @@ function awards.getFormspec(name, to, sid)
|
|||||||
local listofawards = awards._order_awards(name)
|
local listofawards = awards._order_awards(name)
|
||||||
local playerdata = awards.players[name]
|
local playerdata = awards.players[name]
|
||||||
|
|
||||||
|
if #listofawards == 0 then
|
||||||
|
formspec = formspec .. "label[3.9,1.5;"..minetest.formspec_escape(S("Error: No awards available.")).."]"
|
||||||
|
formspec = formspec .. "button_exit[4.2,2.3;3,1;close;"..minetest.formspec_escape(S("OK")).."]"
|
||||||
|
return formspec
|
||||||
|
end
|
||||||
|
|
||||||
-- Sidebar
|
-- Sidebar
|
||||||
if sid then
|
if sid then
|
||||||
local item = listofawards[sid+0]
|
local item = listofawards[sid+0]
|
||||||
local def = awards.def[item.name]
|
local def = awards.def[item.name]
|
||||||
|
|
||||||
if def and def.secret and not item.got then
|
if def and def.secret and not item.got then
|
||||||
formspec = formspec .. "label[1,2.75;"..minetest.formspec_escape(S("(Secret Award)")).."]"..
|
formspec = formspec .. "label[1,2.75;"..minetest.formspec_escape(S("(Secret Award)")).."]"..
|
||||||
"image[1,0;3,3;awards_unknown.png]"
|
"image[1,0;3,3;awards_unknown.png]"
|
||||||
@ -428,8 +435,12 @@ function awards.show_to(name, to, sid, text)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
if text then
|
if text then
|
||||||
if not awards.players[name] or not awards.players[name].unlocked then
|
local listofawards = awards._order_awards(name)
|
||||||
minetest.chat_send_player(to, S("You have not unlocked any awards"))
|
if #listofawards == 0 then
|
||||||
|
minetest.chat_send_player(to, S("Error: No awards available."))
|
||||||
|
return
|
||||||
|
elseif not awards.players[name] or not awards.players[name].unlocked then
|
||||||
|
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 awards:"), name))
|
minetest.chat_send_player(to, string.format(S("%s’s awards:"), name))
|
||||||
@ -454,7 +465,8 @@ function awards.show_to(name, to, sid, text)
|
|||||||
end
|
end
|
||||||
-- Show formspec to user
|
-- Show formspec to user
|
||||||
minetest.show_formspec(to,"awards:awards",
|
minetest.show_formspec(to,"awards:awards",
|
||||||
"size[11,5]" .. awards.getFormspec(name, to, sid))
|
"size[11,5]" .. default.gui_bg .. default.gui_bg_img ..
|
||||||
|
awards.getFormspec(name, to, sid))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
awards.showto = awards.show_to
|
awards.showto = awards.show_to
|
||||||
|
@ -143,7 +143,7 @@ Secret Achievement Unlocked! = Geheime Auszeichnung erhalten!
|
|||||||
Secret Achievement Unlocked: = Geheime Auszeichnung erhalten:
|
Secret Achievement Unlocked: = Geheime Auszeichnung erhalten:
|
||||||
Secret Achievement Unlocked: %s = Geheime Auszeichnung erhalten: %s
|
Secret Achievement Unlocked: %s = Geheime Auszeichnung erhalten: %s
|
||||||
Unlock this award to find out what it is. = Verdienen Sie sich diese Auszeichnung, um herauszufinden, was sie ist.
|
Unlock this award to find out what it is. = Verdienen Sie sich diese Auszeichnung, um herauszufinden, was sie ist.
|
||||||
You have not unlocked any awards = Sie haben noch keine Auszeichnungen.
|
You have not unlocked any awards. = Sie haben noch keine Auszeichnungen.
|
||||||
You've disabled awards. Type /awards enable to reenable. = Sie haben die Auszeichnungen deaktiviert. Geben Sie »/awards enable« ein, um sie wieder zu aktivieren.
|
You've disabled awards. Type /awards enable to reenable. = Sie haben die Auszeichnungen deaktiviert. Geben Sie »/awards enable« ein, um sie wieder zu aktivieren.
|
||||||
<achievement ID> = <Auszeichnungs-ID>
|
<achievement ID> = <Auszeichnungs-ID>
|
||||||
<name> = <Name>
|
<name> = <Name>
|
||||||
@ -173,3 +173,5 @@ Place blocks: %d×%s = Platzieren Sie Blöcke: %d×%s
|
|||||||
Join the game. = Treten Sie dem Spiel bei.
|
Join the game. = Treten Sie dem Spiel bei.
|
||||||
Join the game %d times. = Treten Sie dem Spiel %d mal bei.
|
Join the game %d times. = Treten Sie dem Spiel %d mal bei.
|
||||||
Show details of an achievement = Details einer Auszeichnung anzeigen
|
Show details of an achievement = Details einer Auszeichnung anzeigen
|
||||||
|
OK = OK
|
||||||
|
Error: No awards available. = Fehler: Keine Auszeichnungen vorhanden.
|
||||||
|
@ -171,7 +171,9 @@ Write %d chat messages. =
|
|||||||
Write something in chat. =
|
Write something in chat. =
|
||||||
You have disabled your achievements. =
|
You have disabled your achievements. =
|
||||||
You have enabled your achievements. =
|
You have enabled your achievements. =
|
||||||
You have not unlocked any awards =
|
You have not unlocked any awards. =
|
||||||
You've disabled awards. Type /awards enable to reenable. =
|
You've disabled awards. Type /awards enable to reenable. =
|
||||||
You’re a copper =
|
You’re a copper =
|
||||||
[c|clear|disable|enable] =
|
[c|clear|disable|enable] =
|
||||||
|
OK =
|
||||||
|
Error: No awards available. =
|
||||||
|
Loading…
Reference in New Issue
Block a user